Go to the documentation of this file.
51 #include <type_traits>
59 template<
class EnumType,
int nEnum>
class NamedEnum;
61 template<
class EnumType,
int nEnum>
69 template<
class EnumType,
int nEnum>
73 static_assert(nEnum > 0,
"nEnum must be positive (non-zero)");
87 void operator=(
const NamedEnum&) =
delete;
99 static const char*
names[nEnum];
132 inline
bool found(const
word& enumName) const;
138 bool hasName(const EnumType
e) const;
180 inline const
char*
operator[](const EnumType
e) const;
189 const
NamedEnum<EnumType, nEnum>& wrapped
201 #include "NamedEnumI.H"
List< int > values() const
The list of enum values, in construction order.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
label size() const
The number of lookup names for the enumeration.
A class for handling words, derived from Foam::string.
#define FOAM_DEPRECATED_FOR(since, replacement)
bool hasName(const EnumType e) const
Test if there is a name corresponding to the given enumeration.
friend Ostream & operator(Ostream &os, const NamedEnum< EnumType, nEnum > &wrapped)
Write names to Ostream, as per writeKeys() with shortListLen=10.
bool found(const word &enumName) const
Test if there is an enumeration corresponding to the given name.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
word name(const complex &c)
Return string representation of complex.
Lookup type of boundary radiation properties.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
void write(const EnumType e, Ostream &os) const
Write the name representation of the enumeration to an Ostream.
EnumType lookupOrDefault(const word &key, const dictionary &dict, const EnumType deflt) const
Find the key in the dictionary and return the corresponding.
NamedEnum() FOAM_DEPRECATED_FOR(2017-05
Construct from names.
bool hasEnum(const word &enumName) const
Test if there is an enumeration corresponding to the given name.
wordList words() const
The list of enum names, in construction order.
EnumType value_type
The type of enumeration wrapped by NamedEnum.
wordList sortedToc() const
The sorted list of enum names.
const dimensionedScalar e
Elementary charge.
wordList toc() const
The list of enum names.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static const char * names[nEnum]
The set of names corresponding to the enumeration EnumType.
Ostream & operator<<(Ostream &, const boundaryPatch &)
A NamedEnum is a wrapper around a list of names that represent particular enumeration values.
EnumType read(Istream &is) const
Read a word from Istream and return the corresponding enumeration.