Scalar bounds to be used as a unary predicate. More...
Public Types | |
typedef scalar | value_type |
Type of values the range contains. More... | |
Public Member Functions | |
scalarRange () noexcept | |
Construct an empty (inverse) range. More... | |
scalarRange (const scalar value) noexcept | |
Construct an exact value matcher. More... | |
scalarRange (const scalar minVal, const scalar maxVal) noexcept | |
Construct a range from min-value to max-value. More... | |
scalarRange (const MinMax< label > &range) noexcept | |
Copy construct from a min/max range. More... | |
scalarRange (const MinMax< scalar > &range) noexcept | |
Copy construct from a min/max range. More... | |
void | clear () noexcept |
Reset to an empty (inverse) range. More... | |
bool | empty () const noexcept |
True if range is empty (eg, inverted) More... | |
bool | valid () const noexcept |
True if range is non-empty. More... | |
bool | single () const noexcept |
True if the range bounds represent a single value. More... | |
scalar | min () const noexcept |
The min value of the range. More... | |
scalar | max () const noexcept |
The max value of the range. More... | |
scalar | value () const |
A representative (average) value for the range. More... | |
bool | match (const scalar &val) const |
True if the value matches the condition. More... | |
bool | operator() (const scalar &val) const |
Identical to match(), for use as a predicate. More... | |
bool | operator== (const scalarRange &rhs) const noexcept |
bool | operator!= (const scalarRange &rhs) const noexcept |
Static Public Member Functions | |
static bool | parse (const std::string &str, scalarRange &range) |
Construct by parsing string content. More... | |
static scalarRange | parse (const std::string &str) |
Construct by parsing string content. More... | |
static scalarRange | ge (const scalar minVal) noexcept |
Construct a greater-equals bound. More... | |
static scalarRange | gt (const scalar minVal) noexcept |
Construct a greater-than bound. More... | |
static scalarRange | ge0 () noexcept |
Construct a greater-equals zero bound. More... | |
static scalarRange | gt0 () noexcept |
Construct a greater-than zero bound. More... | |
static scalarRange | le (const scalar maxVal) noexcept |
Construct a less-equals bound. More... | |
static scalarRange | lt (const scalar maxVal) noexcept |
Construct a less-than bound. More... | |
static scalarRange | zero_one () noexcept |
Construct a greater-equals 0, less-equals 1 bound. More... | |
Static Public Attributes | |
static const scalarRange | null |
An empty/inverted range that never matches. More... | |
static const scalarRange | always |
A range that always matches. More... | |
Friends | |
Ostream & | operator<< (Ostream &os, const scalarRange &range) |
Print information about the range. More... | |
Scalar bounds to be used as a unary predicate.
The bound can be specified as an "MIN:MAX" range, as a "MIN:" or ":MAX" bound or simply as a single "VALUE".
When defined via the parse() method, the special string "none" can be used to define an empty (inverse) range.
Definition at line 67 of file scalarRange.H.
typedef scalar value_type |
Type of values the range contains.
Definition at line 108 of file scalarRange.H.
|
inlinenoexcept |
Construct an empty (inverse) range.
Definition at line 43 of file scalarRangeI.H.
Referenced by scalarRange::parse().
|
inlineexplicitnoexcept |
Construct an exact value matcher.
Definition at line 49 of file scalarRangeI.H.
|
inlinenoexcept |
Construct a range from min-value to max-value.
Definition at line 56 of file scalarRangeI.H.
References clear(), and Foam::equal().
|
explicitnoexcept |
Copy construct from a min/max range.
Automatically decides if this is a GE_LE or NONE range
Definition at line 140 of file scalarRange.C.
|
explicitnoexcept |
Copy construct from a min/max range.
Automatically decides if this is a GE_LE or NONE range
Definition at line 148 of file scalarRange.C.
|
static |
Construct by parsing string content.
A colon (:) is used as a range marker or when specifying greater-than or less-than bounds.
Definition at line 48 of file scalarRange.C.
References scalarRange::always, Switch::find(), scalarRange::ge(), Switch::good(), scalarRange::le(), range, and scalarRange::scalarRange().
|
static |
Construct by parsing string content.
Any parse problems are emitted as information and the returned range is of type empty().
Definition at line 125 of file scalarRange.C.
References Foam::endl(), Foam::Info, and range.
|
inlinestaticnoexcept |
Construct a greater-equals bound.
Definition at line 74 of file scalarRangeI.H.
Referenced by scalarRange::parse().
|
inlinestaticnoexcept |
Construct a greater-than bound.
Definition at line 80 of file scalarRangeI.H.
|
inlinestaticnoexcept |
Construct a greater-equals zero bound.
Definition at line 86 of file scalarRangeI.H.
|
inlinestaticnoexcept |
Construct a greater-than zero bound.
Definition at line 92 of file scalarRangeI.H.
|
inlinestaticnoexcept |
Construct a less-equals bound.
Definition at line 98 of file scalarRangeI.H.
Referenced by scalarRange::parse().
|
inlinestaticnoexcept |
Construct a less-than bound.
Definition at line 103 of file scalarRangeI.H.
|
inlinestaticnoexcept |
Construct a greater-equals 0, less-equals 1 bound.
Definition at line 109 of file scalarRangeI.H.
|
inlinenoexcept |
Reset to an empty (inverse) range.
Definition at line 117 of file scalarRangeI.H.
|
inlinenoexcept |
True if range is empty (eg, inverted)
Definition at line 125 of file scalarRangeI.H.
|
inlinenoexcept |
True if range is non-empty.
Definition at line 131 of file scalarRangeI.H.
|
inlinenoexcept |
True if the range bounds represent a single value.
Definition at line 137 of file scalarRangeI.H.
|
inlinenoexcept |
The min value of the range.
Definition at line 143 of file scalarRangeI.H.
|
inlinenoexcept |
The max value of the range.
Definition at line 149 of file scalarRangeI.H.
|
inline |
A representative (average) value for the range.
For GE, LE bounds it is the min/max value, respectively.
Definition at line 155 of file scalarRangeI.H.
|
inline |
True if the value matches the condition.
Definition at line 178 of file scalarRangeI.H.
References Foam::equal().
|
inline |
Identical to match(), for use as a predicate.
Definition at line 196 of file scalarRangeI.H.
References Foam::stringOps::match().
|
inlinenoexcept |
Definition at line 203 of file scalarRangeI.H.
|
inlinenoexcept |
Definition at line 212 of file scalarRangeI.H.
References Foam::operator==().
|
friend |
Print information about the range.
|
static |
An empty/inverted range that never matches.
Definition at line 114 of file scalarRange.H.
|
static |
A range that always matches.
Definition at line 117 of file scalarRange.H.
Referenced by scalarRange::parse().