vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vrecko::ReaderWriter Class Reference

#include <ReaderWriter.h>

Classes

struct  AbilityToInitialize
 

Public Member Functions

 ReaderWriter ()
 
 ~ReaderWriter ()
 
bool loadMultipleFiles (std::vector< std::string > &files, float *loadingPosition, std::string *loadingCategory, VRECKOMutex load_Mutex)
 
bool loadOld (const char *configName, float *loadingPosition, std::string *loadingCategory, VRECKOMutex load_Mutex)
 
int save (const char *configName, const char *originalSceneFile, float *savingPosition, std::string *savingCategory, VRECKOMutex save_Mutex)
 

Static Public Member Functions

static
XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode
findNodeByName (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node, const std::string &nodeName, int level=1)
 
static
XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode
findChildByName (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node, const XMLCh *xChChildNodeName, int level=1)
 
static void getStringValue (std::string &returnValue, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node, const std::string &nodeName, const std::string &failReturn="", int level=1)
 
static const XMLCh * getStringValueXCh (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *parentNode, const XMLCh *childNodeName)
 
static bool getBoolValue (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node, const std::string &nodeName, bool failReturn=false, int level=1)
 
static int getIntValue (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node, const std::string &nodeName, int failReturn=0, int level=1)
 
static long int getLongIntValue (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node, const std::string &nodeName, long int failReturn=0, int level=1)
 
static float getFloatValue (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node, const std::string &nodeName, float failReturn=0.0, int level=1)
 
static double getDoubleValue (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node, const std::string &nodeName, double failReturn=0.0, int level=1)
 
static void getVec2Value (osg::Vec2 &returnValue, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node, const std::string &nodeName, const osg::Vec2 &failReturn=osg::Vec2(0.0, 0.0), int level=1)
 
static void getVec3Value (osg::Vec3 &returnValue, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node, const std::string &nodeName, const osg::Vec3 &failReturn=osg::Vec3(0.0, 0.0, 0.0), int level=1)
 
static void getVec4Value (osg::Vec4 &returnValue, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node, const std::string &nodeName, const osg::Vec4 &failReturn=osg::Vec4(0.0, 0.0, 0.0, 0.0), int level=1)
 
static void getMatrixValue (osg::Matrix &returnValue, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node, const std::string &nodeName, const osg::Matrix &failReturn=osg::Matrix::identity(), int level=1)
 
static void getQuatValue (osg::Quat &returnValue, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node, const std::string &nodeName, const osg::Quat &failReturn=osg::Quat(), int level=1)
 
static bool getAttribStringValue (std::string &returnValue, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node, const std::string &attribName, const std::string &failReturn="")
 
static
XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode
createElement (XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *pDocNode, const std::string &elementName)
 
static
XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode
appendElementAndStringValue (XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *pDocNode, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *pParentNode, const std::string &elementName, const std::string &value)
 
static
XERCES_CPP_NAMESPACE_QUALIFIER
DOMElement * 
appendElementAndBoolValue (XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *pDocNode, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *pParentNode, const std::string &elementName, bool value)
 
static
XERCES_CPP_NAMESPACE_QUALIFIER
DOMElement * 
appendElementAndIntValue (XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *pDocNode, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *pParentNode, const std::string &elementName, int value)
 
static
XERCES_CPP_NAMESPACE_QUALIFIER
DOMElement * 
appendElementAndLongIntValue (XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *pDocNode, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *pParentNode, const std::string &elementName, long int value)
 
static
XERCES_CPP_NAMESPACE_QUALIFIER
DOMElement * 
appendElementAndFloatValue (XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *pDocNode, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *pParentNode, const std::string &elementName, float value)
 
static
XERCES_CPP_NAMESPACE_QUALIFIER
DOMElement * 
appendElementAndDoubleValue (XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *pDocNode, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *pParentNode, const std::string &elementName, double value)
 
static
XERCES_CPP_NAMESPACE_QUALIFIER
DOMElement * 
appendElementAndVec2Value (XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *pDocNode, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *pParentNode, const std::string &elementName, osg::Vec2 value)
 
