Go to the documentation of this file.
44 #include <initializer_list>
55 template<
class EnumType>
class Enum;
61 template<
class EnumType>
81 std::is_enum<EnumType>::value || std::is_integral<EnumType>::value,
82 "Enum must be enum or an integral type"
96 std::initializer_list<std::pair<EnumType, const char*>> list
105 inline bool empty() const noexcept;
132 std::initializer_list<std::pair<EnumType, const
char*>> list
147 inline
bool found(const
word& enumName) const;
150 inline
bool found(const EnumType
e) const;
154 EnumType
get(const
word& enumName) const;
158 EnumType
get(const
word& enumName, const EnumType deflt) const;
162 inline const
word&
get(const EnumType
e) const;
186 const EnumType deflt,
187 const
bool failsafe = false
200 const
bool mandatory = true
227 const
bool mandatory = true
244 inline EnumType operator[](const
word& enumName) const;
249 inline const
word& operator[](const EnumType
e) const;
254 inline const
word& operator()(const EnumType
e) const;
258 inline EnumType operator()
260 const
word& enumName,
276 const EnumType deflt,
277 const
bool failsafe = false
296 template<
class EnumType>
297 inline Ostream&
operator<<(Ostream& os,
const Enum<EnumType>& list);
300 template<
class EnumType>
301 inline std::ostream&
operator<<(std::ostream& os,
const Enum<EnumType>& list);
EnumType lookupOrDefault(const word &key, const dictionary &dict, const EnumType deflt, const bool failsafe=false) const
label ListType::const_reference val
A class for handling words, derived from Foam::string.
EnumType const dictionary &const dict
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.
Enum()=default
Construct null (empty list)
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.
EnumType value_type
The type of enumeration represented by the Enum.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void write(const EnumType e, Ostream &os) const
Write the name representation of the enumeration to an Ostream.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
const List< int > & values() const
The list of enum values, in construction order.
EnumType getOrDefault(const word &key, const dictionary &dict, const EnumType deflt, const bool failsafe=false) const
EnumType FOAM_DEPRECATED_FOR(2018-10, "get() method") lookup(const word &key
Deprecated(2018-10) same as two-parameter get()
Lookup type of boundary radiation properties.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
void append(std::initializer_list< std::pair< EnumType, const char * >> list)
Append value/key pairs to the lists of known enumerations.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
label size() const noexcept
The number of name/value pairs for the enumeration.
void clear()
Clear all entries.
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,...
EnumType read(Istream &is) const
Read a word from Istream and return the corresponding enumeration.
const List< word > & toc() const
The list of enum names, in construction order. Same as names()
Ostream & operator<<(Ostream &, const boundaryPatch &)
bool readEntry(const word &key, const dictionary &dict, EnumType &val, const bool mandatory=true) const
Find entry and assign to T val.