openDAQ
Open data acquisition platform
EnumerationPtr Class Reference

Enumerations are 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 EnumerationPtr:
+ Collaboration diagram for EnumerationPtr:

Detailed Description

Enumerations are 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

EnumerationTypePtr getEnumerationType () const
 Gets the Enumeration's type. More...
 
StringPtr getValue () const
 Gets the Enumeration value as String containing the name of the enumerator constant. More...
 
Int getIntValue () const
 Gets the Enumeration value as Integer enumerator constant. More...
 
- Public Member Functions inherited from ObjectPtr< IEnumeration >
 ObjectPtr ()
 Creates a smart pointer with no wrapped interface.
 
 ObjectPtr (std::nullptr_t)
 Creates a smart pointer with no wrapped interface.
 
 ObjectPtr (const ObjectPtr< IEnumeration > &objPtr)
 Creates a smart pointer from another smart pointer. More...
 
 ObjectPtr (ObjectPtr< IEnumeration > &&objPtr) noexcept
 Creates a smart pointer from another smart pointer with move semantics. More...
 
 ObjectPtr (const ObjectPtr< U > &objPtr)
 Creates a smart pointer from another smart pointer of a different interface type. More...
 
 ObjectPtr (ObjectPtr< U > &&objPtr)
 Creates a smart pointer from another smart pointer of a different interface type with move semantics. More...
 
 ObjectPtr (IEnumeration *&obj)
 Creates a smart pointer from an interface pointer. More...
 
 ObjectPtr (IEnumeration *&&obj)
 Creates a smart pointer from an interface pointer with move semantics. More...
 
 ObjectPtr (IWeakRef *obj)
 Creates a smart pointer from a weak reference interface pointer. More...
 
 ObjectPtr (const wchar_t *value)
 Creates a string object smart pointer from UTF16 null terminated sequence. More...
 
 ObjectPtr (ConstCharPtr value)
 Creates a string object smart pointer from UTF8 null terminated sequence. More...
 
 ObjectPtr (const U &value)
 Creates a smart pointer wrapper from value type. More...
 
virtual ~ObjectPtr ()
 Destructor. More...
 
bool equals (ObjectPtr< IBaseObject > other) const
 Compares object to another object for equality. More...
 
IEnumerationdetach ()
 Disassociates this smart pointer object from the interface that it represents. More...
 
void dispose () const
 Disposes all references held by the object. More...
 
void release ()
 Resets the wrapped interface to nullptr. More...
 
IEnumerationaddRefAndReturn () const
 Increments the reference count and returns the interface. More...
 
 operator IEnumeration * () const
 Casts the pointer to the wrapped interface. More...
 
bool assigned () const
 Checks if the smart pointer is not empty.
 
IEnumerationgetObject () const
 Gets the pointer to the wrapped interface. More...
 
IEnumeration ** addressOf ()
 Gets the address of the pointer to the wrapped interface. More...
 
IEnumeration ** operator& ()
 Gets the address of the pointer to the wrapped interface. More...
 
U * as (bool borrow=false) const
 Casts the wrapped interface to another interface. More...
 
U * asOrNull (bool borrow=false) const
 Casts the wrapped interface to another interface. More...
 
Ptr asPtr (bool borrow=false) const
 Casts the wrapped interface to another interface and wraps in a smart pointer. More...
 
Ptr asPtrOrNull (bool borrow=false) const
 Casts the wrapped interface to another interface and wraps in a smart pointer. More...
 
bool supportsInterface () const
 Checks if the wrapped interface supports another interface. More...
 
bool supportsInterface (const IntfID &id) const
 Checks if the wrapped interface supports another interface using the interface ID. More...
 
CoreType getCoreType () const
 Gets the object's CoreType. More...
 
ObjectPtr< IBaseObjectconvertTo (CoreType ct) const
 Converts the object to the specified CoreType. More...
 
SizeT getHashCode () const
 Returns hash code of the object. More...
 
ObjectPtr< IStringtoString () const
 Converts the object to the string object. More...
 
void freeze () const
 Freezes the object. More...
 
Bool isFrozen () const
 Checks if the object is frozen. More...
 
void dispatch (const ObjectPtr< IBaseObject > &params) const
 Calls the stored callback. More...
 
void dispatch () const
 Calls the stored callback without any parameters. More...
 
void execute () const
 Calls the stored callback without any parameters. More...
 
void execute (Params... params) const
 Calls the stored callback. More...
 
ObjectPtr< IBaseObjectcall (Params... params) const
 Calls the stored callback and returns the result. More...
 
bool isBorrowed () const
 Checks if the reference is borrowed. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ObjectPtr< IEnumeration >
static InterfaceToSmartPtr< U >::SmartPtr Borrow (IEnumeration *&obj)
 Borrows an interface. More...
 
static InterfaceToSmartPtr< V >::SmartPtr Borrow (U *&obj)
 Borrows an interface from the interface of another type. More...
 
static InterfaceToSmartPtr< U >::SmartPtr Adopt (IEnumeration *obj)
 Adopts an interface. More...
 
static Bool Equals (const ObjectPtr< IBaseObject > &a, const ObjectPtr< IBaseObject > &b)
 Value based comparison of two objects. If both objects are nullptr, they are considered to be equal. More...
 

Member Function Documentation

◆ getEnumerationType()

EnumerationTypePtr getEnumerationType ( ) const
inline

Gets the Enumeration's type.

Returns
The Enumeration type

◆ getIntValue()

Int getIntValue ( ) const
inline

Gets the Enumeration value as Integer enumerator constant.

Returns
Emumeration Integer value.

◆ getValue()

StringPtr getValue ( ) const
inline

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

Returns
Emumeration value.