Sort all includes in src/gromacs
[alexxy/gromacs.git] / src / gromacs / commandline / cmdlineprogramcontext.h
index f2a2f215abe2ff6ba7be9f1b2ab6d9d514d52ca6..bfcc17322c5b6e7f192d5b4b61961d402a273aac 100644 (file)
  */
 /*! \file
  * \brief
- * Declares gmx::ProgramInfo.
+ * Declares gmx::CommandLineProgramContext.
  *
  * This header is installed to support cmdlineinit.h because some compilers
  * don't allow returning a reference to an incomplete type from a function.
- * It should not be necessary to use gmx::ProgramInfo outside the Gromacs
- * library.
+ * It should not be necessary to use gmx::CommandLineProgramContext outside the
+ * \Gromacs library.
  *
  * \author Teemu Murtola <teemu.murtola@gmail.com>
  * \inlibraryapi
 #include <string>
 #include <vector>
 
-#include "../utility/common.h"
-#include "../utility/programcontext.h"
-#include "../utility/uniqueptr.h"
+#include <boost/shared_ptr.hpp>
+
+#include "gromacs/utility/common.h"
+#include "gromacs/utility/programcontext.h"
 
 namespace gmx
 {
@@ -63,11 +64,11 @@ namespace gmx
 
 /*! \libinternal \brief
  * Allows customization of the way various directories are found by
- * ProgramInfo.
+ * CommandLineProgramContext.
  *
- * For the ProgramInfo constructors that do not take this interface as a
- * parameter, a default implementation is used that forwards the calls to the
- * corresponding methods in gmx::Path.
+ * For the CommandLineProgramContext constructors that do not take this
+ * interface as a parameter, a default implementation is used that forwards
+ * the calls to the corresponding methods in gmx::Path.
  *
  * \inlibraryapi
  */
@@ -90,16 +91,17 @@ class ExecutableEnvironmentInterface
 };
 
 //! Shorthand for a smart pointer to ExecutableEnvironmentInterface.
-typedef gmx_unique_ptr<ExecutableEnvironmentInterface>::type
+typedef boost::shared_ptr<ExecutableEnvironmentInterface>
     ExecutableEnvironmentPointer;
 
 /*! \libinternal \brief
- * Helper class for managing information about the running binary.
+ * Program context implementation for command line programs.
  *
  * Constructors are provided mostly for unit testing purposes; in normal usage,
- * a single ProgramInfo object is constructed with init() in the beginning of
- * the program.  The returned object can be explicitly passed to other methods,
- * or accessed through getInstance().
+ * a single CommandLineProgramContext object is constructed with
+ * initForCommandLine() in the beginning of the program.
+ * The returned object can be explicitly passed to other methods, or accessed
+ * through getProgramContext().
  *
  * Unless explicitly noted otherwise, methods in this class may throw
  * std::bad_alloc on out-of-memory conditions, but do not throw other
@@ -107,17 +109,17 @@ typedef gmx_unique_ptr<ExecutableEnvironmentInterface>::type
  *
  * \inlibraryapi
  */
-class ProgramInfo : public ProgramContextInterface
+class CommandLineProgramContext : public ProgramContextInterface
 {
     public:
         /*! \brief
-         * Constructs an empty program info objects.
+         * Constructs an empty context object.
          *
          * All methods in the constructed object return dummy values.
          */
-        ProgramInfo();
+        CommandLineProgramContext();
         /*! \brief
-         * Initializes a program information object with binary name only.
+         * Initializes a program context object with binary name only.
          *
          * \param[in] binaryName  Name of the binary.
          *
@@ -125,17 +127,16 @@ class ProgramInfo : public ProgramContextInterface
          * The constructed object works as if the command line consisted of
          * only of the binary name.
          */
-        explicit ProgramInfo(const char *binaryName);
+        explicit CommandLineProgramContext(const char *binaryName);
         /*! \brief
-         * Initializes a program information object based on command line.
+         * Initializes a program context object based on command line.
          *
          * \param[in] argc  argc value passed to main().
          * \param[in] argv  argv array passed to main().
          */
-        ProgramInfo(int argc, const char *const argv[]);
+        CommandLineProgramContext(int argc, const char *const argv[]);
         /*! \brief
-         * Initializes a program information object based on binary name and
-         * command line.
+         * Initializes a program context object based on command line.
          *
          * \param[in] argc  argc value passed to main().
          * \param[in] argv  argv array passed to main().
@@ -150,9 +151,9 @@ class ProgramInfo : public ProgramContextInterface
          * into a non-Gromacs executable (with possible extensions in
          * ExecutableEnvironmentInterface).
          */
-        ProgramInfo(int argc, const char *const argv[],
-                    ExecutableEnvironmentPointer env);
-        virtual ~ProgramInfo();
+        CommandLineProgramContext(int argc, const char *const argv[],
+                                  ExecutableEnvironmentPointer env);
+        virtual ~CommandLineProgramContext();
 
         /*! \brief
          * Sets a display name for the binary.
@@ -186,21 +187,30 @@ class ProgramInfo : public ProgramContextInterface
          */
         virtual const char *displayName() const;
         /*! \brief
-         * Returns the full command line used to invoke the binary.
+         * Returns the full path of the running binary.
          *
-         * Does not throw.
+         * \throws std::bad_alloc if out of memory.
+         * \throws tMPI::system_error on thread synchronization errors.
+         *
+         * Returns argv[0] if there was an error in finding the absolute path.
          */
-        virtual const char *commandLine() const;
-
+        virtual const char *fullBinaryPath() const;
         /*! \brief
-         * Returns the full path of the invoked binary.
+         * Returns the default path for \Gromacs data files.
          *
          * \throws std::bad_alloc if out of memory.
          * \throws tMPI::system_error on thread synchronization errors.
          *
-         * Returns argv[0] if there was an error in finding the absolute path.
+         * Returns a hardcoded path set during configuration time if there is
+         * an error in finding the library data files.
          */
-        virtual const char *fullBinaryPath() const;
+        virtual const char *defaultLibraryDataPath() const;
+        /*! \brief
+         * Returns the full command line used to invoke the binary.
+         *
+         * Does not throw.
+         */
+        virtual const char *commandLine() const;
 
     private:
         class Impl;