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) |
Print out the keywords for an action in html 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... | |
typedef std::map< std::string, creator_pointer >::iterator | mIterator |
Iterator over the map. More... | |
typedef std::map< std::string, creator_pointer > ::const_iterator | const_mIterator |
Iterator over the map. More... | |
typedef std::map< std::string, Keywords >::iterator | mIteratork |
Iterator over the map. More... | |
typedef std::map< std::string, Keywords >::const_iterator | const_mIteratork |
Iterator over the map. 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.
Definition at line 45 of file ActionRegister.h.
|
private |
Iterator over the map.
Definition at line 57 of file ActionRegister.h.
|
private |
Iterator over the map.
Definition at line 63 of file ActionRegister.h.
|
private |
Pointer to a function which, given the options, create an Action.
Definition at line 49 of file ActionRegister.h.
|
private |
Pointer to a function which, returns the keywords allowed.
Definition at line 51 of file ActionRegister.h.
|
private |
Iterator over the map.
Definition at line 55 of file ActionRegister.h.
|
private |
Iterator over the map.
Definition at line 61 of file ActionRegister.h.
PLMD::ActionRegister::~ActionRegister | ( | ) |
Definition at line 32 of file ActionRegister.cpp.
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 |
Definition at line 53 of file ActionRegister.cpp.
bool PLMD::ActionRegister::check | ( | std::string | action | ) |
Verify if a directive is present in the register.
Definition at line 66 of file ActionRegister.cpp.
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 |
Definition at line 71 of file ActionRegister.cpp.
bool PLMD::ActionRegister::printManual | ( | const std::string & | action | ) |
Print out the keywords for an action in html ready for input into the manual.
Definition at line 89 of file ActionRegister.cpp.
bool PLMD::ActionRegister::printTemplate | ( | const std::string & | action, |
bool | include_optional | ||
) |
Print out a template command for an action.
Definition at line 99 of file ActionRegister.cpp.
void PLMD::ActionRegister::remove | ( | creator_pointer | f | ) |
Definition at line 45 of file ActionRegister.cpp.
|
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
Definition at line 40 of file ActionRegister.cpp.
|
friend |
Write on a stream the list of registered directives.
Definition at line 109 of file ActionRegister.cpp.
|
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 |
Definition at line 103 of file ActionRegister.h.
|
private |
Set of disabled actions (which were registered more than once)
Definition at line 65 of file ActionRegister.h.
|
private |
Map action to a function which creates the related object.
Definition at line 53 of file ActionRegister.h.
|
private |
Map action to a function which documents the related object.
Definition at line 59 of file ActionRegister.h.
Hosted by GitHub
![]() |
![]() |