static
XERCES_CPP_NAMESPACE_QUALIFIER
DOMElement * 
appendElementAndVec3Value (XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *pDocNode, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *pParentNode, const std::string &elementName, osg::Vec3 value)
 
static
XERCES_CPP_NAMESPACE_QUALIFIER
DOMElement * 
appendElementAndVec4Value (XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *pDocNode, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *pParentNode, const std::string &elementName, osg::Vec4 value)
 
static
XERCES_CPP_NAMESPACE_QUALIFIER
DOMElement * 
appendElementAndMatrixValue (XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *pDocNode, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *pParentNode, const std::string &elementName, osg::Matrix value)
 
static
XERCES_CPP_NAMESPACE_QUALIFIER
DOMElement * 
appendElementAndQuatValue (XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *pDocNode, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *pParentNode, const std::string &elementName, osg::Quat value)
 

Protected Types

enum  FDNNodeType {
  FDNSimpleNode = 0, FDNFilter, FDNAbility, FDNDevice,
  FDNEnvironmentObject, FDNAttribute, FDNUserData, FDNEvent,
  FDNReceiver
}
 
typedef std::vector
< AbilityToInitialize
AbInitVector
 

Protected Member Functions

bool loadVirtualEnvironment (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *veNode)
 
bool loadScene (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *sceneNode, AbInitVector &abilitiesToInitialize)
 
bool loadDevice (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *deviceNode)
 
bool loadAbilities (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *eoNode, bool bLoadingWorldAbility, AbInitVector &abilitiesToInitialize)
 
vrecko::EnvironmentObjectloadEnvironmentObject (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *eoNode, osg::Group *parentSceneNode)
 
bool loadEvent (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *eventNode)
 
void saveEnvironmentObject (const char *originalSceneFile, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *pDocNode, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *parentNode, vrecko::EnvironmentObject *pEO)
 
void saveChildren (const char *originalSceneFile, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *pDocNode, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *eoNode, vrecko::EnvironmentObject *pEO)
 
void analyzeXMLTree (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *pNode)
 
unsigned int getNodeCountByName (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *pNode, const std::string &nodeName)
 
XERCES_CPP_NAMESPACE_QUALIFIER
DOMBuilder * 
createParser ()
 
void releaseParser (XERCES_CPP_NAMESPACE_QUALIFIER DOMBuilder *parser)
 
XERCES_CPP_NAMESPACE_QUALIFIER
DOMDocument * 
loadXMLDocument (const char *configName, XERCES_CPP_NAMESPACE_QUALIFIER DOMBuilder *parser)
 
bool findRealFile (char *outputFileWithPath, const char *inputFile, const char *currentDir, std::vector< std::string > *requiredBy=NULL, bool bOutputErrors=true)
 
void removeUnnecessaryWhitespace (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *pNode)
 
bool saveXMLDocument (XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *pDoc, const char *strPath)
 
XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode
mergeFiles (std::vector< std::string > &files, XERCES_CPP_NAMESPACE_QUALIFIER DOMBuilder *parser)
 
bool processNodeToMergeRecursive (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *mainNode, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *secNode, const XMLCh *xChConfigFile)
 
bool removeAttribRecursive (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node, const XMLCh *attribName)
 
XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode
findDuplicateNode (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *mainParentNode, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *origNode)
 
bool getNodeIdentification (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node, FDNNodeType nodeType, XMLCh *strId1, XMLCh *strId2)
 
bool addCreatorInfoRecursive (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node, const XMLCh *xChConfigFile)
 
void addSceneFileInfoIfPossible (vrecko::BaseClass *bc, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node)
 
bool incrementActNode ()
 

Protected Attributes

std::string _cfg_file
 
std::string _cfg_path
 The path includes the ending slash. More...
 
vrecko::DeviceManagerdevice_manager_local
 
vrecko::EventDispatcherevent_dispatcher_local
 
vrecko::EnvironmentObject_eobject
 
unsigned int nodes_count
 
