ReFRACtor
FullPhysics::LuabindObject Class Reference

This is a light wrapper around the luabind::object. More...

#include <luabind_object.h>

+ Inheritance diagram for FullPhysics::LuabindObject:
+ Collaboration diagram for FullPhysics::LuabindObject:

Public Member Functions

 LuabindObject ()
 
 LuabindObject (const luabind::object &Obj, const boost::shared_ptr< LuaState > &Ls)
 Constructor. More...
 
template<class T >
 LuabindObject (const boost::shared_ptr< LuaState > &Ls, const T &V)
 Conversion constructor. More...
 
 LuabindObject (const boost::shared_ptr< LuaState > &Ls, const LuabindObject &V)
 
virtual ~LuabindObject ()
 
LuabindObject call ()
 Call a function pointed to by this object. More...
 
template<class T1 >
LuabindObject call (const T1 &Arg1)
 
template<class T1 , class T2 >
LuabindObject call (const T1 &Arg1, const T2 &Arg2)
 
template<class T1 , class T2 , class T3 >
LuabindObject call (const T1 &Arg1, const T2 &Arg2, const T3 &Arg3)
 
template<class T1 , class T2 , class T3 , class T4 >
LuabindObject call (const T1 &Arg1, const T2 &Arg2, const T3 &Arg3, const T4 &Arg4)
 
template<class T1 , class T2 , class T3 , class T4 , class T5 >
LuabindObject call (const T1 &Arg1, const T2 &Arg2, const T3 &Arg3, const T4 &Arg4, const T5 &Arg5)
 
template<class T1 , class T2 , class T3 , class T4 , class T5 , class T6 >
LuabindObject call (const T1 &Arg1, const T2 &Arg2, const T3 &Arg3, const T4 &Arg4, const T5 &Arg5, const T6 &Arg6)
 
template<class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 >
LuabindObject call (const T1 &Arg1, const T2 &Arg2, const T3 &Arg3, const T4 &Arg4, const T5 &Arg5, const T6 &Arg6, const T7 &Arg7)
 
template<class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 >
LuabindObject call (const T1 &Arg1, const T2 &Arg2, const T3 &Arg3, const T4 &Arg4, const T5 &Arg5, const T6 &Arg6, const T7 &Arg7, const T8 &Arg8)
 
LuabindObject get_index (int Vidx) const
 
bool is_boolean () const
 
bool is_function () const
 
bool is_nil () const
 Test type of an object. More...
 
bool is_number () const
 
bool is_string () const
 
bool is_table () const
 
template<class T >
bool is_type () const
 Test if value in a table is the given type. More...
 
template<class T >
bool is_type_ptr () const
 Test if value in a table is the given type. More...
 
int length (int index=0) const
 Return the "length" of the value at the given index using the Lua interpreter method that evaluates as the length operator. More...
 
const boost::shared_ptr< LuaState > & lua_state () const
 Lua state pointer. More...
 
LuabindObject new_table ()
 Creates a new table object. More...
 
luabind::object & object ()
 Underlying object. More...
 
const luabind::object & object () const
 
LuabindObject operator[] (const std::string &Vname) const
 Return a variable found in this table as another LuabindObject. More...
 
void print (std::ostream &Os) const
 
std::string print_to_string () const
 Print to string. More...
 
void set_index (int Vidx, const boost::shared_ptr< GenericObject > &V)
 Set value as a GenericObject, returning true if this succeeds. More...
 
template<class T >
void set_index (int Vidx, const boost::shared_ptr< T > &V)
 Set an index. More...
 
void set_index (int Vidx, const std::string &V)
 
void set_index (int Vidx, const char *V)
 
void set_index (int Vidx, int V)
 
void set_index (int Vidx, double V)
 
void set_index (int Vidx, bool V)
 
void set_index (int Vidx, const LuabindObject &V)
 
void set_value (const std::string &Vname, const boost::shared_ptr< GenericObject > &V)
 Set value as a GenericObject, returning true if this succeeds. More...
 
template<class T >
void set_value (const std::string &Vname, const boost::shared_ptr< T > &V)
 Set a value. More...
 
template<class T , int D>
void set_value (const std::string &Vname, const blitz::Array< T, D > &V)
 
void set_value (const std::string &Vname, const std::string &V)
 
void set_value (const std::string &Vname, const char *V)
 
void set_value (const std::string &Vname, int V)
 
void set_value (const std::string &Vname, double V)
 
void set_value (const std::string &Vname, bool V)
 
void set_value (const std::string &Vname, const LuabindObject &V)
 
template<class T >
value () const
 Return value of a variable. More...
 
