Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
continuous_exec_thread.h
1
2
/***************************************************************************
3
* continuous_exec_thread.h - Fawkes LuaAgent: Continuous Execution Thread
4
*
5
* Created: Thu May 26 11:49:17 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_LUAAGENT_CONTINUOUS_EXEC_THREAD_H_
24
#define __PLUGINS_LUAAGENT_CONTINUOUS_EXEC_THREAD_H_
25
26
#include <core/threading/thread.h>
27
#include <aspect/blocked_timing.h>
28
#include <aspect/logging.h>
29
#include <aspect/configurable.h>
30
#include <aspect/clock.h>
31
#include <aspect/blackboard.h>
32
#include <aspect/thread_producer.h>
33
#ifdef HAVE_TF
34
#include <aspect/tf.h>
35
#endif
36
#include <utils/system/fam.h>
37
38
#include <string>
39
#include <cstdlib>
40
41
namespace
fawkes {
42
class
ComponentLogger;
43
class
Mutex;
44
class
LuaContext;
45
class
LuaInterfaceImporter;
46
class
Interface;
47
class
SkillerInterface;
48
class
SkillerDebugInterface;
49
}
50
51
class
LuaAgentContinuousExecutionThread
52
:
public
fawkes::Thread
,
53
public
fawkes::BlockedTimingAspect
,
54
public
fawkes::LoggingAspect
,
55
public
fawkes::BlackBoardAspect
,
56
public
fawkes::ConfigurableAspect
,
57
public
fawkes::ClockAspect
,
58
public
fawkes::ThreadProducerAspect
,
59
#ifdef HAVE_TF
60
public
fawkes::TransformAspect
,
61
#endif
62
public
fawkes::FamListener
63
{
64
public
:
65
LuaAgentContinuousExecutionThread
();
66
virtual
~LuaAgentContinuousExecutionThread
();
67
68
virtual
void
init
();
69
virtual
void
loop
();
70
virtual
void
finalize
();
71
72
virtual
void
fam_event
(
const
char
*filename,
unsigned
int
mask);
73
74
void
read_interfaces
();
75
void
write_interfaces
();
76
77
/** Stub to see name in backtrace for easier debugging. @see Thread::run() */
78
protected
:
virtual
void
run
() {
Thread::run
(); }
79
80
private
:
/* methods */
81
void
init_failure_cleanup();
82
83
class
LuaThread
84
:
public
Thread
,
85
public
fawkes::LoggingAspect
86
{
87
public
:
88
LuaThread(
fawkes::LuaContext
*lua);
89
virtual
void
loop
();
90
91
/** Check if LuaThread failed.
92
* @return true if an error occured, false otherwise. */
93
bool
failed() {
return
__failed; }
94
private
:
95
fawkes::LuaContext
*__lua;
96
bool
__failed;
97
};
98
99
private
:
/* members */
100
fawkes::ComponentLogger
*__clog;
101
102
// config values
103
std::string __cfg_agent;
104
bool
__cfg_watch_files;
105
106
fawkes::SkillerInterface
*__skiller_if;
107
108
fawkes::LuaContext
*__lua;
109
fawkes::LuaInterfaceImporter
*__lua_ifi;
110
111
fawkes::Mutex
*__ifi_mutex;
112
LuaThread *__lua_thread;
113
};
114
115
#endif
src
plugins
luaagent
continuous_exec_thread.h
Generated by
1.8.1.1