unsigned int act_node
 
pthread_mutex_t * loadsave_Mutex
 
float * loadsave_position
 
std::string * loadsave_category
 

Detailed Description

Class to handle reading from (and in the future possibly writing to) XML configuration files.

Member Typedef Documentation

At first all the abilities are created and after that all are initialized. This array holds the list of abilities to initialize.

Member Enumeration Documentation

Enumerator
FDNSimpleNode 
FDNFilter 
FDNAbility 
FDNDevice 
FDNEnvironmentObject 
FDNAttribute 
FDNUserData 
FDNEvent 
FDNReceiver 

Constructor & Destructor Documentation

vrecko::ReaderWriter::ReaderWriter ( )
inline
vrecko::ReaderWriter::~ReaderWriter ( )
inline

Member Function Documentation

bool vrecko::ReaderWriter::addCreatorInfoRecursive ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode node,
const XMLCh *  xChConfigFile 
)
protected

Adds the attribute containing the original file name to each node in the specified subtree.

void vrecko::ReaderWriter::addSceneFileInfoIfPossible ( vrecko::BaseClass bc,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode node 
)
protected

Sets the SceneFile of the given [bc] (BaseClass::setSceneFile()). This is set only if the given [node] has an attribute CREATOR_FILENAME_ID.

void vrecko::ReaderWriter::analyzeXMLTree ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode pNode)
protected

Analyzes the XML tree in memory.

Calculates the number of nodes.

XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * vrecko::ReaderWriter::appendElementAndBoolValue ( XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *  pDocNode,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode pParentNode,
const std::string &  elementName,
bool  value 
)
static

Creates a new XML element and fills out its value (usually your parameter name and parameter value).

XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * vrecko::ReaderWriter::appendElementAndDoubleValue ( XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *  pDocNode,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode pParentNode,
const std::string &  elementName,
double  value 
)
static

Creates a new XML element and fills out its value (usually your parameter name and parameter value).

XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * vrecko::ReaderWriter::appendElementAndFloatValue ( XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *  pDocNode,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode pParentNode,
const std::string &  elementName,
float  value 
)
static

Creates a new XML element and fills out its value (usually your parameter name and parameter value).

XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * vrecko::ReaderWriter::appendElementAndIntValue ( XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *  pDocNode,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode pParentNode,
const std::string &  elementName,
int  value 
)
static

Creates a new XML element and fills out its value (usually your parameter name and parameter value).

XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * vrecko::ReaderWriter::appendElementAndLongIntValue ( XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *  pDocNode,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode pParentNode,
const std::string &  elementName,
long int  value 
)
static

Creates a new XML element and fills out its value (usually your parameter name and parameter value).

XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * vrecko::ReaderWriter::appendElementAndMatrixValue ( XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *  pDocNode,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode pParentNode,
const std::string &  elementName,
osg::Matrix  value 
)
static

Creates a new XML element and fills out its value (usually your parameter name and parameter value).

XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * vrecko::ReaderWriter::appendElementAndQuatValue ( XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *  pDocNode,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode pParentNode,
const std::string &  elementName,
osg::Quat  value 
)
static

Creates a new XML element and fills out its value (usually your parameter name and parameter value).

XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * vrecko::ReaderWriter::appendElementAndStringValue ( XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *  pDocNode,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode pParentNode,
const std::string &  elementName,
const std::string &  value 
)
static

Creates a new XML element and fills out its value (usually your parameter name and parameter value).

XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * vrecko::ReaderWriter::appendElementAndVec2Value ( XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *  pDocNode,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode pParentNode,
const std::string &  elementName,
osg::Vec2  value 
)
static

Creates a new XML element and fills out its value (usually your parameter name and parameter value).

XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * vrecko::ReaderWriter::appendElementAndVec3Value ( XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *  pDocNode,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode pParentNode,
const std::string &  elementName,
osg::Vec3  value 
)
static

Creates a new XML element and fills out its value (usually your parameter name and parameter value).

XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * vrecko::ReaderWriter::appendElementAndVec4Value ( XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *  pDocNode,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode pParentNode,
const std::string &  elementName,
osg::Vec4  value 
)
static

Creates a new XML element and fills out its value (usually your parameter name and parameter value).

XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * vrecko::ReaderWriter::createElement ( XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *  pDocNode,
const std::string &  elementName 
)
static

Creates a new XML element (node) (usually "Parameters")

XERCES_CPP_NAMESPACE_QUALIFIER DOMBuilder * vrecko::ReaderWriter::createParser ( )
protected

Creates a XML parser.

Note: Assumes the XML4C is already initialized. (done in vreckoApp/Main.cpp)

XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * vrecko::ReaderWriter::findChildByName ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode node,
const XMLCh *  xChChildNodeName,
int  level = 1 
)
static
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * vrecko::ReaderWriter::findDuplicateNode ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode mainParentNode,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode origNode 
)
protected

Finds a duplicate of a given node if it exists.

XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * vrecko::ReaderWriter::findNodeByName ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode node,
const std::string &  nodeName,
int  level = 1 
)
static

Finds a node with a specific name. Can return even the specified node. Level = 0 means the specified node only. Level = 1 means the node AND its direct children. etc.

bool vrecko::ReaderWriter::findRealFile ( char *  outputFileWithPath,
const char *  inputFile,
const char *  currentDir,
std::vector< std::string > *  requiredBy = NULL,
bool  bOutputErrors = true 
)
protected

Checks if the file exists and if not tries the alternative paths.

Returns true if the file has been found somewhere and the real path + filename.

bool vrecko::ReaderWriter::getAttribStringValue ( std::string &  returnValue,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode node,
const std::string &  attribName,
const std::string &  failReturn = "" 
)
static

Searches ATTRIBUTES of a [node] for an attribute named [attribName] and returns its value. Returns [failReturn] in case of a problem.

* Example of attributes: <Node attribute1="value" attribute2="value">...</Node>
* 
bool vrecko::ReaderWriter::getBoolValue ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode node,
const std::string &  nodeName,
bool  failReturn = false,
int  level = 1 
)
static

Searches children of a [node] for a node with name [nodeName] and reads its value. Returns [failReturn] if the value cannot be read. Can go deeper than one level - specify the limit in [level] parameter.

double vrecko::ReaderWriter::getDoubleValue ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode node,
const std::string &  nodeName,
double  failReturn = 0.0,
int  level = 1 
)
static

Searches children of a [node] for a node with name [nodeName] and reads its value. Returns [failReturn] if the value cannot be read. Can go deeper than one level - specify the limit in [level] parameter.

float vrecko::ReaderWriter::getFloatValue ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode node,
const std::string &  nodeName,
float  failReturn = 0.0,
int  level = 1 
)
static

Searches children of a [node] for a node with name [nodeName] and reads its value. Returns [failReturn] if the value cannot be read. Can go deeper than one level - specify the limit in [level] parameter.

int vrecko::ReaderWriter::getIntValue ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode node,
const std::string &  nodeName,
int  failReturn = 0,
int  level = 1 
)
static

Searches children of a [node] for a node with name [nodeName] and reads its value. Returns [failReturn] if the value cannot be read. Can go deeper than one level - specify the limit in [level] parameter.

long int vrecko::ReaderWriter::getLongIntValue ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode node,
const std::string &  nodeName,
long int  failReturn = 0,
int  level = 1 
)
static

Searches children of a [node] for a node with name [nodeName] and reads its value. Returns [failReturn] if the value cannot be read. Can go deeper than one level - specify the limit in [level] parameter.

void vrecko::ReaderWriter::getMatrixValue ( osg::Matrix &  returnValue,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode node,
const std::string &  nodeName,
const osg::Matrix &  failReturn = osg::Matrix::identity(),
int  level = 1 
)
static

Searches children of a [node] for a node with name [nodeName] and reads its value. Returns [failReturn] if the value cannot be read. Can go deeper than one level - specify the limit in [level] parameter.

