Register holding all the allowed keywords. More...
#include <ActionRegister.h>
Public Member Functions | |
ID | add (std::string key, const ActionRegisterPointers &content) |
Register a new class. More... | |
ID | add (std::string key, creator_pointer cp, keywords_pointer kp) |
bool | check (const std::string &key) const |
Verify if a key is present in the register, only considering the default image. More... | |
bool | check (const std::vector< void * > &images, const std::string &key) const |
Verify if a key is present in the register, accessing to registered images. More... | |
void | clearStaged () noexcept override |
Clear staged objects. More... | |
void | completeRegistration (void *handle) override |
complete registration all staged keys will be enabled Should be called after dlopen has been completed correctly. More... | |
std::unique_ptr< Action > | create (const ActionOptions &ao) |
Create an Action of the type indicated in the options. More... | |
std::unique_ptr< Action > | create (const std::vector< void * > &images, const ActionOptions &ao) |
const ActionRegisterPointers & | get (const std::string &key) const |
Return the content associated to a key in the register, only considering the default image. More... | |
const ActionRegisterPointers & | get (const std::vector< void * > &images, const std::string &key) const |
Return the content associated to a key in the register, accessing to registerd images. More... | |
std::vector< std::string > | getActionNames () const |
const std::string & | getFullPath (const std::vector< void * > &images, const std::string &key) const |
Return the full path associated to a key in the register, accessing to registerd images. More... | |
std::vector< std::string > | getKeys () const override |
Get a list of keys Notice that these are the keys in the map, not the plumed keywords! Also notice that this list includes keys from all images, including the textual version of the image void*. More... | |
std::vector< std::string > | getKeysWithDLHandle (void *handle) const |
Get only keys registered specifically by a given image. More... | |
bool | getKeywords (const std::string &action, Keywords &keys) |
Retrieve a keywords object for a particular action. More... | |
void | getKeywords (const std::vector< void * > &images, const std::string &action, Keywords &keys) |
bool | printManual (const std::string &action, const bool &vimout, const bool &spellout) |
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 (ID id) |
Remove a registered keyword. More... | |
Static Public Member Functions | |
static void | completeAllRegistrations (void *image) |
Save all staged objects in all registers. More... | |
static RegistrationLock | registrationLock (const std::string &fullpath) |
return a registration lock More... | |
Protected Member Functions | |
virtual std::vector< std::string > | getKeys () const =0 |
Get all registered keys. More... | |
Static Protected Member Functions | |
static const std::string | getRegisteringFullPath () noexcept |
Return the path of the currently-loading library. More... | |
static std::string | imageToString (void *image) |
Internal tool to format image addresses. More... | |
static bool | isDLRegistering () noexcept |
Check if we are in a dlopen section. More... | |
Protected Attributes | |
std::shared_mutex | mutex |
Mutex protecting access to map. More... | |
Private Types | |
typedef ActionRegisterPointers::creator_pointer | creator_pointer |
typedef ActionRegisterPointers::keywords_pointer | keywords_pointer |
typedef ActionRegisterPointers | Pointers |
Static Private Member Functions | |
static void | popDLRegistration () noexcept |
Finalize registration - only used by registrationLock() More... | |
static void | pushDLRegistration (const std::string &fullpath) |
Initialize registration - only used by registrationLock() More... | |
Private Attributes | |
std::map< std::string, std::unique_ptr< ContentAndFullPath > > | m |
Main register map. More... | |
std::map< std::string, std::unique_ptr< ContentAndFullPath > > | staged_m |
Map of staged keys. 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
|
private |
|
private |
|
private |
|
inherited |
Register a new class.
key | The name of the directive to be used in the input file |
content | The registered content |
ID | A returned ID that can be used to remove the directive later |
ActionRegister::ID PLMD::ActionRegister::add | ( | std::string | key, |
creator_pointer | cp, | ||
keywords_pointer | kp | ||
) |
|
inherited |
Verify if a key is present in the register, only considering the default image.
|
inherited |
Verify if a key is present in the register, accessing to registered images.
|
overridevirtualnoexceptinherited |
Clear staged objects.
Should be used when leaving the dlopen section to remove any dangling object.
Implements PLMD::Register.
|
staticinherited |
Save all staged objects in all registers.
|
overridevirtualinherited |
complete registration all staged keys will be enabled Should be called after dlopen has been completed correctly.
Implements PLMD::Register.
std::unique_ptr< 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 |
std::unique_ptr< Action > PLMD::ActionRegister::create | ( | const std::vector< void * > & | images, |
const ActionOptions & | ao | ||
) |
|
inherited |
Return the content associated to a key in the register, only considering the default image.
|
inherited |
Return the content associated to a key in the register, accessing to registerd images.
std::vector< std::string > PLMD::ActionRegister::getActionNames | ( | ) | const |
|
inherited |
Return the full path associated to a key in the register, accessing to registerd images.
|
protectedpure virtualinherited |
Get all registered keys.
These are the keys in the map, not the plumed keywords!
Implemented in PLMD::RegisterBase< Content >.
|
overrideinherited |
Get a list of keys Notice that these are the keys in the map, not the plumed keywords! Also notice that this list includes keys from all images, including the textual version of the image void*.
|
inherited |
Get only keys registered specifically by a given image.
bool PLMD::ActionRegister::getKeywords | ( | const std::string & | action, |
Keywords & | keys | ||
) |
Retrieve a keywords object for a particular action.
void PLMD::ActionRegister::getKeywords | ( | const std::vector< void * > & | images, |
const std::string & | action, | ||
Keywords & | keys | ||
) |
|
staticprotectednoexceptinherited |
Return the path of the currently-loading library.
|
staticprotectedinherited |
Internal tool to format image addresses.
|
staticprotectednoexceptinherited |
Check if we are in a dlopen section.
|
staticprivatenoexceptinherited |
Finalize registration - only used by registrationLock()
bool PLMD::ActionRegister::printManual | ( | const std::string & | action, |
const bool & | vimout, | ||
const bool & | spellout | ||
) |
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.
|
staticprivateinherited |
Initialize registration - only used by registrationLock()
|
staticinherited |
return a registration lock
|
inherited |
Remove a registered keyword.
Use the ID returned by add().
|
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
|
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 |
|
privateinherited |
Main register map.
|
mutableprotectedinherited |
Mutex protecting access to map.
|
privateinherited |
Map of staged keys.
Hosted by GitHub | 1.8.17 |