dtUtil::Enumeration Class Reference

This class represents a type-safe enumeration pattern. More...

#include <enumeration.h>

Inheritance diagram for dtUtil::Enumeration:

dtABC::StateManager::EventType dtActors::BaseLightActorProxy::LightModeEnum dtActors::BasicEnvironmentActor::CloudCoverEnum dtActors::BasicEnvironmentActor::SeasonEnum dtActors::BasicEnvironmentActor::TimePeriodEnum dtActors::BasicEnvironmentActor::VisibilityTypeEnum dtActors::BasicEnvironmentActor::WeatherThemeEnum dtActors::BasicEnvironmentActor::WindTypeEnum dtActors::MotionActionActorProxy::ParentRelationEnum dtActors::TaskActorOrdered::FailureType dtActors::TripodActorProxy::TetherModeEnum dtAI::NPCEvent dtAI::NPCStateTypes dtCore::ExceptionEnum dtCore::ShaderException dtCore::ShaderParameter::ParamType dtCore::ShaderParameterException dtCore::ShaderParamOscillator::OscillationTrigger dtCore::ShaderParamOscillator::OscillationType dtCore::ShaderParamTexture::AddressMode dtCore::ShaderParamTexture::TextureAxis dtCore::ShaderParamTexture::TextureSourceType dtCore::Transformable::CollisionGeomType dtDAL::ActorProxy::RenderMode dtDAL::ActorProxyIcon::IconType dtDAL::DataType dtDAL::ExceptionEnum dtGame::DeadReckoningAlgorithm dtGame::DeadReckoningHelper::UpdateMode dtGame::ExceptionEnum dtGame::GameActorProxy::Ownership dtGame::GameManager::ComponentPriority dtGame::GroundClamper::GroundClampingType dtGame::LogStateEnumeration dtGame::LogStreamException dtGame::MapChangeStateData::MapChangeState dtGame::MessageFactory::MessageFactoryException dtGame::MessageType dtGUI::ExceptionEnum dtHLAGM::AttributeType dtHLAGM::DDMCalculatorGeographic::DDMForce dtHLAGM::DDMCalculatorGeographic::DDMObjectKind dtHLAGM::DDMCalculatorGeographic::RegionCalculationType dtHLAGM::ExceptionEnum dtHLAGM::ObjectToActor::LocalOrRemoteType dtLMS::LmsConnectionState dtLMS::LmsExceptionEnum dtLMS::LmsMessageType dtLMS::LmsMessageValue::LaunchPageValue dtLMS::LmsMessageValue::ObjectiveCompletionValue dtLMS::LmsMessageValue::SimulationValue dtNetGM::NetworkComponent::DestinationType dtTerrain::DTEDTerrainReader::DTEDLevelEnum dtTerrain::GeoCoordinatesException dtTerrain::HeightFieldException dtTerrain::HeightFieldResizePolicy dtTerrain::ImageUtilException dtTerrain::LCCAnalyzerException dtTerrain::LCCAnalyzerResourceName dtTerrain::PagedTerrainTileLoadState dtTerrain::PagedTerrainTileResourceName dtTerrain::SoarXCacheResourceName dtTerrain::TerrainDataReaderException dtTerrain::TerrainDataType dtTerrain::TerrainException dtTerrain::VegetationException dtUtil::BaseExceptionType dtUtil::CoordinateConversionExceptionEnum dtUtil::DataStream::SeekTypeEnum dtUtil::DataStreamException dtUtil::FileExceptionEnum dtUtil::IncomingCoordinateType dtUtil::LibrarySharingManager::ExceptionEnum dtUtil::LocalCoordinateType

List of all members.

Public Member Functions

const std::string & GetName () const
 
Returns:
the string representation of this enumeration.

bool operator== (const Enumeration &rhs) const
 Equality test for an enumeration.
bool operator!= (const Enumeration &rhs) const
 Inequality test for an enumeration.
bool operator== (const std::string &rhs) const
 Overloaded string compare operator for the enumeration.
bool operator!= (const std::string &rhs) const
 Overloaded inequality test for this enumeration's string value.
bool operator< (const std::string &rhs) const
 Overloaded less than test for this enumeration's string value.
bool operator> (const std::string &rhs) const
 Overloaded greater than test for this enumeration's string value.
bool operator< (const Enumeration &rhs) const
 Overloaded less than operator.

Protected Member Functions

virtual ~Enumeration ()
 Private virtual desctructor to get rid of compile warning.
 Enumeration (const std::string &name)
 Construct the enumeration.

Friends

std::ostream & operator<< (std::ostream &os, const Enumeration &e)
 Helper method to print enumerations to an output stream.


Detailed Description

This class represents a type-safe enumeration pattern.

It allows one to also enumerate an enumeration thus looking up values in a list fashion.


Constructor & Destructor Documentation

virtual dtUtil::Enumeration::~Enumeration (  )  [inline, protected, virtual]

Private virtual desctructor to get rid of compile warning.

dtUtil::Enumeration::Enumeration ( const std::string &  name  )  [inline, protected]

Construct the enumeration.

Note:
When creating a new enumeration, the constructor of derived types must call addInstance(this) in order for enumerations to be enumerated.


Member Function Documentation

const std::string& dtUtil::Enumeration::GetName (  )  const [inline]

Returns:
the string representation of this enumeration.

bool dtUtil::Enumeration::operator== ( const Enumeration rhs  )  const [inline]

Equality test for an enumeration.

Since enumeration objects are static, and only references to enumerations may be stored by the user, it is safe and efficient to compare enumeration objects based on their memory address.

bool dtUtil::Enumeration::operator!= ( const Enumeration rhs  )  const [inline]

Inequality test for an enumeration.

See also:
operator==

bool dtUtil::Enumeration::operator== ( const std::string &  rhs  )  const [inline]

Overloaded string compare operator for the enumeration.

This will compare the string to this enumerations getName() value.

Parameters:
rhs 
Returns:
True if they are equal.
Note:
Uses the STL string compare method implying that the rules for string equality are the same as they are for the STL string compare method.

bool dtUtil::Enumeration::operator!= ( const std::string &  rhs  )  const [inline]

Overloaded inequality test for this enumeration's string value.

bool dtUtil::Enumeration::operator< ( const std::string &  rhs  )  const [inline]

Overloaded less than test for this enumeration's string value.

bool dtUtil::Enumeration::operator> ( const std::string &  rhs  )  const [inline]

Overloaded greater than test for this enumeration's string value.

bool dtUtil::Enumeration::operator< ( const Enumeration rhs  )  const [inline]

Overloaded less than operator.

This checks the memory addresses of the two enumerations.

Parameters:
rhs The second enumeration to compare to this one.
Returns:
True if this enumeration is less than rhs.
Note:
This method is supported by enumerations so they may be used as keys in STL containers. Since memory addresses are guarenteed to be unique this methods works fine. However, it really does not make sense to use this method of comparison in other circumstances.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const Enumeration e 
) [friend]

Helper method to print enumerations to an output stream.


http://www.delta3d.org
2.0.0 generated 14 Feb 2008