MeVisLab Toolbox Reference
ml::TreeNode Class Reference

The class TreeNode is the abstract base class for the import/export of ML objects. More...

#include <mlTreeNode.h>

Inheritance diagram for ml::TreeNode:
ml::XMLTreeNode

Public Types

enum  ConstructionMode { CM_writerRoot , CM_readerRoot , CM_COUNT }
 TreeNode construction modes: More...
 

Public Member Functions

virtual ~TreeNode ()
 Destructor deleting all children of this node. More...
 
TREE WRITING METHODS:

Each method appends a child representing the variable/object given as first parameter and identified via the second.

You can also add several children with the same name. This feature should be used with care though, because it is not specified here whether the implementation preserves the object order while reading and writing. Those methods with VOID_IMPLEMENTATION must be reimplemented when used in derived classes. The first parameter is the value to be stored and the second holds a name for it (for example a tag name in XML files.

virtual void addChild (bool val, const char *name) ADD_ULONG_CHILD
 Factory method adding a child encapsulating a variable of type bool. More...
 
virtual void addChild (unsigned char val, const char *name) ADD_ULONG_CHILD
 Factory method adding a child encapsulating a variable of type unsigned char. More...
 
virtual void addChild (char val, const char *name) ADD_LONG_CHILD
 Factory method adding a child encapsulating a variable of type char. More...
 
virtual void addChild (unsigned short val, const char *name) ADD_ULONG_CHILD
 Factory method adding a child encapsulating a variable of type unsigned short. More...
 
virtual void addChild (short val, const char *name) ADD_LONG_CHILD
 Factory method adding a child encapsulating a variable of type short. More...
 
virtual void addChild (unsigned int val, const char *name) ADD_ULONG_CHILD
 Factory method adding a child encapsulating a variable of type unsigned int. More...
 
virtual void addChild (int val, const char *name) ADD_LONG_CHILD
 Factory method adding a child encapsulating a variable of type int. More...
 
virtual void addChild (unsigned long, const char *) VOID_IMPLEMENTATION("addChild(unsigned long)")
 Factory method adding a child encapsulating a variable of type long. More...
 
virtual void addChild (long, const char *) VOID_IMPLEMENTATION("addChild(long)")
 Factory method adding a child encapsulating a variable of type long. More...
 
virtual void addChild (MLuint64, const char *) VOID_IMPLEMENTATION("addChild(MLuint64)")
 Factory method adding a child encapsulating a variable of type MLuint64. More...
 
virtual void addChild (MLint64, const char *) VOID_IMPLEMENTATION("addChild(MLint64)")
 Factory method adding a child encapsulating a variable of type MLint64. More...
 
virtual void addChild (float val, const char *name) ADD_LDOUBLE_CHILD
 Factory method adding a child encapsulating a variable of type float. More...
 
virtual void addChild (double val, const char *name) ADD_LDOUBLE_CHILD
 Factory method adding a child encapsulating a variable of type double. More...
 
virtual void addChild (long double, const char *) VOID_IMPLEMENTATION("addChild(long double)")
 Factory method adding a child encapsulating a variable of type long double. More...
 

TREE IMPORT/EXPORT METHODS:

Re-implement in derived classes.

virtual void writeToFile (const char *) VOID_IMPLEMENTATION("writeToFile")
 Writes the subtree represented by this node to a file. More...
 
virtual void readFromFile (const char *) VOID_IMPLEMENTATION("readFromFile")
 Reads the subtree represented by this node from a file. More...
 
virtual void writeToString (std::string &) VOID_IMPLEMENTATION("writeToString")
 Generates a string representation of the subtree represented by this node to a file. More...
 
virtual void readFromString (const std::string &) VOID_IMPLEMENTATION("readFromString")
 Reads the subtree represented by this node from a string. More...
 

Detailed Description

The class TreeNode is the abstract base class for the import/export of ML objects.

It provides an interface that allows the import/export of standard C types such as int or float, as well as standard ML types like Vector6 or SubImageBox, and last but definitely not least, of complex user defined objects. Polymorphy is supported by allowing the I/E of base objects which can created automatically using the runtime system, and can be initialized using the Base::readStateFromTree method.

Definition at line 170 of file mlTreeNode.h.

Member Enumeration Documentation

◆ ConstructionMode

TreeNode construction modes:

Enumerator
CM_writerRoot 

Construct as root node for writing.

CM_readerRoot 

Construct as root node for reading.

CM_COUNT 

number of construction modes

Definition at line 213 of file mlTreeNode.h.

Constructor & Destructor Documentation

◆ ~TreeNode()

virtual ml::TreeNode::~TreeNode ( )
virtual

Destructor deleting all children of this node.

Member Function Documentation

◆ addChild() [1/14]

virtual void ml::TreeNode::addChild ( bool  val,
const char *  name 
)
virtual

Factory method adding a child encapsulating a variable of type bool.

Referenced by ml::ListTemplate< T >::addStateToTree(), and ml::BaseListTemplate< T >::addStateToTree().

◆ addChild() [2/14]

virtual void ml::TreeNode::addChild ( char  val,
const char *  name 
)
virtual

Factory method adding a child encapsulating a variable of type char.

◆ addChild() [3/14]

virtual void ml::TreeNode::addChild ( double  val,
const char *  name 
)
virtual

Factory method adding a child encapsulating a variable of type double.

◆ addChild() [4/14]

virtual void ml::TreeNode::addChild ( float  val,
const char *  name 
)
virtual

Factory method adding a child encapsulating a variable of type float.

◆ addChild() [5/14]

virtual void ml::TreeNode::addChild ( int  val,
const char *  name 
)
virtual

Factory method adding a child encapsulating a variable of type int.

◆ addChild() [6/14]

virtual void ml::TreeNode::addChild ( long double  ,
const char *   
)
virtual

Factory method adding a child encapsulating a variable of type long double.

Reimplemented in ml::XMLTreeNode.

◆ addChild() [7/14]

virtual void ml::TreeNode::addChild ( long  ,
const char *   
)
virtual

Factory method adding a child encapsulating a variable of type long.

Reimplemented in ml::XMLTreeNode.

◆ addChild() [8/14]

virtual void ml::TreeNode::addChild ( MLint64  ,
const char *   
)
virtual

Factory method adding a child encapsulating a variable of type MLint64.

Reimplemented in ml::XMLTreeNode.

◆ addChild() [9/14]

virtual void ml::TreeNode::addChild ( MLuint64  ,
const char *   
)
virtual

Factory method adding a child encapsulating a variable of type MLuint64.

Reimplemented in ml::XMLTreeNode.

◆ addChild() [10/14]

virtual void ml::TreeNode::addChild ( short  val,
const char *  name 
)
virtual

Factory method adding a child encapsulating a variable of type short.

◆ addChild() [11/14]

virtual void ml::TreeNode::addChild ( unsigned char  val,
const char *  name 
)
virtual

Factory method adding a child encapsulating a variable of type unsigned char.

◆ addChild() [12/14]

virtual void ml::TreeNode::addChild ( unsigned int  val,
const char *  name 
)
virtual

Factory method adding a child encapsulating a variable of type unsigned int.

◆ addChild() [13/14]

virtual void ml::TreeNode::addChild ( unsigned long  ,
const char *   
)
virtual

Factory method adding a child encapsulating a variable of type long.

Reimplemented in ml::XMLTreeNode.

◆ addChild() [14/14]

virtual void ml::TreeNode::addChild ( unsigned short  val,
const char *  name 
)
virtual

Factory method adding a child encapsulating a variable of type unsigned short.

◆ readFromFile()

virtual void ml::TreeNode::readFromFile ( const char *  )
virtual

Reads the subtree represented by this node from a file.

Reimplemented in ml::XMLTreeNode.

◆ readFromString()

virtual void ml::TreeNode::readFromString ( const std::string &  )
virtual

Reads the subtree represented by this node from a string.

This method can be used to quickly implement setPersistentString() for a class with TreeNode support. It might not make sense in all cases, for example when the derived class performs a binary import/export of the data.

Reimplemented in ml::XMLTreeNode.

◆ writeToFile()

virtual void ml::TreeNode::writeToFile ( const char *  )
virtual

Writes the subtree represented by this node to a file.

Reimplemented in ml::XMLTreeNode.

◆ writeToString()

virtual void ml::TreeNode::writeToString ( std::string &  )
virtual

Generates a string representation of the subtree represented by this node to a file.

This method can be used to quickly implement getPersistentString() for a class with TreeNode support. It might not make sense in all cases, for example when the derived class performs a binary import/export of the data.

Reimplemented in ml::XMLTreeNode.


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