30 #ifndef OFOrderedSet_h
31 #define OFOrderedSet_h
33 #include "dcmtk/config/osconfig.h"
34 #include "dcmtk/ofstd/oftypes.h"
35 #include "dcmtk/ofstd/ofset.h"
112 if( this->
num != other.
num )
116 OFBool result = OFTrue;
119 for(
unsigned int i=0 ; i < this->
num && result == OFTrue ; i++ )
138 return( !( *
this == other ) );
152 T *newItem =
new T( item );
168 for(
unsigned int i=0 ; i<other.
num ; i++ )
180 virtual void InsertAt(
const T &item,
unsigned int idx )
186 if( idx > this->
num - 1 )
195 T *newItem =
new T( item );
198 T **tmp =
new T*[this->
size];
200 for( i=0 ; i<idx ; i++ )
201 tmp[i] = this->
items[i];
205 for( i=idx ; i < this->
size - 1 ; i++ )
208 tmp[i+1] = this->
items[i];
231 OFBool itemDeleted = OFFalse;
234 for(
unsigned int i=0 ; i < this->
num && !itemDeleted ; i++ )
237 if( *this->
items[i] == item )
240 delete this->
items[i];
245 if( i != this->
num - 1 )
248 for( j=i+1 ; j < this->
num ; j++ )
253 this->
items[j-1] = NULL;
256 this->
items[i] = NULL;
262 itemDeleted = OFTrue;
274 if( idx < this->
num )
277 delete this->
items[idx];
282 if( idx != this->num - 1 )
285 for( j=idx+1 ; j < this->
num ; j++ )
290 this->
items[j-1] = NULL;
293 this->
items[idx] = NULL;
307 virtual T *
Find(
const T &item )
const
310 OFBool itemFound = OFFalse;
312 for( i=0 ; i < this->
num && !itemFound ; i++ )
314 if( *this->
items[i] == item )
319 return( this->
items[i-1] );
331 OFBool itemFound = OFFalse;
333 for(
unsigned int i=0 ; i < this->
num && !itemFound ; i++ )
335 if( *this->
items[i] == item )
352 if( this->
num <= other.
num )
356 OFBool result = OFTrue;
362 for(
unsigned int i=0 ; i<other.
num && result == OFTrue ; i++ )
405 resultSet.
Insert( other );
427 for(
unsigned int i=0 ; i < this->
num ; i++ )
461 for(
unsigned int i=0 ; i < this->
num ; i++ )
464 if( !s.
Contains( *this->items[i] ) )