vrecko
virtual reality framework
|
#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::EnvironmentObject * | loadEnvironmentObject (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::DeviceManager * | device_manager_local |
vrecko::EventDispatcher * | event_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 |
Class to handle reading from (and in the future possibly writing to) XML configuration files.
|
protected |
At first all the abilities are created and after that all are initialized. This array holds the list of abilities to initialize.
|
protected |
|
inline |
|
inline |
|
protected |
Adds the attribute containing the original file name to each node in the specified subtree.
|
protected |
Sets the SceneFile of the given [bc] (BaseClass::setSceneFile()). This is set only if the given [node] has an attribute CREATOR_FILENAME_ID.
|
protected |
Analyzes the XML tree in memory.
Calculates the number of nodes.
|
static |
Creates a new XML element and fills out its value (usually your parameter name and parameter value).
|
static |
Creates a new XML element and fills out its value (usually your parameter name and parameter value).
|
static |
Creates a new XML element and fills out its value (usually your parameter name and parameter value).
|
static |
Creates a new XML element and fills out its value (usually your parameter name and parameter value).
|
static |
Creates a new XML element and fills out its value (usually your parameter name and parameter value).
|
static |
Creates a new XML element and fills out its value (usually your parameter name and parameter value).
|
static |
Creates a new XML element and fills out its value (usually your parameter name and parameter value).
|
static |
Creates a new XML element and fills out its value (usually your parameter name and parameter value).
|
static |
Creates a new XML element and fills out its value (usually your parameter name and parameter value).
|
static |
Creates a new XML element and fills out its value (usually your parameter name and parameter value).
|
static |
Creates a new XML element and fills out its value (usually your parameter name and parameter value).
|
static |
Creates a new XML element (node) (usually "Parameters")
|
protected |
Creates a XML parser.
Note: Assumes the XML4C is already initialized. (done in vreckoApp/Main.cpp)
|
static |
|
protected |
Finds a duplicate of a given node if it exists.
|
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.
|
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.
|
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> *
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
protected |
Returns the number of children nodes of a given name.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
protected |
Increment the number of processed nodes to keep track and draw the progress bar.
|
protected |
Reads the "Abilities" node.
|
protected |
Reads a given "Device" node.
|
protected |
Reads the "EnvironmentObject" node.
|
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)
|
protected |
Reads the "Scene" node and its subtree.
|
protected |
Main loading function called to load a whole XML tree.
|
protected |
Loads a XML file and returns the tree in memory.
Needs an externally created parser.
|
protected |
Merges multiple files into one XML tree. Understands the vrecko XML syntax and makes proper changes to the XML trees.
|
protected |
Merges children of the specified nodes.
|
protected |
Releases a XML parser.
Note: Doesn't release the XML4C (done in vreckoApp/Main.cpp)
|
protected |
Removes the specified attribute from the whole specified subtree.
|
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?
|
protected |
Save children EO. This method will ONLY save objects with sceneFile == originalSceneFile.
|
protected |
Save an EO. This method will ONLY save objects with sceneFile == originalSceneFile.
|
protected |
Saves a XML tree from memory into file.
|
protected |
|
protected |
The path includes the ending slash.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |