Simbody
Classes | Public Member Functions

SimTK::EnumerationSet< T > Class Template Reference

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

#include <Enumeration.h>

List of all members.

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

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

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
 

Constructor & Destructor Documentation

template<class T>
SimTK::EnumerationSet< T >::EnumerationSet ( ) [inline]

Create an empty EnumerationSet.

template<class T>
SimTK::EnumerationSet< T >::EnumerationSet ( const Enumeration< T > &  value) [inline]

Create an EnumerationSet which contains a single value.

template<class T>
SimTK::EnumerationSet< T >::EnumerationSet ( const EnumerationSet< T > &  set) [inline]

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

template<class T>
SimTK::EnumerationSet< T >::~EnumerationSet ( ) [inline]

Member Function Documentation

template<class T>
int SimTK::EnumerationSet< T >::size ( ) const [inline]

Get the number of elements in this set.

template<class T>
bool SimTK::EnumerationSet< T >::empty ( ) const [inline]

Check whether this set is empty.

template<class T>
bool SimTK::EnumerationSet< T >::contains ( const Enumeration< T > &  value) const [inline]

Determine whether this set contains a particular value.

template<class T>
bool SimTK::EnumerationSet< T >::containsAll ( const EnumerationSet< T > &  set) const [inline]

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

template<class T>
bool SimTK::EnumerationSet< T >::containsAny ( const EnumerationSet< T > &  set) const [inline]

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

template<class T>
bool SimTK::EnumerationSet< T >::operator== ( const EnumerationSet< T > &  set) const [inline]

Determine whether this set has identical contents to another one.

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

Determine whether this set has identical contents to another one.

template<class T>
void SimTK::EnumerationSet< T >::clear ( ) [inline]

Remove all elements from the set.

template<class T>
iterator SimTK::EnumerationSet< T >::begin ( ) [inline]

Get an iterator pointing to the start of the set.

template<class T>
iterator SimTK::EnumerationSet< T >::end ( ) [inline]

Get an iterator pointing to the end of the set.

template<class T>
EnumerationSet<T>& SimTK::EnumerationSet< T >::operator= ( const EnumerationSet< T > &  set) [inline]
template<class T>
EnumerationSet<T>& SimTK::EnumerationSet< T >::operator-= ( const Enumeration< T > &  value) [inline]
template<class T>
EnumerationSet<T>& SimTK::EnumerationSet< T >::operator-= ( const EnumerationSet< T > &  set) [inline]
template<class T>
EnumerationSet<T> SimTK::EnumerationSet< T >::operator- ( const Enumeration< T > &  value) const [inline]
template<class T>
EnumerationSet<T> SimTK::EnumerationSet< T >::operator- ( const EnumerationSet< T > &  set) const [inline]
template<class T>
EnumerationSet<T>& SimTK::EnumerationSet< T >::operator|= ( const EnumerationSet< T > &  set) [inline]
template<class T>
EnumerationSet<T> SimTK::EnumerationSet< T >::operator| ( const EnumerationSet< T > &  set) const [inline]
template<class T>
EnumerationSet<T>& SimTK::EnumerationSet< T >::operator&= ( const EnumerationSet< T > &  set) [inline]
template<class T>
EnumerationSet<T> SimTK::EnumerationSet< T >::operator& ( const EnumerationSet< T > &  set) const [inline]
template<class T>
EnumerationSet<T>& SimTK::EnumerationSet< T >::operator^= ( const EnumerationSet< T > &  set) [inline]
template<class T>
EnumerationSet<T> SimTK::EnumerationSet< T >::operator^ ( const EnumerationSet< T > &  set) const [inline]
template<class T>
EnumerationSet<T> SimTK::EnumerationSet< T >::operator~ ( ) const [inline]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines