Enum represents an Enumerated data type.
More...
#include <EnumDataType.hpp>
Enum represents an Enumerated data type.
- Note
- since the underlying type can vary in size, it would possibly be cleaner to implement this in a similar way to the Primitive/SpecifiedPrimititive<T> hierarchy. However, I think since there are only 3 possible sizes, maybe this is ok.
◆ EnumDataType() [1/2]
| EnumDataType::EnumDataType |
( |
EnumDictionary * |
enumDictionary, |
|
|
std::string |
name, |
|
|
size_t |
sizeof_element |
|
) |
| |
Constructor for an Enumerated type object.
- Parameters
-
| enumDictionary | global enum value dictionary |
| name | name of type |
| sizeof_element | size, in bytes, of this type |
◆ EnumDataType() [2/2]
◆ ~EnumDataType()
| EnumDataType::~EnumDataType |
( |
| ) |
|
◆ accept()
◆ addEnumerator()
| void EnumDataType::addEnumerator |
( |
std::string |
val_name, |
|
|
int |
value |
|
) |
| |
Add a name-value pair to this enum data type.
- Parameters
-
| val_name | literal name of this enum member |
| value | integer value associated |
◆ assignValue()
| bool EnumDataType::assignValue |
( |
void * |
address, |
|
|
int |
value |
|
) |
| const |
Assign the value to the instance of this data member.
- Parameters
-
| address | Address to assign to |
| value | integer value to assign. Must be a pre-defined value for this type. |
◆ clearValue()
| void EnumDataType::clearValue |
( |
void * |
address | ) |
const |
Set the instance of this type at the given address to 0.
- Parameters
-
| address | address of instance |
◆ containsValue()
| bool EnumDataType::containsValue |
( |
int |
value | ) |
const |
Determine if this enum type has something defined to this value.
- Parameters
-
| value | integer value to find |
- Returns
- true if found, false otherwise
◆ createInstance()
| void * EnumDataType::createInstance |
( |
unsigned int |
n | ) |
const |
|
overridevirtual |
Create one or more instances of this type.
- Parameters
-
- Returns
- void* address of the beginnning of the allocation
Implements DataType.
◆ deleteInstance()
| void EnumDataType::deleteInstance |
( |
void * |
address | ) |
const |
|
overridevirtual |
Delete this instance.
- Parameters
-
| address | of instance to delete |
- Note
- Is this compatible with the createInstance?
Implements DataType.
◆ getSize()
| size_t EnumDataType::getSize |
( |
| ) |
const |
|
overridevirtual |
◆ getTypeSpecName()
| std::string EnumDataType::getTypeSpecName |
( |
| ) |
const |
|
overridevirtual |
Get the name of the enumeration type.
Implements DataType.
◆ getValue()
| int EnumDataType::getValue |
( |
void * |
address | ) |
const |
Get the Value of an instance of this type with the given address.
- Parameters
-
| address | Address to pull the value from |
- Returns
- int numerical value of the enum instance
◆ isValid()
| bool EnumDataType::isValid |
( |
| ) |
const |
|
overridevirtual |
Determine whether this type has already been successfully validated.
- Returns
- true if validated, false otherwise
Implements DataType.
◆ lookupEnumeratorName()
| std::string EnumDataType::lookupEnumeratorName |
( |
int |
value | ) |
const |
Get the string name that corresponds to the integer for this type.
- Parameters
-
| value | integer value to find |
- Returns
- std::string name of this value for this type, or empty string if value is not named in this enum
◆ operator=()
◆ toString()
| std::string EnumDataType::toString |
( |
| ) |
const |
|
overridevirtual |
◆ validate()
Verify that all of the types that are named by this DataType or subordinate DataTypes are resolvable to actual DataTypes in the TypeDictionary.
- Parameters
-
| dataTypeInator | - type resolver machine |
- Returns
- true if successful, false otherwise
Implements DataType.
◆ invalid_str
| const std::string EnumDataType::invalid_str |
|
static |
The documentation for this class was generated from the following files: