DCMTK
Version 3.6.5
OFFIS DICOM Toolkit
|
Class implementing a tree node cursor. More...
Public Member Functions | |
DSRTreeNodeCursor () | |
default constructor | |
DSRTreeNodeCursor (const DSRTreeNodeCursor< T > &cursor) | |
copy constructor More... | |
DSRTreeNodeCursor (T *node, const DSRPositionCounter *position=NULL) | |
constructor. More... | |
virtual | ~DSRTreeNodeCursor () |
destructor | |
DSRTreeNodeCursor< T > & | operator= (const DSRTreeNodeCursor< T > &cursor) |
assignment operator More... | |
DSRTreeNodeCursor< T > & | operator= (T *node) |
assignment operator. More... | |
virtual void | clear () |
clear all member variables. More... | |
virtual OFBool | isValid () const |
check whether cursor currently points to a valid node More... | |
virtual size_t | countChildNodes (const OFBool searchIntoSub=OFTrue) const |
count number of children of the current node. More... | |
OFBool | hasParentNode () const |
check whether the current node has a parent More... | |
OFBool | hasChildNodes () const |
check whether the current node has any children More... | |
OFBool | hasPreviousNode () const |
check whether the current node has a preceding sibling More... | |
OFBool | hasNextNode () const |
check whether the current node has a following sibling More... | |
OFBool | hasSiblingNodes () const |
check whether the current node has any siblings More... | |
virtual T * | getNode () const |
get pointer to current node More... | |
virtual const T * | getParentNode () const |
get pointer to parent node. More... | |
virtual const T * | getChildNode () const |
get pointer to first child node. More... | |
virtual const T * | getPreviousNode () const |
get pointer to previous node. More... | |
virtual const T * | getNextNode () const |
get pointer to next node. More... | |
virtual size_t | gotoFirst () |
goto first node on the same level (first sibling). More... | |
virtual size_t | gotoLast () |
goto last node on the same level (last sibling). More... | |
virtual size_t | gotoPrevious () |
goto previous node on the same level (preceding sibling) More... | |
virtual size_t | gotoNext () |
goto next node on the same level (following sibling) More... | |
virtual size_t | goUp () |
goto parent node (one level up) More... | |
virtual size_t | goDown () |
goto first child node (one level down) More... | |
virtual size_t | gotoParent () |
goto parent node (one level up) More... | |
virtual size_t | gotoChild () |
goto first child node (one level down) More... | |
virtual size_t | iterate (const OFBool searchIntoSub=OFTrue) |
iterate over all nodes (starting from current position!) More... | |
size_t | gotoNode (const size_t searchID) |
set cursor to specified node. More... | |
size_t | gotoNode (const OFString &position, const char separator='.') |
set cursor to specified node. More... | |
size_t | gotoNode (const DSRTreeNodeAnnotation &annotation) |
set cursor to specified node. More... | |
size_t | gotoNode (const T &nodeValue) |
set cursor to specified node. More... | |
size_t | getNodeID () const |
get current node ID. More... | |
size_t | getLevel () const |
get current level. More... | |
DSRPositionCounter & | getPositionCounter () |
get reference to internal position counter. More... | |
const OFString & | getPosition (OFString &position, const char separator='.') const |
get position string of the current node. More... | |
Protected Member Functions | |
void | swap (DSRTreeNodeCursor< T > &cursor) |
fast, non-throwing swap function. More... | |
void | clearNodeCursorStack () |
clear the internal node cursor stack | |
const DSRTreeNodeCursor< T > & | getCursor () const |
get cursor More... | |
void | setCursor (const DSRTreeNodeCursor< T > &cursor) |
set cursor to specified object More... | |
size_t | setCursor (T *node) |
set cursor to specified node. More... | |
T * | getChild () const |
get pointer to first child node More... | |
Protected Attributes | |
T * | NodeCursor |
pointer to current node | |
OFStack< T * > | NodeCursorStack |
stack of node pointers. Used to store the cursor position of upper levels. | |
DSRPositionCounter | Position |
counter for the current position within the current level and on upper levels | |
Class implementing a tree node cursor.
T | template type used for the tree node pointers |
DSRTreeNodeCursor< T >::DSRTreeNodeCursor | ( | const DSRTreeNodeCursor< T > & | cursor | ) |
copy constructor
cursor | object to be copied |
DSRTreeNodeCursor< T >::DSRTreeNodeCursor | ( | T * | node, |
const DSRPositionCounter * | position = NULL |
||
) |
constructor.
See comments on setCursor(T*) method.
node | pointer to tree node used to initialize the cursor |
position | optional pointer to position counter that should be used to initialize the internal counter |
|
virtual |
clear all member variables.
The cursor becomes invalid afterwards (same state as after default construction).
Reimplemented in DSRTree< T >, DSRTree< DSRDocumentTreeNode >, DSRDocumentSubTree, TID1500_MeasurementReport, DSRRootTemplate, DSRSubTemplate, DSRDocumentTree, TID1411_VolumetricROIMeasurements< T_Measurement, T_Units, T_Method, T_Derivation >, TID1419_ROIMeasurements_Measurement< T_Measurement, T_Units, T_Method, T_Derivation >, TID300_Measurement< T_Measurement, T_Units, T_Method, T_Derivation >, and TID1501_MeasurementGroup< T_Measurement, T_Units, T_Method, T_Derivation >.
|
virtual |
count number of children of the current node.
This method iterates over all children of the current node, either on all sub-levels or on the first child level only.
searchIntoSub | flag indicating whether to search into sub-trees ("deep search") or on the first child level only |
Reimplemented in DSRIncludedTemplateNodeCursor.
|
protected |
get pointer to first child node
|
virtual |
get pointer to first child node.
Can be used to have a lookup to the first child node without changing the cursor.
Reimplemented in DSRIncludedTemplateNodeCursor.
|
inlineprotected |
get cursor
|
inline |
get current level.
The level starts with 1 for the root node, then 2 for its child nodes, etc.
|
virtual |
get pointer to next node.
Can be used to have a lookup to the next node without changing the cursor.
|
virtual |
get pointer to current node
Reimplemented in DSRDocumentSubTree.
Referenced by DSRTree< DSRDocumentTreeNode >::clearAnnotations(), and DSRTree< DSRDocumentTreeNode >::DSRTree().
|
inline |
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.
|
virtual |
get pointer to parent node.
Can be used to have a lookup to the parent node without changing the cursor.
|
inline |
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.
position | variable where the position string should be stored |
separator | character used to separate the figures (default: '.') |
|
inline |
get reference to internal position counter.
Please note that this method allows for manipulating the internal position counter, so handle with care!
|
virtual |
get pointer to previous node.
Can be used to have a lookup to the previous node without changing the cursor.
|
virtual |
goto first child node (one level down)
Reimplemented in DSRIncludedTemplateNodeCursor.
|
virtual |
goto first child node (one level down)
|
virtual |
goto first node on the same level (first sibling).
Please note that the first node might be identical to the current node.
|
virtual |
goto last node on the same level (last sibling).
Please note that the last node might be identical to the current node.
|
virtual |
goto next node on the same level (following sibling)
size_t DSRTreeNodeCursor< T >::gotoNode | ( | const size_t | searchID | ) |
set cursor to specified node.
Starts search from current position.
searchID | ID of the node to set the cursor to |
Referenced by DSRTree< DSRDocumentTreeNode >::gotoNode().
size_t DSRTreeNodeCursor< T >::gotoNode | ( | const OFString & | position, |
const char | separator = '.' |
||
) |
set cursor to specified node.
Starts search from current position.
position | 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 getPosition()). |
separator | character used to separate the figures (default: '.') |
size_t DSRTreeNodeCursor< T >::gotoNode | ( | const DSRTreeNodeAnnotation & | annotation | ) |
set cursor to specified node.
Starts search from current position.
annotation | annotation of the node to set the cursor to |
size_t DSRTreeNodeCursor< T >::gotoNode | ( | const T & | nodeValue | ) |
set cursor to specified node.
Starts search from current position. This method requires that T implements the comparison operator "not equal".
nodeValue | value of the node to set the cursor to |
|
virtual |
goto parent node (one level up)
|
virtual |
goto previous node on the same level (preceding sibling)
|
virtual |
goto parent node (one level up)
Referenced by DSRTree< DSRDocumentTreeNode >::DSRTree().
|
inline |
check whether the current node has any children
|
inline |
check whether the current node has a following sibling
|
inline |
check whether the current node has a parent
|
inline |
check whether the current node has a preceding sibling
|
inline |
check whether the current node has any siblings
|
virtual |
check whether cursor currently points to a valid node
Reimplemented in DSRDocumentSubTree, TID1500_MeasurementReport, TID1600_ImageLibrary, DSRRootTemplate, DSRSubTemplate, DSRDocumentTree, TID1411_VolumetricROIMeasurements< T_Measurement, T_Units, T_Method, T_Derivation >, TID1419_ROIMeasurements_Measurement< T_Measurement, T_Units, T_Method, T_Derivation >, TID1501_MeasurementGroup< T_Measurement, T_Units, T_Method, T_Derivation >, and TID300_Measurement< T_Measurement, T_Units, T_Method, T_Derivation >.
Referenced by DSRTree< DSRDocumentTreeNode >::clearAnnotations(), and DSRTree< DSRDocumentTreeNode >::countNodes().
|
virtual |
iterate over all nodes (starting from current position!)
searchIntoSub | flag indicating whether to search into sub-trees ("deep search") or on the current level only |
Reimplemented in DSRIncludedTemplateNodeCursor.
Referenced by DSRTree< DSRDocumentTreeNode >::clearAnnotations(), and DSRTree< DSRDocumentTreeNode >::countNodes().
DSRTreeNodeCursor< T > & DSRTreeNodeCursor< T >::operator= | ( | const DSRTreeNodeCursor< T > & | cursor | ) |
assignment operator
cursor | object to be copied |
DSRTreeNodeCursor< T > & DSRTreeNodeCursor< T >::operator= | ( | T * | node | ) |
assignment operator.
See comments on setCursor(T*) method.
node | node to which the cursor should be set |
|
inlineprotected |
set cursor to specified object
cursor | object to set this cursor to |
|
protected |
set cursor to specified node.
Clears the internal position counter and sets the position of the current level to 1 (if the passed 'node' is valid) or 0 (if the 'node' is invalid).
node | node to which the cursor should be set |
|
protected |
fast, non-throwing swap function.
The time complexity of this function is constant.
cursor | cursor to swap with |
Referenced by DSRTree< DSRDocumentTreeNode >::swap().