54 template<
class EnumType>
class Enum;
60 template<
class EnumType>
75 std::is_enum<EnumType>::value || std::is_integral<EnumType>::value,
76 "Enum must be enum or an integral type" 100 std::initializer_list<
std::pair<EnumType, const
char*>> list
136 std::initializer_list<
std::pair<EnumType, const
char*>> list
146 inline
bool contains(const EnumType
e) const;
150 EnumType
get(const
word& enumName) const;
154 inline const
word&
get(const EnumType
e) const;
159 EnumType
lookup(const
word& enumName, const EnumType deflt) const;
183 const EnumType deflt,
184 const
bool warnOnly = false
198 const
bool mandatory = true,
199 const
bool warnOnly = false
212 const
bool warnOnly = false
227 const
bool mandatory = true
237 inline OS&
writeList(OS&
os, const label ununsed=0) const;
245 inline EnumType operator[](const
word& enumName) const;
250 inline const
word& operator[](const EnumType
e) const;
268 inline explicit const_iterator
270 const Enum* eptr =
nullptr,
278 inline const word&
key()
const;
281 inline EnumType val()
const;
289 inline const_iterator& operator++()
noexcept;
303 inline const_iterator
cfind(
const word&
key)
const;
314 const dictionary&
dict,
315 const EnumType deflt,
316 const
bool warnOnly = false
325 const word& operator()(const EnumType
e)
const 333 EnumType operator()(const
word&
key, const EnumType deflt)
const 341 EnumType
get(const
word&
key, const EnumType deflt)
const 349 EnumType
lookup(const word&
key, const dictionary&
dict)
const 359 std::initializer_list<
std::pair<EnumType, const
char*>> list
376 template<
class EnumType>
377 inline Ostream& operator<<(Ostream& os, const Enum<EnumType>& list);
380 template<
class EnumType>
381 inline std::ostream& operator<<(std::ostream& os, const Enum<EnumType>& list);
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.
EnumType read(Istream &is) const
Read a word from Istream and return the corresponding enumeration.
void push_back(std::initializer_list< std::pair< EnumType, const char *>> list)
Append value/key pairs to the lists of known enumerations.
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 found(const word &key) const
Same as contains()
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.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
const_iterator cfind(const word &key) const
Find the enumeration by name.
bool contains(const word &enumName) const
True if there is an enumeration corresponding to the given name.
Lookup type of boundary radiation properties.
EnumType value_type
The type of enumeration represented by the Enum.
EnumType getOrDefault(const word &key, const dictionary &dict, const EnumType deflt, const bool warnOnly=false) const
Find the key in the dictionary and return the corresponding enumeration element based on its name...
const List< word > & toc() const noexcept
The list of enum names, in construction order. Same as names()
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
void clear()
Clear all entries.
const_iterator find(const word &key) const
const_iterator end() const noexcept
const dimensionedScalar e
Elementary charge.
tmp< faMatrix< Type > > operator*(const areaScalarField::Internal &, const faMatrix< Type > &)
A class for handling words, derived from Foam::string.
const List< int > & values() const noexcept
The list of enum values, in construction order.
bool readEntry(const word &key, const dictionary &dict, EnumType &val, const bool mandatory=true, const bool warnOnly=false) const
Find entry and assign to T val.
#define FOAM_DEPRECATED_STRICT(since, replacement)
word key_type
The type of keys used.
void append(std::initializer_list< std::pair< EnumType, const char *>> list)
Append value/key pairs to the lists of known enumerations.
Enum() noexcept=default
Default construct, an empty list.
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
label size() const noexcept
The number of name/value pairs for the enumeration.
List< word > sortedToc() const
The sorted list of enum names.
const_iterator begin() const noexcept
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
EnumType lookupOrDefault(const word &key, const dictionary &dict, const EnumType deflt, const bool warnOnly=false) const
Same as getOrDefault()
const_iterator cbegin() const noexcept
bool operator!=(const eddy &a, const eddy &b)
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
bool empty() const noexcept
True if the enumeration list is empty.
EnumType lookup(const word &enumName, const EnumType deflt) const
The enumeration corresponding to the given name.