Gromacs
2025-dev-20241003-bd59e46
|
#include <gromacs/selection/parsetree.h>
Describes a parsed value, possibly resulting from expression evaluation.
All factory methods and the constructors may throw an std::bad_alloc if out of memory.
Public Member Functions | |
const SelectionLocation & | location () const |
Returns the location of this value in the parsed selection text. | |
bool | hasExpressionValue () const |
Returns true if the value comes from expression evaluation. | |
const std::string & | stringValue () const |
Returns the string value (type must be STR_VALUE). | |
Static Public Member Functions | |
static SelectionParserValueListPointer | createList () |
Allocates and initializes an empty value list. | |
static SelectionParserValueListPointer | createList (const SelectionParserValue &value) |
Allocates and initializes a value list with a single value. More... | |
static SelectionParserValue | createExpr (const gmx::SelectionTreeElementPointer &expr) |
Allocates and initializes an expression value. More... | |
static SelectionParserValue | createInteger (int value, const SelectionLocation &location) |
Allocates and initializes a constant integer value. More... | |
static SelectionParserValue | createIntegerRange (int from, int to, const SelectionLocation &location) |
Allocates and initializes a constant integer range value. More... | |
static SelectionParserValue | createReal (real value, const SelectionLocation &location) |
Allocates and initializes a constant floating-point value. More... | |
static SelectionParserValue | createRealRange (real from, real to, const SelectionLocation &location) |
Allocates and initializes a constant floating-point range value. More... | |
static SelectionParserValue | createString (const char *value, const SelectionLocation &location) |
Allocates and initializes a constant string value. More... | |
static SelectionParserValue | createPosition (rvec value, const SelectionLocation &location) |
Allocates and initializes a constant position value. More... | |
Public Attributes | |
e_selvalue_t | type_ |
Type of the value. | |
gmx::SelectionTreeElementPointer | expr_ |
Expression pointer if the value is the result of an expression. | |
std::string | str |
String value for type STR_VALUE. | |
union { | |
struct { | |
int i1 | |
Beginning of the range. | |
int i2 | |
End of the range; equals i1 for a single integer. | |
} i | |
The integer value/range (type INT_VALUE). | |
struct { | |
real r1 | |
Beginning of the range. | |
real r2 | |
End of the range; equals r1 for a single number. | |
} r | |
The real value/range (type REAL_VALUE). | |
rvec x | |
The position value (type POS_VALUE). | |
} | u |
The actual value if expr is NULL and type is not STR_VALUE. | |
|
inlinestatic |
Allocates and initializes an expression value.
[in] | expr | Root of the expression tree to assign to the value. |
|
inlinestatic |
Allocates and initializes a constant integer value.
[in] | value | Integer value to assign to the value. |
[in] | location | Location of the value. |
|
inlinestatic |
Allocates and initializes a constant integer range value.
[in] | from | Beginning of the range to assign to the value. |
[in] | to | End of the range to assign to the value. |
[in] | location | Location of the value. |
|
inlinestatic |
Allocates and initializes a value list with a single value.
[in] | value | Initial value to put in the list. |
value
.
|
inlinestatic |
Allocates and initializes a constant position value.
[in] | value | Position vector to assign to the value. |
[in] | location | Location of the value. |
|
inlinestatic |
Allocates and initializes a constant floating-point value.
[in] | value | Floating-point value to assign to the value. |
[in] | location | Location of the value. |
|
inlinestatic |
Allocates and initializes a constant floating-point range value.
[in] | from | Beginning of the range to assign to the value. |
[in] | to | End of the range to assign to the value. |
[in] | location | Location of the value. |
|
inlinestatic |
Allocates and initializes a constant string value.
[in] | value | String to assign to the value. |
[in] | location | Location of the value. |