#include "gmxpre.h"
#include "selmethod.h"
#include <cctype>
#include <cstdarg>
#include <cstdio>
#include <string>
#include "gromacs/selection/selparam.h"
#include "gromacs/selection/selvalue.h"
#include "gromacs/utility/arraysize.h"
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/stringutil.h"
#include "selmethod_impl.h"
#include "symrec.h"
|
static void | report_error (FILE *fp, const char *name, gmx_fmtstr const char *fmt,...) gmx_format(printf |
| Convenience function for reporting errors found in selection methods.
|
|
static void | report_param_error (FILE *fp, const char *mname, const char *pname, gmx_fmtstr const char *fmt,...) gmx_format(printf |
| Convenience function for reporting errors found in selection method parameters.
|
|
static bool | check_params (FILE *fp, const char *name, int nparams, gmx_ana_selparam_t params[], const gmx::SelectionParserSymbolTable &symtab) |
| Checks the validity of parameters. More...
|
|
static bool | check_callbacks (FILE *fp, gmx_ana_selmethod_t *method) |
| Checks the validity of selection method callback functions. More...
|
|
static bool | check_method (FILE *fp, gmx_ana_selmethod_t *method, const gmx::SelectionParserSymbolTable &symtab) |
| Checks the validity of a selection method. More...
|
|
static bool | check_modifier (FILE *fp, gmx_ana_selmethod_t *method, const gmx::SelectionParserSymbolTable &symtab) |
| Checks the validity of a selection modifier method. More...
|
|
int | gmx_ana_selmethod_register (gmx::SelectionParserSymbolTable *symtab, const char *name, gmx_ana_selmethod_t *method) |
| Registers a selection method. More...
|
|
int | gmx_ana_selmethod_register_defaults (gmx::SelectionParserSymbolTable *symtab) |
| Registers all selection methods in the library. More...
|
|
gmx_ana_selparam_t * | gmx_ana_selmethod_find_param (const char *name, gmx_ana_selmethod_t *method) |
| Finds a parameter from a selection method by name. More...
|
|
Checks the validity of selection method callback functions.
- Parameters
-
[in] | fp | File handle to use for diagnostic messages (can be NULL). |
[in] | method | The method to check. |
- Returns
- true if there are no problems, false otherwise.
This function performs some checks common to both check_method() and check_modifier(). This function checks that all the required callbacks are defined, i.e., not NULL, to find programming errors.
Checks the validity of a selection method.
- Parameters
-
[in] | fp | File handle to use for diagnostic messages (can be NULL). |
[in,out] | method | Method to check. |
[in] | symtab | Symbol table (used for checking overlaps). |
Checks the validity of the given selection method data structure that does not have SMETH_MODIFIER set. If you remove a check, please make sure that the selection parser, compiler, and evaluation functions can deal with the method.
Checks the validity of a selection modifier method.
- Parameters
-
[in] | fp | File handle to use for diagnostic messages (can be NULL). |
[in,out] | method | Method to check. |
[in] | symtab | Symbol table (used for checking overlaps). |
Checks the validity of the given selection method data structure that has SMETH_MODIFIER set. If you remove a check, please make sure that the selection parser, compiler, and evaluation functions can deal with the method.
Checks the validity of parameters.
- Parameters
-
[in] | fp | File handle to use for diagnostic messages (can be NULL). |
[in] | name | Name of the method (used for error messages). |
[in] | nparams | Number of parameters in param . |
[in,out] | params | Parameter array (only the flags field of boolean parameters may be modified). |
[in] | symtab | Symbol table (used for checking overlaps). |
- Returns
- true if there are no problems with the parameters, false otherwise.
This function performs some checks common to both check_method() and check_modifier(). The purpose of these checks is to ensure that the selection parser does not need to check for the validity of the parameters at each turn, and to report programming errors as early as possible. If you remove a check, make sure that the parameter parser can handle the resulting parameters.
Finds a parameter from a selection method by name.
- Parameters
-
[in] | name | Name of the parameter to search. |
[in] | method | Method to search for the parameter. |
- Returns
- Pointer to the parameter in the method->param array, or NULL if no parameter with name
name
was found.
This is a simple wrapper for gmx_ana_selparam_find().
Registers a selection method.
- Parameters
-
[in,out] | symtab | Symbol table to register the method to. |
[in] | name | Name under which the method should be registered. |
[in] | method | Method to register. |
- Returns
- 0 on success, -1 if there was something wrong with the method.
name
does not need to match the name of the method, and the same method can be registered multiple times under different names. If name
equals some previously registered name, an error message is printed and the method is not registered.
The function also performs some sanity checking on the input method, and refuses to register it if there are problems. Some problems only generate warnings. All problems are described to stderr
.
Registers all selection methods in the library.
- Parameters
-
[in,out] | symtab | Symbol table to register the methods to. |
- Returns
- 0 on success, -1 if any of the default methods could not be registered.