DCMTK: OFOrderedSet< T > Class Template Reference

DCMTK Version 3.7.0 OFFIS DICOM Toolkit

Loading...
Searching...
No Matches
Public Member Functions | List of all members
OFOrderedSet< T > Class Template Reference

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

Inheritance diagram for OFOrderedSet< T >:

## Public Member Functions
| OFOrderedSet ()
| Default constructor.
| OFOrderedSet (const OFOrderedSet< T > &src)
| Copy constructor.
virtual | ~OFOrderedSet ()
| Destructor.
const OFOrderedSet< T > & | operator= (const OFOrderedSet< T > &src)
| operator=.
const OFOrderedSet< T > & | assign (const OFOrderedSet< T > &src)
| This function is a workaround for avoiding a compiler warning on Solaris 2.5.1 using compiler SC 2.0.1.
virtual OFBool | operator== (const OFOrderedSet< T > &other) const
| Determines if two sets are identical.
virtual OFBool | operator!= (const OFOrderedSet< T > &other) const
| Determines if two sets are not identical.
virtual void | Insert (const T &item)
| Inserts a new item into the set.
virtual void | Insert (const OFOrderedSet< T > &other)
| Inserts all items of another set into this set.
virtual void | InsertAt (const T &item, unsigned int idx)
| Inserts a new item at a certain position into the set.
virtual void | Remove (const T &item)
| Removes one item from the set.
virtual void | RemoveByIndex (unsigned int idx)
| Removes one item from the set.
virtual T * | Find (const T &item) const
| Tries to find a given object in the set.
virtual OFBool | Contains (const T &item) const
| Determines if a certain item is contained in the set.
virtual OFBool | IsSupersetOf (const OFOrderedSet< T > &other) const
| Determines if this is an actual superset of other, i.e.
virtual OFBool | IsSubsetOf (const OFOrderedSet< T > &other) const
| Determines if this is an actual subset of other, i.e.
OFOrderedSet< T > | Union (const OFOrderedSet< T > &other) const
| Determines the union of the two sets this and other, i.e.
OFOrderedSet< T > | Intersection (const OFOrderedSet< T > &other) const
| Determines the intersection of the two sets this and other, i.e.
OFOrderedSet< T > | Difference (const OFOrderedSet< T > &other) const
| Determines the difference this - other, i.e.
OFOrderedSet< T > | SymmetricDifference (const OFOrderedSet< T > &other) const
| Determines the symmetric difference of this and other, i.e.
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.
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=.
virtual T & | operator[] (unsigned int i) const
| Returns a certain element which is contained in the set.
virtual void | Resize (unsigned int newSize)
| Resizes the set.
virtual void | Clear ()
| Removes all items from the set.
virtual OFBool | IsEmpty () const
| Determines if the set is an empty set.
virtual unsigned int | NumberOfElements () const
| Returns the number of elements in the set.

## 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 OFOrderedSet< T >

This template class provides a data structure and operations for administrating an ordered 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
- when removing an element, the indices of the elements behind the removed element will be reduced by one
- the set will be ordered according to the point in time at which an element is inserted into the set; a new element will always be inserted at the end of the set

## Constructor & Destructor Documentation

## ◆ OFOrderedSet()

template<class T>

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

Copy constructor.

Parameters

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

References OFOrderedSet(), and OFSet< T >::OFSet().

## Member Function Documentation

## ◆ Contains()

template<class T>

virtual OFBool OFOrderedSet< T >::Contains | ( | const T & | item | ) | const
| inlinevirtual

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 >.

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

Referenced by Difference(), Intersection(), and IsSupersetOf().

## ◆ Difference()

template<class T>

