Go to the documentation of this file.
30 template<
class EnumType>
37 template<
class EnumType>
44 template<
class EnumType>
52 template<
class EnumType>
60 template<
class EnumType>
68 template<
class EnumType>
80 template<
class EnumType>
88 template<
class EnumType>
91 return keys_.find(enumName);
95 template<
class EnumType>
98 return vals_.find(
int(
e));
102 template<
class EnumType>
105 return keys_.found(enumName);
109 template<
class EnumType>
112 return vals_.found(
int(
e));
116 template<
class EnumType>
119 const label idx =
find(
e);
130 template<
class EnumType>
139 return readEntry(key,
dict, val,
false);
143 template<
class EnumType>
146 const label idx =
find(
e);
155 template<
class EnumType>
162 for (
const word&
k : keys_)
175 template<
class EnumType>
187 template<
class EnumType>
191 return ptr_->
names()[idx_];
195 template<
class EnumType>
198 return EnumType(ptr_->values()[idx_]);
202 template<
class EnumType>
211 template<
class EnumType>
217 return idx_ == iter.idx_;
221 template<
class EnumType>
227 return idx_ != iter.idx_;
231 template<
class EnumType>
239 template<
class EnumType>
249 template<
class EnumType>
255 return get(enumName);
259 template<
class EnumType>
271 template<
class EnumType>
278 return list.writeList(os);
282 template<
class EnumType>
283 inline std::ostream& Foam::operator<<
289 return list.writeList(os);
const_iterator cbegin() const
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
True if there is an enumeration corresponding to the given name.
EnumType val() const
Enumeration value at the current index.
bool empty() const noexcept
True if the enumeration list is empty.
const List< word > & toc() const noexcept
The list of enum names, in construction order. Same as names()
A const_iterator for iterating an Enum list.
EnumType get(const word &enumName) const
The enumeration corresponding to the given name.
const_iterator cend() const
void write(const EnumType e, Ostream &os) const
Write the name representation of the enumeration to an Ostream.
const_iterator & operator++() noexcept
Move to the next index.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const word & key() const
The name at the current index.
label find(const ListType &input, const UnaryPredicate &pred, const label start=0)
Find index of the first occurrence that satisfies the predicate.
const_iterator(const Enum *eptr=nullptr, const label idx=0) noexcept
Default construct, construct at given position.
label size() const noexcept
The number of name/value pairs for the enumeration.
void clear()
Clear all entries.
OS & writeList(OS &os, const label ununsed=0) const
label k
Boltzmann constant.
const dimensionedScalar e
Elementary charge.
bool readIfPresent(const word &key, const dictionary &dict, EnumType &val) const
Find an entry if present, and assign to T val.
List< word > sortedToc() const
The sorted list of enum names.
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< int > & values() const noexcept
The list of enum values, in construction order.
const List< word > & names() const noexcept
The list of enum names, in construction order. Same as toc()