/*
* 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_SELECTION_SELECTIONOPTION_H
#define GMX_SELECTION_SELECTIONOPTION_H
-#include "../options/abstractoption.h"
-
-#include "selection.h"
-#include "selectionenums.h"
+#include "gromacs/options/abstractoption.h"
+#include "gromacs/selection/selection.h"
+#include "gromacs/selection/selectionenums.h"
namespace gmx
{
*
* Public methods in this class do not throw.
*
+ * To use options of this type, SelectionOptionManager must first be added to
+ * the Options collection. For trajectory analysis tools, the framework takes
+ * care of this.
+ *
* \todo
* Support for specifying that an option accepts, e.g., two to four selections.
* Currently, only a fixed count or any number of selections is possible.
//! Initializes an option with the given name.
explicit SelectionOption(const char *name)
- : MyBase(name), selectionFlags_(efSelection_DisallowEmpty)
+ : MyBase(name), defaultText_(""),
+ selectionFlags_(efSelection_DisallowEmpty)
{
}
MyClass &allowEmpty()
{ selectionFlags_.clear(efSelection_DisallowEmpty); return me(); }
+ /*! \brief
+ * Sets default selection text for the option.
+ *
+ * If the option is not set by the user, the provided text is parsed as
+ * the value of the selection.
+ */
+ MyClass &defaultSelectionText(const char *text)
+ { defaultText_ = text; return me(); }
+
private:
// Disable possibility to allow multiple occurrences, since it isn't
// implemented.
using MyBase::defaultValue;
using MyBase::defaultValueIfSet;
- virtual AbstractOptionStoragePointer createStorage() const;
+ virtual AbstractOptionStorage *createStorage(
+ const OptionManagerContainer &managers) const;
+ const char *defaultText_;
SelectionFlags selectionFlags_;
/*! \brief
*/
explicit SelectionOptionInfo(SelectionOptionStorage *option);
- /*! \brief
- * Set manager for handling interaction with other options and the
- * selection collection.
- *
- * \param manager Selection manager to set.
- *
- * This must be called before the values are added.
- *
- * Typically it is called through setManagerForSelectionOptions(),
- * which recursively sets the manager for all selection options in
- * an Options object.
- *
- * Does not throw.
- */
- void setManager(SelectionOptionManager *manager);
-
/*! \brief
* Sets the number of selections allowed for the option.
*