TrueReality  v0.1.1912
trUtil::EnumerationNumeric Class Reference

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

#include <EnumerationNumeric.h>

Inheritance diagram for trUtil::EnumerationNumeric:
Collaboration diagram for trUtil::EnumerationNumeric:

Public Types

using BaseClass = EnumerationString
 / Adds an easy and swappable access to the base class. More...
 

Public Member Functions

unsigned int GetID () const
 Returns the Numeric value of the Enum. More...
 
bool operator== (const unsigned int &id) const
 Equality test for an EnumerationNumeric. More...
 
bool operator!= (const unsigned int &id) const
 Inequality test for an EnumerationNumeric. More...
 
bool operator> (const unsigned int &id) const
 Greater than test for an EnumerationNumeric. More...
 
bool operator< (const unsigned int &id) const
 Less than test for an EnumerationNumeric. More...
 
bool operator> (const EnumerationNumeric &e) const
 Greater than test for an EnumerationNumeric. More...
 
bool operator< (const EnumerationNumeric &e) const
 Less than test for an EnumerationNumeric. More...
 
bool operator== (const EnumerationNumeric &e) const
 Equality test for an EnumerationNumeric. More...
 
bool operator!= (const EnumerationNumeric &e) const
 Inequality test for an EnumerationNumeric. More...
 
bool operator== (const std::string &rhs) const
 Overloaded string compare operator for the EnumerationNumeric. More...
 
bool operator!= (const std::string &rhs) const
 Overloaded inequality test for this EnumerationNumeric's string value. More...
 
bool operator< (const std::string &rhs) const
 Overloaded less than test for this EnumerationNumeric's string value. More...
 
bool operator> (const std::string &rhs) const
 Overloaded greater than test for this EnumerationNumeric's string value. More...
 
- Public Member Functions inherited from trUtil::EnumerationString
const std::string & GetName () const
 Inlined because it's called frequently. More...
 
bool operator== (const EnumerationString &rhs) const
 Equality test for an EnumerationString. More...
 
bool operator!= (const EnumerationString &rhs) const
 Inequality test for an EnumerationString. More...
 
bool operator== (const std::string &rhs) const
 Overloaded string compare operator for the EnumerationString. More...
 
bool operator!= (const std::string &rhs) const
 Overloaded inequality test for this EnumerationString's string value. More...
 
bool operator< (const std::string &rhs) const
 Overloaded less than test for this EnumerationString's string value. More...
 
bool operator> (const std::string &rhs) const
 Overloaded greater than test for this EnumerationString's string value. More...
 
bool operator< (const EnumerationString &rhs) const
 Overloaded less than operator. More...
 

Protected Member Functions

 EnumerationNumeric (const std::string &name, unsigned int orderId)
 ctor Protected to prevent creation of an instance. More...
 
 ~EnumerationNumeric ()
 dtor. More...
 
- Protected Member Functions inherited from trUtil::EnumerationString
virtual int Compare (const std::string &nameString) const
 Virtual string compare method to used by the operators that take a string. More...
 
virtual ~EnumerationString ()
 Private virtual destructor to get rid of compile warning. More...
 
 EnumerationString (const std::string &name)
 Construct the EnumerationString. More...
 

Private Member Functions

EnumerationNumericoperator= (const EnumerationNumeric &)
 Private assignment operator to enforce EnumerationNumeric storage by reference. More...
 
 EnumerationNumeric (const EnumerationNumeric &)
 Private copy constructor to enforce EnumerationNumeric storage by reference. More...
 

Private Attributes

unsigned int mID
 The identifier. More...
 

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. Unlike EnumerationString, EnumerationNumeric also stores an integer value with each Enum.

Author
Maxim Serebrennik

Definition at line 45 of file EnumerationNumeric.h.

Member Typedef Documentation

◆ BaseClass

/ Adds an easy and swappable access to the base class.

Definition at line 49 of file EnumerationNumeric.h.

Constructor & Destructor Documentation

◆ EnumerationNumeric() [1/2]

trUtil::EnumerationNumeric::EnumerationNumeric ( const std::string &  name,
unsigned int  orderId 
)
protected

ctor Protected to prevent creation of an instance.

Parameters
nameThe name.
orderIdIdentifier for the order.

Definition at line 27 of file EnumerationNumeric.cpp.

◆ ~EnumerationNumeric()

trUtil::EnumerationNumeric::~EnumerationNumeric ( )
protected

dtor.

Definition at line 62 of file EnumerationNumeric.cpp.

◆ EnumerationNumeric() [2/2]

trUtil::EnumerationNumeric::EnumerationNumeric ( const EnumerationNumeric )
private

Private copy constructor to enforce EnumerationNumeric storage by reference.

Parameters
parameter1The first parameter.

Member Function Documentation

◆ GetID()

unsigned int trUtil::EnumerationNumeric::GetID ( ) const

Returns the Numeric value of the Enum.

Returns
The identifier.

Definition at line 67 of file EnumerationNumeric.cpp.

References mID.

Referenced by trManager::DirectorBase::CompareComponentPriority(), and trUtil::operator<<().

Here is the caller graph for this function:

◆ operator!=() [1/3]

bool trUtil::EnumerationNumeric::operator!= ( const unsigned int &  id) const
inline

