DCMTK Version 3.7.0 OFFIS DICOM Toolkit

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DSRListOfItems< T > Class Template Reference

Template class to store and access items in a list structure. More...

## Public Member Functions
| DSRListOfItems ()
| default constructor
| DSRListOfItems (const DSRListOfItems< T > &lst)
| copy constructor More...
virtual | ~DSRListOfItems ()
| destructor
DSRListOfItems< T > & | operator= (const DSRListOfItems< T > &lst)
| assignment operator More...
OFBool | operator== (const DSRListOfItems< T > &lst) const
| comparison operator "equal" More...
OFBool | operator!= (const DSRListOfItems< T > &lst) const
| comparison operator "not equal" More...
void | clear ()
| clear all internal variables
OFBool | isEmpty () const
| check whether the list is empty More...
size_t | getNumberOfItems () const
| get number of items contained in the list More...
OFBool | isElement (const T &item) const
| check whether specified item is contained in the list More...
const T & | getItem (const size_t idx) const
| get reference to the specified item More...
OFCondition | getItem (const size_t idx, T &item) const
| get copy of the specified item More...
OFCondition | getItems (OFVector< T > &items) const
| get copy of all items (as a vector) More...
void | addItem (const T &item)
| add item to the list More...
void | addOnlyNewItem (const T &item)
| add item to the list only if it's not already contained More...
void | addItems (const OFVector< T > &items)
| add items to the list More...
OFCondition | insertItem (const size_t idx, const T &item)
| insert item at specified position to the list More...
OFCondition | removeItem (const size_t idx)
| remove item from the list More...

## Protected Member Functions
OFBool | gotoItemPos (size_t idx, OFLIST_TYPENAME OFListConstIterator(T) &iterator) const
| goto specified item position More...
OFBool | gotoItem (const T &item, OFLIST_TYPENAME OFListConstIterator(T) &iterator) const
| goto specified item More...

## Protected Attributes
OFList< T > | ItemList
| the list maintained by this class

## Detailed Description

### template<class T>
class DSRListOfItems< T >

Template class to store and access items in a list structure.

For instances of this class T needs to have at least a default constructor, assignment and comparison operator.

## Constructor & Destructor Documentation

## ◆ DSRListOfItems()

template<class T >

DSRListOfItems< T >::DSRListOfItems | ( | const DSRListOfItems< T > & | lst | ) |
| inline

copy constructor

Parameters

  lst | list to be copied

## Member Function Documentation

## ◆ addItem()

template<class T >

void DSRListOfItems< T >::addItem | ( | const T & | item | ) |
| inline

add item to the list

Parameters

  item | item to be added

References DSRListOfItems< T >::ItemList.

## ◆ addItems()

template<class T >

void DSRListOfItems< T >::addItems | ( | const OFVector< T > & | items | ) |
| inline

add items to the list

Parameters

  items | items to be added (stored as a vector)

## ◆ addOnlyNewItem()

template<class T >

void DSRListOfItems< T >::addOnlyNewItem | ( | const T & | item | ) |
| inline

add item to the list only if it's not already contained

Parameters

  item | item to be added

References DSRListOfItems< T >::isElement(), and DSRListOfItems< T >::ItemList.

## ◆ getItem() [1/2]

template<class T >

const T& DSRListOfItems< T >::getItem | ( | const size_t | idx | ) | const
| inline

get reference to the specified item

Parameters

  idx | index of the item to be returned (starting from 1)

Returns
  reference to the specified item if successful, EmptyItem otherwise

References DSRListOfItems< T >::gotoItemPos(), and DSRListOfItems< T >::ItemList.

## ◆ getItem() [2/2]

template<class T >

OFCondition DSRListOfItems< T >::getItem | ( | const size_t | idx,
|  | T & | item
| ) |  | const
| inline

get copy of the specified item

Parameters

  idx | index of the item to be returned (starting from 1)
  item | reference to a variable where the result should be stored. (not changed/cleared if an error occurs!)

Returns
  status, EC_Normal if successful, an error code otherwise

References EC_IllegalParameter, EC_Normal, DSRListOfItems< T >::gotoItemPos(), and DSRListOfItems< T >::ItemList.

## ◆ getItems()

template<class T >

OFCondition DSRListOfItems< T >::getItems | ( | OFVector< T > & | items | ) | const
| inline

get copy of all items (as a vector)

Parameters

  items | reference to a variable where the result should be stored. (always cleared before items are added)

Returns
  status, EC_Normal if successful, an error code otherwise

