DCMTK Version 3.7.0 OFFIS DICOM Toolkit

Public Member Functions | List of all members
OFUnorderedSet< T > Class Template Reference

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

Inheritance diagram for OFUnorderedSet< T >:

## Public Member Functions
| OFUnorderedSet ()
| Default constructor.
| OFUnorderedSet (const OFUnorderedSet< T > &src)
| Copy constructor. More...
virtual | ~OFUnorderedSet ()
| Destructor.
const OFUnorderedSet< T > & | operator= (const OFUnorderedSet< T > &src)
| operator=. More...
virtual OFBool | operator== (const OFUnorderedSet< T > &other) const
| Determines if two sets are identical. More...
virtual OFBool | operator!= (const OFUnorderedSet< T > &other) const
| Determines if two sets are not identical. More...
virtual void | Insert (const T &item)
| Inserts a new item into the set. More...
virtual void | Insert (const OFUnorderedSet< T > &other)
| Inserts all items of another set into this set. More...
virtual void | Remove (const T &item)
| Removes one item from the set. More...
virtual void | RemoveByIndex (unsigned int index)
| Removes one item from the set. More...
virtual T * | Find (const T &item) const
| Tries to find a given object in the set. More...
virtual OFBool | Contains (const T &item) const
| Determines if a certain item is contained in the set. More...
virtual OFBool | IsSupersetOf (const OFUnorderedSet< T > &other) const
| Determines if this is an actual superset of other, i.e. More...
virtual OFBool | IsSubsetOf (const OFUnorderedSet< T > &other) const
| Determines if this is an actual subset of other, i.e. More...
OFUnorderedSet< T > | Union (const OFUnorderedSet< T > &other) const
| Determines the union of the two sets this and other, i.e. More...
OFUnorderedSet< T > | Intersection (const OFUnorderedSet< T > &other) const
| Determines the intersection of the two sets this and other, i.e. More...
OFUnorderedSet< T > | Difference (const OFUnorderedSet< T > &other) const
| Determines the difference this - other, i.e. More...
OFUnorderedSet< T > | SymmetricDifference (const OFUnorderedSet< T > &other) const
| Determines the symmetric difference of this and other, i.e. More...
Public Member Functions inherited from OFSet< T >
| 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...

## Additional Inherited Members
Protected Attributes inherited from OFSet< T >
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 OFUnorderedSet< T >

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

Note the following properties of this class:

- an element which is inserted into the set will be copied
- the datatype of the set's elements has to support operator== so that it is possible to find a certain element
- it is allowed to insert identical elements into the set
- if a user requires to remove a certain element and if there are several elements which are identical to this element, only one element will be removed from the set
- after removing an element of a set, the indices of the set's elements might have changed; hence, looping over all elements of a set must be restarted if an element was removed from the set within the loop
- the order of the elements is arbitrary, but it will not be changed unless an element is removed from the set

## Constructor & Destructor Documentation

## ◆ OFUnorderedSet()

template<class T >

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

Copy constructor.

Parameters

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

## Member Function Documentation

## ◆ Contains()

template<class T >

virtual OFBool OFUnorderedSet< T >::Contains | ( | const T & | item | ) | const
| inline 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.

Implements OFSet< T >.

Referenced by OFUnorderedSet< T >::Difference(), and OFUnorderedSet< T >::Intersection().

## ◆ Difference()

template<class T >

OFUnorderedSet<T> OFUnorderedSet< T >::Difference | ( | const OFUnorderedSet< T > & | other | ) | const
| inline

Determines the difference this - other, i.e.

the set containing all the items found in this but not in other, and returns the resulting new set.

Parameters

  other | Second parameter for difference.

Returns
  New set.

References OFUnorderedSet< T >::Contains(), OFUnorderedSet< T >::Insert(), and OFUnorderedSet< T >::Remove().

Referenced by OFUnorderedSet< T >::SymmetricDifference().

## ◆ Find()

template<class T >

virtual T* OFUnorderedSet< T >::Find | ( | const T & | item | ) | const
| inline 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.

Implements OFSet< T >.

## ◆ Insert() [1/2]

template<class T >

virtual void OFUnorderedSet< T >::Insert | ( | const OFUnorderedSet< T > & | other | ) |
| inline virtual

Inserts all items of another set into this set.

Parameters

  other | set whose items shall be inserted into the set.

References OFUnorderedSet< T >::Insert(), OFSet< T >::items, and OFSet< T >::num.

## ◆ Insert() [2/2]

template<class T >

