ReFRACtor
lua_state.h
Go to the documentation of this file.
1 #ifndef LUA_STATE_H
2 #define LUA_STATE_H
3 #include "printable.h"
4 #include "register_lua.h"
5 #include <boost/noncopyable.hpp>
6 
7 namespace FullPhysics {
8 class LuabindObject;
9 // Actual class that holds the implementation. We use this level of
10 // indirection so we can make sure to maintain the lifetime of the
11 // underlying lua_State apart from the LuaState class.
12 class LuaStateImp : public boost::noncopyable {
13 public:
14  LuaStateImp(lua_State* Ls, const std::string& Dir_name)
15  : ls(Ls), dir_name(Dir_name) {}
16  lua_State *ls;
17  std::string dir_name;
18  ~LuaStateImp();
19 };
20 
21 /****************************************************************/
25 class LuaState : public Printable<LuaState> {
26 public:
27  LuaState(const std::string& Dir_name = "./");
28  virtual ~LuaState() {}
29  void print(std::ostream& Os) const { Os << "LuaState";}
30 
31  static boost::shared_ptr<LuaState> load_file(const std::string& Fname);
32  void do_file(const std::string& Fname);
33  void run(const std::string& S);
34  LuabindObject globals();
35  LuabindObject registry();
36 
37 //-----------------------------------------------------------------------
39 //-----------------------------------------------------------------------
40 
41  const std::string& base_dir_name() const {return lsimp->dir_name; }
42 
43 //-----------------------------------------------------------------------
46 //-----------------------------------------------------------------------
47  lua_State* lua_state() {return lsimp->ls;}
48 private:
51  : lsimp(Lsimp) {}
52 };
53 }
54 
55 // This needs to get defined after LuaState.
56 #include "luabind_object.h"
57 #endif
LuaStateImp(lua_State *Ls, const std::string &Dir_name)
Definition: lua_state.h:14
const std::string & base_dir_name() const
Base directory that we use when running Lua.
Definition: lua_state.h:41
lua_State * lua_state()
Lua state pointer.
Definition: lua_state.h:47
void print(std::ostream &Os) const
Definition: lua_state.h:29
This is a light wrapper around the luabind::object.
This is a Mixin for classes that can be printed.
Definition: printable.h:24
std::string dir_name
Definition: lua_state.h:17
virtual ~LuaState()
Definition: lua_state.h:28
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
This is a light wrapper around the lua_state object.
Definition: lua_state.h:25

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