Gromacs  2024.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Typedefs | Enumerations | Functions
#include "gromacs/utility/real.h"
+ Include dependency graph for selvalue.h:
+ This graph shows which files directly or indirectly include this file:

Description

Declares gmx_ana_selvalue_t.

There should be no need to use the data structures in this file directly unless implementing a custom selection routine.

Author
Teemu Murtola teemu.nosp@m..mur.nosp@m.tola@.nosp@m.gmai.nosp@m.l.com

Classes

struct  gmx_ana_selvalue_t
 Describes a value of a selection expression or of a selection method parameter. More...
 

Typedefs

typedef struct gmx_ana_selvalue_t gmx_ana_selvalue_t
 Describes a value of a selection expression or of a selection method parameter. More...
 

Enumerations

enum  e_selvalue_t {
  NO_VALUE, INT_VALUE, REAL_VALUE, STR_VALUE,
  POS_VALUE, GROUP_VALUE
}
 Defines the value type of a different selection objects. More...
 

Functions

void _gmx_selvalue_clear (gmx_ana_selvalue_t *val)
 Initializes an empty selection value structure. More...
 
void _gmx_selvalue_free (gmx_ana_selvalue_t *val)
 Frees memory allocated for a selection value structure. More...
 
void _gmx_selvalue_reserve (gmx_ana_selvalue_t *val, int n)
 Reserve memory for storing selection values. More...
 
void _gmx_selvalue_getstore_and_release (gmx_ana_selvalue_t *val, void **ptr, int *nalloc)
 Gets and releases the memory pointer for storing selection values. More...
 
void _gmx_selvalue_setstore (gmx_ana_selvalue_t *val, void *ptr)
 Sets the memory for storing selection values. More...
 
void _gmx_selvalue_setstore_alloc (gmx_ana_selvalue_t *val, void *ptr, int nalloc)
 Sets the memory for storing selection values and marks it for automatic freeing. More...
 

Typedef Documentation

Describes a value of a selection expression or of a selection method parameter.

Which field in the union is used depends on the type.

Enumeration Type Documentation

Defines the value type of a different selection objects.

Enumerator
NO_VALUE 

No value; either an error condition or an boolean parameter.

INT_VALUE 

One or more integer values.

REAL_VALUE 

One or more real values.

STR_VALUE 

One or more string values.

POS_VALUE 

One or more position values.

GROUP_VALUE 

One group of atoms.

Function Documentation

void _gmx_selvalue_clear ( gmx_ana_selvalue_t val)

Initializes an empty selection value structure.

Parameters
[out]valOutput structure

The type of val is not touched. Any contents of val are discarded without freeing.

void _gmx_selvalue_free ( gmx_ana_selvalue_t val)

Frees memory allocated for a selection value structure.

Parameters
[in,out]valValues to free.

The type of val is not touched. If memory is not allocated, the value pointers are simply cleared without freeing.

void _gmx_selvalue_getstore_and_release ( gmx_ana_selvalue_t val,
void **  ptr,
int *  nalloc 
)

Gets and releases the memory pointer for storing selection values.

Parameters
[in,out]valValue structure to release.
[out]ptrPointer where the values are stored.
[out]nallocPointer where the values are stored.

Returns the pointer where values of val were stored in ptr and nalloc, and clears the memory in val.

void _gmx_selvalue_reserve ( gmx_ana_selvalue_t val,
int  n 
)

Reserve memory for storing selection values.

Parameters
[in,out]valValue structure to allocate.
[in]nMaximum number of values needed.

Reserves memory for the values within val to store at least n values, of the type specified in the val structure.

If the type is POS_VALUE or GROUP_VALUE, memory is reserved for the data structures, but no memory is reserved inside these newly allocated data structures. Similarly, for STR_VALUE values, the pointers are set to NULL. For other values, the memory is uninitialized.

void _gmx_selvalue_setstore ( gmx_ana_selvalue_t val,
void *  ptr 
)

Sets the memory for storing selection values.

Parameters
[in,out]valValue structure to set storage for.
[in]ptrPointer where the values should be stored.

Automatic memory management is disabled for ptr. Asserts if val had a previous storage that it owned, as that would result in a memory leak.

void _gmx_selvalue_setstore_alloc ( gmx_ana_selvalue_t val,
void *  ptr,
int  nalloc 
)

Sets the memory for storing selection values and marks it for automatic freeing.

Parameters
[in,out]valValue structure to set storage for.
[in]ptrPointer where the values should be stored.
[in]nallocNumber of values allocated for ptr.

Asserts if val had a previous storage that it owned, as that would result in a memory leak.