EnumerationSet Class Template Reference

#include <Enumeration.h>

List of all members.


Detailed Description

template<class T>
class SimTK::EnumerationSet< T >

This class provides an efficient implementation of a set for storing values of an enumerated type defined with Enumeration.

The set is represented internally with bit flags, so storage, assignment, and lookup are all extremely efficient.

This class supports all the standard bitwise operators, like &, |, ^, and ~. This allows you to manipulate sets exactly as if they were ints. It also supports the - operator, which represents the difference between two sets.

For example, if a method expects an EnumerationSet<Color> as an argument, you could pass any of the following values:

 Color::Red                   // a set containing Red
 Color::Green | Color::Blue   // a set containing Green and Blue
 EnumerationSet<Color>()      // an empty set
 ~EnumerationSet<Color>()     // the set of all possible values
 

Public Member Functions

 EnumerationSet ()
 Create an empty EnumerationSet.
 EnumerationSet (const Enumeration< T > &value)
 Create an EnumerationSet which contains a single value.
 EnumerationSet (const EnumerationSet< T > &set)
 Create an EnumerationSet which contains the same values as another set.
 ~EnumerationSet ()
int size () const
 Get the number of elements in this set.
bool empty () const
 Check whether this set is empty.
bool contains (const Enumeration< T > &value) const
 Determine whether this set contains a particular value.
bool containsAll (const EnumerationSet< T > &set) const
 Determine whether this set contains all of the values in another set.
bool containsAny (const EnumerationSet< T > &set) const
 Determine wheter this set contains any value which is in another set.
bool operator== (const EnumerationSet< T > &set) const
 Determine whether this set has identical contents to another one.
bool operator!= (const EnumerationSet< T > &set) const
 Determine whether this set has identical contents to another one.
void clear ()
 Remove all elements from the set.
iterator begin ()
 Get an iterator pointing to the start of the set.
iterator end ()
 Get an iterator pointing to the end of the set.
EnumerationSet< T > & operator= (const EnumerationSet< T > &set)
EnumerationSet< T > & operator-= (const Enumeration< T > &value)
EnumerationSet< T > & operator-= (const EnumerationSet< T > &set)
EnumerationSet< T > operator- (const Enumeration< T > &value) const
EnumerationSet< T > operator- (const EnumerationSet< T > &set) const
EnumerationSet< T > & operator|= (const EnumerationSet< T > &set)
EnumerationSet< T > operator| (const EnumerationSet< T > &set) const
EnumerationSet< T > & operator &= (const EnumerationSet< T > &set)
EnumerationSet< T > operator & (const EnumerationSet< T > &set) const
EnumerationSet< T > & operator^= (const EnumerationSet< T > &set)
EnumerationSet< T > operator^ (const EnumerationSet< T > &set) const
EnumerationSet< T > operator~ () const

Classes

class  EnumerationSetRep
 This class is the internal implementation of EnumerationSet. More...
class  iterator
 This class provides an interface for iterating over the content of an EnumerationSet. More...

Constructor & Destructor Documentation

EnumerationSet (  )  [inline]

Create an empty EnumerationSet.

EnumerationSet ( const Enumeration< T > &  value  )  [inline]

Create an EnumerationSet which contains a single value.

EnumerationSet ( const EnumerationSet< T > &  set  )  [inline]

Create an EnumerationSet which contains the same values as another set.

~EnumerationSet (  )  [inline]


Member Function Documentation

int size (  )  const [inline]

Get the number of elements in this set.

References EnumerationSet::EnumerationSetRep::size().

bool empty (  )  const [inline]

Check whether this set is empty.

References EnumerationSet::EnumerationSetRep::size().

bool contains ( const Enumeration< T > &  value  )  const [inline]

Determine whether this set contains a particular value.

References EnumerationSet::EnumerationSetRep::contains().

bool containsAll ( const EnumerationSet< T > &  set  )  const [inline]

Determine whether this set contains all of the values in another set.

References EnumerationSet::EnumerationSetRep::containsAll().

bool containsAny ( const EnumerationSet< T > &  set  )  const [inline]

Determine wheter this set contains any value which is in another set.

References EnumerationSet::EnumerationSetRep::containsAny().

bool operator== ( const EnumerationSet< T > &  set  )  const [inline]

Determine whether this set has identical contents to another one.

bool operator!= ( const EnumerationSet< T > &  set  )  const [inline]

Determine whether this set has identical contents to another one.

void clear (  )  [inline]

Remove all elements from the set.

References EnumerationSet::EnumerationSetRep::clear().

iterator begin (  )  [inline]

Get an iterator pointing to the start of the set.

iterator end (  )  [inline]

Get an iterator pointing to the end of the set.

EnumerationSet<T>& operator= ( const EnumerationSet< T > &  set  )  [inline]

EnumerationSet<T>& operator-= ( const Enumeration< T > &  value  )  [inline]

EnumerationSet<T>& operator-= ( const EnumerationSet< T > &  set  )  [inline]

EnumerationSet<T> operator- ( const Enumeration< T > &  value  )  const [inline]

EnumerationSet<T> operator- ( const EnumerationSet< T > &  set  )  const [inline]

EnumerationSet<T>& operator|= ( const EnumerationSet< T > &  set  )  [inline]

EnumerationSet<T> operator| ( const EnumerationSet< T > &  set  )  const [inline]

EnumerationSet<T>& operator &= ( const EnumerationSet< T > &  set  )  [inline]

EnumerationSet<T> operator & ( const EnumerationSet< T > &  set  )  const [inline]

EnumerationSet<T>& operator^= ( const EnumerationSet< T > &  set  )  [inline]

EnumerationSet<T> operator^ ( const EnumerationSet< T > &  set  )  const [inline]

EnumerationSet<T> operator~ (  )  const [inline]


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

Generated on Fri Sep 26 07:44:29 2008 for SimTKcore by  doxygen 1.5.6