take advantage of having the common Command base class to unify code paths

This commit is contained in:
Axel Kohlmeyer
2021-04-14 07:05:00 -04:00
parent 81578d9934
commit 75579fc100
47 changed files with 83 additions and 91 deletions

View File

@ -9,7 +9,7 @@
#include <cstring>
namespace LAMMPS_NS {
class Hello : protected Command {
class Hello : public Command {
public:
Hello(class LAMMPS *lmp) : Command(lmp) {};
void command(int, char **);
@ -25,10 +25,9 @@ void Hello::command(int argc, char **argv)
utils::logmesg(lmp,fmt::format("Hello, {}!\n",argv[0]));
}
static void hellocreator(LAMMPS *lmp, int argc, char **argv)
static Command *hellocreator(LAMMPS *lmp)
{
Hello hello(lmp);
hello.command(argc,argv);
return new Hello(lmp);
}
extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc)
@ -39,9 +38,9 @@ extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc)
plugin.version = LAMMPS_VERSION;
plugin.style = "command";
plugin.name = "hello";
plugin.info = "Hello world command v1.0";
plugin.info = "Hello world command v1.1";
plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)";
plugin.creator.v3 = (lammpsplugin_factory3 *) &hellocreator;
plugin.creator.v1 = (lammpsplugin_factory1 *) &hellocreator;
plugin.handle = handle;
(*register_plugin)(&plugin,lmp);
}