Sort all includes in src/gromacs
[alexxy/gromacs.git] / src / gromacs / trajectoryanalysis / cmdlinerunner.h
index fefb93ef9b3c63a3da8355269f2e3fb35e7b4534..242a6299598ac69d784c4b832bb5f5245377ce11 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2010,2011,2012,2013, by the GROMACS development team, led by
- * David van der Spoel, Berk Hess, Erik Lindahl, and including many
- * others, as listed in the AUTHORS file in the top-level source
- * directory and at http://www.gromacs.org.
+ * Copyright (c) 2010,2011,2012,2013,2014, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
  *
  * GROMACS is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
 #ifndef GMX_TRAJECTORYANALYSIS_CMDLINERUNNER_H
 #define GMX_TRAJECTORYANALYSIS_CMDLINERUNNER_H
 
-#include "../utility/common.h"
-#include "../utility/uniqueptr.h"
+#include "gromacs/trajectoryanalysis/analysismodule.h"
+#include "gromacs/utility/common.h"
 
 namespace gmx
 {
 
 class CommandLineModuleManager;
 class CommandLineHelpContext;
-class TrajectoryAnalysisModule;
 
 /*! \brief
  * Runner class for command-line analysis tools.
@@ -68,6 +67,16 @@ class TrajectoryAnalysisModule;
 class TrajectoryAnalysisCommandLineRunner
 {
     public:
+        /*! \brief
+         * Factory method type for creating a trajectory analysis module.
+         *
+         * This method allows the module creation to be postponed to be inside
+         * the try/catch block in runAsMain()/registerModule() implementation
+         * methods and still keep the implementation out of the header, making
+         * the ABI more stable.
+         */
+        typedef TrajectoryAnalysisModulePointer (*ModuleFactoryMethod)();
+
         /*! \brief
          * Implements a main() method that runs a given module.
          *
@@ -109,6 +118,24 @@ class TrajectoryAnalysisCommandLineRunner
         {
             registerModule(manager, name, description, &createModule<ModuleType>);
         }
+        /*! \brief
+         * Registers a command-line module that runs a given module.
+         *
+         * \tparam ModuleType  Trajectory analysis module.
+         * \param  manager     Manager to register the module to.
+         * \param  name        Name of the module to register.
+         * \param  description One-line description for the module to register.
+         * \param  factory     Function that creates the module on demand.
+         *
+         * \p name and \p descriptions must be string constants or otherwise
+         * stay valid for the duration of the program execution.
+         *
+         * Implements the template registerModule() method, but can also be
+         * used independently.
+         */
+        static void registerModule(CommandLineModuleManager *manager,
+                                   const char *name, const char *description,
+                                   ModuleFactoryMethod factory);
 
         /*! \brief
          * Create a new runner with the provided module.
@@ -122,9 +149,21 @@ class TrajectoryAnalysisCommandLineRunner
         TrajectoryAnalysisCommandLineRunner(TrajectoryAnalysisModule *module);
         ~TrajectoryAnalysisCommandLineRunner();
 
+        /*! \brief
+         * Sets whether default index groups are initialized.
+         *
+         * This is intended only for internal unit testing purposes to avoid
+         * repeated, unnecessary initialization of the default groups, which
+         * can be expensive under, e.g., valgrind.
+         *
+         * Does not throw.
+         */
+        void setUseDefaultGroups(bool bUseDefaults);
         /*! \brief
          * Sets the default debugging level for selections.
          *
+         * \param[in] debuglevel  Level of debugging verbosity.
+         *
          * This is intended only for use by internal debugging tools.
          *
          * Does not throw.
@@ -149,19 +188,6 @@ class TrajectoryAnalysisCommandLineRunner
         void writeHelp(const CommandLineHelpContext &context);
 
     private:
-        //! Smart pointer type for managing a trajectory analysis module.
-        typedef gmx_unique_ptr<TrajectoryAnalysisModule>::type
-            TrajectoryAnalysisModulePointer;
-
-        /*! \brief
-         * Factory method type for creating a trajectory analysis module.
-         *
-         * This method allows the module creation to be postponed to be inside
-         * the try/catch block in runAsMain()/registerModule() implementation
-         * methods and still keep the implementation out of the header, making
-         * the ABI more stable.
-         */
-        typedef TrajectoryAnalysisModulePointer (*ModuleFactoryMethod)();
         /*! \brief
          * Creates a trajectory analysis module of a given type.
          *
@@ -176,10 +202,6 @@ class TrajectoryAnalysisCommandLineRunner
         //! Implements the template runAsMain() method.
         static int runAsMain(int argc, char *argv[],
                              ModuleFactoryMethod factory);
-        //! Implements the template registerModule() method.
-        static void registerModule(CommandLineModuleManager *manager,
-                                   const char *name, const char *description,
-                                   ModuleFactoryMethod factory);
 
         class Impl;