OpenStudio:utilities
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
EnumBase< Enum > Class Template Reference

#include <EnumBase.hpp>

+ Inheritance diagram for EnumBase< Enum >:

Public Member Functions

 EnumBase ()=delete
 Default constructor. More...
 
 EnumBase (int t_value)
 Construct from t_value. More...
 
 EnumBase (const std::string &t_value)
 Construct from t_value. More...
 
int lookupValue (std::string t_name)
 Returns the (integer) value associated with t_name, as determined by case-insensitive comparison to the enumerated names and descriptions. More...
 
int lookupValue (int t_value)
 Returns t_value if it is in the domain. More...
 
bool operator!= (const EnumBase< Enum > &other) const
 
bool operator< (const EnumBase< Enum > &other) const
 
bool operator<= (const EnumBase< Enum > &other) const
 
bool operator== (const EnumBase< Enum > &other) const
 
bool operator> (const EnumBase< Enum > &other) const
 
bool operator>= (const EnumBase< Enum > &other) const
 
void setValue (int t_value)
 Set this instance's value to t_value. More...
 
int value () const
 Returns this instance's current value (as an integer). More...
 
std::string valueDescription () const
 Returns the description associated with this instance's current value. More...
 
std::string valueName () const
 Returns the name associated with this instance's current value. More...
 
- Public Member Functions inherited from StaticInitializer< Enum >
 StaticInitializer ()
 

Static Public Member Functions

static const std::map< int,
std::string > & 
getDescriptions ()
 
static const std::map
< std::string, int > & 
getLookupMap ()
 
static const std::map< int,
std::string > & 
getNames ()
 
static const std::set< int > & getValues ()
 Returns the set of all values in this enum's domain. More...
 
static void initialize ()
 
static std::string valueDescription (int t_value)
 Returns the description associated with t_value, if it exists. More...
 
static std::string valueName (int t_value)
 Returns the name associated with t_value, if it exists. More...
 
- Static Public Member Functions inherited from StaticInitializer< Enum >
static void do_initialize ()
 

Protected Attributes

int m_value
 

Detailed Description

template<typename Enum>
class EnumBase< Enum >

Base class for OPENSTUDIO_ENUMs.

Comparison operators use the underlying (integer) value.

Constructor & Destructor Documentation

template<typename Enum>
EnumBase< Enum >::EnumBase ( )
delete

Default constructor.

EnumBase default constructor never actually called; OPENSTUDIO_ENUM- generated classes have default constructors that set the value to the first item in the enumerated list.

template<typename Enum>
EnumBase< Enum >::EnumBase ( int  t_value)
inline

Construct from t_value.

Throws std::runtime_error if t_value is not in the domain.

template<typename Enum>
EnumBase< Enum >::EnumBase ( const std::string &  t_value)
inline

Construct from t_value.

Throws std::runtime_error if t_value does not match a name or a description (case insensitive).

Member Function Documentation

template<typename Enum>
static const std::map<int, std::string>& EnumBase< Enum >::getDescriptions ( )
inlinestatic
template<typename Enum>
static const std::map<std::string, int>& EnumBase< Enum >::getLookupMap ( )
inlinestatic
template<typename Enum>
static const std::map<int, std::string>& EnumBase< Enum >::getNames ( )
inlinestatic
template<typename Enum>
static const std::set<int>& EnumBase< Enum >::getValues ( )
inlinestatic

Returns the set of all values in this enum's domain.

template<typename Enum>
static void EnumBase< Enum >::initialize ( )
inlinestatic
template<typename Enum>
int EnumBase< Enum >::lookupValue ( std::string  t_name)
inline

Returns the (integer) value associated with t_name, as determined by case-insensitive comparison to the enumerated names and descriptions.

template<typename Enum>
int EnumBase< Enum >::lookupValue ( int  t_value)
inline

Returns t_value if it is in the domain.

Otherwise throws std::runtime_error.

template<typename Enum>
bool EnumBase< Enum >::operator!= ( const EnumBase< Enum > &  other) const
inline
template<typename Enum>
bool EnumBase< Enum >::operator< ( const EnumBase< Enum > &  other) const
inline
template<typename Enum>
bool EnumBase< Enum >::operator<= ( const EnumBase< Enum > &  other) const
inline
template<typename Enum>
bool EnumBase< Enum >::operator== ( const EnumBase< Enum > &  other) const
inline
template<typename Enum>
bool EnumBase< Enum >::operator> ( const EnumBase< Enum > &  other) const
inline
template<typename Enum>
bool EnumBase< Enum >::operator>= ( const EnumBase< Enum > &  other) const
inline
template<typename Enum>
void EnumBase< Enum >::setValue ( int  t_value)
inline

Set this instance's value to t_value.

Throws std::runtime_error if t_value is not in the domain.

template<typename Enum>
int EnumBase< Enum >::value ( ) const
inline

Returns this instance's current value (as an integer).

template<typename Enum>
static std::string EnumBase< Enum >::valueDescription ( int  t_value)
inlinestatic

Returns the description associated with t_value, if it exists.

Otherwise, throws std::runtime_error.

template<typename Enum>
std::string EnumBase< Enum >::valueDescription ( ) const
inline

Returns the description associated with this instance's current value.

template<typename Enum>
static std::string EnumBase< Enum >::valueName ( int  t_value)
inlinestatic

Returns the name associated with t_value, if it exists.

Otherwise, throws std::runtime_error.

template<typename Enum>
std::string EnumBase< Enum >::valueName ( ) const
inline

Returns the name associated with this instance's current value.

Member Data Documentation

template<typename Enum>
int EnumBase< Enum >::m_value
protected