30 template<
class Enum,
unsigned int nEnum>
35 for (
unsigned int enumI = 0; enumI < nEnum; ++enumI)
37 if (!names[enumI] || names[enumI][0] ==
'\0')
41 for (
unsigned int i = 0; i < enumI; ++i)
43 goodNames[i] = names[i];
47 <<
"Illegal enumeration name at position " << enumI <<
endl 48 <<
"after entries " << goodNames <<
".\n" 49 <<
"Possibly your NamedEnum<Enum, nEnum>::names array" 50 <<
" is not of size " << nEnum <<
endl 53 insert(names[enumI], enumI);
60 template<
class Enum,
unsigned int nEnum>
70 << name <<
" is not in enumeration: " 78 template<
class Enum,
unsigned int nEnum>
85 template<
class Enum,
unsigned int nEnum>
91 for (
unsigned int enumI = 0; enumI < nEnum; ++enumI)
93 if (names[enumI] && names[enumI][0])
95 lst[nElem++] = names[enumI];
104 template<
class Enum,
unsigned int nEnum>
110 for (
unsigned int enumI = 0; enumI < nEnum; ++enumI)
112 if (names[enumI] && names[enumI][0])
114 lst[nElem++] = names[enumI];
123 template<
class Enum,
unsigned int nEnum>
126 unsigned int ue = unsigned(e);
135 <<
"names array index " << ue <<
" out of range 0-" static wordList words()
The set of names as a list of words.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const Enum operator[](const char *name) const
Return the enumeration element corresponding to the given name.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Ostream & endl(Ostream &os)
Add newline and flush stream.
void write(const Enum e, Ostream &) const
Write the name representation of the enumeration to an Ostream.
static stringList strings()
The set of names as a list of strings.
void insert(const scalar, DynamicList< floatScalar > &)
Append scalar to given DynamicList.
const dimensionedScalar & e
Elementary charge.
A class for handling words, derived from string.
NamedEnum()
Construct from names.
An STL-conforming hash table.
errorManip< error > abort(error &err)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
word name(const complex &)
Return a string representation of a complex.
void setSize(const label)
Reset size of List.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Enum read(Istream &) const
Read a word from Istream and return the corresponding.