33 #include "dcmtk/config/osconfig.h"
34 #include "dcmtk/ofstd/oftypes.h"
36 #define INCLUDE_CSTDDEF
37 #include "dcmtk/ofstd/ofstdinc.h"
39 #define STARTING_SIZE 8
58 :
items( new T*[ STARTING_SIZE ] ),
num( 0 ),
size( STARTING_SIZE )
69 for(
unsigned i=0 ; i<
size ; i++ )
90 for(
unsigned int i=0 ; i<
size ; i++ )
104 for(
unsigned int i=0 ; i<
num ; i++ )
121 for( i=0 ; i<
num ; i++ )
128 for( i=0 ; i<
size ; i++ )
165 virtual void Resize(
unsigned int newSize )
171 T **tmp =
new T*[newSize];
173 for( i=0 ; i<newSize ; i++ )
193 for(
unsigned int i=0 ; i<
num ; i++ )
227 virtual void Insert(
const T &item ) = 0;
233 virtual void Remove(
const T &item ) = 0;
248 virtual T *
Find(
const T &item )
const = 0;
255 virtual OFBool
Contains(
const T &item )
const = 0;
const OFSet< T > & operator=(const OFSet< T > &src)
operator=.
unsigned int num
number of entries in the set
void init()
This function is a workaround for avoiding a compiler warning on Solaris 2.5.1 using compiler SC 2...
void init(const OFSet< T > &src)
This function is a workaround for avoiding a compiler warning on Solaris 2.5.1 using compiler SC 2...
OFSet()
Default constructor.
virtual void RemoveByIndex(unsigned int idx)=0
Removes one item from the set.
virtual OFBool IsEmpty() const
Determines if the set is an empty set.
virtual OFBool Contains(const T &item) const =0
Determines if a certain item is contained in the set.
OFSet(const OFSet< T > &src)
Copy constructor.
virtual void Insert(const T &item)=0
Inserts a new item into the set.
virtual T * Find(const T &item) const =0
Tries to find a given object in the set.
virtual void Resize(unsigned int newSize)
Resizes the set.
virtual unsigned int NumberOfElements() const
Returns the number of elements in the set.
virtual T & operator[](unsigned int i) const
Returns a certain element which is contained in the set.
T ** items
array containing the entries
virtual void Clear()
Removes all items from the set.
unsigned int size
current size of the set (always >= num)
This abstract template class provides a data structure and operations for administrating a set of ele...
virtual ~OFSet()
Destructor.
virtual void Remove(const T &item)=0
Removes one item from the set.