DCMTK Version 3.7.0 OFFIS DICOM Toolkit

Public Member Functions | Protected Attributes | List of all members
OFSet< T > Class Template Referenceabstract

This abstract template class provides a data structure and operations for administrating a set of elements of an arbitrary type. More...

Inheritance diagram for OFSet< T >:

## Public Member Functions
| OFSet ()
| Default constructor.
void | init ()
| This function is a workaround for avoiding a compiler warning on Solaris 2.5.1 using compiler SC 2.0.1.
| OFSet (const OFSet< T > &src)
| Copy constructor. More...
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.0.1.
virtual | ~OFSet ()
| Destructor.
const OFSet< T > & | operator= (const OFSet< T > &src)
| operator=. More...
virtual T & | operator[] (unsigned int i) const
| Returns a certain element which is contained in the set. More...
virtual void | Resize (unsigned int newSize)
| Resizes the set. More...
virtual void | Clear ()
| Removes all items from the set.
virtual OFBool | IsEmpty () const
| Determines if the set is an empty set. More...
virtual unsigned int | NumberOfElements () const
| Returns the number of elements in the set. More...
virtual void | Insert (const T &item)=0
| Inserts a new item into the set. More...
virtual void | Remove (const T &item)=0
| Removes one item from the set. More...
virtual void | RemoveByIndex (unsigned int idx)=0
| Removes one item from the set. More...
virtual T * | Find (const T &item) const =0
| Tries to find a given object in the set. More...
virtual OFBool | Contains (const T &item) const =0
| Determines if a certain item is contained in the set. More...

## Protected Attributes
T ** | items
| array containing the entries
unsigned int | num
| number of entries in the set
unsigned int | size
| current size of the set (always >= num)

## Detailed Description

### template<class T>
class OFSet< T >

This abstract template class provides a data structure and operations for administrating a set of elements of an arbitrary type.

## Constructor & Destructor Documentation

## ◆ OFSet()

template<class T >

OFSet< T >::OFSet | ( | const OFSet< T > & | src | ) |
| inline

Copy constructor.

Parameters

  src | Source object of which this will be a copy.

References OFSet< T >::init().

## Member Function Documentation

## ◆ Contains()

template<class T >

virtual OFBool OFSet< T >::Contains | ( | const T & | item | ) | const
| pure virtual

Determines if a certain item is contained in the set.

Parameters

  item | - Item which shall be looked for.

Returns
  OFTrue, if item is contained in the set, OFFalse otherwise.

Implemented in OFUnorderedSet< T >, and OFOrderedSet< T >.

## ◆ Find()

template<class T >

virtual T* OFSet< T >::Find | ( | const T & | item | ) | const
| pure virtual

Tries to find a given object in the set.

In case the specified object could be found, a pointer to the corresponding element within the set is returned; in case the specified object could not be found, NULL will be returned.

Parameters

  item | Search pattern.

Returns
  Pointer to the corresponding element within the set or NULL.

Implemented in OFUnorderedSet< T >, and OFOrderedSet< T >.

## ◆ Insert()

template<class T >

virtual void OFSet< T >::Insert | ( | const T & | item | ) |
| pure virtual

Inserts a new item into the set.

Parameters

  item | Item which shall be inserted into the set.

Implemented in OFUnorderedSet< T >, and OFOrderedSet< T >.

## ◆ IsEmpty()

template<class T >

virtual OFBool OFSet< T >::IsEmpty | ( |  | ) | const
| inline virtual

Determines if the set is an empty set.

Returns
  OFTrue, if the set is an empty set, OFFalse otherwise.

References OFSet< T >::num.

## ◆ NumberOfElements()

template<class T >

virtual unsigned int OFSet< T >::NumberOfElements | ( |  | ) | const
| inline virtual

Returns the number of elements in the set.

Returns
  Number of elements in the set.

References OFSet< T >::num.

## ◆ operator=()

template<class T >

const OFSet<T>& OFSet< T >::operator= | ( | const OFSet< T > & | src | ) |
| inline

operator=.

Parameters

  src | Source object whose values will be assigned to this.

Returns
  Reference to this.

References OFSet< T >::items, OFSet< T >::num, and OFSet< T >::size.

Referenced by OFUnorderedSet< T >::operator=().

## ◆ operator[]()

template<class T >

virtual T& OFSet< T >::operator[] | ( | unsigned int | i | ) | const
| inline virtual

Returns a certain element which is contained in the set.

Note that the original object which actually is contained in the set will be returned, and not a copy of the object. Further note that if the specified index is out of range, a newly default constructed object of class T will be returned.

Returns
  A certain element (original) which is contained in the set.

References OFSet< T >::items, and OFSet< T >::num.

## ◆ Remove()

template<class T >

virtual void OFSet< T >::Remove | ( | const T & | item | ) |
| pure virtual

Removes one item from the set.

Parameters

  item | Item which shall be removed from the set.

Implemented in OFUnorderedSet< T >, and OFOrderedSet< T >.

## ◆ RemoveByIndex()

template<class T >

virtual void OFSet< T >::RemoveByIndex | ( | unsigned int | idx | ) |
| pure virtual

Removes one item from the set.

Parameters

  idx | Index of the item which shall be removed from the set.

Implemented in OFUnorderedSet< T >, and OFOrderedSet< T >.

## ◆ Resize()

template<class T >

virtual void OFSet< T >::Resize | ( | unsigned int | newSize | ) |
| inline virtual

Resizes the set.

If newSize is lower than the current number of elements in the set, this function doesn't do anything.

Parameters

  newSize | New size the set is supposed to have.

References OFSet< T >::items, OFSet< T >::num, and OFSet< T >::size.

Referenced by OFOrderedSet< T >::Insert(), OFUnorderedSet< T >::Insert(), and OFOrderedSet< T >::InsertAt().

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

- ofstd/include/dcmtk/ofstd/ofset.h

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