MIRA
Classes | Public Member Functions | List of all members
PropertyTree Class Reference

Helper class that is able to hold a complete property tree structure. More...

#include <serialization/PropertyTree.h>

Public Member Functions

 PropertyTree ()
 Creates an empty tree. More...
 
 PropertyTree (PropertyNode *root)
 Constructs a property tree representation from a given property node and all of its child nodes. More...
 
template<typename Reflector >
void reflect (Reflector &r)
 
const PropertyNodeInfogetRootNodeInfo () const
 Returns the info for the root node, and therefore allows the user to create a root property node from this root node info manually. More...
 
template<typename PropertyNodeType >
PropertyNodeType * generatePropertyNodes (PropertyNodeType *root=NULL) const
 Reconstructs the property nodes from the given tree structure. More...
 

Detailed Description

Helper class that is able to hold a complete property tree structure.

It allows to serialize and deserialize such a structure.

Example for serializing a property tree:

MyClass myobject;
// create the property tree of myobject
PropertyManager m;
m.addObject("MyObject", myobject);
PropertyNode* n = m.getRootNode();
// serialize the property tree
PropertyTree tree(n);
XMLSerializer s(xmldom);
s.serialize("PropertyTree", tree);

From a property tree, all property nodes can be restored as follows:

XMLDeserializer d(xmldom);
d.deserialize("PropertyTree", tree);
// generate all property nodes of type MyPropertyNode
PropertyNode* n = tree.generatePropertyNodes<MyPropertyNode>();

Constructor & Destructor Documentation

◆ PropertyTree() [1/2]

PropertyTree ( )
inline

Creates an empty tree.

◆ PropertyTree() [2/2]

PropertyTree ( PropertyNode root)
inline

Constructs a property tree representation from a given property node and all of its child nodes.

The property nodes can be recreated from the tree using the generatePropertyNodes() methods.

Member Function Documentation

◆ reflect()

void reflect ( Reflector &  r)
inline

◆ getRootNodeInfo()

const PropertyNodeInfo& getRootNodeInfo ( ) const
inline

Returns the info for the root node, and therefore allows the user to create a root property node from this root node info manually.

◆ generatePropertyNodes()

PropertyNodeType* generatePropertyNodes ( PropertyNodeType *  root = NULL) const
inline

Reconstructs the property nodes from the given tree structure.

Optionally, the user can specify a previously created root node (e.g. using the info obtained by getRootNodeInfo() )


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