References OFVector< T >::clear(), EC_Normal, DSRListOfItems< T >::ItemList, OFVector< T >::push_back(), and OFVector< T >::reserve().

## ◆ getNumberOfItems()

template<class T >

size_t DSRListOfItems< T >::getNumberOfItems | ( |  | ) | const
| inline

get number of items contained in the list

Returns
  number of items if any, 0 otherwise

References DSRListOfItems< T >::ItemList.

## ◆ gotoItem()

template<class T >

OFBool DSRListOfItems< T >::gotoItem | ( | const T & | item,
|  | OFLIST_TYPENAME OFListConstIterator(T) & | iterator
| ) |  | const
| inline protected

goto specified item

Parameters

  item | value of the item to go to (starting from 1)
  iterator | list iterator storing the position of the item

Returns
  OFTrue if specified item was found, OFFalse otherwise

References DSRListOfItems< T >::ItemList.

Referenced by DSRListOfItems< T >::isElement().

## ◆ gotoItemPos()

template<class T >

OFBool DSRListOfItems< T >::gotoItemPos | ( | size_t | idx,
|  | OFLIST_TYPENAME OFListConstIterator(T) & | iterator
| ) |  | const
| inline protected

goto specified item position

Parameters

  idx | index of the item to go to (starting from 1)
  iterator | list iterator storing the position of the item

Returns
  OFTrue if specified item was found, OFFalse otherwise

Referenced by DSRListOfItems< T >::getItem(), DSRListOfItems< T >::insertItem(), and DSRListOfItems< T >::removeItem().

## ◆ insertItem()

template<class T >

OFCondition DSRListOfItems< T >::insertItem | ( | const size_t | idx,
|  | const T & | item
| ) |  |
| inline

insert item at specified position to the list

Parameters

  idx | index of the item before the new one should be inserted (starting from 1)
  item | item to be inserted

Returns
  status, EC_Normal if successful, an error code otherwise

References EC_IllegalParameter, EC_Normal, DSRListOfItems< T >::gotoItemPos(), and DSRListOfItems< T >::ItemList.

## ◆ isElement()

template<class T >

OFBool DSRListOfItems< T >::isElement | ( | const T & | item | ) | const
| inline

check whether specified item is contained in the list

Parameters

  item | item to be checked

Returns
  OFTrue if the item is in the list, OFFalse otherwise

References DSRListOfItems< T >::gotoItem(), and DSRListOfItems< T >::ItemList.

Referenced by DSRListOfItems< T >::addOnlyNewItem().

## ◆ isEmpty()

template<class T >

OFBool DSRListOfItems< T >::isEmpty | ( |  | ) | const
| inline

check whether the list is empty

Returns
  OFTrue if the list is empty, OFFalse otherwise

References DSRListOfItems< T >::ItemList.

## ◆ operator!=()

template<class T >

OFBool DSRListOfItems< T >::operator!= | ( | const DSRListOfItems< T > & | lst | ) | const
| inline

comparison operator "not equal"

Parameters

  lst | list that should be compared to the current one

Returns
  OFTrue if both lists are not equal, OFFalse otherwise

References DSRListOfItems< T >::ItemList.

## ◆ operator=()

template<class T >

DSRListOfItems<T>& DSRListOfItems< T >::operator= | ( | const DSRListOfItems< T > & | lst | ) |
| inline

assignment operator

Parameters

  lst | list to be copied

Returns
  reference to this list after 'lst' has been copied

References DSRListOfItems< T >::ItemList.

## ◆ operator==()

template<class T >

OFBool DSRListOfItems< T >::operator== | ( | const DSRListOfItems< T > & | lst | ) | const
| inline

comparison operator "equal"

Parameters

  lst | list that should be compared to the current one

Returns
  OFTrue if both lists are equal, OFFalse otherwise

References DSRListOfItems< T >::ItemList.

## ◆ removeItem()

template<class T >

OFCondition DSRListOfItems< T >::removeItem | ( | const size_t | idx | ) |
| inline

remove item from the list

Parameters

  idx | index of the item to be removed (starting from 1)

Returns
  status, EC_Normal if successful, an error code otherwise

References EC_IllegalParameter, EC_Normal, DSRListOfItems< T >::gotoItemPos(), and DSRListOfItems< T >::ItemList.

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

- dcmsr/include/dcmtk/dcmsr/dsrtlist.h

Generated on Mon Dec 15 2025 for DCMTK Version 3.7.0 by Doxygen 1.9.1