Gromacs  2025-dev-20241003-bd59e46
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Public Attributes
gmx::SelectionParserValue Class Reference

#include <gromacs/selection/parsetree.h>

Description

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 SelectionLocationlocation () 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.
 

Member Function Documentation

static SelectionParserValue gmx::SelectionParserValue::createExpr ( const gmx::SelectionTreeElementPointer expr)
inlinestatic

Allocates and initializes an expression value.

Parameters
[in]exprRoot of the expression tree to assign to the value.
Returns
The newly created value.
static SelectionParserValue gmx::SelectionParserValue::createInteger ( int  value,
const SelectionLocation location 
)
inlinestatic

Allocates and initializes a constant integer value.

Parameters
[in]valueInteger value to assign to the value.
[in]locationLocation of the value.
Returns
The newly created value.
static SelectionParserValue gmx::SelectionParserValue::createIntegerRange ( int  from,
int  to,
const SelectionLocation location 
)
inlinestatic

Allocates and initializes a constant integer range value.

Parameters
[in]fromBeginning of the range to assign to the value.
[in]toEnd of the range to assign to the value.
[in]locationLocation of the value.
Returns
The newly created value.
static SelectionParserValueListPointer gmx::SelectionParserValue::createList ( const SelectionParserValue value)
inlinestatic

Allocates and initializes a value list with a single value.

Parameters
[in]valueInitial value to put in the list.
Returns
Pointer to a new value list that contains value.
static SelectionParserValue gmx::SelectionParserValue::createPosition ( rvec  value,
const SelectionLocation location 
)
inlinestatic

Allocates and initializes a constant position value.

Parameters
[in]valuePosition vector to assign to the value.
[in]locationLocation of the value.
Returns
The newly created value.
static SelectionParserValue gmx::SelectionParserValue::createReal ( real  value,
const SelectionLocation location 
)
inlinestatic

Allocates and initializes a constant floating-point value.

Parameters
[in]valueFloating-point value to assign to the value.
[in]locationLocation of the value.
Returns
The newly created value.
static SelectionParserValue gmx::SelectionParserValue::createRealRange ( real  from,
real  to,
const SelectionLocation location 
)
inlinestatic

Allocates and initializes a constant floating-point range value.

Parameters
[in]fromBeginning of the range to assign to the value.
[in]toEnd of the range to assign to the value.
[in]locationLocation of the value.
Returns
The newly created value.
static SelectionParserValue gmx::SelectionParserValue::createString ( const char *  value,
const SelectionLocation location 
)
inlinestatic

Allocates and initializes a constant string value.

Parameters
[in]valueString to assign to the value.
[in]locationLocation of the value.
Returns
The newly created value.

The documentation for this class was generated from the following files: