Go to the documentation of this file.
30 template<
class EnumType>
37 template<
class EnumType>
44 template<
class EnumType>
51 template<
class EnumType>
58 template<
class EnumType>
65 template<
class EnumType>
73 template<
class EnumType>
76 return keys_.find(enumName);
80 template<
class EnumType>
83 return vals_.find(
int(
e));
87 template<
class EnumType>
90 return keys_.found(enumName);
94 template<
class EnumType>
97 return vals_.found(
int(
e));
101 template<
class EnumType>
104 const label idx =
find(
e);
115 template<
class EnumType>
122 return keys_.writeList(os, shortLen);
126 template<
class EnumType>
129 const label idx =
find(
e);
140 template<
class EnumType>
146 return get(enumName);
150 template<
class EnumType>
160 template<
class EnumType>
170 template<
class EnumType>
173 const word& enumName,
177 const label idx =
find(enumName);
181 return EnumType(vals_[idx]);
190 template<
class EnumType>
197 return list.names().writeList(os, 0);
201 template<
class EnumType>
202 inline std::ostream& Foam::operator<<
212 for (
const word&
k : list.names())
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
A class for handling words, derived from Foam::string.
bool found(const word &enumName) const
Test if there is an enumeration corresponding to the given name.
const List< word > & names() const
The list of enum names, in construction order. Same as toc()
bool empty() const noexcept
True if the enumeration list is empty.
Ostream & writeList(Ostream &os, const label shortLen=0) const
Write the names as a list to an Ostream.
EnumType get(const word &enumName) const
The enumeration corresponding to the given name.
void write(const EnumType e, Ostream &os) const
Write the name representation of the enumeration to an Ostream.
const List< int > & values() const
The list of enum values, in construction order.
label find(const ListType &input, const UnaryPredicate &pred, const label start=0)
Find index of the first occurrence that satisfies the predicate.
label size() const noexcept
The number of name/value pairs for the enumeration.
void clear()
Clear all entries.
label k
Boltzmann constant.
const dimensionedScalar e
Elementary charge.
label find(const word &enumName) const
Find the index of the given name.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
const List< word > & toc() const
The list of enum names, in construction order. Same as names()