openDAQ
Open data acquisition platform
EnumerationTypePtr Class Reference

Enumeration types define the enumerator names and values of Enumerations with a name matching that of the Enumeration type. More...

+ Inheritance diagram for EnumerationTypePtr:
+ Collaboration diagram for EnumerationTypePtr:

Detailed Description

Enumeration types define the enumerator names and values of Enumerations with a name matching that of the Enumeration type.

An Enumeration type provides a String-type name, a list of enumerator names (list of Strings) and a list of enumerator values (list of Integer objects). To use Enumeration types for creating Enumeration objects, they must be added to the Type Manager. Alternatively, if an Enumeration is created without a matching Enumeration type in the manager, a default Enumeration type is generated based on the enumerator names and values of the created Enumeration object. This generated Enumeration type is then added to the Type Manager.

The enumerator values are represented as a list of Integer objects. These values can be explicitly specified during Enumeration type creation, or only the first enumerator value can be specified, with the rest automatically assigned in ascending order, starting from that value (or from the default '0' value if not specified).

Public Member Functions

ListPtr< IStringgetEnumeratorNames () const
 Gets the list of enumerator names. More...
 
DictPtr< IString, IIntegergetAsDictionary () const
 Gets the enumerator names and values as a Dictionary. More...
 
Int getEnumeratorIntValue (const StringPtr &name) const
 Gets the value of enumerator with the specified name. More...
 
SizeT getCount () const
 Gets the number of enumerators within the Enumeration Type. More...
 
- Public Member Functions inherited from GenericTypePtr< IEnumerationType >
StringPtr getName () const
 Gets the name of the Type. More...
 

Member Function Documentation

◆ getAsDictionary()

DictPtr<IString, IInteger> getAsDictionary ( ) const
inline

Gets the enumerator names and values as a Dictionary.

Returns
The Dictionary object with enumerator names as keys, and enumerator values * as its values.

◆ getCount()

SizeT getCount ( ) const
inline

Gets the number of enumerators within the Enumeration Type.

Returns
The number of enumerators within the Enumeration Type.

◆ getEnumeratorIntValue()

Int getEnumeratorIntValue ( const StringPtr name) const
inline

Gets the value of enumerator with the specified name.

Parameters
nameThe name of the enumerator (String object).
Returns
The integer value of the enumerator with the specified name.

◆ getEnumeratorNames()

ListPtr<IString> getEnumeratorNames ( ) const
inline

Gets the list of enumerator names.

Returns
The list of enumerator names (String objects)