42 #ifndef Foam_expressions_exprValue_H 43 #define Foam_expressions_exprValue_H 53 #undef FOR_ALL_EXPR_VALUE_TYPES 54 #define FOR_ALL_EXPR_VALUE_TYPES(Macro, ...) \ 55 Macro(scalar, __VA_ARGS__) \ 56 Macro(vector, __VA_ARGS__) \ 57 Macro(tensor, __VA_ARGS__) \ 58 Macro(symmTensor, __VA_ARGS__) \ 59 Macro(sphericalTensor, __VA_ARGS__) \ 60 Macro(label, __VA_ARGS__) \ 61 Macro(bool, __VA_ARGS__) 87 #undef declareUnionMember 88 #define declareUnionMember(Type, UnusedParam) \ 94 #undef declareUnionMember 108 inline const Type*
get()
const noexcept {
return nullptr; }
112 inline void set(
const Type& val)
noexcept 122 #undef defineMultiTypeValueUnionMethods 123 #define defineMultiTypeValueUnionMethods(Type, UnusedParam) \ 127 inline const Type* exprValueUnion::get<Type>() const noexcept \ 129 return &(Type##Value); \ 134 inline void exprValueUnion::set<Type>(const Type& val) noexcept \ 141 #undef defineMultiTypeValueUnionMethods 166 inline void fill_zero();
183 inline explicit exprValue(
const Type& val);
189 inline static bool good 282 inline
bool set(const Type& val);
286 inline const Type&
get() const;
291 #undef defineUnionMethods 292 #define defineUnionMethods(Type, UnusedParam) \ 295 bool is_##Type() const noexcept \ 297 return (typeCode_ == exprTypeTraits<Type>::value); \ 301 void operator=(const Type& val) { this->set<Type>(val); } 304 #undef defineUnionMethods 319 return reinterpret_cast<const char*
>(
this);
325 return reinterpret_cast<char*
>(
this);
351 InfoProxy<exprValue>
info()
const {
return *
this; }
360 void write(Ostream&
os,
bool prune =
false)
const;
382 Ostream& operator<<(Ostream& os, const InfoProxy<expressions::exprValue>&);
const Type * isA() const noexcept
Return non-null pointer to the data element (if types match). Can also be tested as a bool...
bool good() const noexcept
True if the value type is not none/invalid.
static void notSpecialized(const std::string &msg) noexcept
Runtime 'assert' for unimplemented generic methods.
const Type & get() const
Return the value. Return pTraits zero if the types mismatch.
direction nComponents() const noexcept
The number of components associated with the value type.
A polymorphic typed union of simple primitive and VectorSpace types. It uses a 'fatter' representatio...
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
char * data_bytes() noexcept
Pointer to the data content as byte data.
No type, or default initialized type.
void operator=(const scalar &val)
bool set(const Type &val)
Assign from type. Returns false and sets to 'none' for unsupported types.
static bool supportedType()
True if the specified type is supported.
The data content (as a union).
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.
Istream & operator>>(Istream &, directionInfo &)
static expressions::valueTypeCode peekType(const ITstream &is)
Detect the type from the available tokens.
static constexpr unsigned size_bytes() noexcept
Size of the (contiguous) data content as byte data is compile-time constant.
static bool read(const std::string &str, exprValue &val)
Read entire string as a exprValue, skipping leading/trailing whitespace.
valueTypeCode
An enumeration of known and expected expression value types.
direction rank() const noexcept
The vector-space rank associated with the value type.
int compare(const exprValue &rhs) const
Compare (type,value)
bool is_integral() const noexcept
True if the value type is an integral (bool or label)
const char * cdata_bytes() const noexcept
Pointer to the data content as byte data.
bool operator<(const exprValue &rhs) const
Compare (type,value)
void write(Ostream &os, bool prune=false) const
Write the (type-specific) content.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
word valueTypeName() const
The name for the value type. Similar to pTraits typeName.
bool readTokens(ITstream &is)
Guess type and read tokens (if possible)
bool operator==(const exprValue &rhs) const
Compare (type,value) for equality.
OBJstream os(runTime.globalPath()/outputName)
#define defineMultiTypeValueUnionMethods(Type, UnusedParam)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
bool operator!=(const exprValue &rhs) const
Compare (type,value) for inequality.
#define FOR_ALL_EXPR_VALUE_TYPES(Macro,...)
A template class to specify that a data type can be considered as being contiguous in memory...
expressions::valueTypeCode typeCode() const noexcept
The value type code.
word listCompoundName() const
The name for the compound token (for a List of values). Eg, List<scalar>, List<vector> ...
InfoProxy< exprValue > info() const
Return info proxy for printing information to a stream.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
exprValue()
Default construct (zero-initialized) as 'none'.
void clear()
Reset to 'none'.
#define defineUnionMethods(Type, UnusedParam)
#define declareUnionMember(Type, UnusedParam)
An input stream of tokens.