boost::shared_ptr< GenericObjectvalue_generic_object () const
 Return value as a GenericObject, or return a null pointer if we can't convert to a GenericObject. More...
 
template<class T >
boost::shared_ptr< T > value_ptr () const
 Return value of a variable found in this table. More...
 

Static Public Member Functions

static boost::shared_ptr< LuabindObjectcreate_luabind_object (const boost::shared_ptr< LuaState > &Ls, const boost::shared_ptr< GenericObject > &Obj)
 Create a LuabindObject from a GenericObject. More...
 
static LuabindObject nil (const boost::shared_ptr< LuaState > &Ls)
 Return a nil value. More...
 

Static Public Attributes

static std::vector< boost::shared_ptr< BridgeLuabindAndGenericBase > > base_bridge
 Map used for mapping base classes to and from Lua and GenericObject. More...
 
static std::vector< boost::shared_ptr< BridgeLuabindAndGenericBase > > derived_bridge
 Map used for mapping derived class to and from Lua and GenericObject. More...
 

Detailed Description

This is a light wrapper around the luabind::object.

This adds a few convenience routines.

Definition at line 65 of file luabind_object.h.

Constructor & Destructor Documentation

◆ LuabindObject() [1/4]

FullPhysics::LuabindObject::LuabindObject ( )
inline

Definition at line 67 of file luabind_object.h.

◆ LuabindObject() [2/4]

FullPhysics::LuabindObject::LuabindObject ( const luabind::object &  Obj,
const boost::shared_ptr< LuaState > &  Ls 
)
inline

Constructor.

Definition at line 72 of file luabind_object.h.

◆ LuabindObject() [3/4]

template<class T >
FullPhysics::LuabindObject::LuabindObject ( const boost::shared_ptr< LuaState > &  Ls,
const T &  V 
)
inline

Conversion constructor.

Definition at line 85 of file luabind_object.h.

◆ LuabindObject() [4/4]

FullPhysics::LuabindObject::LuabindObject ( const boost::shared_ptr< LuaState > &  Ls,
const LuabindObject V 
)
inline

Definition at line 91 of file luabind_object.h.

◆ ~LuabindObject()

virtual FullPhysics::LuabindObject::~LuabindObject ( )
inlinevirtual

Definition at line 95 of file luabind_object.h.

Member Function Documentation

◆ call() [1/9]

LuabindObject FullPhysics::LuabindObject::call ( )
inline

Call a function pointed to by this object.

Definition at line 282 of file luabind_object.h.

◆ call() [2/9]

template<class T1 >
LuabindObject FullPhysics::LuabindObject::call ( const T1 &  Arg1)
inline

Definition at line 296 of file luabind_object.h.

◆ call() [3/9]

template<class T1 , class T2 >
LuabindObject FullPhysics::LuabindObject::call ( const T1 &  Arg1,
const T2 &  Arg2 
)
inline

Definition at line 311 of file luabind_object.h.

◆ call() [4/9]

template<class T1 , class T2 , class T3 >
LuabindObject FullPhysics::LuabindObject::call ( const T1 &  Arg1,
const T2 &  Arg2,
const T3 &  Arg3 
)
inline

Definition at line 327 of file luabind_object.h.

◆ call() [5/9]

template<class T1 , class T2 , class T3 , class T4 >
LuabindObject FullPhysics::LuabindObject::call ( const T1 &  Arg1,
const T2 &  Arg2,
const T3 &  Arg3,
const T4 &  Arg4 
)
inline

Definition at line 343 of file luabind_object.h.

◆ call() [6/9]

template<class T1 , class T2 , class T3 , class T4 , class T5 >
LuabindObject FullPhysics::LuabindObject::call ( const T1 &  Arg1,
const T2 &  Arg2,
const T3 &  Arg3,
const T4 &  Arg4,
const T5 &  Arg5 
)
inline

Definition at line 361 of file luabind_object.h.

◆ call() [7/9]

template<class T1 , class T2 , class T3 , class T4 , class T5 , class T6 >
LuabindObject FullPhysics::LuabindObject::call ( const T1 &  Arg1,
const T2 &  Arg2,
const T3 &  Arg3,
const T4 &  Arg4,
const T5 &  Arg5,
const T6 &  Arg6 
)
inline

Definition at line 378 of file luabind_object.h.

◆ call() [8/9]

template<class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 >
LuabindObject FullPhysics::LuabindObject::call ( const T1 &  Arg1,
const T2 &  Arg2,
const T3 &  Arg3,
const T4 &  Arg4,
const T5 &  Arg5,
const T6 &  Arg6,
const T7 &  Arg7 
)
inline

