X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=blobdiff_plain;f=src%2Fgromacs%2Ftrajectoryanalysis%2Fcmdlinerunner.h;fp=src%2Fgromacs%2Ftrajectoryanalysis%2Fcmdlinerunner.h;h=54f945560c6034b5ea375c007f7b138e4bcb0218;hb=92925bf48cb36ab98d2e058ca92e5fc4b17dbdad;hp=0b703ea268485300ab0d70954064217634a8870d;hpb=c3f2d46e4047f0c465f7234b3784a2fa6f02a065;p=alexxy%2Fgromacs.git diff --git a/src/gromacs/trajectoryanalysis/cmdlinerunner.h b/src/gromacs/trajectoryanalysis/cmdlinerunner.h index 0b703ea268..54f945560c 100644 --- a/src/gromacs/trajectoryanalysis/cmdlinerunner.h +++ b/src/gromacs/trajectoryanalysis/cmdlinerunner.h @@ -43,6 +43,7 @@ #ifndef GMX_TRAJECTORYANALYSIS_CMDLINERUNNER_H #define GMX_TRAJECTORYANALYSIS_CMDLINERUNNER_H +#include "gromacs/commandline/cmdlineoptionsmodule.h" #include "gromacs/trajectoryanalysis/analysismodule.h" #include "gromacs/utility/classhelpers.h" @@ -64,7 +65,7 @@ class CommandLineHelpContext; * \inpublicapi * \ingroup module_trajectoryanalysis */ -class TrajectoryAnalysisCommandLineRunner +class TrajectoryAnalysisCommandLineRunner : public ICommandLineOptionsModule { public: /*! \brief @@ -158,15 +159,19 @@ class TrajectoryAnalysisCommandLineRunner ModuleFactoryMethod factory); /*! \brief - * Create a new runner with the provided module. + * Constructs a module. * - * \param module Analysis module to run using the runner. - * \throws std::bad_alloc if out of memory. + * \param[in] factory Factory method to create the analysis module. * - * The caller should ensure that the provided module is not destroyed - * while the runner exists. + * Does not throw. This is important for correct implementation of + * runAsMain(). */ - TrajectoryAnalysisCommandLineRunner(TrajectoryAnalysisModule *module); + TrajectoryAnalysisCommandLineRunner(ModuleFactoryMethod factory); + + /*! \brief + * Overloaded constructor accepting a functor instead of function pointer. + */ + TrajectoryAnalysisCommandLineRunner(ModuleFactoryFunctor *factory); ~TrajectoryAnalysisCommandLineRunner(); /*! \brief @@ -191,21 +196,13 @@ class TrajectoryAnalysisCommandLineRunner * \see SelectionCollection::setDebugLevel() */ void setSelectionDebugLevel(int debuglevel); - /*! \brief - * Parses options from the given command line and runs the analysis. - * - * \throws multiple Exceptions are used to indicate errors. - * \returns Zero on success. - */ - int run(int argc, char *argv[]); - /*! \brief - * Prints help for the module, including common options from the runner. - * - * \param[in] context Context object for writing the help. - * \throws std::bad_alloc if out of memory. - * \throws FileIOError on any I/O error. - */ - void writeHelp(const CommandLineHelpContext &context); + + // From ICommandLineOptionsModule + virtual void init(CommandLineModuleSettings *settings); + void initOptions(IOptionsContainer *options, + ICommandLineOptionsModuleSettings *settings); + void optionsFinished(); + int run(); //! Implements the template runAsMain() method. static int runAsMain(int argc, char *argv[],