Fawkes API
Fawkes Development Version
openni_inifin.cpp
1
2
/***************************************************************************
3
* openni_inifin.cpp - Fawkes OpenNiAspect initializer/finalizer
4
*
5
* Created: Sat Feb 26 15:42:56 2011
6
* Copyright 2006-2011 Tim Niemueller [www.niemueller.de]
7
*
8
****************************************************************************/
9
10
/* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version. A runtime exception applies to
14
* this software (see LICENSE.GPL_WRE file mentioned below for details).
15
*
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU Library General Public License for more details.
20
*
21
* Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22
*/
23
24
#include <core/threading/thread_finalizer.h>
25
#include <plugins/openni/aspect/openni_inifin.h>
26
27
#include <XnCppWrapper.h>
28
29
namespace
fawkes
{
30
31
/** @class OpenNiAspectIniFin <plugins/openni/aspect/openni_inifin.h>
32
* OpenNiAspect initializer/finalizer.
33
* This initializer/finalizer will provide the OpenNI context to threads
34
* with the OpenNiAspect.
35
* @author Tim Niemueller
36
*/
37
38
/** Constructor. */
39
OpenNiAspectIniFin::OpenNiAspectIniFin
() : AspectIniFin(
"OpenNiAspect"
)
40
{
41
}
42
43
void
44
OpenNiAspectIniFin::init
(Thread *thread)
45
{
46
OpenNiAspect
*openni_thread;
47
openni_thread =
dynamic_cast<
OpenNiAspect
*
>
(thread);
48
if
(openni_thread == NULL) {
49
throw
CannotInitializeThreadException
(
"Thread '%s' claims to have the "
50
"OpenNiAspect, but RTTI says it "
51
"has not. "
,
52
thread->name());
53
}
54
if
(!openni_context_) {
55
throw
CannotInitializeThreadException
(
"OpenNI context has not been set."
);
56
}
57
58
openni_thread->init_OpenNiAspect(openni_context_);
59
}
60
61
void
62
OpenNiAspectIniFin::finalize
(Thread *thread)
63
{
64
}
65
66
/** Set the OpenNI context to use for aspect initialization.
67
* @param openni_context OpenNI context to pass to threads with OpenNiAspect.
68
*/
69
void
70
OpenNiAspectIniFin::set_openni_context
(
LockPtr<xn::Context>
openni_context)
71
{
72
openni_context_ = openni_context;
73
}
74
75
}
// end namespace fawkes
fawkes::LockPtr< xn::Context >
fawkes::OpenNiAspectIniFin::OpenNiAspectIniFin
OpenNiAspectIniFin()
Constructor.
Definition:
openni_inifin.cpp:45
fawkes::CannotInitializeThreadException
Definition:
thread_initializer.h:39
fawkes::OpenNiAspect
Definition:
openni.h:38
fawkes::OpenNiAspectIniFin::finalize
virtual void finalize(Thread *thread)
Definition:
openni_inifin.cpp:68
fawkes
fawkes::OpenNiAspectIniFin::init
virtual void init(Thread *thread)
Definition:
openni_inifin.cpp:50
fawkes::OpenNiAspectIniFin::set_openni_context
void set_openni_context(LockPtr< xn::Context > openni_context)
Set the OpenNI context to use for aspect initialization.
Definition:
openni_inifin.cpp:76
src
plugins
openni
aspect
openni_inifin.cpp
Generated by
1.8.17