openDAQ
Open data acquisition platform
IEnumeration Struct Referenceabstract

Enumerations are immutable objects that encapsulate a value within a predefined set of named integral constants. These constants are predefined in an Enumeration type with the same name as the Enumeration. More...

+ Inheritance diagram for IEnumeration:
+ Collaboration diagram for IEnumeration:

Detailed Description

Enumerations are immutable objects that encapsulate a value within a predefined set of named integral constants. These constants are predefined in an Enumeration type with the same name as the Enumeration.

The Enumeration types are stored within a Type manager. In any given instance of openDAQ, a single Type manager should exist that is part of its Context.

When creating an Enumeration object, the Type manager is used to validate the given enumerator value name against the Enumeration type stored within the manager. If no type with the given Enumeration name is currently stored, construction of the Enumeration object will fail. Similarly, if the provided enumerator value name is not part of the Enumeration type, the construction of the Enumeration object will also fail.

Since the Enumerations objects are immutable the value of an existing Enumeration object cannot be modified. However, the Enumeration object encapsulated by a smart pointer of the corresponding type can be replaced with a newly created one. This replacement is accomplished using the assignment operator with the right operand being a constant string literal containing the enumerator value name valid for the Enumeration type of the original Enumeration object.

Public Member Functions

virtual ErrCode INTERFACE_FUNC getEnumerationType (IEnumerationType **type)=0
 Gets the Enumeration's type. More...
 
virtual ErrCode INTERFACE_FUNC getValue (IString **value)=0
 Gets the Enumeration value as String containing the name of the enumerator constant. More...
 
virtual ErrCode INTERFACE_FUNC getIntValue (Int *value)=0
 Gets the Enumeration value as Integer enumerator constant. More...
 
- Public Member Functions inherited from IBaseObject
virtual ErrCode INTERFACE_FUNC borrowInterface (const IntfID &intfID, void **obj) const =0
 Returns another interface which is supported by the object without incrementing the reference count. More...
 
virtual ErrCode INTERFACE_FUNC dispose ()=0
 Disposes all references held by the object. More...
 
virtual ErrCode INTERFACE_FUNC getHashCode (SizeT *hashCode)=0
 Returns hash code of the object. More...
 
virtual ErrCode INTERFACE_FUNC equals (IBaseObject *other, Bool *equal) const =0
 Compares object to another object for equality. More...
 
virtual ErrCode INTERFACE_FUNC toString (CharPtr *str)=0
 Returns a string representation of the object. More...
 
- Public Member Functions inherited from IUnknown
virtual ErrCode INTERFACE_FUNC queryInterface (const IntfID &intfID, void **obj)=0
 Returns another interface which is supported by the object and increments the reference count. More...
 
virtual int INTERFACE_FUNC addRef ()=0
 Increments the reference count for an interface on an object. More...
 
virtual int INTERFACE_FUNC releaseRef ()=0
 Decrements the reference count for an interface on an object. More...
 

Member Function Documentation

◆ getEnumerationType()

virtual ErrCode INTERFACE_FUNC getEnumerationType ( IEnumerationType **  type)
pure virtual

Gets the Enumeration's type.

Parameters
[out]typeThe Enumeration type

◆ getIntValue()

virtual ErrCode INTERFACE_FUNC getIntValue ( Int *  value)
pure virtual

Gets the Enumeration value as Integer enumerator constant.

Parameters
[out]valueEmumeration Integer value.

◆ getValue()

virtual ErrCode INTERFACE_FUNC getValue ( IString **  value)
pure virtual

Gets the Enumeration value as String containing the name of the enumerator constant.

Parameters
[out]valueEmumeration value.