Definition at line 396 of file luabind_object.h.

◆ call() [9/9]

template<class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 >
LuabindObject FullPhysics::LuabindObject::call ( const T1 &  Arg1,
const T2 &  Arg2,
const T3 &  Arg3,
const T4 &  Arg4,
const T5 &  Arg5,
const T6 &  Arg6,
const T7 &  Arg7,
const T8 &  Arg8 
)
inline

Definition at line 415 of file luabind_object.h.

◆ create_luabind_object()

boost::shared_ptr< LuabindObject > LuabindObject::create_luabind_object ( const boost::shared_ptr< LuaState > &  Ls,
const boost::shared_ptr< GenericObject > &  Obj 
)
static

Create a LuabindObject from a GenericObject.

This is really meant for use in python, in C++ you can just directly use the templated constructor with the actually type.

Definition at line 82 of file luabind_object.cc.

◆ get_index()

LuabindObject FullPhysics::LuabindObject::get_index ( int  Vidx) const
inline

Definition at line 130 of file luabind_object.h.

◆ is_boolean()

bool FullPhysics::LuabindObject::is_boolean ( ) const
inline

Definition at line 263 of file luabind_object.h.

◆ is_function()

bool FullPhysics::LuabindObject::is_function ( ) const
inline

Definition at line 267 of file luabind_object.h.

◆ is_nil()

bool FullPhysics::LuabindObject::is_nil ( ) const
inline

Test type of an object.

Definition at line 262 of file luabind_object.h.

◆ is_number()

bool FullPhysics::LuabindObject::is_number ( ) const
inline

Definition at line 264 of file luabind_object.h.

◆ is_string()

bool FullPhysics::LuabindObject::is_string ( ) const
inline

Definition at line 265 of file luabind_object.h.

◆ is_table()

bool FullPhysics::LuabindObject::is_table ( ) const
inline

Definition at line 266 of file luabind_object.h.

◆ is_type()

template<class T >
bool FullPhysics::LuabindObject::is_type ( ) const
inline

Test if value in a table is the given type.

Return true if it is, false otherwise.

Definition at line 171 of file luabind_object.h.

◆ is_type_ptr()

template<class T >
bool FullPhysics::LuabindObject::is_type_ptr ( ) const
inline

Test if value in a table is the given type.

This is a shortcut for is_type where you can leave off the boost::shared_ptr, since that is so common.

Definition at line 180 of file luabind_object.h.

◆ length()

int FullPhysics::LuabindObject::length ( int  index = 0) const
inline

Return the "length" of the value at the given index using the Lua interpreter method that evaluates as the length operator.

Definition at line 274 of file luabind_object.h.

◆ lua_state()

const boost::shared_ptr<LuaState>& FullPhysics::LuabindObject::lua_state ( ) const
inline

Lua state pointer.

You can use this to do things with luabind (or directly with Lua) that this class doesn't already support.

Definition at line 454 of file luabind_object.h.

◆ new_table()

LuabindObject FullPhysics::LuabindObject::new_table ( )
inline

Creates a new table object.

Definition at line 437 of file luabind_object.h.

◆ nil()

static LuabindObject FullPhysics::LuabindObject::nil ( const boost::shared_ptr< LuaState > &  Ls)
inlinestatic

Return a nil value.

Definition at line 78 of file luabind_object.h.

◆ object() [1/2]

luabind::object& FullPhysics::LuabindObject::object ( )
inline

Underlying object.

You can use this to do things with luabind that this class doesn't already support.

Definition at line 446 of file luabind_object.h.

◆ object() [2/2]

const luabind::object& FullPhysics::LuabindObject::object ( ) const
inline

Definition at line 447 of file luabind_object.h.

◆ operator[]()

LuabindObject FullPhysics::LuabindObject::operator[] ( const std::string &  Vname) const
inline

Return a variable found in this table as another LuabindObject.

Definition at line 127 of file luabind_object.h.

◆ print()

void FullPhysics::LuabindObject::print ( std::ostream &  Os) const
inline

Definition at line 97 of file luabind_object.h.

◆ print_to_string()

std::string FullPhysics::Printable< LuabindObject >::print_to_string ( ) const
inlineinherited

Print to string.

This is primarily useful for SWIG wrappers to this class, e.g. a to_s method in ruby.

Definition at line 31 of file printable.h.

◆ set_index() [1/8]

void LuabindObject::set_index ( int  Vidx,
const boost::shared_ptr< GenericObject > &  V 
)

Set value as a GenericObject, returning true if this succeeds.

This is useful for use with Python.

Definition at line 57 of file luabind_object.cc.

◆ set_index() [2/8]

