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_.contains(enumName);
95 template<
class EnumType>
98 return vals_.contains(
int(
e));
102 template<
class EnumType>
105 const label idx = vals_.find(
int(
e));
116 template<
class EnumType>
126 return readEntry(
key,
dict, val,
false, warnOnly);
130 template<
class EnumType>
133 const label idx = vals_.find(
int(
e));
142 template<
class EnumType>
149 for (
const word&
k : keys_)
162 template<
class EnumType>
174 template<
class EnumType>
178 return ptr_->
names()[idx_];
182 template<
class EnumType>
185 return EnumType(ptr_->values()[idx_]);
189 template<
class EnumType>
192 return (ptr_ && idx_ >= 0 && idx_ < ptr_->
size());
196 template<
class EnumType>
205 template<
class EnumType>
211 return idx_ == iter.idx_;
215 template<
class EnumType>
221 return idx_ != iter.idx_;
225 template<
class EnumType>
233 template<
class EnumType>
241 template<
class EnumType>
245 const label idx = keys_.
find(
key);
250 (idx >= 0 ? idx : this->
size())
255 template<
class EnumType>
259 const label idx = vals_.
find(
int(
e));
264 (idx >= 0 ? idx : this->
size())
271 template<
class EnumType>
277 return get(enumName);
281 template<
class EnumType>
293 template<
class EnumType>
297 const Enum<EnumType>& list
300 return list.writeList(
os);
304 template<
class EnumType>
305 inline std::ostream& Foam::operator<<
308 const Enum<EnumType>& list
311 return list.writeList(
os);
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_iterator(const Enum *eptr=nullptr, const label idx=0) noexcept
Default construct, construct at given position.
OS & writeList(OS &os, const label ununsed=0) const
Write enumeration names as a list without line-breaks to an output stream.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
bool good() const noexcept
True if iterator points to an entry.
bool readIfPresent(const word &key, const dictionary &dict, EnumType &val, const bool warnOnly=false) const
Find an entry if present, and assign to T val.
const_iterator cfind(const word &key) const
Find key/value pair by enumeration name.
A const_iterator for iterating an Enum list.
EnumType val() const
Enumeration value at the current index.
label k
Boltzmann constant.
bool contains(const word &enumName) const
True if there is an enumeration corresponding to the given name.
const List< word > & toc() const noexcept
The list of enum names, in construction order. Same as names()
void clear()
Clear all entries.
const dimensionedScalar e
Elementary charge.
A class for handling words, derived from Foam::string.
void sort(UList< T > &list)
Sort the list.
const List< int > & values() const noexcept
The list of enum values, in construction order.
label find(const T &val) const
Find index of the first occurrence of the value.
const_iterator & operator++() noexcept
Move to the next index.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
const List< word > & names() const noexcept
The list of enum names, in construction order. Same as toc()
OBJstream os(runTime.globalPath()/outputName)
const_iterator cend() const noexcept
const word & key() const
The name at the current index.
label size() const noexcept
The number of name/value pairs for the enumeration.
List< word > sortedToc() const
The sorted list of enum names.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
const_iterator cbegin() const noexcept
bool empty() const noexcept
True if the enumeration list is empty.