|
| PlumedHandle () |
| Default constructor. More...
|
|
| PlumedHandle (PlumedHandle &&other) noexcept |
| Move constructor. More...
|
|
virtual | ~PlumedHandle () |
| Destructor. More...
|
|
void | cmd (const std::string &key, const TypesafePtr &ptr=nullptr) |
| Execute cmd. More...
|
|
void | cmd (const std::string &key, const TypesafePtr &val, const std::size_t *shape) |
|
void | cmd (const std::string &key, const TypesafePtr &val, const std::size_t *shape) |
| Bring in the possibility to pass shape/nelem. More...
|
|
void | cmd (const std::string &key, const TypesafePtr &val, std::size_t nelem, const std::size_t *shape=nullptr) |
|
void | cmd (const std::string &key, const TypesafePtr &val, std::size_t nelem, const std::size_t *shape=nullptr) |
| Bring in the possibility to pass shape/nelem. More...
|
|
virtual void | cmd (const std::string &key, const TypesafePtr &val=nullptr)=0 |
| Bring in the possibility to pass shape/nelem. More...
|
|
PlumedHandle & | operator= (PlumedHandle &&other) noexcept |
| Move assignment. More...
|
|
Tiny local class to load a PLUMED kernel.
Maps command to either a loaded PLUMED kernel or to the present one. It provides a wrapper around the official interface located at wrapper/Plumed.h, with some changes. Differences are:
- It does not use the
PLUMED_KERNEL
env var. Indeed, it would not make sense to use it, since this class is meant to load different kernels.
- It does not implement interoperability with C/FORTRAN interfaces.
- It does not implement global versions (e.g. PLMD::Plumed::gcmd).
- It does not implement PLMD::Plumed::valid. If kernel cannot be loaded, its constructor throws. This will make sure that once constructed the object is usable.
In its implementation, this class uses the PLMD::Plumed class in wrapper/Plumed.h and thus has the same capability to load PLUMED kernels of any version (starting with 2.0). It can also be created without passing any kernel path. In that case it refers to the current one (the one to which this class belongs).
The following syntax creates a handle referring to the current kernel
PlumedHandle p;
// Alternatively:
// auto p=PlumedHandle();
p.cmd("init");
The following syntax instead creates a handle referring to a loaded kernel
PlumedHandle p(PlumedHandle::dlopen("/path/to/libplumedkernel.so");
// Alternatively:
// auto p=PlumedHandle::dlopen("/path/to/libplumedkernel.so");
p.cmd("init");
Notice that if there are problems loading the kernel an exception is thrown. Thus, once constructed the object is guaranteed to be functional.