OFFIS DCMTK  Version 3.6.0
Public Member Functions | Static Public Attributes | 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...

Inheritance diagram for DSRListOfItems< T >:
[legend]
Collaboration diagram for DSRListOfItems< T >:
[legend]

Public Member Functions

 DSRListOfItems ()
 default constructor
 
 DSRListOfItems (const DSRListOfItems< T > &lst)
 copy constructor
 
virtual ~DSRListOfItems ()
 destructor
 
DSRListOfItems< T > & operator= (const DSRListOfItems< T > &lst)
 assignment operator
 
void clear ()
 clear all internal variables
 
OFBool isEmpty () const
 check whether the list is empty
 
size_t getNumberOfItems () const
 get number of items contained in the list
 
OFBool isElement (const T &item) const
 check whether specified item is contained in the list
 
const T & getItem (const size_t idx) const
 get reference to the specified item
 
OFCondition getItem (const size_t idx, T &item) const
 get copy of the specified item
 
void addItem (const T &item)
 add item to the list
 
void addOnlyNewItem (const T &item)
 add item to the list only if it's not already contained
 
OFCondition insertItem (const size_t idx, const T &item)
 insert item at specified position to the list
 
OFCondition removeItem (const size_t idx)
 remove item from the list
 

Static Public Attributes

static const T EmptyItem
 default item which is returned in getItem() if the index is invalid.
 

Protected Member Functions

OFBool gotoItemPos (size_t idx, OFLIST_TYPENAME OFListConstIterator(T)&iterator) const
 goto specified item position
 
OFBool gotoItem (const T &item, OFLIST_TYPENAME OFListConstIterator(T)&iterator) const
 goto specified item
 

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.

Definition at line 49 of file dsrtlist.h.

Constructor & Destructor Documentation

template<class T>
DSRListOfItems< T >::DSRListOfItems ( const DSRListOfItems< T > &  lst)
inline

copy constructor

Parameters
lstlist to be copied

Definition at line 64 of file dsrtlist.h.

Member Function Documentation

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

add item to the list

Parameters
itemitem to be added

Definition at line 161 of file dsrtlist.h.

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

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

Parameters
itemitem to be added

Definition at line 169 of file dsrtlist.h.

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

get reference to the specified item

Parameters
idxindex of the item to be returned (starting from 1)
Returns
reference to the specified item if successful, EmptyItem otherwise

Definition at line 130 of file dsrtlist.h.

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

get copy of the specified item

Parameters
idxindex of the item to be returned (starting from 1)
itemreference 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

Definition at line 145 of file dsrtlist.h.

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

Definition at line 111 of file dsrtlist.h.

template<class T>
OFBool DSRListOfItems< T >::gotoItem ( const T &  item,
OFLIST_TYPENAME OFListConstIterator(T)&  iterator 
) const
inlineprotected

goto specified item

Parameters
itemvalue of the item to go to (starting from 1)
iteratorlist iterator storing the positition of the item
Returns
OFTrue if specified item was found, OFFalse otherwise

Definition at line 249 of file dsrtlist.h.

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

template<class T>
OFBool DSRListOfItems< T >::gotoItemPos ( size_t  idx,
OFLIST_TYPENAME OFListConstIterator(T)&  iterator 
) const
inlineprotected

goto specified item position

Parameters
idxindex of the item to go to (starting from 1)
iteratorlist iterator storing the positition of the item
Returns
OFTrue if specified item was found, OFFalse otherwise

Definition at line 229 of file dsrtlist.h.

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

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

insert item at specified position to the list

Parameters
idxindex of the item before the new one should be inserted (starting from 1)
itemitem to be inserted
Returns
status, EC_Normal if successful, an error code otherwise

Definition at line 180 of file dsrtlist.h.

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

check whether specified item is contained in the list

Parameters
itemitem to be checked
Returns
OFTrue if the item is in the list, OFFalse otherwise

Definition at line 120 of file dsrtlist.h.

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

template<class T>
OFBool DSRListOfItems< T >::isEmpty ( ) const
inline

check whether the list is empty

Returns
OFTrue if the list is empty, OFFalse otherwise

Definition at line 103 of file dsrtlist.h.

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

assignment operator

Parameters
lstlist to be copied
Returns
reference to this list after 'lst' has been copied

Definition at line 79 of file dsrtlist.h.

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

remove item from the list

Parameters
idxindex of the item to be removed (starting from 1)
Returns
status, EC_Normal if successful, an error code otherwise

Definition at line 204 of file dsrtlist.h.

Member Data Documentation

template<class T>
const T DSRListOfItems< T >::EmptyItem
static

default item which is returned in getItem() if the index is invalid.

This static member variable needs to be defined (not only declared) in each derived class.

Definition at line 219 of file dsrtlist.h.

Referenced by DSRListOfItems< DSRWaveformChannelItem >::getItem().


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


Generated on Thu Dec 20 2012 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.2