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
144 inline label
find(const
word& enumName) const;
148 inline label
find(const EnumType
e) const;
151 inline
bool found(const
word& enumName) const;
154 inline
bool found(const EnumType
e) const;
158 EnumType
get(const
word& enumName) const;
162 inline const
word&
get(const EnumType
e) const;
167 EnumType
lookup(const
word& enumName, const EnumType deflt) const;
191 const EnumType deflt,
192 const
bool failsafe = false
205 const
bool mandatory = true
232 const
bool mandatory = true
242 inline OS&
writeList(OS&
os, const label ununsed=0) const;
250 inline EnumType operator[](const
word& enumName) const;
255 inline const
word& operator[](const EnumType
e) const;
273 inline explicit const_iterator
275 const Enum* eptr =
nullptr,
280 inline const word&
key()
const;
283 inline EnumType val()
const;
291 inline const_iterator& operator++()
noexcept;
314 const dictionary&
dict,
315 const EnumType deflt,
316 const bool failsafe =
false 326 const word& operator()(const EnumType
e)
const 334 EnumType operator()(const word&
key, const EnumType deflt)
const 342 EnumType
get(const
word&
key, const EnumType deflt)
const 359 std::initializer_list<std::pair<EnumType, const char*>> list
370 template<
class EnumType>
371 inline Ostream& operator<<(Ostream& os, const Enum<EnumType>& list);
374 template<
class EnumType>
375 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.
label find(const word &enumName) const
Find the index of the given name.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
EnumType lookupOrDefault(const word &key, const dictionary &dict, const EnumType deflt, const bool failsafe=false) const
Find the key in the dictionary and return the corresponding enumeration element based on its name...
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)...
bool found(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.
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 end() const noexcept
bool readEntry(const word &key, const dictionary &dict, EnumType &val, const bool mandatory=true) const
Find entry and assign to T val.
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.
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
bool readIfPresent(const word &key, const dictionary &dict, EnumType &val) const
Find an entry if present, and assign to T val.
const_iterator cbegin() const noexcept
bool operator!=(const eddy &a, const eddy &b)
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
EnumType getOrDefault(const word &key, const dictionary &dict, const EnumType deflt, const bool failsafe=false) const
Find the key in the dictionary and return the corresponding enumeration element based on its name...
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.