DCMTK  Version 3.6.7
OFFIS DICOM Toolkit
Public Member Functions | Private Attributes | List of all members
DSRPositionCounter Class Reference

Class implementing a position counter to be used for iterating a tree of nodes. More...

Public Member Functions

 DSRPositionCounter (const size_t flags=0)
 (default) constructor More...
 
 DSRPositionCounter (const DSRPositionCounter &counter)
 copy constructor More...
 
virtual ~DSRPositionCounter ()
 destructor
 
DSRPositionCounteroperator= (const DSRPositionCounter &counter)
 assignment operator More...
 
 operator size_t () const
 conversion operator that returns the position on the current level (0 if the position counter is invalid)
 
DSRPositionCounteroperator++ ()
 pre-increment operator. More...
 
DSRPositionCounteroperator-- ()
 pre-decrement operator. More...
 
void clear ()
 clear all member variables. More...
 
void initialize (const OFBool valid=OFTrue, const size_t flags=0)
 initialize the position counter More...
 
OFBool isValid () const
 check whether position counter is valid (i.e. has been initialized) More...
 
OFBool goUp ()
 go one level up, i.e. restore the position on the next upper level and forget about the current level More...
 
OFBool goDown ()
 go one level down, i.e. store the position on the current level and start with 1 on the new level More...
 
size_t getFlags () const
 get specified flags that can be used to customize the counter More...
 
size_t getLevel () const
 get current level of the position counter. More...
 
const OFStringgetString (OFString &position, const char separator='.') const
 get string representing the current state of the position counter. More...
 

Private Attributes

size_t Position
 current position within the current level
 
OFList< size_t > PositionList
 list of position counters in upper levels
 
size_t Flags
 flags used to customize the counter
 

Detailed Description

Class implementing a position counter to be used for iterating a tree of nodes.

Constructor & Destructor Documentation

◆ DSRPositionCounter() [1/2]

DSRPositionCounter::DSRPositionCounter ( const size_t  flags = 0)

(default) constructor

Parameters
flagsoptional flags used to customize the processing of the counter. These flags are only stored but not evaluated by this class.

◆ DSRPositionCounter() [2/2]

DSRPositionCounter::DSRPositionCounter ( const DSRPositionCounter counter)

copy constructor

Parameters
counterobject to be copied

Member Function Documentation

◆ clear()

void DSRPositionCounter::clear ( )

clear all member variables.

The position counter becomes invalid afterwards (same state as after default construction). Also see initialize().

◆ getFlags()

size_t DSRPositionCounter::getFlags ( ) const
inline

get specified flags that can be used to customize the counter

Returns
flags used to customize the counter

Referenced by DSRTreeNodeCursor< T >::DSRTreeNodeCursor().

◆ getLevel()

size_t DSRPositionCounter::getLevel ( ) const
inline

get current level of the position counter.

The top most (root) level is 1, the next lower level is 2, etc.

Returns
number of the current level if valid, 0 otherwise

◆ getString()

const OFString& DSRPositionCounter::getString ( OFString position,
const char  separator = '.' 
) const

get string representing the current state of the position counter.

See DSRTreeNodeCursor::getPosition() for details.

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)

◆ goDown()

OFBool DSRPositionCounter::goDown ( )

go one level down, i.e. store the position on the current level and start with 1 on the new level

Returns
OFTrue if successful, OFFalse otherwise

◆ goUp()

OFBool DSRPositionCounter::goUp ( )

go one level up, i.e. restore the position on the next upper level and forget about the current level

Returns
OFTrue if successful, OFFalse otherwise

◆ initialize()

void DSRPositionCounter::initialize ( const OFBool  valid = OFTrue,
const size_t  flags = 0 
)

initialize the position counter

Parameters
validflag specifying whether the counter should be initialized as valid (default) or invalid
flagsoptional flags used to customize the processing of the counter. These flags are only stored but not evaluated by this class.

Referenced by DSRTreeNodeCursor< T >::DSRTreeNodeCursor().

◆ isValid()

OFBool DSRPositionCounter::isValid ( ) const
inline

check whether position counter is valid (i.e. has been initialized)

Returns
OFTrue if valid, OFFalse otherwise

Referenced by DSRTreeNodeCursor< T >::DSRTreeNodeCursor().

◆ operator++()

DSRPositionCounter& DSRPositionCounter::operator++ ( )
inline

pre-increment operator.

Increases the position on the current level by 1. Also makes the position counter valid if it was invalid before.

Returns
reference to modified cursor (this object)

◆ operator--()

DSRPositionCounter& DSRPositionCounter::operator-- ( )
inline

pre-decrement operator.

Decreases the position on the current level by 1. This makes the position counter invalid if the position was 1 before.

Returns
reference to modified cursor (this object)

◆ operator=()

DSRPositionCounter& DSRPositionCounter::operator= ( const DSRPositionCounter counter)

assignment operator

Parameters
counterobject to be copied
Returns
reference to modified cursor (this object)

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


Generated on Thu Apr 28 2022 for DCMTK Version 3.6.7 by Doxygen 1.9.1