#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"
* \inpublicapi
* \ingroup module_trajectoryanalysis
*/
-class TrajectoryAnalysisCommandLineRunner
+class TrajectoryAnalysisCommandLineRunner : public ICommandLineOptionsModule
{
public:
/*! \brief
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
* \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[],