Fawkes API
Fawkes Development Version
context_thread.h
1
2
/***************************************************************************
3
* context_thread.h - OpenNI context providing thread
4
*
5
* Created: Sat Feb 26 15:23:16 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.
14
*
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU Library General Public License for more details.
19
*
20
* Read the full text in the LICENSE.GPL file in the doc directory.
21
*/
22
23
#ifndef _PLUGINS_OPENNI_CONTEXT_THREAD_H_
24
#define _PLUGINS_OPENNI_CONTEXT_THREAD_H_
25
26
#include <aspect/aspect_provider.h>
27
#include <aspect/blocked_timing.h>
28
#include <aspect/clock.h>
29
#include <aspect/configurable.h>
30
#include <aspect/logging.h>
31
#include <core/threading/thread.h>
32
#include <core/utils/lockptr.h>
33
#include <plugins/openni/aspect/openni_inifin.h>
34
#include <sys/types.h>
35
#include <utils/time/time.h>
36
37
#include <map>
38
#include <string>
39
40
namespace
xn {
41
class
Context;
42
class
Device;
43
}
// namespace xn
44
45
class
OpenNiContextThread
:
public
fawkes::Thread
,
46
public
fawkes::BlockedTimingAspect
,
47
public
fawkes::LoggingAspect
,
48
public
fawkes::ConfigurableAspect
,
49
public
fawkes::ClockAspect
,
50
public
fawkes::AspectProviderAspect
51
{
52
public
:
53
OpenNiContextThread
();
54
virtual
~OpenNiContextThread
();
55
56
virtual
void
init
();
57
virtual
void
loop
();
58
virtual
void
finalize
();
59
60
private
:
61
void
print_nodes();
62
void
verify_active();
63
void
start_sensor_server();
64
void
stop_sensor_server();
65
66
/** Stub to see name in backtrace for easier debugging. @see Thread::run() */
67
protected
:
68
virtual
void
69
run
()
70
{
71
Thread::run();
72
}
73
74
private
:
75
fawkes::LockPtr<xn::Context>
openni_;
76
fawkes::OpenNiAspectIniFin
openni_aspect_inifin_;
77
78
bool
cfg_run_sensor_server_;
79
std::string cfg_sensor_bin_;
80
pid_t sensor_server_pid_;
81
xn::Device *device_;
82
83
int
last_refcount_;
84
85
fawkes::Time
check_last_;
86
fawkes::Time
check_now_;
87
88
unsigned
int
device_no_data_loops_;
89
90
std::map<std::string, unsigned int> dead_loops_;
91
};
92
93
#endif
OpenNiContextThread
OpenNI Context Thread.
Definition:
context_thread.h:51
OpenNiContextThread::OpenNiContextThread
OpenNiContextThread()
Constructor.
Definition:
context_thread.cpp:45
OpenNiContextThread::init
virtual void init()
Initialize the thread.
Definition:
context_thread.cpp:58
OpenNiContextThread::loop
virtual void loop()
Code to execute in the thread.
Definition:
context_thread.cpp:128
OpenNiContextThread::~OpenNiContextThread
virtual ~OpenNiContextThread()
Destructor.
Definition:
context_thread.cpp:53
OpenNiContextThread::run
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition:
context_thread.h:69
OpenNiContextThread::finalize
virtual void finalize()
Finalize the thread.
Definition:
context_thread.cpp:109
fawkes::AspectProviderAspect
Thread aspect provide a new aspect.
Definition:
aspect_provider.h:36
fawkes::BlockedTimingAspect
Thread aspect to use blocked timing.
Definition:
blocked_timing.h:51
fawkes::ClockAspect
Thread aspect that allows to obtain the current time from the clock.
Definition:
clock.h:34
fawkes::ConfigurableAspect
Thread aspect to access configuration data.
Definition:
configurable.h:33
fawkes::LockPtr< xn::Context >
fawkes::LoggingAspect
Thread aspect to log output.
Definition:
logging.h:33
fawkes::OpenNiAspectIniFin
OpenNiAspect initializer/finalizer.
Definition:
openni_inifin.h:33
fawkes::Thread
Thread class encapsulation of pthreads.
Definition:
thread.h:46
fawkes::Time
A class for handling time.
Definition:
time.h:93
src
plugins
openni
context_thread.h
Generated by
1.9.4