Same as ActionRegister, but for CLTools. More...
#include <CLToolRegister.h>
Public Member Functions | |
ID | add (std::string key, const CLToolRegisterPointers &content) |
Register a new class. More... | |
ID | add (std::string key, creator_pointer cp, keywords_pointer kp) |
Register a new class. More... | |
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< CLTool > | create (const CLToolOptions &ao) |
Create an CLTool of the type indicated in the options. More... | |
std::unique_ptr< CLTool > | create (const std::vector< void * > &images, const CLToolOptions &ao) |
const CLToolRegisterPointers & | get (const std::string &key) const |
Return the content associated to a key in the register, only considering the default image. More... | |
const CLToolRegisterPointers & | 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... | |
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 > | getKeys (const std::string &cltool) const |
Return all the keys of this cltool. More... | |
std::vector< std::string > | getKeysWithDLHandle (void *handle) const |
Get only keys registered specifically by a given image. More... | |
std::vector< std::string > | list () const |
Returns a list of the allowed CLTools. More... | |
bool | printManual (const std::string &cltool, const bool &spelling) |
Print out the instructions for using the tool in html ready for input into the manual. 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 CLToolRegisterPointers::creator_pointer | creator_pointer |
typedef CLToolRegisterPointers::keywords_pointer | keywords_pointer |
typedef CLToolRegisterPointers | 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.) | |
CLToolRegister & | cltoolRegister () |
Function returning a reference to the CLToolRegister. More... | |
#define | PLUMED_REGISTER_CLTOOL(classname, directive) |
Shortcut for CLTool registration. More... | |
Same as ActionRegister, but for CLTools.
|
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 |
CLToolRegister::ID PLMD::CLToolRegister::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 |
|
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< CLTool > PLMD::CLToolRegister::create | ( | const CLToolOptions & | ao | ) |
Create an CLTool 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< CLTool > PLMD::CLToolRegister::create | ( | const std::vector< void * > & | images, |
const CLToolOptions & | 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.
|
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*.
std::vector< std::string > PLMD::CLToolRegister::getKeys | ( | const std::string & | cltool | ) | const |
Return all the keys of this cltool.
|
inherited |
Get only keys registered specifically by a given image.
|
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.
std::vector< std::string > PLMD::CLToolRegister::list | ( | ) | const |
Returns a list of the allowed CLTools.
|
staticprivatenoexceptinherited |
Finalize registration - only used by registrationLock()
bool PLMD::CLToolRegister::printManual | ( | const std::string & | cltool, |
const bool & | spelling | ||
) |
Print out the instructions for using the tool in html ready for input into the manual.
|
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 CLToolRegister.
To avoid problems with order of initialization, this function contains a static CLToolRegister which is built the first time the function is called. In this manner, it is always initialized before it's used
|
related |
Shortcut for CLTool registration.
For easier registration, this file also provides a macro PLUMED_REGISTER_CLTOOL.
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 |