unsigned int vrecko::ReaderWriter::getNodeCountByName ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode pNode,
const std::string &  nodeName 
)
protected

Returns the number of children nodes of a given name.

bool vrecko::ReaderWriter::getNodeIdentification ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode node,
FDNNodeType  nodeType,
XMLCh *  strId1,
XMLCh *  strId2 
)
protected

Assembles a node identificator, that can be used in a search for duplicates. Can return false in case the identification cannot be retrieved. This doesn't necessarily mean an error.

void vrecko::ReaderWriter::getQuatValue ( osg::Quat &  returnValue,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode node,
const std::string &  nodeName,
const osg::Quat &  failReturn = osg::Quat(),
int  level = 1 
)
static

Searches children of a [node] for a node with name [nodeName] and reads its value. Returns [failReturn] if the value cannot be read. Can go deeper than one level - specify the limit in [level] parameter.

void vrecko::ReaderWriter::getStringValue ( std::string &  returnValue,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode node,
const std::string &  nodeName,
const std::string &  failReturn = "",
int  level = 1 
)
static

Searches children of a [node] for a node with name [nodeName] and reads its value. Returns [failReturn] if the value cannot be read. Can go deeper than one level - specify the limit in [level] parameter.

const XMLCh * vrecko::ReaderWriter::getStringValueXCh ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode parentNode,
const XMLCh *  childNodeName 
)
static

Searches children of a [node] for a node with name [nodeName] and reads its value. Returns [failReturn] if the value cannot be read. Can go deeper than one level - specify the limit in [level] parameter.

void vrecko::ReaderWriter::getVec2Value ( osg::Vec2 &  returnValue,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode node,
const std::string &  nodeName,
const osg::Vec2 &  failReturn = osg::Vec2(0.0, 0.0),
int  level = 1 
)
static

Searches children of a [node] for a node with name [nodeName] and reads its value. Returns [failReturn] if the value cannot be read. Can go deeper than one level - specify the limit in [level] parameter.

void vrecko::ReaderWriter::getVec3Value ( osg::Vec3 &  returnValue,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode node,
const std::string &  nodeName,
const osg::Vec3 &  failReturn = osg::Vec3(0.0, 0.0, 0.0),
int  level = 1 
)
static

Searches children of a [node] for a node with name [nodeName] and reads its value. Returns [failReturn] if the value cannot be read. Can go deeper than one level - specify the limit in [level] parameter.

void vrecko::ReaderWriter::getVec4Value ( osg::Vec4 &  returnValue,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode node,
const std::string &  nodeName,
const osg::Vec4 &  failReturn = osg::Vec4(0.0, 0.0, 0.0, 0.0),
int  level = 1 
)
static

Searches children of a [node] for a node with name [nodeName] and reads its value. Returns [failReturn] if the value cannot be read. Can go deeper than one level - specify the limit in [level] parameter.

bool vrecko::ReaderWriter::incrementActNode ( )
protected

Increment the number of processed nodes to keep track and draw the progress bar.

bool vrecko::ReaderWriter::loadAbilities ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode eoNode,
bool  bLoadingWorldAbility,
AbInitVector abilitiesToInitialize 
)
protected

Reads the "Abilities" node.

bool vrecko::ReaderWriter::loadDevice ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode deviceNode)
protected

Reads a given "Device" node.

vrecko::EnvironmentObject * vrecko::ReaderWriter::loadEnvironmentObject ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode eoNode,
osg::Group *  parentSceneNode 
)
protected

Reads the "EnvironmentObject" node.

bool vrecko::ReaderWriter::loadEvent ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode eventNode)
protected

Reads the "Event" node.

bool vrecko::ReaderWriter::loadMultipleFiles ( std::vector< std::string > &  files,
float *  loadingPosition,
std::string *  loadingCategory,
VRECKOMutex  load_Mutex 
)

Loads a list of .xml files.

It performs a merge first, then attempts to load the resulting tree from memory.

