LuaComponent.hpp
Go to the documentation of this file.
1 /*
2  * Lua-RTT bindings. LuaComponent.
3  *
4  * (C) Copyright 2010 Markus Klotzbuecher
5  * markus.klotzbuecher@mech.kuleuven.be
6  * Department of Mechanical Engineering,
7  * Katholieke Universiteit Leuven, Belgium.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public
11  * License as published by the Free Software Foundation;
12  * version 2 of the License.
13  *
14  * As a special exception, you may use this file as part of a free
15  * software library without restriction. Specifically, if other files
16  * instantiate templates or use macros or inline functions from this
17  * file, or you compile this file and link it with other files to
18  * produce an executable, this file does not by itself cause the
19  * resulting executable to be covered by the GNU General Public
20  * License. This exception does not however invalidate any other
21  * reasons why the executable file might be covered by the GNU General
22  * Public License.
23  *
24  * This library is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27  * Lesser General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public
30  * License along with this library; if not, write to the Free Software
31  * Foundation, Inc., 59 Temple Place,
32  * Suite 330, Boston, MA 02111-1307 USA
33  */
34 
35 #ifndef OCL_LUACOMPONENT_HPP
36 #define OCL_LUACOMPONENT_HPP
37 
38 #include <string>
39 #include <rtt/os/Mutex.hpp>
40 #include <rtt/TaskContext.hpp>
41 
42 #include "LuaStateHandle.hpp"
43 
44 struct lua_State;
45 #ifdef LUA_RTT_TLSF
46 struct lua_tlsf_info;
47 #endif
48 
49 namespace OCL
50 {
52  {
53  protected:
54  std::string lua_string;
55  std::string lua_file;
58 
59  public:
60  LuaComponent(std::string name);
61  ~LuaComponent();
62 
63  bool exec_file(const std::string &file);
64  bool exec_str(const std::string &str);
65 
66  bool configureHook();
67  bool activateHook();
68  bool startHook();
69  void updateHook();
70  void stopHook();
71  void cleanupHook();
72  void errorHook();
73 
75  };
76 
77 #if LUA_RTT_TLSF
78  class LuaTLSFComponent : public RTT::TaskContext
79  {
80  protected:
81  std::string lua_string;
82  std::string lua_file;
83  lua_State *L;
85  struct lua_tlsf_info *tlsf_inf;
86 
87  public:
88  LuaTLSFComponent(std::string name);
89  ~LuaTLSFComponent();
90 
91  bool tlsf_incmem(unsigned int size);
92 
93  bool exec_file(const std::string &file);
94  bool exec_str(const std::string &str);
95 
96  bool configureHook();
97  bool activateHook();
98  bool startHook();
99  void updateHook();
100  void stopHook();
101  void cleanupHook();
102  void errorHook();
103 
105  };
106 #endif // LUA_RTT_TLSF
107 } // namespace OCL
108 
109 #endif // OCL_LUACOMPONENT_HPP
bool exec_str(const std::string &str)
std::string lua_file
LuaComponent(std::string name)
struct lua_State lua_State
Definition: lua-repl.h:54
std::string lua_string
bool exec_file(const std::string &file)
RTT::os::MutexRecursive m
LuaStateHandle getLuaState()


ocl
Author(s): OCL Development Team
autogenerated on Wed Jun 26 2019 19:26:27