VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes
DtLuaScriptResourceManager Class Reference

Manages resources shared by scripts. More...

Inheritance diagram for DtLuaScriptResourceManager:
Inheritance graph
[legend]

Classes

struct  DtBytecodeRwInteface
 Struct used as the user data argument with the lua bytecode reader and writer callbacks. More...

Public Member Functions

 DtLuaScriptResourceManager ()
virtual ~DtLuaScriptResourceManager ()
virtual void initializeForScenario (unsigned numObjects)
 Initializes the resource manager for the scenario, pre-allocating some resources based on the number of sim objects.
virtual lua_State * getLuaState (bool forBackgroundProcess=false)
 Returns a new Lua state.
virtual bool loadModule (lua_State *L, const std::string &moduleName)
 Loads a module with the given name into the Lua state. Returns true if successful.
- Public Member Functions inherited from DtScriptResourceManager
 DtScriptResourceManager ()
virtual ~DtScriptResourceManager ()
virtual void setScriptPaths (const std::vector< std::string > &scriptPaths)
virtual const std::vector
< std::string > & 
scriptPaths () const

Static Public Member Functions

static lua_State * createLuaState (const std::vector< std::string > &scriptPaths, bool forBackgroundProcess=false)
 Creates and initializes a new Lua state with the given paths.
static bool initializeVRFLuaExtensions (lua_State *L, const std::vector< std::string > &scriptPaths, bool forBackgroundProcess=false)
 Initializes a Lua state with the standard VRF Lua extensions.
static DtScriptResourceManagercreator ()
 Creator function for the Lua resource manager.

Protected Types

typedef std::vector< charDtLuaBytecodeChunk
typedef DtBoost::shared_ptr
< DtLuaBytecodeChunk
DtLuaBytecodeChunkPtr

Protected Member Functions

virtual std::string findLuaModuleFile (const std::string &filename)
 Finds the full path to the given filename using the current script paths.
virtual void saveBytecodeChunk (lua_State *L, const std::string &chunkName)
 Saves the top of the lua_State stack as a bytecode cache labeled as chunkName.
virtual void createLuaStates (unsigned numStates)
 Creates a number of Lua states in parallel.
 DtLuaScriptResourceManager (const DtLuaScriptResourceManager &other)
DtLuaScriptResourceManageroperator= (const DtLuaScriptResourceManager &other)
- Protected Member Functions inherited from DtScriptResourceManager
 DtScriptResourceManager (const DtScriptResourceManager &other)
DtScriptResourceManageroperator= (const DtScriptResourceManager &other)

Static Protected Member Functions

static int luaBytecodeSaveCb (lua_State *L, const void *p, size_t sz, void *ud)
static const charluaBytecodeLoadCb (lua_State *L, void *ud, size_t *size)

Protected Attributes

std::list< lua_State * > myLuaStates
std::map< std::string,
DtLuaBytecodeChunkPtr
myLuaBytecodeChunks
- Protected Attributes inherited from DtScriptResourceManager
std::vector< std::string > myScriptPaths

Detailed Description

Manages resources shared by scripts.

Member Typedef Documentation

typedef std::vector<char> DtLuaScriptResourceManager::DtLuaBytecodeChunk
protected

Constructor & Destructor Documentation

DtLuaScriptResourceManager::DtLuaScriptResourceManager ( )
virtual DtLuaScriptResourceManager::~DtLuaScriptResourceManager ( )
virtual
DtLuaScriptResourceManager::DtLuaScriptResourceManager ( const DtLuaScriptResourceManager other)
protected

Member Function Documentation

virtual void DtLuaScriptResourceManager::initializeForScenario ( unsigned  numObjects)
virtual

Initializes the resource manager for the scenario, pre-allocating some resources based on the number of sim objects.

Implements DtScriptResourceManager.

virtual lua_State* DtLuaScriptResourceManager::getLuaState ( bool  forBackgroundProcess = false)
virtual

Returns a new Lua state.

virtual bool DtLuaScriptResourceManager::loadModule ( lua_State *  L,
const std::string &  moduleName 
)
virtual

Loads a module with the given name into the Lua state. Returns true if successful.

static lua_State* DtLuaScriptResourceManager::createLuaState ( const std::vector< std::string > &  scriptPaths,
bool  forBackgroundProcess = false 
)
static

Creates and initializes a new Lua state with the given paths.

static bool DtLuaScriptResourceManager::initializeVRFLuaExtensions ( lua_State *  L,
const std::vector< std::string > &  scriptPaths,
bool  forBackgroundProcess = false 
)
static

Initializes a Lua state with the standard VRF Lua extensions.

static DtScriptResourceManager* DtLuaScriptResourceManager::creator ( )
static

Creator function for the Lua resource manager.

virtual std::string DtLuaScriptResourceManager::findLuaModuleFile ( const std::string &  filename)
protectedvirtual

Finds the full path to the given filename using the current script paths.

virtual void DtLuaScriptResourceManager::saveBytecodeChunk ( lua_State *  L,
const std::string &  chunkName 
)
protectedvirtual

Saves the top of the lua_State stack as a bytecode cache labeled as chunkName.

virtual void DtLuaScriptResourceManager::createLuaStates ( unsigned  numStates)
protectedvirtual

Creates a number of Lua states in parallel.

DtLuaScriptResourceManager& DtLuaScriptResourceManager::operator= ( const DtLuaScriptResourceManager other)
protected
static int DtLuaScriptResourceManager::luaBytecodeSaveCb ( lua_State *  L,
const void *  p,
size_t  sz,
void *  ud 
)
staticprotected
static const char* DtLuaScriptResourceManager::luaBytecodeLoadCb ( lua_State *  L,
void *  ud,
size_t *  size 
)
staticprotected

Member Data Documentation

std::list<lua_State*> DtLuaScriptResourceManager::myLuaStates
protected
std::map<std::string, DtLuaBytecodeChunkPtr > DtLuaScriptResourceManager::myLuaBytecodeChunks
protected

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

Document ID: Generated on Mon Jul 4 01:00:18 EDT 2016 from SVN revision 166489
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)