bool vrecko::ReaderWriter::loadOld ( const char *  configName,
float *  loadingPosition,
std::string *  loadingCategory,
VRECKOMutex  load_Mutex 
)

Old loading method to load the files one-by-one without merging. (OBSOLETE, probably can be deleted)

bool vrecko::ReaderWriter::loadScene ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode sceneNode,
AbInitVector abilitiesToInitialize 
)
protected

Reads the "Scene" node and its subtree.

bool vrecko::ReaderWriter::loadVirtualEnvironment ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode veNode)
protected

Main loading function called to load a whole XML tree.

XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * vrecko::ReaderWriter::loadXMLDocument ( const char *  configName,
XERCES_CPP_NAMESPACE_QUALIFIER DOMBuilder *  parser 
)
protected

Loads a XML file and returns the tree in memory.

Needs an externally created parser.

XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * vrecko::ReaderWriter::mergeFiles ( std::vector< std::string > &  files,
XERCES_CPP_NAMESPACE_QUALIFIER DOMBuilder *  parser 
)
protected

Merges multiple files into one XML tree. Understands the vrecko XML syntax and makes proper changes to the XML trees.

bool vrecko::ReaderWriter::processNodeToMergeRecursive ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode mainNode,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode secNode,
const XMLCh *  xChConfigFile 
)
protected

Merges children of the specified nodes.

void vrecko::ReaderWriter::releaseParser ( XERCES_CPP_NAMESPACE_QUALIFIER DOMBuilder *  parser)
protected

Releases a XML parser.

Note: Doesn't release the XML4C (done in vreckoApp/Main.cpp)

bool vrecko::ReaderWriter::removeAttribRecursive ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode node,
const XMLCh *  attribName 
)
protected

Removes the specified attribute from the whole specified subtree.

void vrecko::ReaderWriter::removeUnnecessaryWhitespace ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode pNode)
protected

Removes empty text nodes in the given node and its children.

int vrecko::ReaderWriter::save ( const char *  configName,
const char *  originalSceneFile,
float *  savingPosition,
std::string *  savingCategory,
VRECKOMutex  save_Mutex 
)

(V.K. - summer 2011) I am not sure, how well method works. At least some of the data are NOT SAVED (some abilitity attributes etc.).

[originalSceneFile] represents the scene file that was used for loading (probably). This method will EITHER ONLY save those objects/abilities/connections that originated from this originalSceneFile OR will save EVERYTHING if [originalsceneFile] is "". TODO ?: Save the path to models relatively to the main .exe?

void vrecko::ReaderWriter::saveChildren ( const char *  originalSceneFile,
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *  pDocNode,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode eoNode,
vrecko::EnvironmentObject pEO 
)
protected

Save children EO. This method will ONLY save objects with sceneFile == originalSceneFile.

void vrecko::ReaderWriter::saveEnvironmentObject ( const char *  originalSceneFile,
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *  pDocNode,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode parentNode,
vrecko::EnvironmentObject pEO 
)
protected

Save an EO. This method will ONLY save objects with sceneFile == originalSceneFile.

bool vrecko::ReaderWriter::saveXMLDocument ( XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *  pDoc,
const char *  strPath 
)
protected

Saves a XML tree from memory into file.

Member Data Documentation

std::string vrecko::ReaderWriter::_cfg_file
protected
std::string vrecko::ReaderWriter::_cfg_path
protected

The path includes the ending slash.

vrecko::EnvironmentObject* vrecko::ReaderWriter::_eobject
protected
unsigned int vrecko::ReaderWriter::act_node
protected
vrecko::DeviceManager* vrecko::ReaderWriter::device_manager_local
protected
vrecko::EventDispatcher* vrecko::ReaderWriter::event_dispatcher_local
protected
std::string* vrecko::ReaderWriter::loadsave_category
protected
pthread_mutex_t* vrecko::ReaderWriter::loadsave_Mutex
protected
float* vrecko::ReaderWriter::loadsave_position
protected
unsigned int vrecko::ReaderWriter::nodes_count
protected

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