template<class T >
void FullPhysics::LuabindObject::set_index ( int  Vidx,
const boost::shared_ptr< T > &  V 
)
inline

Set an index.

Definition at line 228 of file luabind_object.h.

◆ set_index() [3/8]

void FullPhysics::LuabindObject::set_index ( int  Vidx,
const std::string &  V 
)
inline

Definition at line 233 of file luabind_object.h.

◆ set_index() [4/8]

void FullPhysics::LuabindObject::set_index ( int  Vidx,
const char *  V 
)
inline

Definition at line 237 of file luabind_object.h.

◆ set_index() [5/8]

void FullPhysics::LuabindObject::set_index ( int  Vidx,
int  V 
)
inline

Definition at line 241 of file luabind_object.h.

◆ set_index() [6/8]

void FullPhysics::LuabindObject::set_index ( int  Vidx,
double  V 
)
inline

Definition at line 245 of file luabind_object.h.

◆ set_index() [7/8]

void FullPhysics::LuabindObject::set_index ( int  Vidx,
bool  V 
)
inline

Definition at line 249 of file luabind_object.h.

◆ set_index() [8/8]

void FullPhysics::LuabindObject::set_index ( int  Vidx,
const LuabindObject V 
)
inline

Definition at line 253 of file luabind_object.h.

◆ set_value() [1/9]

void LuabindObject::set_value ( const std::string &  Vname,
const boost::shared_ptr< GenericObject > &  V 
)

Set value as a GenericObject, returning true if this succeeds.

This is useful for use with Python.

Definition at line 35 of file luabind_object.cc.

◆ set_value() [2/9]

template<class T >
void FullPhysics::LuabindObject::set_value ( const std::string &  Vname,
const boost::shared_ptr< T > &  V 
)
inline

Set a value.

Definition at line 189 of file luabind_object.h.

◆ set_value() [3/9]

template<class T , int D>
void FullPhysics::LuabindObject::set_value ( const std::string &  Vname,
const blitz::Array< T, D > &  V 
)
inline

Definition at line 194 of file luabind_object.h.

◆ set_value() [4/9]

void FullPhysics::LuabindObject::set_value ( const std::string &  Vname,
const std::string &  V 
)
inline

Definition at line 199 of file luabind_object.h.

◆ set_value() [5/9]

void FullPhysics::LuabindObject::set_value ( const std::string &  Vname,
const char *  V 
)
inline

Definition at line 203 of file luabind_object.h.

◆ set_value() [6/9]

void FullPhysics::LuabindObject::set_value ( const std::string &  Vname,
int  V 
)
inline

Definition at line 207 of file luabind_object.h.

◆ set_value() [7/9]

void FullPhysics::LuabindObject::set_value ( const std::string &  Vname,
double  V 
)
inline

Definition at line 211 of file luabind_object.h.

◆ set_value() [8/9]

void FullPhysics::LuabindObject::set_value ( const std::string &  Vname,
bool  V 
)
inline

Definition at line 215 of file luabind_object.h.

◆ set_value() [9/9]

void FullPhysics::LuabindObject::set_value ( const std::string &  Vname,
const LuabindObject V 
)
inline

Definition at line 219 of file luabind_object.h.

◆ value()

template<class T >
T FullPhysics::LuabindObject::value ( ) const
inline

Return value of a variable.

Definition at line 138 of file luabind_object.h.

◆ value_generic_object()

boost::shared_ptr< GenericObject > LuabindObject::value_generic_object ( ) const

Return value as a GenericObject, or return a null pointer if we can't convert to a GenericObject.

This is useful for use with Python.

Definition at line 17 of file luabind_object.cc.

◆ value_ptr()

template<class T >
boost::shared_ptr<T> FullPhysics::LuabindObject::value_ptr ( ) const
inline

Return value of a variable found in this table.

Shortcut of value that lets you leave the boost::shared_ptr off in the type, since this is so common.

Definition at line 161 of file luabind_object.h.

Member Data Documentation

◆ base_bridge

std::vector< boost::shared_ptr< BridgeLuabindAndGenericBase > > LuabindObject::base_bridge
static

Map used for mapping base classes to and from Lua and GenericObject.

See discussion above BridgeLuabindAndGenericBase.

Definition at line 105 of file luabind_object.h.

◆ derived_bridge

std::vector< boost::shared_ptr< BridgeLuabindAndGenericBase > > LuabindObject::derived_bridge
static

Map used for mapping derived class to and from Lua and GenericObject.

See discussion above BridgeLuabindAndGenericBase.

Definition at line 113 of file luabind_object.h.


The documentation for this class was generated from the following files:

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