virtual void OFUnorderedSet< T >::Insert | ( | const T & | item | ) |
| inline virtual

Inserts a new item into the set.

Parameters

  item | Item which shall be inserted into the set.

Implements OFSet< T >.

References OFSet< T >::Resize().

Referenced by OFUnorderedSet< T >::Difference(), OFUnorderedSet< T >::Insert(), OFUnorderedSet< T >::Intersection(), and OFUnorderedSet< T >::Union().

## ◆ Intersection()

template<class T >

OFUnorderedSet<T> OFUnorderedSet< T >::Intersection | ( | const OFUnorderedSet< T > & | other | ) | const
| inline

Determines the intersection of the two sets this and other, i.e.

the set containing all items which can be found in both this and other, and returns the resulting new set.

Parameters

  other | Second parameter for intersection.

Returns
  New set.

References OFUnorderedSet< T >::Contains(), OFUnorderedSet< T >::Insert(), and OFUnorderedSet< T >::Remove().

## ◆ IsSubsetOf()

template<class T >

virtual OFBool OFUnorderedSet< T >::IsSubsetOf | ( | const OFUnorderedSet< T > & | other | ) | const
| inline virtual

Determines if this is an actual subset of other, i.e.

if this is completely contained in other and other furthermore has additional elements.

Parameters

  other | - Set which shall be compared with this.

Returns
  OFTrue if this is a subset of other, OFFalse otherwise.

References OFUnorderedSet< T >::IsSupersetOf().

## ◆ IsSupersetOf()

template<class T >

virtual OFBool OFUnorderedSet< T >::IsSupersetOf | ( | const OFUnorderedSet< T > & | other | ) | const
| inline virtual

Determines if this is an actual superset of other, i.e.

if this completely contains other and furthermore has additional elements.

Parameters

  other | - Set which shall be compared with this.

Returns
  OFTrue if this is a superset of other, OFFalse otherwise.

References OFSet< T >::num.

Referenced by OFUnorderedSet< T >::IsSubsetOf().

## ◆ operator!=()

template<class T >

virtual OFBool OFUnorderedSet< T >::operator!= | ( | const OFUnorderedSet< T > & | other | ) | const
| inline virtual

Determines if two sets are not identical.

Parameters

  other | Set which shall be compared with this.

Returns
  OFTrue if sets are not identical, OFFalse otherwise.

## ◆ operator=()

template<class T >

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

operator=.

Parameters

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

Returns
  Reference to this.

References OFSet< T >::operator=().

## ◆ operator==()

template<class T >

virtual OFBool OFUnorderedSet< T >::operator== | ( | const OFUnorderedSet< T > & | other | ) | const
| inline virtual

Determines if two sets are identical.

Parameters

  other | Set which shall be compared with this.

Returns
  OFTrue if sets are identical, OFFalse otherwise.

References OFSet< T >::num.

## ◆ Remove()

template<class T >

virtual void OFUnorderedSet< T >::Remove | ( | const T & | item | ) |
| inline virtual

Removes one item from the set.

Parameters

  item | Item which shall be removed from the set.

Implements OFSet< T >.

Referenced by OFUnorderedSet< T >::Difference(), and OFUnorderedSet< T >::Intersection().

## ◆ RemoveByIndex()

template<class T >

virtual void OFUnorderedSet< T >::RemoveByIndex | ( | unsigned int | index | ) |
| inline virtual

Removes one item from the set.

Parameters

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

Implements OFSet< T >.

## ◆ SymmetricDifference()

template<class T >

OFUnorderedSet<T> OFUnorderedSet< T >::SymmetricDifference | ( | const OFUnorderedSet< T > & | other | ) | const
| inline

Determines the symmetric difference of this and other, i.e.

the set containing all the items which can be found either in this or in other but not in the intersection of this and other, and returns the resulting new set.

Parameters

  other | Second parameter for symmetric difference.

Returns
  New set.

References OFUnorderedSet< T >::Difference(), and OFUnorderedSet< T >::Union().

## ◆ Union()

template<class T >

OFUnorderedSet<T> OFUnorderedSet< T >::Union | ( | const OFUnorderedSet< T > & | other | ) | const
| inline

Determines the union of the two sets this and other, i.e.

the set containing all items which can be found either in this or in other, and returns the resulting new set.

Parameters

  other | Second parameter for union.

Returns
  New set.

References OFUnorderedSet< T >::Insert().

Referenced by OFUnorderedSet< T >::SymmetricDifference().

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

- ofstd/include/dcmtk/ofstd/ofuoset.h

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