|
| CLToolMain () |
|
| ~CLToolMain () |
|
void | cmd (const char *key, const TypesafePtr &val=nullptr) |
| This is needed to avoid ambiguities. 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...
|
|
void | cmd (std::string_view key, const TypesafePtr &val, const std::size_t *shape) |
|
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) |
|
void | cmd (std::string_view key, const TypesafePtr &val, std::initializer_list< SizeLike > shape) |
|
void | cmd (std::string_view key, const TypesafePtr &val=nullptr) override |
| Send messages to the CLToolMain. More...
|
|
Class providing cmd() access to command line tools.
This class provides an interface using the "cmd()" syntax to all the command-line tools. It is only accessed via the cmd() function, which can be used to set the arguments, communicators and IO descriptors and to run the tool. It can run all the tools registered via the PLUMED_REGISTER_CLTOOL macro, or the scripts which are located in PLUMED_ROOT/scripts.
A typical usage is:
#include "CLToolMain.h"
int main(int argc,char**argv){
PLMD::CLToolMain cltoolMain;
cltoolMain.cmd("setArgc",&argc);
cltoolMain.cmd("setArgv",argv);
int ret;
cltoolMain.cmd("run",&ret);
return ret;
}
This will run the tool registered with name argv[1] with options argv[2]...argv[argc-1].
This class is also used in the PlumedMain class to provide the same functionalities through the external plumed interface, which is available also for C and FORTRAN. Thus, the preferred approach is to do something like
#include "Plumed.h"
int main(int argc,char**argv){
PLMD::Plumed p;
p.cmd("CLTool setArgc",&argc);
p.cmd("CLTool setArgv",argv);
int ret;
p.cmd("CLTool run",&ret);
return ret;
}
See the file main.cpp for a similar example.