To declare input data for the tool (typically, command-line options, including
input files and selections), \ref module_options module is used.
-The analysis tool code receives a pre-initialized gmx::Options object in one of
-its initialization methods, and fills it with its input options.
+The analysis tool code receives an instance of gmx::IOptionsContainer for one of
+its initialization methods, and uses it to provide its input options.
Basic options are declared in basicoptions.h, and also gmx::SelectionOption is
used in the same manner. For each option, the tool declares a local variable
that will receive the value for that option. After the options are parsed from
the command line (by the framework), the tool code can read the values from
-these variables. The option declarations, and other information filled into
-the gmx::Options object, are also used to provide help to the user (also
+these variables. The option declarations filled into the
+gmx::IOptionsContainer object are also used to provide help to the user (also
handled by the framework).
See the documentation for gmx::TrajectoryAnalysisModule and the
[options module documentation](\ref module_options) for more details.
public:
AnalysisTemplate();
- virtual void initOptions(Options *options,
+ virtual void initOptions(IOptionsContainer *options,
TrajectoryAnalysisSettings *settings);
virtual void initAnalysis(const TrajectoryAnalysisSettings &settings,
const TopologyInformation &top);
void
-AnalysisTemplate::initOptions(Options *options,
+AnalysisTemplate::initOptions(IOptionsContainer *options,
TrajectoryAnalysisSettings *settings)
{
static const char *const desc[] = {
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014,2015, 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.
#include "gromacs/legacyheaders/oenv.h"
#include "gromacs/math/vec.h"
#include "gromacs/options/basicoptions.h"
-#include "gromacs/options/options.h"
+#include "gromacs/options/ioptionscontainer.h"
#include "gromacs/options/timeunitmanager.h"
#include "gromacs/selection/selectioncollection.h"
#include "gromacs/utility/exceptions.h"
void
-AnalysisDataPlotSettings::addOptions(Options *options)
+AnalysisDataPlotSettings::initOptions(IOptionsContainer *options)
{
options->addOption(StringOption("xvg").enumValue(g_plotFormats)
.defaultValue("xmgrace")
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014,2015, 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.
{
class AnalysisDataValue;
-class Options;
+class IOptionsContainer;
class SelectionCollection;
/*! \brief
*
* \param[in,out] options Options object to which options are added.
*/
- void addOptions(Options *options);
+ void initOptions(IOptionsContainer *options);
private:
const SelectionCollection *selections_;
class CommandLineModuleManager;
class ICommandLineModule;
+class IOptionsContainer;
class Options;
/*! \brief
* the module to \p options. Output values from options should be
* stored in member variables.
*/
- virtual void initOptions(Options *options,
+ virtual void initOptions(IOptionsContainer *options,
ICommandLineOptionsModuleSettings *settings) = 0;
/*! \brief
* Called after all option values have been set.
*
* \ingroup module_commandline
*/
-void initOptionsBasic(gmx::Options *options,
+void initOptionsBasic(gmx::IOptionsContainer *options,
gmx::ICommandLineOptionsModuleSettings *settings)
{
const char *const desc[] = {
~MockOptionsModule();
MOCK_METHOD1(init, void(gmx::CommandLineModuleSettings *settings));
- MOCK_METHOD2(initOptions, void(gmx::Options *options, gmx::ICommandLineOptionsModuleSettings *settings));
+ MOCK_METHOD2(initOptions, void(gmx::IOptionsContainer *options, gmx::ICommandLineOptionsModuleSettings *settings));
MOCK_METHOD1(optionsFinished, void(gmx::Options *options));
MOCK_METHOD0(run, int());
};
#include "gromacs/math/vec.h"
#include "gromacs/options/basicoptions.h"
#include "gromacs/options/filenameoption.h"
+#include "gromacs/options/ioptionscontainer.h"
#include "gromacs/options/options.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/random/random.h"
{
}
- virtual void initOptions(Options *options,
+ virtual void initOptions(IOptionsContainer *options,
ICommandLineOptionsModuleSettings *settings);
virtual void optionsFinished(Options *options);
int enumRot_;
};
-void InsertMolecules::initOptions(Options *options,
+void InsertMolecules::initOptions(IOptionsContainer *options,
ICommandLineOptionsModuleSettings *settings)
{
const char *const desc[] = {
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014,2015, 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.
*
* <H3>Basic Use</H3>
*
- * Basic interface for providing options is implemented by the Options class
- * and classes defined in basicoptions.h for specifying individual options.
- * Only these are needed if a class wants to provide a set of standard options.
- * When creating an Options object and adding options, it is possible to add
- * descriptions for individual options as well as for the whole set of options.
- * These can then be used to write out help text.
+ * Code that provides options does so using methods in gmx::IOptionsContainer
+ * and classes defined in basicoptions.h.
+ * Only these are needed if a class wants to provide a set of standard options
+ * (other modules can provide additional option types, such as
+ * gmx::SelectionOption).
+ * For each option, the caller provides an output variable that will receive
+ * the final value of the option once user input has been parsed.
+ * When adding options, it is possible to also provide descriptions for the
+ * options for use in generated help text.
+ *
+ * Generic code that handles the user input does so by creating a gmx::Options
+ * instance and passing it (as gmx::IOptionsContainer) to the classes that add
+ * the actual options. It can then use a parser to set values to the options.
+ * Final values for the options can be inspected in the code that added the
+ * individual options, from the provided output variables.
*
* The sequence charts below provides an overview of how the options work from
* usage perspective. They include two fictional modules, A and B, that provide
* typical initialization sequence, where the main routine creates an options
* object, and calls an initOptions() method in each module that can provide
* options (the modules may also request their submodules to add their own
- * options). Each module uses gmx::Options::addOption() to add the options
- * they require, and specify output variables into which the options values are
- * stored.
+ * options). Each module uses gmx::IOptionsContainer::addOption() to add the
+ * options they require, and specify output variables into which the options
+ * values are stored.
* \msc
* main,
* options [ label="Options", URL="\ref gmx::Options" ],
* main box B [ label="main owns all objects" ];
* main => options [ label="create", URL="\ref gmx::Options::Options()" ];
* main => A [ label="initOptions()" ];
- * A => options [ label="addOption()", URL="\ref gmx::Options::addOption()" ];
+ * A => options [ label="addOption()", URL="\ref gmx::IOptionsContainer::addOption()" ];
* ...;
* main << A;
* main => B [ label="initOptions()" ];
- * B => options [ label="addOption()", URL="\ref gmx::Options::addOption()" ];
+ * B => options [ label="addOption()", URL="\ref gmx::IOptionsContainer::addOption()" ];
* ...;
* main << B;
* \endmsc
* the input into option-value pairs (one option may have multiple values), and
* passes these into the gmx::Options object, which is responsible for
* converting them into the appropriate types and storing the values into the
- * variables provided in the calls to gmx::Options::addOption().
+ * variables provided in the calls to gmx::IOptionsContainer::addOption().
* \msc
* main,
* parser [ label="parser" ],
* To implement new option types, it is necessary to subclass the templates
* OptionTemplate and OptionStorageTemplate with the type of the values that
* the option should provide as the template argument. After this is done, it
- * is possible to add options of this new type using Options::addOption().
+ * is possible to add options of this new type using IOptionsContainer::addOption().
*
* To implement new parsers, one can use OptionsAssigner, which provides an
* interface to set values in an Options object.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2010,2012,2013,2014, by the GROMACS development team, led by
+# Copyright (c) 2010,2012,2013,2014,2015, 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.
basicoptions.h
filenameoption.h
filenameoptionmanager.h
+ ioptionscontainer.h
optionfiletype.h
optionflags.h
options.h
#include "gromacs/fileio/filenm.h"
#include "gromacs/options/basicoptions.h"
#include "gromacs/options/filenameoption.h"
-#include "gromacs/options/options.h"
+#include "gromacs/options/ioptionscontainer.h"
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/fileredirector.h"
}
void FileNameOptionManager::addDefaultFileNameOption(
- Options *options, const char *name)
+ IOptionsContainer *options, const char *name)
{
options->addOption(
StringOption(name).store(&impl_->defaultFileName_)
class FileNameOptionInfo;
class IFileInputRedirector;
-class Options;
+class IOptionsContainer;
/*! \brief
* Handles interaction of file name options with global options.
* instead from an option-specific default
* (FileNameOption::defaultBaseName()).
*/
- void addDefaultFileNameOption(Options *options, const char *name);
+ void addDefaultFileNameOption(IOptionsContainer *options, const char *name);
/*! \brief
* Completes file name option values.
--- /dev/null
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2015, 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
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+/*! \file
+ * \brief
+ * Declares gmx::IOptionsContainer.
+ *
+ * \author Teemu Murtola <teemu.murtola@gmail.com>
+ * \inpublicapi
+ * \ingroup module_options
+ */
+#ifndef GMX_OPTIONS_IOPTIONSCONTAINER_H
+#define GMX_OPTIONS_IOPTIONSCONTAINER_H
+
+#include "gromacs/options/abstractoption.h"
+#include "gromacs/utility/gmxassert.h"
+
+namespace gmx
+{
+
+/*! \brief
+ * Interface for adding input options.
+ *
+ * This interface provides methods to add new options.
+ * Standard usage is for code to receive this interface and populate it with
+ * supported options:
+ * \code
+ // <as class attributes>
+ std::string arg1;
+ int arg2;
+
+ void MyClass::initOptions(gmx::IOptionsContainer *options)
+ {
+ options->addOption(gmx::StringOption("arg1").store(&arg1));
+ options->addOption(gmx::IntegerOption("arg2").store(&arg2));
+ }
+ \endcode
+ * The caller can collect options from multiple sources into a single container
+ * (a gmx::Options), and use a parser implementation such as CommandLineParser
+ * to provide values for the options.
+ *
+ * Header basicoptions.h provides declarations of several standard
+ * option types for use with addOption(). Documentation of those classes
+ * also give more examples of how to define options.
+ *
+ * \inpublicapi
+ * \ingroup module_options
+ */
+class IOptionsContainer
+{
+ public:
+ /*! \brief
+ * Adds a recognized option.
+ *
+ * \param[in] settings Option description.
+ * \returns OptionInfo object for the created option (never NULL).
+ * \throws APIError if invalid option settings are provided.
+ *
+ * This method provides the internal implementation, but in most cases
+ * the templated method is called from user code.
+ * See the templated method for more details.
+ */
+ virtual OptionInfo *addOption(const AbstractOption &settings) = 0;
+ /*! \brief
+ * Adds a recognized option.
+ *
+ * \tparam OptionType Type of the options description object.
+ * \param[in] settings Option description.
+ * \returns OptionInfo object for the created option (never NULL).
+ * \throws APIError if invalid option settings are provided.
+ *
+ * The return value is a pointer for more convenient use in callers:
+ * often callers need to declare the variable that will hold the return
+ * value in wider scope than would be achieved by declaring it at the
+ * site where addOption() is called.
+ * The returned pointer must not be freed.
+ *
+ * See \link Options class documentation \endlink for example usage.
+ *
+ * \libinternal
+ * \p OptionType::InfoType must specify a type that derives from
+ * OptionInfo and matches the type that is returned by
+ * AbstractOptionStorage::optionInfo() for the storage object that
+ * corresponds to \p OptionType.
+ */
+ template <class OptionType>
+ typename OptionType::InfoType *addOption(const OptionType &settings)
+ {
+ OptionInfo *info
+ = addOption(static_cast<const AbstractOption &>(settings));
+ GMX_ASSERT(info->isType<typename OptionType::InfoType>(),
+ "Mismatching option info type declaration and implementation");
+ return info->toType<typename OptionType::InfoType>();
+ }
+
+ protected:
+ // Disallow deletion through the interface.
+ // (no need for the virtual, but some compilers warn otherwise)
+ virtual ~IOptionsContainer();
+
+};
+
+} // namespace
+
+#endif
{
}
+/********************************************************************
+ * IOptionsContainer
+ */
+
+IOptionsContainer::~IOptionsContainer()
+{
+}
+
/********************************************************************
* Options::Impl
*/
#include <string>
-#include "gromacs/options/abstractoption.h"
+#include "gromacs/options/ioptionscontainer.h"
#include "gromacs/utility/classhelpers.h"
-#include "gromacs/utility/gmxassert.h"
namespace gmx
{
/*! \brief
* Collection of options.
*
- * This class provides a standard interface for implementing input options.
- * Standard usage is to write a method that creates an Options that is owned by
- * the object, populates it with supported options, and then returns it:
- * \code
- // <as class attributes>
- using gmx::Options;
- Options options("common", "Common Options");
- std::string arg1;
- int arg2;
-
- // <populating>
- using gmx::StringOption;
- using gmx::IntegerOption;
- options.addOption(StringOption("arg1").store(&arg1));
- options.addOption(IntegerOption("arg2").store(&arg2));
- return &options;
- \endcode
- * The caller of that method can then use a parser implementation such as
- * CommandLineParser to provide values for the options.
+ * See \ref module_options for an overview of how the options work.
+ * The IOptionsContainer interface documents how to add options.
*
- * Header basicoptions.h provides declarations of several standard
- * option types for use with addOption(). Documentation of those classes
- * also give more examples of how to define options.
- *
- * In order to keep the public interface of this class simple and to reduce
- * build dependencies on objects that simply provide options, functionality
+ * In order to keep the public interface of this class simple, functionality
* to assign values to options is provided by a separate OptionsAssigner class.
* Similarly, functionality for looping over all options (e.g., for writing out
* help) is provided by OptionsIterator.
* \inpublicapi
* \ingroup module_options
*/
-class Options
+class Options : public IOptionsContainer
{
public:
/*! \brief
* If an attempt is made, the function asserts.
*/
void addSubSection(Options *section);
- /*! \brief
- * Adds a recognized option to the collection.
- *
- * \param[in] settings Option description.
- * \returns OptionInfo object for the created option (never NULL).
- * \throws APIError if invalid option settings are provided.
- *
- * This method provides the internal implementation, but in most cases
- * the templated method is called from user code.
- * See the templated method for more details.
- */
- OptionInfo *addOption(const AbstractOption &settings);
- /*! \brief
- * Adds a recognized option to the collection.
- *
- * \tparam OptionType Type of the options description object.
- * \param[in] settings Option description.
- * \returns OptionInfo object for the created option (never NULL).
- * \throws APIError if invalid option settings are provided.
- *
- * The return value is a pointer for more convenient use in callers:
- * often callers need to declare the variable that will hold the return
- * value in wider scope than would be achieved by declaring it at the
- * site where addOption() is called.
- * The returned pointer must not be freed.
- *
- * See \link Options class documentation \endlink for example usage.
- *
- * \libinternal
- * \p OptionType::InfoType must specify a type that derives from
- * OptionInfo and matches the type that is returned by
- * AbstractOptionStorage::optionInfo() for the storage object that
- * corresponds to \p OptionType.
- */
- template <class OptionType>
- typename OptionType::InfoType *addOption(const OptionType &settings)
- {
- OptionInfo *info
- = addOption(static_cast<const AbstractOption &>(settings));
- GMX_ASSERT(info->isType<typename OptionType::InfoType>(),
- "Mismatching option info type declaration and implementation");
- return info->toType<typename OptionType::InfoType>();
- }
+
+ // From IOptionsContainer
+ virtual OptionInfo *addOption(const AbstractOption &settings);
+ using IOptionsContainer::addOption;
//! Returns true if option \p name is set.
bool isSet(const char *name) const;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015, 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.
#include <algorithm>
#include "gromacs/options/basicoptions.h"
+#include "gromacs/options/ioptionscontainer.h"
#include "gromacs/options/options.h"
#include "gromacs/options/optionsvisitor.h"
#include "gromacs/utility/arrayref.h"
}
}
-void TimeUnitManager::addTimeUnitOption(Options *options, const char *name)
+void TimeUnitManager::addTimeUnitOption(IOptionsContainer *options, const char *name)
{
options->addOption(StringOption(name).enumValue(g_timeUnits)
.defaultValue(g_timeUnits[timeUnit()])
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2014, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015, 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.
namespace gmx
{
+class IOptionsContainer;
class Options;
/*! \brief
* Adds an enum option to \p options to select the time unit for this
* manager.
*/
- void addTimeUnitOption(Options *options, const char *name);
+ void addTimeUnitOption(IOptionsContainer *options, const char *name);
/*! \brief
* Scales user input values given to time options.
*
#include "gromacs/onlinehelp/helpmanager.h"
#include "gromacs/onlinehelp/helpwritercontext.h"
#include "gromacs/options/basicoptions.h"
-#include "gromacs/options/options.h"
+#include "gromacs/options/ioptionscontainer.h"
#include "gromacs/selection/selection.h"
#include "gromacs/selection/selhelp.h"
#include "gromacs/topology/topology.h"
void
-SelectionCollection::initOptions(Options *options)
+SelectionCollection::initOptions(IOptionsContainer *options)
{
const char * const debug_levels[]
= { "no", "basic", "compile", "eval", "full" };
namespace gmx
{
-class Options;
+class IOptionsContainer;
class SelectionCompiler;
class SelectionEvaluator;
class TextInputStream;
* position types (see setReferencePosType() and setOutputPosType())
* and debugging flags.
*/
- void initOptions(Options *options);
+ void initOptions(IOptionsContainer *options);
/*! \brief
* Sets the default reference position handling for a selection
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014,2015, 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.
* appropriate. Otherwise, values that are provided before adjustments will
* need to follow the more strict checks. In most cases in trajectory analysis
* (which is the main use case for selection options), the adjustments should
- * be done in TrajectoryAnalysisModule::initOptionsDone() for them to take
+ * be done in TrajectoryAnalysisModule::optionsFinished() for them to take
* place before interactive selection prompts.
*
* An instance of this class for a selection option can be obtained with
#include "gromacs/fileio/trx.h"
#include "gromacs/options/basicoptions.h"
-#include "gromacs/options/options.h"
+#include "gromacs/options/ioptionscontainer.h"
#include "gromacs/selection/indexutil.h"
#include "gromacs/selection/selection.h"
#include "gromacs/topology/topology.h"
#include <math.h>
#include "gromacs/options/basicoptions.h"
-#include "gromacs/options/options.h"
+#include "gromacs/options/ioptionscontainer.h"
#include "gromacs/utility/basedefinitions.h"
#include "testutils/testoptions.h"
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014,2015, 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.
class AnalysisData;
class AnalysisDataHandle;
class AnalysisDataParallelOptions;
+class IOptionsContainer;
class Options;
class SelectionCollection;
class TopologyInformation;
* If settings depend on the option values provided by the user, see
* optionsFinished().
*/
- virtual void initOptions(Options *options,
+ virtual void initOptions(IOptionsContainer *options,
TrajectoryAnalysisSettings *settings) = 0;
/*! \brief
* Called after all option values have been set.
#include "gromacs/math/vec.h"
#include "gromacs/options/basicoptions.h"
#include "gromacs/options/filenameoption.h"
+#include "gromacs/options/ioptionscontainer.h"
#include "gromacs/options/options.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/selection/selection.h"
public:
Angle();
- virtual void initOptions(Options *options,
+ virtual void initOptions(IOptionsContainer *options,
TrajectoryAnalysisSettings *settings);
virtual void optionsFinished(Options *options,
TrajectoryAnalysisSettings *settings);
void
-Angle::initOptions(Options *options, TrajectoryAnalysisSettings *settings)
+Angle::initOptions(IOptionsContainer *options, TrajectoryAnalysisSettings *settings)
{
static const char *const desc[] = {
"[THISMODULE] computes different types of angles between vectors.",
#include "gromacs/math/vec.h"
#include "gromacs/options/basicoptions.h"
#include "gromacs/options/filenameoption.h"
-#include "gromacs/options/options.h"
+#include "gromacs/options/ioptionscontainer.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/selection/selection.h"
#include "gromacs/selection/selectionoption.h"
public:
Distance();
- virtual void initOptions(Options *options,
+ virtual void initOptions(IOptionsContainer *options,
TrajectoryAnalysisSettings *settings);
virtual void initAnalysis(const TrajectoryAnalysisSettings &settings,
const TopologyInformation &top);
void
-Distance::initOptions(Options *options, TrajectoryAnalysisSettings *settings)
+Distance::initOptions(IOptionsContainer *options, TrajectoryAnalysisSettings *settings)
{
static const char *const desc[] = {
"[THISMODULE] calculates distances between pairs of positions",
#include "gromacs/math/vec.h"
#include "gromacs/options/basicoptions.h"
#include "gromacs/options/filenameoption.h"
-#include "gromacs/options/options.h"
+#include "gromacs/options/ioptionscontainer.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/random/random.h"
#include "gromacs/selection/nbsearch.h"
class FreeVolume : public TrajectoryAnalysisModule
{
public:
- //! Constructor
FreeVolume();
-
- //! Destructor
virtual ~FreeVolume();
- //! Set the options and setting
- virtual void initOptions(Options *options,
+ virtual void initOptions(IOptionsContainer *options,
TrajectoryAnalysisSettings *settings);
-
- //! First routine called by the analysis framework
virtual void initAnalysis(const TrajectoryAnalysisSettings &settings,
const TopologyInformation &top);
-
- //! Call for each frame of the trajectory
virtual void analyzeFrame(int frnr, const t_trxframe &fr, t_pbc *pbc,
TrajectoryAnalysisModuleData *pdata);
-
- //! Last routine called by the analysis framework
virtual void finishAnalysis(int nframes);
-
- //! Routine to write output, that is additional over the built-in
virtual void writeOutput();
private:
void
-FreeVolume::initOptions(Options *options,
+FreeVolume::initOptions(IOptionsContainer *options,
TrajectoryAnalysisSettings *settings)
{
static const char *const desc[] = {
#include "gromacs/fileio/trx.h"
#include "gromacs/options/basicoptions.h"
#include "gromacs/options/filenameoption.h"
-#include "gromacs/options/options.h"
+#include "gromacs/options/ioptionscontainer.h"
#include "gromacs/selection/nbsearch.h"
#include "gromacs/selection/selection.h"
#include "gromacs/selection/selectionoption.h"
public:
PairDistance();
- virtual void initOptions(Options *options,
+ virtual void initOptions(IOptionsContainer *options,
TrajectoryAnalysisSettings *settings);
virtual void initAnalysis(const TrajectoryAnalysisSettings &settings,
const TopologyInformation &top);
void
-PairDistance::initOptions(Options *options, TrajectoryAnalysisSettings *settings)
+PairDistance::initOptions(IOptionsContainer *options, TrajectoryAnalysisSettings *settings)
{
static const char *const desc[] = {
"[THISMODULE] calculates pairwise distances between one reference",
#include "gromacs/math/vec.h"
#include "gromacs/options/basicoptions.h"
#include "gromacs/options/filenameoption.h"
+#include "gromacs/options/ioptionscontainer.h"
#include "gromacs/options/options.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/selection/nbsearch.h"
public:
Rdf();
- virtual void initOptions(Options *options,
+ virtual void initOptions(IOptionsContainer *options,
TrajectoryAnalysisSettings *settings);
virtual void optionsFinished(Options *options,
TrajectoryAnalysisSettings *settings);
}
void
-Rdf::initOptions(Options *options, TrajectoryAnalysisSettings *settings)
+Rdf::initOptions(IOptionsContainer *options, TrajectoryAnalysisSettings *settings)
{
static const char *const desc[] = {
"[THISMODULE] calculates radial distribution functions from one",
#include "gromacs/math/vec.h"
#include "gromacs/options/basicoptions.h"
#include "gromacs/options/filenameoption.h"
-#include "gromacs/options/options.h"
+#include "gromacs/options/ioptionscontainer.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/selection/selection.h"
#include "gromacs/selection/selectionoption.h"
public:
Sasa();
- virtual void initOptions(Options *options,
+ virtual void initOptions(IOptionsContainer *options,
TrajectoryAnalysisSettings *settings);
virtual void initAnalysis(const TrajectoryAnalysisSettings &settings,
const TopologyInformation &top);
}
void
-Sasa::initOptions(Options *options, TrajectoryAnalysisSettings *settings)
+Sasa::initOptions(IOptionsContainer *options, TrajectoryAnalysisSettings *settings)
{
static const char *const desc[] = {
"[THISMODULE] computes solvent accessible surface areas.",
#include "gromacs/fileio/trxio.h"
#include "gromacs/options/basicoptions.h"
#include "gromacs/options/filenameoption.h"
-#include "gromacs/options/options.h"
+#include "gromacs/options/ioptionscontainer.h"
#include "gromacs/selection/selection.h"
#include "gromacs/selection/selectionoption.h"
#include "gromacs/topology/topology.h"
public:
Select();
- virtual void initOptions(Options *options,
+ virtual void initOptions(IOptionsContainer *options,
TrajectoryAnalysisSettings *settings);
virtual void optionsFinished(Options *options,
TrajectoryAnalysisSettings *settings);
void
-Select::initOptions(Options *options, TrajectoryAnalysisSettings *settings)
+Select::initOptions(IOptionsContainer *options, TrajectoryAnalysisSettings *settings)
{
static const char *const desc[] = {
"[THISMODULE] writes out basic data about dynamic selections.",
#include "gromacs/math/vec.h"
#include "gromacs/options/basicoptions.h"
#include "gromacs/options/filenameoption.h"
+#include "gromacs/options/ioptionscontainer.h"
#include "gromacs/options/options.h"
#include "gromacs/pbcutil/rmpbc.h"
#include "gromacs/selection/indexutil.h"
void
-TrajectoryAnalysisRunnerCommon::initOptions(Options *options)
+TrajectoryAnalysisRunnerCommon::initOptions(IOptionsContainer *options)
{
TrajectoryAnalysisSettings &settings = impl_->settings_;
settings.impl_->timeUnitManager.addTimeUnitOption(options, "tu");
// Add plot options.
- settings.impl_->plotSettings.addOptions(options);
+ settings.impl_->plotSettings.initOptions(options);
// Add common options for trajectory processing.
if (!settings.hasFlag(TrajectoryAnalysisSettings::efNoUserRmPBC))
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014,2015, 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.
namespace gmx
{
+class IOptionsContainer;
class Options;
class SelectionCollection;
class TopologyInformation;
*
* \param[in,out] options Options object to add the options to.
*/
- void initOptions(Options *options);
+ void initOptions(IOptionsContainer *options);
//! Scales time option values according to the time unit set.
void scaleTimeOptions(Options *options);
/*! \brief
#include "gmxpre.h"
#include "gromacs/options/basicoptions.h"
-#include "gromacs/options/options.h"
+#include "gromacs/options/ioptionscontainer.h"
#include "gromacs/selection/selection.h"
#include "gromacs/selection/selectionoption.h"
#include "gromacs/trajectoryanalysis/analysismodule.h"
SelectionTester();
virtual ~SelectionTester();
- virtual void initOptions(Options *options,
+ virtual void initOptions(IOptionsContainer *options,
TrajectoryAnalysisSettings *settings);
virtual void initAnalysis(const TrajectoryAnalysisSettings &settings,
const TopologyInformation &top);
}
void
-SelectionTester::initOptions(Options *options,
+SelectionTester::initOptions(IOptionsContainer *options,
TrajectoryAnalysisSettings *settings)
{
static const char *const desc[] = {
#include "gromacs/gmxpreprocess/grompp.h"
#include "gromacs/options/basicoptions.h"
-#include "gromacs/options/options.h"
+#include "gromacs/options/ioptionscontainer.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/basenetwork.h"
#include "gromacs/utility/gmxmpi.h"
#include <boost/scoped_ptr.hpp>
#include "gromacs/options/basicoptions.h"
-#include "gromacs/options/options.h"
+#include "gromacs/options/ioptionscontainer.h"
#include "gromacs/utility/textreader.h"
#include "testutils/refdata.h"
#include <gtest/gtest.h>
#include "gromacs/options/basicoptions.h"
-#include "gromacs/options/options.h"
+#include "gromacs/options/ioptionscontainer.h"
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/path.h"
}
//! Initializes the options from all the provides.
- void initOptions(Options *options);
+ void initOptions(IOptionsContainer *options);
private:
TestOptionsRegistry() {}
GMX_DISALLOW_COPY_AND_ASSIGN(TestOptionsRegistry);
};
-void TestOptionsRegistry::initOptions(Options *options)
+void TestOptionsRegistry::initOptions(IOptionsContainer *options)
{
// TODO: Have some deterministic order for the options; now it depends on
// the order in which the global initializers are run.
TestOptionsRegistry::getInstance().add(name, provider);
}
-void initTestOptions(Options *options)
+void initTestOptions(IOptionsContainer *options)
{
TestOptionsRegistry::getInstance().initOptions(options);
}
namespace gmx
{
-class Options;
+class IOptionsContainer;
namespace test
{
*
* \param options The options need to be added here.
*/
- virtual void initOptions(Options *options) = 0;
+ virtual void initOptions(IOptionsContainer *options) = 0;
protected:
virtual ~TestOptionsProvider() {}
*
* \ingroup module_testutils
*/
-void initTestOptions(Options *options);
+void initTestOptions(IOptionsContainer *options);
// Uncrustify screws up the indentation for the example otherwise.
/* *INDENT-OFF* */
* Typical usage:
* \code
#include "gromacs/options/basicoptions.h"
- #include "gromacs/options/options.h"
+ #include "gromacs/options/ioptionscontainer.h"
#include "testutils/testoptions.h"
{ \
::gmx::test::registerTestOptions(#name, this); \
} \
- virtual void initOptions(::gmx::Options *options); \
+ virtual void initOptions(::gmx::IOptionsContainer *options); \
}; \
\
static name s_ ## name ## Instance; \
\
- void name::initOptions(::gmx::Options *options)
+ void name::initOptions(::gmx::IOptionsContainer *options)
} // namespace test
} // namespace gmx