46 #ifndef FoamCompat_NamedEnum_H 47 #define FoamCompat_NamedEnum_H 51 #include <type_traits> 59 template<
class EnumType,
int nEnum>
class NamedEnum;
61 template<
class EnumType,
int nEnum>
62 Ostream& operator<<(Ostream& os, const NamedEnum<EnumType, nEnum>& wrapped);
69 template<
class EnumType,
int nEnum>
73 static_assert(nEnum > 0,
"nEnum must be positive (non-zero)");
88 void operator=(
const NamedEnum&) =
delete;
94 typedef EnumType value_type;
100 static const char*
names[nEnum];
114 inline label size()
const;
132 inline bool found(
const word& enumName)
const;
135 inline bool hasEnum(
const word& enumName)
const;
138 bool hasName(
const EnumType
e)
const;
156 EnumType lookupOrDefault
177 inline const EnumType operator[](
const word&
name)
const;
180 inline const char* operator[](
const EnumType
e)
const;
186 friend Ostream& operator<< <EnumType, nEnum>
List< word > names(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
List of names generated by calling name() for each list item and filtered for matches.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Lookup type of boundary radiation properties.
A NamedEnum is a wrapper around a list of names that represent particular enumeration values...
bool read(const char *buf, int32_t &val)
Same as readInt32.
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
const dimensionedScalar e
Elementary charge.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A class for handling words, derived from Foam::string.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
OBJstream os(runTime.globalPath()/outputName)
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
List< label > sortedToc(const UList< bool > &bools)
Return the (sorted) values corresponding to 'true' entries.
List< label > toc(const UList< bool > &bools)
Return the (sorted) values corresponding to 'true' entries.