template<class EnumType, class ETMapping>
class FFaEnum< EnumType, ETMapping >
Class to be used as a enum variable with text representations.
The class contains stream operators for input and output as text, and overloaded assignment operators such that its value can be assigned also from the text representation.
Usage:
class ClassWithEnum
{
public:
ClassWithEnum() {}
enum SomeEnumType {
AONE,
ATWO,
ATHREE
};
};
};
#define FFaEnumEntryEnd
Defines the end of an enum mapping definition.
Definition: FFaEnum.H:237
#define FFaEnumEntry(Value, Text)
Adds one entry to the current enum mapping definition.
Definition: FFaEnum.H:234
FFaEnumMapping(VTFFileType)
Definition: FmVTFType.H:19
Class to be used as a enum variable with text representations.
Definition: FFaEnum.H:87
Template class for field representation in the FEDEM model database.
Definition: FFaField.H:39
As you can see, the initialization of the text to enum mappings are to be set up using the macros FFaEnumMapping(), FFaEnumEntry() and FFaEnumEntryEnd(). The FFaEnum class supports all kinds of assigning, so it can be used as a normal enum variable.
...
ClassWithEnum::ClassWithEnum()
{
...
...
}
...
ClassWithEnum a;
a.myEnum = ClassWithEnum::ATHREE;
ClassWithEnum b;
b.myEnum = a.myEnum;
a.myEnum = "ATWO";
ClassWithEnum::SomeEnumType en = a.myEnum;
int v = a.myEnum;
std::cout << a.myEnum << std::endl;
std::cin >> a.myEnum;
if (b.myEnum == a.myEnum) std::cout <<"a and b are equal\n";
if (b.myEnum != a.myEnum) std::cout <<"a and b are not equal\n";
#define FFA_FIELD_INIT(field, defaultValue, identifier)
Adds a named field to *this with specified default value.
Definition: FFaFieldContainer.H:228