Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Enum< E > Class Template Reference
[Data classes]

Represents an element in a specified Enumeration set. More...

#include <Enum.h>

Inheritance diagram for Enum< E >:

EnumLink BaseType List of all members.

Public Methods

 Enum (std::string const &token)
 Enum ()
 Enum (int value)
 Enum (EnumLink const &e)
EnumLink const & operator= (EnumLink const &e)
 copy

EnumLink const & operator= (int value)
 Directly assign by integer index.

EnumLink const & operator= (std::string const &token)
 Directly assign by token.

std::string __repr__ () const
 Return a string representation (for SWIG/Python).

virtual void serialize (Archive &)
 Serialize to or from a data archive.

virtual void parseXML (const char *cdata)
 For internal use by the XML parser.

virtual std::string typeString () const
 Return a type label.

virtual std::string asString () const
 Return a string representation.

void cycle (int n=1)
 Cyclically advance the index (default is by one).

void cycleBack (int n=1)
 Cyclically reduce the index (default is by one).

void set (std::string const &token)
 Set this enum by token.

void set (int value)
 Set this enum by integer index.

int getValue () const
 Get the integer index of this enum.

std::string getToken () const
EnumLink next (int n=1) const
 Return a new Enum for the next item in the Enumeration (cyclic).

EnumLink prev (int n=1) const
 Return a new Enum for to the previous item in the Enumeration (cyclic).

EnumLink last () const
 Return the last item in the Enumeration.

EnumLink first () const
 Return the first item in the Enumeration.

Enumeration const & getEnumeration () const
 Return a reference to the associated Enumeration.

 operator int () const
 Coerce this enum to its integer index.

 operator std::string () const
 Coerce this enum to its token.

bool operator> (std::string const &token) const
 Compare with the value of another Enumeration element.

bool operator> (int value) const
 Compare with the value of another Enumeration element.

bool operator> (EnumLink const &x) const
 Compare with the value of another Enumeration element.

bool operator< (std::string const &token) const
 Compare with the value of another Enumeration element.

bool operator< (int value) const
 Compare with the value of another Enumeration element.

bool operator< (EnumLink const &x) const
 Compare with the value of another Enumeration element.

bool operator>= (std::string const &token) const
 Compare with the value of another Enumeration element.

bool operator>= (int value) const
 Compare with the value of another Enumeration element.

bool operator>= (EnumLink const &x) const
 Compare with the value of another Enumeration element.

bool operator<= (std::string const &token) const
 Compare with the value of another Enumeration element.

bool operator<= (int value) const
 Compare with the value of another Enumeration element.

bool operator<= (EnumLink const &x) const
 Compare with the value of another EnumLinkeration element.

bool operator== (std::string const &token) const
 Compare with the value of another Enumeration element.

bool operator== (int value) const
 Compare with the value of another Enumeration element.

bool operator== (EnumLink const &x) const
 Compare with the value of another EnumLinkeration element.

bool operator!= (std::string const &token) const
 Compare with the value of another Enumeration element.

bool operator!= (int value) const
 Compare with the value of another Enumeration element.

bool operator!= (EnumLink const &x) const
 Compare with the value of another EnumLinkeration element.

virtual void convertXML ()
 Convert XML data to internal format prior to serialization.


Protected Methods

int __size () const
 Get the number of items in the associated Enumeration.

int getIndex () const
 Get the enumeration index of the enum.

EnumLink makeEnum (int idx) const
 Construct a new EnumLink bound to the current Enumeration.


Protected Attributes

int _idx
 the index of the enum


Detailed Description

template<Enumeration const & E>
class Enum< E >

Represents an element in a specified Enumeration set.

Use this class to create Enum instances that are bound to an Enumeration during static construction. This early binding to the variable type has the advantage that the Enumeration associated with an Enum<> member variable can be accessed without instantiating the parent class. This feature is used by the ObjectInterface to enhance the introspection capabilities of SimData. An additional advantage is that Enum<> members do not have to be explicitly bound in the class ctor (which is somewhat error prone).


Constructor & Destructor Documentation

template<Enumeration const & E>
Enum< E >::Enum std::string const &    token [inline]
 

template<Enumeration const & E>
Enum< E >::Enum   [inline]
 

template<Enumeration const & E>
Enum< E >::Enum int    value [inline]
 

template<Enumeration const & E>
Enum< E >::Enum EnumLink const &    e [inline]
 


Member Function Documentation

template<Enumeration const & E>
std::string Enum< E >::__repr__   const [inline]
 

Return a string representation (for SWIG/Python).

Reimplemented from EnumLink.

int EnumLink::__size   const [inline, protected, inherited]
 

Get the number of items in the associated Enumeration.

std::string EnumLink::asString   [virtual, inherited]
 

Return a string representation.

Implements BaseType.

void BaseType::convertXML   [virtual, inherited]
 

Convert XML data to internal format prior to serialization.

This method is currently only called by the XML parser for Object classes. If another BaseType class requires this method, a call must be added to the appropriate XML handler in the parser.

void EnumLink::cycle int    n = 1 [inline, inherited]
 

Cyclically advance the index (default is by one).

void EnumLink::cycleBack int    n = 1 [inline, inherited]
 

Cyclically reduce the index (default is by one).

EnumLink EnumLink::first   const [inline, inherited]
 

Return the first item in the Enumeration.

Enumeration const& EnumLink::getEnumeration   const [inline, inherited]
 

Return a reference to the associated Enumeration.

int EnumLink::getIndex   const [inline, protected, inherited]
 

Get the enumeration index of the enum.

std::string EnumLink::getToken   const [inline, inherited]
 

int EnumLink::getValue   const [inline, inherited]
 

Get the integer index of this enum.

EnumLink EnumLink::last   const [inline, inherited]
 

Return the last item in the Enumeration.

EnumLink EnumLink::makeEnum int    idx const [inline, protected, inherited]
 

Construct a new EnumLink bound to the current Enumeration.

EnumLink EnumLink::next int    n = 1 const [inline, inherited]
 

Return a new Enum for the next item in the Enumeration (cyclic).

EnumLink::operator int   const [inline, inherited]
 

Coerce this enum to its integer index.

EnumLink::operator std::string   const [inline, inherited]
 

Coerce this enum to its token.

bool EnumLink::operator!= EnumLink const &    x const [inline, inherited]
 

Compare with the value of another EnumLinkeration element.

bool EnumLink::operator!= int    value const [inline, inherited]
 

Compare with the value of another Enumeration element.

bool EnumLink::operator!= std::string const &    token const [inline, inherited]
 

Compare with the value of another Enumeration element.

bool EnumLink::operator< EnumLink const &    x const [inline, inherited]
 

Compare with the value of another Enumeration element.

bool EnumLink::operator< int    value const [inline, inherited]
 

Compare with the value of another Enumeration element.

bool EnumLink::operator< std::string const &    token const [inline, inherited]
 

Compare with the value of another Enumeration element.

bool EnumLink::operator<= EnumLink const &    x const [inline, inherited]
 

Compare with the value of another EnumLinkeration element.

bool EnumLink::operator<= int    value const [inline, inherited]
 

Compare with the value of another Enumeration element.

bool EnumLink::operator<= std::string const &    token const [inline, inherited]
 

Compare with the value of another Enumeration element.

template<Enumeration const & E>
EnumLink const& Enum< E >::operator= std::string const &    token [inline]
 

Directly assign by token.

Reimplemented from EnumLink.

template<Enumeration const & E>
EnumLink const& Enum< E >::operator= int    value [inline]
 

Directly assign by integer index.

Reimplemented from EnumLink.

template<Enumeration const & E>
EnumLink const& Enum< E >::operator= EnumLink const &    e [inline]
 

copy

Reimplemented from EnumLink.

bool EnumLink::operator== EnumLink const &    x const [inline, inherited]
 

Compare with the value of another EnumLinkeration element.

bool EnumLink::operator== int    value const [inline, inherited]
 

Compare with the value of another Enumeration element.

bool EnumLink::operator== std::string const &    token const [inline, inherited]
 

Compare with the value of another Enumeration element.

bool EnumLink::operator> EnumLink const &    x const [inline, inherited]
 

Compare with the value of another Enumeration element.

bool EnumLink::operator> int    value const [inline, inherited]
 

Compare with the value of another Enumeration element.

bool EnumLink::operator> std::string const &    token const [inline, inherited]
 

Compare with the value of another Enumeration element.

bool EnumLink::operator>= EnumLink const &    x const [inline, inherited]
 

Compare with the value of another Enumeration element.

bool EnumLink::operator>= int    value const [inline, inherited]
 

Compare with the value of another Enumeration element.

bool EnumLink::operator>= std::string const &    token const [inline, inherited]
 

Compare with the value of another Enumeration element.

void EnumLink::parseXML const char *    cdata [virtual, inherited]
 

For internal use by the XML parser.

Reimplemented from BaseType.

EnumLink EnumLink::prev int    n = 1 const [inline, inherited]
 

Return a new Enum for to the previous item in the Enumeration (cyclic).

NAMESPACE_SIMDATA void EnumLink::serialize Archive   [virtual, inherited]
 

Serialize to or from a data archive.

Reimplemented from BaseType.

void EnumLink::set int    value [inline, inherited]
 

Set this enum by integer index.

void EnumLink::set std::string const &    token [inline, inherited]
 

Set this enum by token.

std::string EnumLink::typeString   [virtual, inherited]
 

Return a type label.

Implements BaseType.


Member Data Documentation

int EnumLink::_idx [protected, inherited]
 

the index of the enum


The documentation for this class was generated from the following file:
SimData version pre-0.4.0. For more information on SimData, visit the SimData Homepage.

Generated on Tue Oct 14 12:06:40 2003, using Doxygen 1.2.18.

[SF.net]