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

Public Types

typedef DtTemplatedException< 300 > DtStateParseException

Public Member Functions

virtual ~DtLuaObjectSerializer ()
virtual DtAsciiSerializablecreateInstance (const DtString &typeName, const DtString &serializedString)
 Registers a DtAsciiSerializable creator function.
virtual void registerCreatorFunc (const DtString &typeName, DtSerializableCreatorFunc func)
virtual void registerDeserializerFunc (const DtString &typeName, DtDeserializerFunc func)
 Registers a deserializer function to convert a string to a lua object.
virtual void registerSerializerFunc (const DtString &typeName, DtSerializerFunc func)
 Registers the function to serialize the lua object to a string.
virtual bool serializeObject (const luabind::object &lobj, std::string &buffer, std::vector< luabind::object > stackParameters)
 Serialize the specific lua object to the string buffer.
virtual const chardeserializeObject (lua_State *state, const char *buffer, luabind::object &lobj)
 Deserialize the serialized string to the lua object.
virtual bool doesSerializerExist (const DtString &type)
virtual DtSimManagersimManager ()
virtual bool saveLuaScriptGlobals (lua_State *state, std::string &buffer)
 Serializes the scripts globals in a character buffer.
virtual bool saveLuaScriptTable (lua_State *state, const std::string &key, const luabind::object &lobj, std::string &buffer)
 Serializes the table with the given key name.
virtual bool loadLuaScriptGlobals (lua_State *state, const DtString &buffer)
 Loads the scripts globals from a character buffer.
virtual void addKeyToIgnore (const std::string &)
 When serializing ignore any key found in this list.
virtual void removeKeyToIgnore (const std::string &)
 Removes a key to ignore during serialization.

Static Public Member Functions

static DtLuaObjectSerializerinstance ()
 Returns the static instance of this class.
static DtLuaObjectSerializercreate (DtSimManager *simManager)
static void setFactory (DtLuaObjectSerializer *factory)

Protected Member Functions

 DtLuaObjectSerializer (DtSimManager *simManager)
 DtLuaObjectSerializer (const DtLuaObjectSerializer &other)
DtLuaObjectSerializeroperator= (const DtLuaObjectSerializer &other)
virtual const charparseBufferToTableKeyVals (lua_State *state, luabind::object &table, const char *buffer)
 internal function for loading lua globals
virtual void parseTableKeyValsToBuffer (const luabind::object &, std::string &buffer, std::vector< luabind::object > stackParameters)
 internal function for saving lua globals.
virtual bool needsEscaping (const DtString &buffer) const
virtual void applyStandardEscapes (DtString &buffer)
virtual bool needsUnescaping (DtString &buffer) const
virtual void unapplyStandardEscapes (DtString &buffer)
virtual bool isKeyToIgnore (const DtString &keyName)
virtual bool IsALoadedPackage (lua_State *L, const char *tableName)
virtual const charnextToken (char separator, const char *buf, DtString &tok)
 Retrieves the next token from buf, separated by the next unescaped separator character.

Protected Attributes

std::map< DtString,
DtSerializableCreatorFunc
myCreators
std::map< DtString,
DtSerializerFunc
mySerializers
std::map< DtString,
DtDeserializerFunc
myDeserializers
DtSimManagermySimManager
std::set< std::string > myKeysToIgnore
 When serializing, ignore these keys.

Static Protected Attributes

static DtLuaObjectSerializertheInstance

Member Typedef Documentation

typedef DtTemplatedException<300> DtLuaObjectSerializer::DtStateParseException

Constructor & Destructor Documentation

DtLuaObjectSerializer::DtLuaObjectSerializer ( DtSimManager simManager)
protected
DtLuaObjectSerializer::DtLuaObjectSerializer ( const DtLuaObjectSerializer other)
protected
virtual DtLuaObjectSerializer::~DtLuaObjectSerializer ( )
virtual

Member Function Documentation

DtLuaObjectSerializer& DtLuaObjectSerializer::operator= ( const DtLuaObjectSerializer other)
protected
static DtLuaObjectSerializer* DtLuaObjectSerializer::instance ( )
static

Returns the static instance of this class.

Referenced by vrfLua::DtAsciiDeserializeLua(), and vrfLua::DtAsciiDeserializeLuaSharedPtr().

virtual DtAsciiSerializable* DtLuaObjectSerializer::createInstance ( const DtString typeName,
const DtString serializedString 
)
virtual

Registers a DtAsciiSerializable creator function.

It should create a default object with default values.

Referenced by vrfLua::DtAsciiDeserializeLua(), and vrfLua::DtAsciiDeserializeLuaSharedPtr().

virtual void DtLuaObjectSerializer::registerCreatorFunc ( const DtString typeName,
DtSerializableCreatorFunc  func 
)
virtual
virtual void DtLuaObjectSerializer::registerDeserializerFunc ( const DtString typeName,
DtDeserializerFunc  func 
)
virtual

Registers a deserializer function to convert a string to a lua object.

virtual void DtLuaObjectSerializer::registerSerializerFunc ( const DtString typeName,
DtSerializerFunc  func 
)
virtual

Registers the function to serialize the lua object to a string.

virtual bool DtLuaObjectSerializer::serializeObject ( const luabind::object &  lobj,
std::string &  buffer,
std::vector< luabind::object >  stackParameters 
)
virtual

Serialize the specific lua object to the string buffer.

This function will append to the string buffer

virtual const char* DtLuaObjectSerializer::deserializeObject ( lua_State *  state,
const char buffer,
luabind::object &  lobj 
)
virtual

Deserialize the serialized string to the lua object.

The lua state is required in the creation of the lua object This is a template since luabind requires the specific object type to be bound rather than the base class these objects inherit from.

virtual bool DtLuaObjectSerializer::doesSerializerExist ( const DtString type)
virtual
virtual DtSimManager& DtLuaObjectSerializer::simManager ( )
virtual
static DtLuaObjectSerializer* DtLuaObjectSerializer::create ( DtSimManager simManager)
static
static void DtLuaObjectSerializer::setFactory ( DtLuaObjectSerializer factory)
static
virtual bool DtLuaObjectSerializer::saveLuaScriptGlobals ( lua_State *  state,
std::string &  buffer 
)
virtual

Serializes the scripts globals in a character buffer.

virtual bool DtLuaObjectSerializer::saveLuaScriptTable ( lua_State *  state,
const std::string &  key,
const luabind::object &  lobj,
std::string &  buffer 
)
virtual

Serializes the table with the given key name.

virtual bool DtLuaObjectSerializer::loadLuaScriptGlobals ( lua_State *  state,
const DtString buffer 
)
virtual

Loads the scripts globals from a character buffer.

virtual void DtLuaObjectSerializer::addKeyToIgnore ( const std::string &  )
virtual

When serializing ignore any key found in this list.

virtual void DtLuaObjectSerializer::removeKeyToIgnore ( const std::string &  )
virtual

Removes a key to ignore during serialization.

virtual const char* DtLuaObjectSerializer::parseBufferToTableKeyVals ( lua_State *  state,
luabind::object &  table,
const char buffer 
)
protectedvirtual

internal function for loading lua globals

virtual void DtLuaObjectSerializer::parseTableKeyValsToBuffer ( const luabind::object &  ,
std::string &  buffer,
std::vector< luabind::object >  stackParameters 
)
protectedvirtual

internal function for saving lua globals.

Stack parameters is used to make sure the serializer is not recursively serializing objects

virtual bool DtLuaObjectSerializer::needsEscaping ( const DtString buffer) const
protectedvirtual
virtual void DtLuaObjectSerializer::applyStandardEscapes ( DtString buffer)
protectedvirtual
virtual bool DtLuaObjectSerializer::needsUnescaping ( DtString buffer) const
protectedvirtual
virtual void DtLuaObjectSerializer::unapplyStandardEscapes ( DtString buffer)
protectedvirtual
virtual bool DtLuaObjectSerializer::isKeyToIgnore ( const DtString keyName)
protectedvirtual
virtual bool DtLuaObjectSerializer::IsALoadedPackage ( lua_State *  L,
const char tableName 
)
protectedvirtual
virtual const char* DtLuaObjectSerializer::nextToken ( char  separator,
const char buf,
DtString tok 
)
protectedvirtual

Retrieves the next token from buf, separated by the next unescaped separator character.

Returns the pointer into buf beyond the returned token.

Member Data Documentation

std::map<DtString, DtSerializableCreatorFunc> DtLuaObjectSerializer::myCreators
protected
std::map<DtString, DtSerializerFunc> DtLuaObjectSerializer::mySerializers
protected
std::map<DtString, DtDeserializerFunc> DtLuaObjectSerializer::myDeserializers
protected
DtSimManager* DtLuaObjectSerializer::mySimManager
protected
DtLuaObjectSerializer* DtLuaObjectSerializer::theInstance
staticprotected
std::set<std::string> DtLuaObjectSerializer::myKeysToIgnore
protected

When serializing, ignore these keys.


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

Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)