This class holds the keywords and their documentation. More...
#include <Keywords.h>
Classes | |
struct | component |
struct | keyInfo |
struct | KeyType |
This class lets me pass keyword types easily. More... | |
Public Types | |
enum class | argType { scalar =1 , vector =1<<2 , matrix =1<<3 , grid =1<<4 } |
enum class | componentType { scalar =1 , vector =1<<2 , matrix =1<<3 , grid =1<<4 , atoms =1<<5 , atom =1<<6 } |
Public Member Functions | |
Keywords () | |
Constructor. | |
void | add (const Keywords &keys) |
append the data from another Keywords object (only keywords, reserved keywords and components) | |
void | add (std::string_view keytype, std::string_view key, std::string_view defaultValue, std::string_view docstring) |
Add a new compulsory keyword (t must equal compulsory) with name k, default value def and description d. | |
void | add (std::string_view keytype, std::string_view key, std::string_view docstring) |
Add a new keyword of type t with name k and description d. | |
void | addActionNameSuffix (const std::string &suffix) |
Add a suffix to the list of possible action name suffixes. | |
void | addDOI (const std::string &doi) |
Add a DOI to the list in the manual page for this action. | |
void | addFlag (std::string_view key, bool defaultValue, std::string_view docstring) |
Add a falg with name k that is by default on if def is true and off if def is false. d should provide a description of the flag. | |
void | addInputKeyword (const std::string &keyType, const std::string &key, argType dataType, const std::string &defaultValue, const std::string &docstring) |
Create the documentation for a keyword that reads arguments. | |
void | addInputKeyword (const std::string &keyType, const std::string &key, argType dataType, const std::string &docstring) |
Create the documentation for a keyword that reads arguments. | |
void | addInputKeyword (const std::string &keyType, const std::string &key, const std::string &dataType, const std::string &defaultValue, const std::string &docstring) |
Create the documentation for a keyword that reads arguments. | |
void | addInputKeyword (const std::string &keyType, const std::string &key, const std::string &dataType, const std::string &docstring) |
Create the documentation for a keyword that reads arguments. | |
void | addOutputComponent (const std::string &name, const std::string &key, componentType type, const std::string &descr) |
Add a potential component which can be output by this particular action. | |
void | addOutputComponent (const std::string &name, const std::string &key, const std::string &descr) |
Add a potential component which can be output by this particular action. | |
void | addOutputComponent (const std::string &name, const std::string &key, const std::string &type, const std::string &descr) |
bool | checkArgumentType (const std::size_t &rank, const bool &hasderiv) const |
Check the documentation of the argument types. | |
bool | componentHasCorrectType (const std::string &name, const std::size_t &rank, const bool &hasderiv) const |
Check that type for component has been documented correctly. | |
void | destroyData () |
Clear everything from the keywords object. | |
bool | exists (std::string_view k) const |
Check if there is a keyword with name k. | |
std::vector< std::string > | getArgumentKeys () const |
std::string | getArgumentType (const std::string &name) const |
Get the valid types that can be used as argument for this keyword. | |
bool | getDefaultValue (const std::string &key, std::string &def) const |
Get the value of the default for the keyword named key. | |
std::string | getDisplayName () const |
Return the name of the action that has this set of keywords. | |
const std::vector< std::string > & | getDOIList () const |
Get the list of DOI. | |
std::string | getHelpString () const |
Get the help string. | |
const std::vector< std::string > & | getKeys () const |
Get the ordered list of active keywords (not the reserved ones) | |
std::string | getKeyword (const unsigned i) const |
Return the ith keyword. | |
std::string | getKeywordDescription (const std::string &name) const |
Get the description of a particular keyword. | |
std::string | getKeywordDocs (const std::string &key) const |
Get the documentation for a particular keyword. | |
std::string | getLinkedActions (const std::string &key) const |
Get any actions that are linked to this keyword. | |
bool | getLogicalDefault (const std::string &key, bool &def) const |
find out whether flag key is on or off by default. | |
const std::vector< std::string > & | getNeededKeywords () const |
Get the list of keywords that are needed by this action. | |
std::string | getOutputComponentDescription (const std::string &name) const |
Get the description of the named component. | |
std::string | getOutputComponentFlag (const std::string &name) const |
Get the flag that forces thie named component to be calculated. | |
const std::vector< std::string > & | getOutputComponents () const |
Get the full ordered list of output components. | |
std::string | getOutputComponentType (const std::string &name) const |
Get the type for the named output component. | |
std::string | getReplacementAction () const |
Get the action that should be used to replace this one if action has been deprecated. | |
std::string | getStyle (const std::string &k) const |
Get the type for the keyword with string k. | |
std::string | getTooltip (const std::string &name) const |
Get the description of a particular keyword. | |
bool | isActionNeeded (std::string_view name) const |
Check if the requested action is in the list of the needed actions. | |
bool | isActionSuffixed (std::string_view name, std::string_view basename) const |
checks that name is is a composition of basename and one of the possible suffixes | |
void | isAnalysis () |
void | isDriver () |
void | linkActionInDocs (const std::string &k, const std::string &action) |
Create a link to this action in the documentation for it. | |
void | needsAction (const std::string &name) |
Note that another actions is required to create this shortcut. | |
bool | numbered (const std::string &k) const |
Check if numbered keywords are allowed for this action. | |
bool | outputComponentExists (const std::string &name) const |
Has a component with this name been added? | |
void | print (FILE *out) const |
Print the documentation to a file (use by PLUMED::CLTool::readCommandLineArgs) | |
void | print (Log &log) const |
Print the documentation to the log file (used by PLMD::Action::error) | |
void | print_html () const |
Print an html version of the documentation. | |
void | print_spelling () const |
Print a file containing the list of keywords for a particular action (used for spell checking) | |
void | print_template (const std::string &actionname, bool include_optional) const |
Print the template version for the documentation. | |
void | print_vim () const |
Print keywords in form readable by vim. | |
void | remove (const std::string &k) |
Remove the keyword with name k. | |
void | removeOutputComponent (const std::string &name) |
Remove a component that can be output by this particular action. | |
void | reserve (std::string_view keytype, std::string_view key, std::string_view docstring) |
Reserve a keyword. | |
bool | reserved (std::string_view k) const |
Check the keyword k has been reserved. | |
void | reserveFlag (const std::string &key, bool defaultValue, const std::string &docstring) |
Reserve a flag. | |
void | reset_style (const std::string &k, const std::string &style) |
Change part of the style of a keyword. | |
void | setComponentsIntroduction (const std::string &instr) |
Set the text that introduces how the components for this action are introduced. | |
void | setDeprecated (const std::string &name) |
Note that this action has been deprecated. | |
void | setDisplayName (const std::string &name) |
Set the display name. | |
void | setValueDescription (componentType type, const std::string &descr) |
void | setValueDescription (const std::string &type, const std::string &descr) |
Add the description of the value. | |
unsigned | size () const |
Return the number of defined keywords. | |
bool | style (const std::string &k, const std::string &t) const |
Check if the keyword with name k has style t. | |
void | use (std::string_view k) |
Use one of the reserved keywords. | |
Private Member Functions | |
void | addOrReserve (std::string_view keytype, std::string_view key, std::string_view docstring, bool reserve) |
Add o reserve a new keyword (internal tool) | |
void | print_html_item (const std::string &) const |
Print the documentation for the named keyword in html. | |
Private Attributes | |
std::vector< std::string > | actionNameSuffixes |
List of suffixes that can be used with this action. | |
std::vector< std::string > | cnames |
The names of all the possible components for an action, in order of their (first) declaration. | |
std::map< std::string, component, std::less< void > > | components |
std::string | cstring |
The string that should be printed out to describe how the components work for this particular action. | |
std::vector< std::string > | doilist |
List of doi's that should appear in the manual. | |
bool | isaction =true |
Is this an action or driver (this bool affects what style==atoms does in print) | |
bool | isatoms =true |
This allows us to overwrite the behavior of the atoms type in analysis actions. | |
std::vector< std::string > | keys |
The names of the allowed keywords, in order of declaration. | |
std::map< std::string, keyInfo, std::less< void > > | keywords |
Stores the keywords along with their settings. | |
std::vector< std::string > | neededActions |
The list of actions that are needed by this action. | |
std::string | replaceaction ="none" |
The action to use in place of this deprecated action. | |
std::vector< std::string > | reserved_keys |
The names of the reserved keywords, in order of declaration. | |
std::string | thisactname |
The name of the action that has this set of keywords. | |
This class holds the keywords and their documentation.
|
strong |
|
strong |
|
inline |
Constructor.
void PLMD::Keywords::add | ( | const Keywords & | keys | ) |
append the data from another Keywords object (only keywords, reserved keywords and components)
void PLMD::Keywords::add | ( | std::string_view | keytype, |
std::string_view | key, | ||
std::string_view | defaultValue, | ||
std::string_view | docstring ) |
Add a new compulsory keyword (t must equal compulsory) with name k, default value def and description d.
void PLMD::Keywords::add | ( | std::string_view | keytype, |
std::string_view | key, | ||
std::string_view | docstring ) |
Add a new keyword of type t with name k and description d.
void PLMD::Keywords::addActionNameSuffix | ( | const std::string & | suffix | ) |
Add a suffix to the list of possible action name suffixes.
void PLMD::Keywords::addDOI | ( | const std::string & | doi | ) |
Add a DOI to the list in the manual page for this action.
void PLMD::Keywords::addFlag | ( | std::string_view | key, |
bool | defaultValue, | ||
std::string_view | docstring ) |
Add a falg with name k that is by default on if def is true and off if def is false. d should provide a description of the flag.
void PLMD::Keywords::addInputKeyword | ( | const std::string & | keyType, |
const std::string & | key, | ||
argType | dataType, | ||
const std::string & | defaultValue, | ||
const std::string & | docstring ) |
Create the documentation for a keyword that reads arguments.
void PLMD::Keywords::addInputKeyword | ( | const std::string & | keyType, |
const std::string & | key, | ||
argType | dataType, | ||
const std::string & | docstring ) |
Create the documentation for a keyword that reads arguments.
void PLMD::Keywords::addInputKeyword | ( | const std::string & | keyType, |
const std::string & | key, | ||
const std::string & | dataType, | ||
const std::string & | defaultValue, | ||
const std::string & | docstring ) |
Create the documentation for a keyword that reads arguments.
void PLMD::Keywords::addInputKeyword | ( | const std::string & | keyType, |
const std::string & | key, | ||
const std::string & | dataType, | ||
const std::string & | docstring ) |
Create the documentation for a keyword that reads arguments.
|
private |
Add o reserve a new keyword (internal tool)
void PLMD::Keywords::addOutputComponent | ( | const std::string & | name, |
const std::string & | key, | ||
componentType | type, | ||
const std::string & | descr ) |
Add a potential component which can be output by this particular action.
void PLMD::Keywords::addOutputComponent | ( | const std::string & | name, |
const std::string & | key, | ||
const std::string & | descr ) |
Add a potential component which can be output by this particular action.
void PLMD::Keywords::addOutputComponent | ( | const std::string & | name, |
const std::string & | key, | ||
const std::string & | type, | ||
const std::string & | descr ) |
bool PLMD::Keywords::checkArgumentType | ( | const std::size_t & | rank, |
const bool & | hasderiv ) const |
Check the documentation of the argument types.
bool PLMD::Keywords::componentHasCorrectType | ( | const std::string & | name, |
const std::size_t & | rank, | ||
const bool & | hasderiv ) const |
Check that type for component has been documented correctly.
void PLMD::Keywords::destroyData | ( | ) |
Clear everything from the keywords object.
Not actually needed if your Keywords object is going out of scope.
bool PLMD::Keywords::exists | ( | std::string_view | k | ) | const |
Check if there is a keyword with name k.
std::vector< std::string > PLMD::Keywords::getArgumentKeys | ( | ) | const |
std::string PLMD::Keywords::getArgumentType | ( | const std::string & | name | ) | const |
Get the valid types that can be used as argument for this keyword.
bool PLMD::Keywords::getDefaultValue | ( | const std::string & | key, |
std::string & | def ) const |
Get the value of the default for the keyword named key.
std::string PLMD::Keywords::getDisplayName | ( | ) | const |
Return the name of the action that has this set of keywords.
const std::vector< std::string > & PLMD::Keywords::getDOIList | ( | ) | const |
Get the list of DOI.
std::string PLMD::Keywords::getHelpString | ( | ) | const |
Get the help string.
|
inline |
Get the ordered list of active keywords (not the reserved ones)
std::string PLMD::Keywords::getKeyword | ( | const unsigned | i | ) | const |
Return the ith keyword.
std::string PLMD::Keywords::getKeywordDescription | ( | const std::string & | name | ) | const |
Get the description of a particular keyword.
std::string PLMD::Keywords::getKeywordDocs | ( | const std::string & | key | ) | const |
Get the documentation for a particular keyword.
std::string PLMD::Keywords::getLinkedActions | ( | const std::string & | key | ) | const |
Get any actions that are linked to this keyword.
bool PLMD::Keywords::getLogicalDefault | ( | const std::string & | key, |
bool & | def ) const |
find out whether flag key is on or off by default.
const std::vector< std::string > & PLMD::Keywords::getNeededKeywords | ( | ) | const |
Get the list of keywords that are needed by this action.
std::string PLMD::Keywords::getOutputComponentDescription | ( | const std::string & | name | ) | const |
Get the description of the named component.
std::string PLMD::Keywords::getOutputComponentFlag | ( | const std::string & | name | ) | const |
Get the flag that forces thie named component to be calculated.
|
inline |
Get the full ordered list of output components.
std::string PLMD::Keywords::getOutputComponentType | ( | const std::string & | name | ) | const |
Get the type for the named output component.
std::string PLMD::Keywords::getReplacementAction | ( | ) | const |
Get the action that should be used to replace this one if action has been deprecated.
std::string PLMD::Keywords::getStyle | ( | const std::string & | k | ) | const |
Get the type for the keyword with string k.
std::string PLMD::Keywords::getTooltip | ( | const std::string & | name | ) | const |
Get the description of a particular keyword.
bool PLMD::Keywords::isActionNeeded | ( | std::string_view | name | ) | const |
Check if the requested action is in the list of the needed actions.
bool PLMD::Keywords::isActionSuffixed | ( | std::string_view | name, |
std::string_view | basename ) const |
checks that name is is a composition of basename and one of the possible suffixes
Cycles on the registered suffixed and return true if the combination basename+suffix
equals to the passed name
|
inline |
|
inline |
void PLMD::Keywords::linkActionInDocs | ( | const std::string & | k, |
const std::string & | action ) |
Create a link to this action in the documentation for it.
void PLMD::Keywords::needsAction | ( | const std::string & | name | ) |
Note that another actions is required to create this shortcut.
bool PLMD::Keywords::numbered | ( | const std::string & | k | ) | const |
Check if numbered keywords are allowed for this action.
bool PLMD::Keywords::outputComponentExists | ( | const std::string & | name | ) | const |
Has a component with this name been added?
void PLMD::Keywords::print | ( | FILE * | out | ) | const |
Print the documentation to a file (use by PLUMED::CLTool::readCommandLineArgs)
void PLMD::Keywords::print | ( | Log & | log | ) | const |
Print the documentation to the log file (used by PLMD::Action::error)
void PLMD::Keywords::print_html | ( | ) | const |
Print an html version of the documentation.
|
private |
Print the documentation for the named keyword in html.
void PLMD::Keywords::print_spelling | ( | ) | const |
Print a file containing the list of keywords for a particular action (used for spell checking)
void PLMD::Keywords::print_template | ( | const std::string & | actionname, |
bool | include_optional ) const |
Print the template version for the documentation.
void PLMD::Keywords::print_vim | ( | ) | const |
Print keywords in form readable by vim.
void PLMD::Keywords::remove | ( | const std::string & | k | ) |
Remove the keyword with name k.
void PLMD::Keywords::removeOutputComponent | ( | const std::string & | name | ) |
Remove a component that can be output by this particular action.
void PLMD::Keywords::reserve | ( | std::string_view | keytype, |
std::string_view | key, | ||
std::string_view | docstring ) |
Reserve a keyword.
bool PLMD::Keywords::reserved | ( | std::string_view | k | ) | const |
Check the keyword k has been reserved.
void PLMD::Keywords::reserveFlag | ( | const std::string & | key, |
bool | defaultValue, | ||
const std::string & | docstring ) |
Reserve a flag.
void PLMD::Keywords::reset_style | ( | const std::string & | k, |
const std::string & | style ) |
Change part of the style of a keyword.
The standard usecase for this method is creating a compulsory or an atom(s) numbered keyword. For example:
true
void PLMD::Keywords::setComponentsIntroduction | ( | const std::string & | instr | ) |
Set the text that introduces how the components for this action are introduced.
void PLMD::Keywords::setDeprecated | ( | const std::string & | name | ) |
Note that this action has been deprecated.
void PLMD::Keywords::setDisplayName | ( | const std::string & | name | ) |
Set the display name.
void PLMD::Keywords::setValueDescription | ( | componentType | type, |
const std::string & | descr ) |
void PLMD::Keywords::setValueDescription | ( | const std::string & | type, |
const std::string & | descr ) |
Add the description of the value.
unsigned PLMD::Keywords::size | ( | ) | const |
Return the number of defined keywords.
bool PLMD::Keywords::style | ( | const std::string & | k, |
const std::string & | t ) const |
Check if the keyword with name k has style t.
void PLMD::Keywords::use | ( | std::string_view | k | ) |
Use one of the reserved keywords.
this "copies" a reserved key into the keylist so it can be used
|
private |
List of suffixes that can be used with this action.
|
private |
The names of all the possible components for an action, in order of their (first) declaration.
|
private |
|
private |
The string that should be printed out to describe how the components work for this particular action.
|
private |
List of doi's that should appear in the manual.
|
private |
Is this an action or driver (this bool affects what style==atoms does in print)
|
private |
This allows us to overwrite the behavior of the atoms type in analysis actions.
|
private |
The names of the allowed keywords, in order of declaration.
|
private |
Stores the keywords along with their settings.
|
private |
The list of actions that are needed by this action.
|
private |
The action to use in place of this deprecated action.
|
private |
The names of the reserved keywords, in order of declaration.
|
private |
The name of the action that has this set of keywords.
Hosted by GitHub
![]() |
![]() |