ReFRACtor
register_lua.h
Go to the documentation of this file.
1 #ifndef REGISTER_LUA_H
2 #define REGISTER_LUA_H
3 
4 extern "C" {
5 #include <lua.h>
6 #include <lauxlib.h>
7 #include <lualib.h>
8 }
9 #include <luabind/luabind.hpp>
10 #include <luabind/tag_function.hpp>
11 #include <boost/function.hpp>
12 #include <vector>
13 #include <map>
14 #include <boost/shared_ptr.hpp>
15 #include "lua_state.h"
16 
17 namespace FullPhysics {
18 /****************************************************************/
105 class RegisterLua {
106 public:
107  static int add_file_and_line(lua_State *ls);
108  static void register_lua(lua_State *ls);
109 };
110 }
111 
112 #define REGISTER_LUA_LIST(X) \
113 void register_lua_##X(lua_State*); register_lua_##X(ls)
114 
115 
116 #define REGISTER_LUA_CLASS(X) \
117 namespace FullPhysics { \
118 void register_lua_##X(lua_State *ls) { \
119  LuabindObject::base_bridge.push_back(boost::shared_ptr<BridgeLuabindAndGenericBase>(new BridgeLuabindAndGeneric< X >)); \
120 luabind::module(ls) [ luabind::class_< X,boost::shared_ptr< X > >(#X) \
121 .def("__tostring", &X::print_to_string)
122 
123 #define REGISTER_LUA_CLASS_NAME_WITH_GENERIC_OBJECT_BASE(X, Y) \
124 namespace FullPhysics { \
125 void register_lua_##Y(lua_State *ls) { \
126  LuabindObject::base_bridge.push_back(boost::shared_ptr<BridgeLuabindAndGenericBase>(new BridgeLuabindAndGeneric< X >)); \
127 luabind::module(ls) [ luabind::class_< X,boost::shared_ptr< X > >(#Y)
128 
129 #define REGISTER_LUA_CLASS_NAME(X, Y) \
130 namespace FullPhysics { \
131 void register_lua_##Y(lua_State *ls) { \
132 luabind::module(ls) [ luabind::class_< X,boost::shared_ptr< X > >(#Y)
133 
134 #define REGISTER_LUA_END() ]; } }
135 
136 #define REGISTER_LUA_DERIVED_CLASS(X, Y) \
137 namespace FullPhysics { \
138 void register_lua_##X(lua_State *ls) { \
139  LuabindObject::base_bridge.push_back(boost::shared_ptr<BridgeLuabindAndGenericBase>(new BridgeLuabindAndGeneric< Y >)); \
140 luabind::module(ls) [ luabind::class_<X,Y,boost::shared_ptr<Y> >(#X)
141 
142 #endif
static void register_lua(lua_State *ls)
This class handles the registration of luabind class wrappers with Lua.
Definition: register_lua.h:105
static int add_file_and_line(lua_State *ls)
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1

Copyright © 2017, California Institute of Technology.
ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
Generated Fri Aug 24 2018 15:44:10