Gromacs
2024.4
|
#include "gromacs/utility/real.h"
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.
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 struct gmx_ana_selvalue_t gmx_ana_selvalue_t |
Describes a value of a selection expression or of a selection method parameter.
Which field in the union is used depends on the type
.
enum e_selvalue_t |
Defines the value type of a different selection objects.
void _gmx_selvalue_clear | ( | gmx_ana_selvalue_t * | val | ) |
Initializes an empty selection value structure.
[out] | val | Output 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.
[in,out] | val | Values 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.
[in,out] | val | Value structure to release. |
[out] | ptr | Pointer where the values are stored. |
[out] | nalloc | Pointer 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.
[in,out] | val | Value structure to allocate. |
[in] | n | Maximum 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.
[in,out] | val | Value structure to set storage for. |
[in] | ptr | Pointer 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.
[in,out] | val | Value structure to set storage for. |
[in] | ptr | Pointer where the values should be stored. |
[in] | nalloc | Number of values allocated for ptr . |
Asserts if val
had a previous storage that it owned, as that would result in a memory leak.