Go to the documentation of this file.
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"
93 Enum() noexcept = default;
100 std::initializer_list<std::pair<EnumType, const
char*>> list
109 inline
bool empty() const noexcept;
112 inline label
size() const noexcept;
118 inline const
List<
int>&
values() const noexcept;
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;
275 const Enum* eptr =
nullptr,
280 inline const word&
key()
const;
283 inline EnumType val()
const;
293 inline
bool operator==(const
const_iterator& iter) const noexcept;
294 inline
bool operator!=(const
const_iterator& iter) const noexcept;
301 const_iterator
end() const noexcept {
return cend(); }
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
360 template<
class EnumType>
361 inline Ostream&
operator<<(Ostream&
os,
const Enum<EnumType>& list);
364 template<
class EnumType>
365 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
const_iterator end() const noexcept
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.
const_iterator begin() const noexcept
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
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.
EnumType value_type
The type of enumeration represented by the Enum.
bool operator!=(const eddy &a, const eddy &b)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
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)....
EnumType getOrDefault(const word &key, const dictionary &dict, const EnumType deflt, const bool failsafe=false) const
Enum() noexcept=default
Default construct, an empty list.
Lookup type of boundary radiation properties.
EnumType lookup(const word &enumName, const EnumType deflt) const
The enumeration corresponding to the given name.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
OBJstream os(runTime.globalPath()/outputName)
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.
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.
tmp< faMatrix< Type > > operator*(const areaScalarField &, const faMatrix< Type > &)
OS & writeList(OS &os, const label ununsed=0) const
const dimensionedScalar e
Elementary charge.
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
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
List< word > sortedToc() const
The sorted list of enum names.
label find(const word &enumName) const
Find the index of the given name.
const_iterator cend() const noexcept
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< 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
Find entry and assign to T val.
const List< word > & names() const noexcept
The list of enum names, in construction order. Same as toc()