Inequality test for an EnumerationNumeric.

This comparison option takes in an unsigned integer. Inlined because it's called frequently.

Parameters
idThe identifier.
Returns
True if the parameters are not considered equivalent.

Definition at line 85 of file EnumerationNumeric.h.

◆ operator!=() [2/3]

bool trUtil::EnumerationNumeric::operator!= ( const EnumerationNumeric e) const
inline

Inequality test for an EnumerationNumeric.

This comparison option takes in an EnumerationNumeric. Inlined because it's called frequently.

Parameters
eThe EnumerationNumeric to process.
Returns
True if the parameters are not considered equivalent.

Definition at line 175 of file EnumerationNumeric.h.

References trUtil::operator!=(), and trUtil::operator==().

Here is the call graph for this function:

◆ operator!=() [3/3]

bool trUtil::EnumerationNumeric::operator!= ( const std::string &  rhs) const

Overloaded inequality test for this EnumerationNumeric's string value.

Parameters
rhsThe right hand side.
Returns
True if the parameters are not considered equivalent.

Definition at line 44 of file EnumerationNumeric.cpp.

References trUtil::EnumerationString::Compare().

Here is the call graph for this function:

◆ operator<() [1/3]

bool trUtil::EnumerationNumeric::operator< ( const unsigned int &  id) const
inline

Less than test for an EnumerationNumeric.

This comparison option takes in an unsigned integer. Inlined because it's called frequently.

Parameters
idThe identifier.
Returns
True if the first parameter is less than the second.

Definition at line 115 of file EnumerationNumeric.h.

◆ operator<() [2/3]

bool trUtil::EnumerationNumeric::operator< ( const EnumerationNumeric e) const
inline

Less than test for an EnumerationNumeric.

This comparison option takes in an EnumerationNumeric. Inlined because it's called frequently.

Parameters
eThe EnumerationNumeric to process.
Returns
True if the first parameter is less than the second.

Definition at line 145 of file EnumerationNumeric.h.

References mID.

◆ operator<() [3/3]

bool trUtil::EnumerationNumeric::operator< ( const std::string &  rhs) const

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

Parameters
rhsThe right hand side.
Returns
True if the first parameter is less than the second.

Definition at line 50 of file EnumerationNumeric.cpp.

References trUtil::EnumerationString::Compare().

Here is the call graph for this function:

◆ operator=()

EnumerationNumeric & trUtil::EnumerationNumeric::operator= ( const EnumerationNumeric )
private

Private assignment operator to enforce EnumerationNumeric storage by reference.

Parameters
parameter1The first parameter.
Returns
A shallow copy of this object.

Definition at line 32 of file EnumerationNumeric.cpp.

◆ operator==() [1/3]

bool trUtil::EnumerationNumeric::operator== ( const unsigned int &  id) const
inline

Equality test for an EnumerationNumeric.

This comparison option takes in an unsigned integer. Inlined because it's called frequently.

Parameters
idThe identifier.
Returns
True if the parameters are considered equivalent.

Definition at line 70 of file EnumerationNumeric.h.

◆ operator==() [2/3]

bool trUtil::EnumerationNumeric::operator== ( const EnumerationNumeric e) const
inline

Equality test for an EnumerationNumeric.

This comparison option takes in an EnumerationNumeric. Inlined because it's called frequently.

Parameters
eThe EnumerationNumeric to process.
Returns
True if the parameters are considered equivalent.

Definition at line 160 of file EnumerationNumeric.h.

◆ operator==() [3/3]

bool trUtil::EnumerationNumeric::operator== ( const std::string &  rhs) const

Overloaded string compare operator for the EnumerationNumeric.

This will compare the string to this EnumerationNumeric 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.

Definition at line 38 of file EnumerationNumeric.cpp.

References trUtil::EnumerationString::Compare().

Here is the call graph for this function:

◆ operator>() [1/3]

bool trUtil::EnumerationNumeric::operator> ( const unsigned int &  id) const
inline

Greater than test for an EnumerationNumeric.

This comparison option takes in an unsigned integer. Inlined because it's called frequently.

Parameters
idThe identifier.
Returns
True if the first parameter is greater than to the second.

Definition at line 100 of file EnumerationNumeric.h.

◆ operator>() [2/3]

bool trUtil::EnumerationNumeric::operator> ( const EnumerationNumeric e) const
inline

Greater than test for an EnumerationNumeric.

This comparison option takes in an EnumerationNumeric. Inlined because it's called frequently.

Parameters
eThe EnumerationNumeric to process.
Returns
True if the first parameter is greater than to the second.

Definition at line 130 of file EnumerationNumeric.h.

References mID.

◆ operator>() [3/3]

bool trUtil::EnumerationNumeric::operator> ( const std::string &  rhs) const

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

Parameters
rhsThe right hand side.
Returns
True if the first parameter is greater than to the second.

Definition at line 56 of file EnumerationNumeric.cpp.

References trUtil::EnumerationString::Compare().

Here is the call graph for this function:

Member Data Documentation

◆ mID

unsigned int trUtil::EnumerationNumeric::mID
private

The identifier.

Definition at line 249 of file EnumerationNumeric.h.

Referenced by GetID(), operator<(), and operator>().


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