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

iterator begin (  )  [inline]

Get an iterator pointing to the start of the set.

void clear (  )  [inline]

Remove all elements from the set.

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

Determine whether this set contains a particular value.

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

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

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

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

bool empty (  )  const [inline]

Check whether this set is empty.

iterator end (  )  [inline]

Get an iterator pointing to the end of the set.

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

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

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

Determine whether this set has identical contents to another one.

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

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

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

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

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

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

Determine whether this set has identical contents to another one.

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 [inline]

int size (  )  const [inline]

Get the number of elements in this set.


The documentation for this class was generated from the following file:
Generated on Thu Feb 28 01:34:35 2008 for SimTKcommon by  doxygen 1.4.7