Base class containing parsing functions; all objects which need to parse input inherit from this.
More...
|
| colvarparse () |
| Default constructor.
|
|
| colvarparse (const std::string &conf) |
| Constructor that stores the object's config string.
|
|
void | clear () |
| Set the object ready to parse a new configuration string.
|
|
void | set_string (std::string const &conf) |
| Set a new config string for this object.
|
|
| ~colvarparse () override |
| Default destructor.
|
|
std::string const & | get_config () const |
| Get the configuration string (includes comments)
|
|
int | check_keywords (std::string &conf, char const *key) |
| Check that all the keywords within "conf" are in the list of allowed keywords; this will invoke strip_values() first and then loop over all words.
|
|
void | clear_keyword_registry () |
| Use this after parsing a config string (note that check_keywords() calls it already)
|
|
bool | get_keyval (std::string const &conf, char const *key, int &value, int const &def_value=0, Parse_Mode const parse_mode=parse_normal) |
|
bool | get_keyval (std::string const &conf, char const *key, size_t &value, size_t const &def_value=0, Parse_Mode const parse_mode=parse_normal) |
|
bool | get_keyval (std::string const &conf, char const *key, long &value, long const &def_value=0, Parse_Mode const parse_mode=parse_normal) |
|
bool | get_keyval (std::string const &conf, char const *key, cvm::step_number &value, cvm::step_number const &def_value=0, Parse_Mode const parse_mode=parse_normal) |
|
bool | get_keyval (std::string const &conf, char const *key, std::string &value, std::string const &def_value=std::string(""), Parse_Mode const parse_mode=parse_normal) |
|
bool | get_keyval (std::string const &conf, char const *key, cvm::real &value, cvm::real const &def_value=0.0, Parse_Mode const parse_mode=parse_normal) |
|
bool | get_keyval (std::string const &conf, char const *key, cvm::rvector &value, cvm::rvector const &def_value=cvm::rvector(), Parse_Mode const parse_mode=parse_normal) |
|
bool | get_keyval (std::string const &conf, char const *key, cvm::quaternion &value, cvm::quaternion const &def_value=cvm::quaternion(), Parse_Mode const parse_mode=parse_normal) |
|
bool | get_keyval (std::string const &conf, char const *key, colvarvalue &value, colvarvalue const &def_value=colvarvalue(colvarvalue::type_notset), Parse_Mode const parse_mode=parse_normal) |
|
bool | get_keyval (std::string const &conf, char const *key, bool &value, bool const &def_value=false, Parse_Mode const parse_mode=parse_normal) |
|
bool | get_keyval (std::string const &conf, char const *key, std::vector< int > &values, std::vector< int > const &def_values=std::vector< int >(0, 0), Parse_Mode const parse_mode=parse_normal) |
|
bool | get_keyval (std::string const &conf, char const *key, std::vector< size_t > &values, std::vector< size_t > const &def_values=std::vector< size_t >(0, 0), Parse_Mode const parse_mode=parse_normal) |
|
bool | get_keyval (std::string const &conf, char const *key, std::vector< long > &values, std::vector< long > const &def_values=std::vector< long >(0, 0), Parse_Mode const parse_mode=parse_normal) |
|
bool | get_keyval (std::string const &conf, char const *key, std::vector< std::string > &values, std::vector< std::string > const &def_values=std::vector< std::string >(0, std::string("")), Parse_Mode const parse_mode=parse_normal) |
|
bool | get_keyval (std::string const &conf, char const *key, std::vector< cvm::real > &values, std::vector< cvm::real > const &def_values=std::vector< cvm::real >(0, 0.0), Parse_Mode const parse_mode=parse_normal) |
|
bool | get_keyval (std::string const &conf, char const *key, std::vector< cvm::rvector > &values, std::vector< cvm::rvector > const &def_values=std::vector< cvm::rvector >(0, cvm::rvector()), Parse_Mode const parse_mode=parse_normal) |
|
bool | get_keyval (std::string const &conf, char const *key, std::vector< cvm::quaternion > &values, std::vector< cvm::quaternion > const &def_values=std::vector< cvm::quaternion >(0, cvm::quaternion()), Parse_Mode const parse_mode=parse_normal) |
|
bool | get_keyval (std::string const &conf, char const *key, std::vector< colvarvalue > &values, std::vector< colvarvalue > const &def_values=std::vector< colvarvalue >(0, colvarvalue(colvarvalue::type_notset)), Parse_Mode const parse_mode=parse_normal) |
|
bool | key_lookup (std::string const &conf, char const *key, std::string *data=nullptr, size_t *save_pos=nullptr) |
| Low-level function for parsing configuration strings; automatically adds the requested keyword to the list of valid ones. More...
|
|
std::istream & | read_config_line (std::istream &is, std::string &line) |
| Reads a configuration line, adds it to config_string, and returns the stream. More...
|
|
template<> |
int | _get_keyval_scalar_value_ (std::string const &key_str, std::string const &data, bool &value, bool const &) |
|
template<> |
int | _get_keyval_scalar_novalue_ (std::string const &key_str, bool &value, Parse_Mode const &parse_mode) |
|
int | param_exists (std::string const ¶m_name) |
| Whether the parameter param_name exists.
|
|
virtual std::vector< std::string > | get_param_names () |
| Get a copy of the names of registered parameters.
|
|
virtual std::vector< std::string > | get_param_grad_names () |
| Get a copy of the names of registered parameter gradients.
|
|
virtual void const * | get_param_ptr (std::string const ¶m_name) |
| Pointer to the parameter param_name.
|
|
virtual void const * | get_param_grad_ptr (std::string const ¶m_name) |
| Pointer to the gradient of parameter param_name.
|
|
virtual cvm::real | get_param (std::string const ¶m_name) |
| Value of the parameter param_name (must be a scalar)
|
|
virtual int | set_param (std::string const ¶m_name, void const *new_value) |
| Set the named parameter to the given value. More...
|
|
|
bool | get_key_string_value (std::string const &conf, char const *key, std::string &data) |
| Get the string value of a keyword, and save it for later parsing.
|
|
bool | get_key_string_multi_value (std::string const &conf, char const *key, std::vector< std::string > &data) |
| Get multiple strings from repeated instances of a same keyword.
|
|
template<typename TYPE > |
bool | _get_keyval_scalar_ (std::string const &conf, char const *key, TYPE &value, TYPE const &def_value, Parse_Mode const &parse_mode) |
| Template for single-value keyword parsers.
|
|
template<typename TYPE > |
bool | _get_keyval_vector_ (std::string const &conf, char const *key, std::vector< TYPE > &values, std::vector< TYPE > const &def_values, Parse_Mode const &parse_mode) |
| Template for multiple-value keyword parsers.
|
|
template<typename TYPE > |
int | _get_keyval_scalar_value_ (std::string const &key_str, std::string const &data, TYPE &value, TYPE const &def_value) |
| Extract the value of a variable from a string.
|
|
template<typename TYPE > |
int | _get_keyval_scalar_novalue_ (std::string const &key_str, TYPE &value, Parse_Mode const &parse_mode) |
| Handle the case where the user provides a keyword without value.
|
|
template<typename TYPE > |
void | mark_key_set_user (std::string const &key_str, TYPE const &value, Parse_Mode const &parse_mode) |
| Record that the keyword has just been user-defined.
|
|
template<typename TYPE > |
void | mark_key_set_default (std::string const &key_str, TYPE const &def_value, Parse_Mode const &parse_mode) |
| Record that the keyword has just been set to its default value.
|
|
void | error_key_required (std::string const &key_str, Parse_Mode const &parse_mode) |
| Raise error condition due to the keyword being required!
|
|
bool | key_already_set (std::string const &key_str) |
| True if the keyword has been set already.
|
|
void | add_keyword (char const *key) |
| Add a new valid keyword to the list.
|
|
void | strip_values (std::string &conf) |
| Remove all the values from the config string.
|
|
| colvarparams () |
| Default constructor.
|
|
virtual | ~colvarparams () |
| Default destructor.
|
|
void | register_param (std::string const ¶m_name, void *param_ptr) |
| Register the given parameter.
|
|
void | register_param_grad (std::string const ¶m_name, colvarvalue *param_grad_ptr) |
| Register the gradient of the given parameter.
|
|
Base class containing parsing functions; all objects which need to parse input inherit from this.