DCMTK  Version 3.6.1 20120515
OFFIS DICOM Toolkit
Public Member Functions | Protected Member Functions | Protected Attributes
DSRTreeNodeCursor Class Reference

Class implementing a tree node cursor. More...

+ Inheritance diagram for DSRTreeNodeCursor:

List of all members.

Public Member Functions

 DSRTreeNodeCursor ()
 default constructor
 DSRTreeNodeCursor (const DSRTreeNodeCursor &cursor)
 copy constructor
 DSRTreeNodeCursor (DSRTreeNode *node)
 constructor
virtual ~DSRTreeNodeCursor ()
 destructor
DSRTreeNodeCursoroperator= (const DSRTreeNodeCursor &cursor)
 assignment operator
DSRTreeNodeCursoroperator= (DSRTreeNode *node)
 assignment operator
virtual void clear ()
 clear all member variables
virtual OFBool isValid () const
 check whether cursor currently points to a valid node
DSRTreeNodegetNode () const
 get pointer to current node
const DSRTreeNodegetParentNode ()
 get pointer to parent node.
const DSRTreeNodegetNextNode () const
 get pointer to next node.
size_t gotoPrevious ()
 goto previous node on the same level
size_t gotoNext ()
 goto next node on the same level
size_t goUp ()
 goto parent node (one level up)
size_t goDown ()
 goto first child node (one level down)
size_t iterate (const OFBool searchIntoSub=OFTrue)
 iterate over all nodes.
size_t gotoNode (const size_t searchID)
 set cursor to specified node.
size_t gotoNode (const OFString &position, const char separator= '.')
 set cursor to specified node.
size_t getNodeID () const
 get current node ID.
size_t getLevel () const
 get current level.
const OFStringgetPosition (OFString &position, const char separator= '.') const
 get position string of the current node.

Protected Member Functions

void clearNodeCursorStack ()
 clear the internal node cursor stack
size_t setCursor (DSRTreeNode *node)
 set cursor to specified node.

Protected Attributes

DSRTreeNodeNodeCursor
 pointer current node
OFStack< DSRTreeNodePointerNodeCursorStack
 stack of node pointers. Used to store the cursor position of upper levels.
size_t Position
 current position within the current level
OFList< size_t > PositionList
 list of position counters in upper levels

Detailed Description

Class implementing a tree node cursor.


Constructor & Destructor Documentation

copy constructor

Parameters:
cursorobject to be copied

constructor

Parameters:
nodepointer tree node used to initialize the cursor (set to this node)

Member Function Documentation

size_t DSRTreeNodeCursor::getLevel ( ) const

get current level.

The level starts with 1 for the root node, then 2 for its child nodes, etc.

Returns:
number of the current level if valid, 0 otherwise

get pointer to next node.

Used to have a lookup to the next node without changing the cursor.

Returns:
pointer to next node (if any), NULL otherwise

get pointer to current node

Returns:
pointer to current node (might be NULL)
size_t DSRTreeNodeCursor::getNodeID ( ) const

get current node ID.

The node ID uniquely identifies a content item in the document tree. Most of the navigation methods above do return this ID too.

Returns:
ID of the current node if valid, 0 otherwise

get pointer to parent node.

Used to have a lookup to the parent node without changing the cursor.

Returns:
pointer to parent node (if any), NULL otherwise
const OFString& DSRTreeNodeCursor::getPosition ( OFString position,
const char  separator = '.' 
) const

get position string of the current node.

Specifies the position of each node by means of a dot separated string of position counters. The first figure of this string specifies the position within the first level (e.g. "1"), the second one the position in the second level (e.g. "2"), the third one the position in the third level (e.g. "3"), etc. A position string of "1.2.3" would, therefore, point to the third child of the second child of the first node.

Parameters:
positionvariable where the position string should be stored
separatorcharacter used to separate the figures (default: '.')
Returns:
reference to the resulting position string (empty if invalid)

goto first child node (one level down)

Returns:
ID of the first child node if successful, 0 otherwise

goto next node on the same level

Returns:
ID of the next node if successful, 0 otherwise
size_t DSRTreeNodeCursor::gotoNode ( const size_t  searchID)

set cursor to specified node.

Starts from current position!

Parameters:
searchIDID of the node to set the cursor to
Returns:
ID of the new current node if successful, 0 otherwise
size_t DSRTreeNodeCursor::gotoNode ( const OFString position,
const char  separator = '.' 
)

set cursor to specified node.

Starts from current position!

Parameters:
positionposition 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 getPosition()).
separatorcharacter used to separate the figures (default: '.')
Returns:
ID of the new current node if successful, 0 otherwise

goto previous node on the same level

Returns:
ID of the previous node if successful, 0 otherwise

goto parent node (one level up)

Returns:
ID of the parent node if successful, 0 otherwise
virtual OFBool DSRTreeNodeCursor::isValid ( ) const [virtual]

check whether cursor currently points to a valid node

Returns:
OFTrue if valid, OFFalse otherwise

Reimplemented in DSRDocumentTree.

size_t DSRTreeNodeCursor::iterate ( const OFBool  searchIntoSub = OFTrue)

iterate over all nodes.

Starts from current position!

Parameters:
searchIntoSubflag indicating whether to search into sub-trees ("deep search") or on the current level only
Returns:
ID of the next node if successful, 0 otherwise
DSRTreeNodeCursor& DSRTreeNodeCursor::operator= ( const DSRTreeNodeCursor cursor)

assignment operator

Parameters:
cursorobject to be copied
Returns:
reference to modified cursor (this object)
DSRTreeNodeCursor& DSRTreeNodeCursor::operator= ( DSRTreeNode node)

assignment operator

Parameters:
nodenode to which the cursor should be set
Returns:
reference to modified cursor (this object)
size_t DSRTreeNodeCursor::setCursor ( DSRTreeNode node) [protected]

set cursor to specified node.

Clears the internal position list/stack and sets the position counter to 1.

Parameters:
nodenode to which the cursor should be set
Returns:
ID of the new current node if successful, 0 otherwise

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


Generated on Tue May 15 2012 for DCMTK Version 3.6.1 20120515 by Doxygen 1.7.5.1-20111027