OFOrderedSet< T > OFOrderedSet< T >::Difference | ( | const OFOrderedSet< 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 OFOrderedSet(), Contains(), Insert(), OFSet< T >::items, OFSet< T >::num, and Remove().

Referenced by SymmetricDifference().

## ◆ Find()

template<class T>

virtual T * OFOrderedSet< T >::Find | ( | const T & | item | ) | const
| inlinevirtual

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 >.

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

## ◆ Insert() [1/2]

template<class T>

virtual void OFOrderedSet< T >::Insert | ( | const OFOrderedSet< T > & | other | ) |
| inlinevirtual

Inserts all items of another set into this set.

Parameters

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

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

## ◆ Insert() [2/2]

template<class T>

virtual void OFOrderedSet< T >::Insert | ( | const T & | item | ) |
| inlinevirtual

Inserts a new item into the set.

Parameters

  item | Item which shall be inserted into the set.

Implements OFSet< T >.

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

Referenced by Difference(), Insert(), InsertAt(), Intersection(), and Union().

## ◆ InsertAt()

template<class T>

virtual void OFOrderedSet< T >::InsertAt | ( | const T & | item,
|  | unsigned int | idx )
| inlinevirtual

Inserts a new item at a certain position into the set.

Parameters

  item | Item which shall be inserted into the set.
  idx | Index of the position at which the item shall be inserted. The first position has index 0. Note that in case index is greater than the index of the last item, the new item will be inserted right behind the last item of the set.

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

## ◆ Intersection()

template<class T>

OFOrderedSet< T > OFOrderedSet< T >::Intersection | ( | const OFOrderedSet< 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 OFOrderedSet(), Contains(), Insert(), OFSet< T >::items, OFSet< T >::num, and Remove().

## ◆ IsSubsetOf()

template<class T>

virtual OFBool OFOrderedSet< T >::IsSubsetOf | ( | const OFOrderedSet< T > & | other | ) | const
| inlinevirtual

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 OFOrderedSet(), and IsSupersetOf().

## ◆ IsSupersetOf()

template<class T>

virtual OFBool OFOrderedSet< T >::IsSupersetOf | ( | const OFOrderedSet< T > & | other | ) | const
| inlinevirtual

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 OFOrderedSet(), Contains(), OFSet< T >::items, OFSet< T >::num, and Remove().

Referenced by IsSubsetOf().

## ◆ operator!=()

template<class T>

virtual OFBool OFOrderedSet< T >::operator!= | ( | const OFOrderedSet< T > & | other | ) | const
| inlinevirtual

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.

References OFOrderedSet().

## ◆ operator=()

template<class T>

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

operator=.

Parameters

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

Returns
  Reference to this.

References OFOrderedSet(), and assign().

Referenced by assign().

## ◆ operator==()

template<class T>

virtual OFBool OFOrderedSet< T >::operator== | ( | const OFOrderedSet< T > & | other | ) | const
| inlinevirtual

Determines if two sets are identical.

Note that for ordered sets not only their elements have to be identical, but also the order of their elements has to be identical.

Parameters

  other | Set which shall be compared with this.

Returns
  OFTrue if sets are identical, OFFalse otherwise.

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

## ◆ Remove()

template<class T>

virtual void OFOrderedSet< T >::Remove | ( | const T & | item | ) |
| inlinevirtual

Removes one item from the set.

Parameters

  item | Item which shall be inserted into the set.

Implements OFSet< T >.

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

Referenced by Difference(), Intersection(), and IsSupersetOf().

## ◆ RemoveByIndex()

template<class T>

virtual void OFOrderedSet< T >::RemoveByIndex | ( | unsigned int | idx | ) |
| inlinevirtual

Removes one item from the set.

Parameters

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

Implements OFSet< T >.

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

## ◆ SymmetricDifference()

template<class T>

OFOrderedSet< T > OFOrderedSet< T >::SymmetricDifference | ( | const OFOrderedSet< 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 OFOrderedSet(), Difference(), and Union().

## ◆ Union()

template<class T>

OFOrderedSet< T > OFOrderedSet< T >::Union | ( | const OFOrderedSet< 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 OFOrderedSet(), and Insert().

Referenced by SymmetricDifference().

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

- ofstd/include/dcmtk/ofstd/ofoset.h

Generated on for DCMTK Version 3.7.0 by Doxygen 1.16.1