DSRTree Class Reference

Class managing a tree of nodes. More...

Inheritance diagram for DSRTree:

DSRTreeNodeCursor DSRTypes DSRDocumentTree List of all members.

Public Member Functions

 DSRTree ()
 default constructor
virtual ~DSRTree ()
 destructor
virtual void clear ()
 clear all member variables
OFBool isEmpty () const
 check whether tree has any nodes
size_t gotoRoot ()
 set internal cursor to root node
size_t gotoNode (const size_t searchID, const OFBool startFromRoot=OFTrue)
 set internal cursor to specified node
size_t gotoNode (const OFString &reference, const OFBool startFromRoot=OFTrue)
 set internal cursor to specified node
virtual size_t addNode (DSRTreeNode *node, const E_AddMode addMode=AM_afterCurrent)
 add new node to the current one.
virtual size_t removeNode ()
 remove current node from tree.

Protected Member Functions

DSRTreeNodegetRoot () const
 get pointer to root node

Private Member Functions

 DSRTree (const DSRTree &)
DSRTreeoperator= (const DSRTree &)

Private Attributes

DSRTreeNodeRootNode
 pointer to the root tree node

Detailed Description

Class managing a tree of nodes.

Definition at line 100 of file dsrtree.h.


Member Function Documentation

OFBool DSRTree::isEmpty (  )  const

check whether tree has any nodes

Returns:
OFTrue if tree is empty, OFFalse otherwise

size_t DSRTree::gotoRoot (  ) 

set internal cursor to root node

Returns:
ID of root node if successful, 0 otherwise

size_t DSRTree::gotoNode ( const size_t  searchID,
const OFBool  startFromRoot = OFTrue 
)

set internal cursor to specified node

Parameters:
searchID ID of the node to set the cursor to
startFromRoot flag indicating whether to start from the root node or the current one
Returns:
ID of the new current node if successful, 0 otherwise

size_t DSRTree::gotoNode ( const OFString reference,
const OFBool  startFromRoot = OFTrue 
)

set internal cursor to specified node

Parameters:
reference position string of the node to set the cursor to. (the format is e.g. "1.2.3" for the third child of the second child of the first node - see DSRTreeNodeCursor).
startFromRoot flag indicating whether to start from the root node or the current one
Returns:
ID of the new current node if successful, 0 otherwise

virtual size_t DSRTree::addNode ( DSRTreeNode node,
const E_AddMode  addMode = AM_afterCurrent 
) [virtual]

add new node to the current one.

Please note that no copy of the given node is created. Therefore, the node should be created with new() - do not use a reference to a local variable. If the node could be added successfully the cursor is set to it automatically.

Parameters:
node pointer to the new node to be added
addMode flag specifying at which position to add the new node. (AM_afterCurrent, AM_beforeCurrent, AM_belowCurrent)
Returns:
ID of the new added node if successful, 0 otherwise

Reimplemented in DSRDocumentTree.

virtual size_t DSRTree::removeNode (  )  [virtual]

remove current node from tree.

Please note that not only the specified node but also all of its child nodes are removed from the tree and then deleted. The cursor is set automatically to a new valid position.

Returns:
ID of the node which became the current one after deletion, 0 if an error occured or the tree is now empty.

Reimplemented in DSRDocumentTree.

DSRTreeNode* DSRTree::getRoot (  )  const [inline, protected]

get pointer to root node

Returns:
pointer to root node, might be NULL (empty tree)

Definition at line 176 of file dsrtree.h.

References RootNode.


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


Generated on 6 Jan 2011 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.5.1