OrocosComponentLibrary  2.9.0
LuaService.hpp
1 #ifndef OCL_LUASERVICE_HPP
2 #define OCL_LUASERVICE_HPP
3 
4 /*
5  * Lua scripting plugin
6  */
7 
8 #include <rtt/Service.hpp>
9 #include <rtt/os/Mutex.hpp>
10 
11 #include "LuaStateHandle.hpp"
12 
13 struct lua_State;
14 #ifdef LUA_RTT_TLSF
15 struct lua_tlsf_info;
16 #endif
17 
18 namespace OCL
19 {
20  class LuaService : public RTT::Service
21  {
22  protected:
23  lua_State *L;
24  RTT::os::Mutex m;
25 
26  public:
27  LuaService(RTT::TaskContext* tc);
28  ~LuaService();
29 
30  bool exec_file(const std::string &file);
31  bool exec_str(const std::string &str);
32 
33  LuaStateHandle getLuaState();
34  };
35 
36 #ifdef LUA_RTT_TLSF
37  class LuaTLSFService : public RTT::Service
38  {
39  protected:
40  lua_State *L;
41  RTT::os::Mutex m;
42  struct lua_tlsf_info *tlsf_inf;
43 
44  public:
45  LuaTLSFService(RTT::TaskContext* tc);
46  ~LuaTLSFService();
47 
48  bool tlsf_incmem(unsigned int size);
49  bool exec_file(const std::string &file);
50  bool exec_str(const std::string &str);
51 
52  LuaStateHandle getLuaState();
53  };
54 #endif // LUA_RTT_TLSF
55 } // namespace OCL
56 
57 #endif // OCL_LUASERVICE_HPP
The Orocos Component Library.
Definition: Component.hpp:43