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 <core/threading/thread.h>
27
#include <core/utils/lockptr.h>
28
#include <aspect/logging.h>
29
#include <aspect/configurable.h>
30
#include <aspect/clock.h>
31
#include <aspect/blocked_timing.h>
32
#include <aspect/aspect_provider.h>
33
#include <plugins/openni/aspect/openni_inifin.h>
34
#include <utils/time/time.h>
35
36
#include <sys/types.h>
37
#include <map>
38
#include <string>
39
40
namespace
xn
{
41
class
Context;
42
class
Device;
43
}
44
45
class
OpenNiContextThread
46
:
public
fawkes::Thread
,
47
public
fawkes::BlockedTimingAspect
,
48
public
fawkes::LoggingAspect
,
49
public
fawkes::ConfigurableAspect
,
50
public
fawkes::ClockAspect
,
51
public
fawkes::AspectProviderAspect
52
{
53
public
:
54
OpenNiContextThread
();
55
virtual
~
OpenNiContextThread
();
56
57
virtual
void
init();
58
virtual
void
loop();
59
virtual
void
finalize();
60
61
private
:
62
void
print_nodes();
63
void
verify_active();
64
void
start_sensor_server();
65
void
stop_sensor_server();
66
67
/** Stub to see name in backtrace for easier debugging. @see Thread::run() */
68
protected
:
virtual
void
run
() { Thread::run(); }
69
70
private
:
71
fawkes::LockPtr<xn::Context>
__openni;
72
fawkes::OpenNiAspectIniFin
__openni_aspect_inifin;
73
74
bool
__cfg_run_sensor_server;
75
std::string __cfg_sensor_bin;
76
pid_t __sensor_server_pid;
77
xn::Device *__device;
78
79
int
__last_refcount;
80
81
fawkes::Time
__check_last;
82
fawkes::Time
__check_now;
83
84
unsigned
int
__device_no_data_loops;
85
86
std::map<std::string, unsigned int> __dead_loops;
87
};
88
89
#endif
fawkes::ClockAspect
Thread aspect that allows to obtain the current time from the clock.
Definition:
clock.h:36
fawkes::Time
A class for handling time.
Definition:
time.h:91
fawkes::Thread
Thread class encapsulation of pthreads.
Definition:
thread.h:42
fawkes::LockPtr< xn::Context >
fawkes::BlockedTimingAspect
Thread aspect to use blocked timing.
Definition:
blocked_timing.h:34
OpenNiContextThread::run
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition:
context_thread.h:68
fawkes::LoggingAspect
Thread aspect to log output.
Definition:
logging.h:35
fawkes::AspectProviderAspect
Thread aspect provide a new aspect.
Definition:
aspect_provider.h:38
fawkes::ConfigurableAspect
Thread aspect to access configuration data.
Definition:
configurable.h:35
OpenNiContextThread
OpenNI Context Thread.
Definition:
context_thread.h:45
xn
Definition:
openni.h:30
fawkes::OpenNiAspectIniFin
OpenNiAspect initializer/finalizer.
Definition:
openni_inifin.h:35
src
plugins
openni
context_thread.h
Generated by
1.8.13