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
};
};
FFaField<SomeEnumTypeEnum> myEnumField;
};
#define FFaEnumEntryEnd
Defines the end of an enum mapping definition.
Definition: FFaEnum.H:238
#define FFaEnumMapping(EnumType)
Defines the start of an enum mapping definition.
Definition: FFaEnum.H:221
#define FFaEnumEntry(EnumValue, EnumText)
Adds one entry to the current enum mapping definition.
Definition: FFaEnum.H:234
Class to be used as a enum variable with text representations.
Definition: FFaEnum.H:87
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()
{
...
FFA_FIELD_INIT(myEnumField, AONE, "ENUM_FIELD_NAME");
...
}
...
a.myEnum = ClassWithEnum::ATHREE;
ClassWithEnum::SomeEnumType en =
a.myEnum;
std::cout <<
a.myEnum << std::endl;
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";
real(sp), dimension(:,:,:), pointer b
Definition: diffractionModule.f90:22
real(sp), dimension(:,:,:), pointer a
Definition: diffractionModule.f90:21