|
| PlumedHandle () |
| Default constructor. More...
|
|
| PlumedHandle (PlumedHandle &&other) noexcept |
| Move constructor. More...
|
|
virtual | ~PlumedHandle () |
| Destructor. More...
|
|
void | cmd (const char *key, const TypesafePtr &val=nullptr) |
| This is needed to avoid ambiguities. More...
|
|
void | cmd (const char *key, const TypesafePtr &val=nullptr) |
| Bring in the possibility to pass shape/nelem. More...
|
|
virtual void | cmd (const std::string &key, const TypesafePtr &val=nullptr) |
| This is the legacy method we used in older plumed versions, so it is still possible. More...
|
|
virtual void | cmd (const std::string &key, const TypesafePtr &val=nullptr) |
| Bring in the possibility to pass shape/nelem. More...
|
|
void | cmd (std::string_view key, const TypesafePtr &ptr) override |
| Execute cmd. More...
|
|
void | cmd (std::string_view key, const TypesafePtr &val, const std::size_t *shape) |
|
void | cmd (std::string_view key, const TypesafePtr &val, const std::size_t *shape) |
| Bring in the possibility to pass shape/nelem. More...
|
|
template<typename I , typename std::enable_if< std::is_integral< I >::value, int >::type = 0> |
void | cmd (std::string_view key, const TypesafePtr &val, I nelem, const std::size_t *shape=nullptr) |
|
template<typename I , typename std::enable_if< std::is_integral< I >::value, int >::type = 0> |
void | cmd (std::string_view key, const TypesafePtr &val, I nelem, const std::size_t *shape=nullptr) |
| Bring in the possibility to pass shape/nelem. More...
|
|
void | cmd (std::string_view key, const TypesafePtr &val, std::initializer_list< SizeLike > shape) |
|
void | cmd (std::string_view key, const TypesafePtr &val, std::initializer_list< SizeLike > shape) |
| Bring in the possibility to pass shape/nelem. More...
|
|
virtual void | cmd (std::string_view key, const TypesafePtr &val=nullptr) |
| 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.