Register holding all the allowed keywords. More...
#include <ActionRegister.h>
Public Member Functions | |
void | add (std::string key, creator_pointer cp, keywords_pointer kp) |
Register a new class. More... | |
bool | check (std::string action) |
Verify if a directive is present in the register. More... | |
Action * | create (const ActionOptions &ao) |
Create an Action of the type indicated in the options. More... | |
bool | printManual (const std::string &action, const bool &vimout) |
Print out the keywords for an action in html/vim ready for input into the manual. More... | |
bool | printTemplate (const std::string &action, bool include_optional) |
Print out a template command for an action. More... | |
void | remove (creator_pointer) |
~ActionRegister () | |
Private Types | |
typedef Action *(* | creator_pointer) (const ActionOptions &) |
Pointer to a function which, given the options, create an Action. More... | |
typedef void(* | keywords_pointer) (Keywords &) |
Pointer to a function which, returns the keywords allowed. More... | |
Private Attributes | |
std::map< std::string, creator_pointer > | m |
Map action to a function which creates the related object. More... | |
std::map< std::string, keywords_pointer > | mk |
Map action to a function which documents the related object. More... | |
std::set< std::string > | disabled |
Set of disabled actions (which were registered more than once) More... | |
Friends | |
std::ostream & | operator<< (std::ostream &, const ActionRegister &) |
Write on a stream the list of registered directives. More... | |
Related Functions | |
(Note that these are not member functions.) | |
ActionRegister & | actionRegister () |
Function returning a reference to the ActionRegister. More... | |
#define | PLUMED_REGISTER_ACTION(classname, directive) |
Shortcut for Action registration. More... | |
Register holding all the allowed keywords.
This is a register which holds a map between strings (directives) and function pointers. The function pointers are pointing to functions which create an object of the corresponding class given the corresponding options (ActionOptions). There should be only one of there objects allocated. Actions should be registered here at the beginning of execution If the same directive is used for different classes, it is automatically disabled to avoid random results.
|
private |
Pointer to a function which, given the options, create an Action.
|
private |
Pointer to a function which, returns the keywords allowed.
PLMD::ActionRegister::~ActionRegister | ( | ) |
void PLMD::ActionRegister::add | ( | std::string | key, |
creator_pointer | cp, | ||
keywords_pointer | kp | ||
) |
Register a new class.
key | The name of the directive to be used in the input file |
cp | A pointer to a function which creates an object of that class |
kp | A pointer to a function which returns the allowed keywords |
bool PLMD::ActionRegister::check | ( | std::string | action | ) |
Verify if a directive is present in the register.
Action * PLMD::ActionRegister::create | ( | const ActionOptions & | ao | ) |
Create an Action of the type indicated in the options.
ao | object containing information for initialization, such as the full input line, a pointer to PlumedMain, etc |
bool PLMD::ActionRegister::printManual | ( | const std::string & | action, |
const bool & | vimout | ||
) |
Print out the keywords for an action in html/vim ready for input into the manual.
bool PLMD::ActionRegister::printTemplate | ( | const std::string & | action, |
bool | include_optional | ||
) |
Print out a template command for an action.
void PLMD::ActionRegister::remove | ( | creator_pointer | f | ) |
|
related |
Function returning a reference to the ActionRegister.
To avoid problems with order of initialization, this function contains a static ActionRegister which is built the first time the function is called. In this manner, it is always initialized before it's used
|
friend |
Write on a stream the list of registered directives.
|
related |
Shortcut for Action registration.
For easier registration, this file also provides a macro PLUMED_REGISTER_ACTION.
classname | the name of the class to be registered |
directive | a string containing the corresponding directive This macro should be used in the .cpp file of the corresponding class |
|
private |
Set of disabled actions (which were registered more than once)
|
private |
Map action to a function which creates the related object.
|
private |
Map action to a function which documents the related object.
Hosted by GitHub | 1.8.14 |