Go to the documentation of this file.
35 template<
class EnumType,
int nEnum>
40 for (
int enumi=0; enumi < nEnum; ++enumi)
44 lookup_.insert(
names[enumi], enumi);
49 List<string> goodNames(enumi);
51 for (
int i = 0; i < enumi; ++i)
53 goodNames[i] =
names[i];
57 <<
"Illegal enumeration name at position " << enumi <<
nl
58 <<
"after entries " << goodNames <<
nl
59 <<
"Possibly your NamedEnum<EnumType, nEnum>::names array"
60 <<
" is not of size " << nEnum <<
endl
69 template<
class EnumType,
int nEnum>
72 List<word> lst(nEnum);
75 for (
int enumi=0; enumi < nEnum; ++enumi)
88 template<
class EnumType,
int nEnum>
94 for (
int enumi=0; enumi < nEnum; ++enumi)
98 auto iter = lookup_.cfind(
names[enumi]);
102 lst[
count++] = iter.val();
112 template<
class EnumType,
int nEnum>
115 const int enumValue(
e);
119 if (iter.val() == enumValue)
128 template<
class EnumType,
int nEnum>
132 const dictionary&
dict
135 const word enumName(
dict.lookup(
key));
136 auto iter = lookup_.cfind(enumName);
141 << enumName <<
" is not in enumeration: "
142 << lookup_.sortedToc() <<
nl
146 return EnumType(iter.val());
150 template<
class EnumType,
int nEnum>
154 const dictionary&
dict,
167 template<
class EnumType,
int nEnum>
170 const word enumName(is);
171 auto iter = lookup_.cfind(enumName);
176 << enumName <<
" is not in enumeration: "
177 << lookup_.sortedToc() <<
nl
181 return EnumType(iter.val());
185 template<
class EnumType,
int nEnum>
192 const int idx = int(
e);
193 if (idx >= 0 && idx < nEnum)
202 template<
class EnumType,
int nEnum>
206 const NamedEnum<EnumType, nEnum>& wrapped
209 return wrapped.lookup_.writeKeys(
os, 10);
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
Ostream & endl(Ostream &os)
void setSize(const label n)
OBJstream os(runTime.globalPath()/outputName)
errorManip< error > abort(error &err)
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
forAllConstIters(mixture.phases(), phase)
unsigned int count(const UList< bool > &bools, const bool val=true)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
const dimensionedScalar e
void write(vtk::formatter &fmt, const Type &val, const label n=1)
#define FatalIOErrorInFunction(ios)
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
List< word > names(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
A NamedEnum is a wrapper around a list of names that represent particular enumeration values.