*/
/*! \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
{
/*! \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
*/
};
//! 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
*
* \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.
*
* 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().
* 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.
*/
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;