Class providing cmd() access to command line tools. More...
#include <CLToolMain.h>
Public Member Functions | |
CLToolMain () | |
~CLToolMain () | |
void | cmd (const std::string &key, void *val=NULL) |
Send messages to the CLToolMain. More... | |
void | cmd (const std::string &key, const void *val) |
Const val version, which indeed just overrides the const and call the virtual method. More... | |
Static Private Member Functions | |
static int | run (int argc, char **argv, FILE *in, FILE *out, Communicator &pc) |
This is the entry point to the command line tools included in the plumed library. More... | |
Private Attributes | |
int | argc |
arguments for command-line mode: More... | |
std::vector< std::string > | argv |
arguments for command-line mode: More... | |
FILE * | in |
FILE * | out |
Communicator & | comm |
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.
PLMD::CLToolMain::CLToolMain | ( | ) |
PLMD::CLToolMain::~CLToolMain | ( | ) |
|
inlineinherited |
Const val version, which indeed just overrides the const and call the virtual method.
|
virtual |
Send messages to the CLToolMain.
Implements PLMD::WithCmd.
|
staticprivate |
This is the entry point to the command line tools included in the plumed library.
|
private |
arguments for command-line mode:
|
private |
arguments for command-line mode:
|
private |
|
private |
|
private |
Hosted by GitHub | 1.8.7 |