DCMTK: DSRPositionCounter Class Reference

DCMTK Version 3.6.9 OFFIS DICOM Toolkit

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

## 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

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

Referenced by DSRPositionCounter(), operator++(), operator--(), and operator=().

## ◆ DSRPositionCounter() [2/2]

DSRPositionCounter::DSRPositionCounter | ( | const DSRPositionCounter & | counter | ) |

copy constructor

Parameters

  counter | object to be copied

References DSRPositionCounter().

## 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

References Flags.

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

References isValid(), and PositionList.

## ◆ 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

  position | variable where the position string should be stored
  separator | character 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

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

## ◆ isValid()

OFBool DSRPositionCounter::isValid | ( |  | ) | const
| inline

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

Returns
  OFTrue if valid, OFFalse otherwise

References Position.

Referenced by DSRTreeNodeCursor< T >::DSRTreeNodeCursor(), and getLevel().

## ◆ 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)

References DSRPositionCounter(), and Position.

## ◆ 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)

References DSRPositionCounter(), and Position.

## ◆ operator=()

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

assignment operator

Parameters

  counter | object to be copied

Returns
  reference to modified cursor (this object)

References DSRPositionCounter().

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

- dcmsr/include/dcmtk/dcmsr/dsrposcn.h

Generated on Wed Apr 30 2025 for DCMTK Version 3.6.9 by Doxygen 1.13.2