VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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.

Inheritance diagram for DtLuaScriptResourceManager:
Inheritance graph
[legend]

Classes

struct  DtBytecodeRwInteface
 

Public Member Functions

 DtLuaScriptResourceManager ()
 
virtual ~DtLuaScriptResourceManager ()
 
virtual void initializeNumberOfStates (unsigned numberOfStates)
 
virtual lua_State * getLuaState (int scriptType=DtScriptedTaskScriptedTask)
 
virtual bool loadModule (lua_State *L, const std::string &moduleName)
 
- 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, int scriptType=DtScriptedTaskScriptedTask)
 
static bool initializeVRFLuaExtensions (lua_State *L, const std::vector< std::string > &scriptPaths, int scriptType=DtScriptedTaskScriptedTask)
 
static DtScriptResourceManagercreator ()
 

Protected Types

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

Protected Member Functions

virtual std::string findLuaModuleFile (const std::string &filename)
 
virtual void saveBytecodeChunk (lua_State *L, const std::string &chunkName)
 
virtual void createLuaStates (unsigned numStates)
 
 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
 
tbb::mutex myBytecodeMutex
 
- Protected Attributes inherited from DtScriptResourceManager
std::vector< std::string > myScriptPaths
 

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::initializeNumberOfStates ( unsigned  numberOfStates)
virtual

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

Implements DtScriptResourceManager.

virtual lua_State* DtLuaScriptResourceManager::getLuaState ( int  scriptType = DtScriptedTaskScriptedTask)
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,
int  scriptType = DtScriptedTaskScriptedTask 
)
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,
int  scriptType = DtScriptedTaskScriptedTask 
)
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
tbb::mutex DtLuaScriptResourceManager::myBytecodeMutex
protected

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

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)