X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=blobdiff_plain;f=src%2Fgromacs%2Foptions%2Fabstractoption.h;h=47276f214b459a6ee20e595ddbfec4f9fb9fe5dc;hb=86f86f19d985cd5516b5f8bd5d3dab4760d4b573;hp=563c3621f68dd9a9ea0ce53083def578bbd2a186;hpb=bd8ff104f5c56e7040041a456a349dac48bf60d9;p=alexxy%2Fgromacs.git diff --git a/src/gromacs/options/abstractoption.h b/src/gromacs/options/abstractoption.h index 563c3621f6..47276f214b 100644 --- a/src/gromacs/options/abstractoption.h +++ b/src/gromacs/options/abstractoption.h @@ -101,7 +101,7 @@ class AbstractOption //! Initializes the name and default values for an option. explicit AbstractOption(const char *name) : minValueCount_(1), maxValueCount_(1), - name_(name), descr_(NULL) + name_(name), descr_(NULL), storeIsSet_(NULL) { } /*! \brief @@ -133,6 +133,8 @@ class AbstractOption //! Sets the description for the option. void setDescription(const char *descr) { descr_ = descr; } + //! Sets the storage location for whether the option is set. + void setStoreIsSet(bool *store) { storeIsSet_ = store; } //! Sets a flag for the option. void setFlag(OptionFlag flag) { flags_.set(flag); } //! Clears a flag for the option. @@ -188,6 +190,7 @@ class AbstractOption //! Pointer to description of the option. const char *descr_; OptionFlags flags_; + bool *storeIsSet_; /*! \brief * Needed to initialize an AbstractOptionStorage object from this class @@ -332,6 +335,21 @@ class OptionTemplate : public AbstractOption */ MyClass &storeVector(std::vector *store) { storeVector_ = store; return me(); } + /*! \brief + * Stores whether the option was explicitly set. + * + * \param[in] store Variable to store the flag in. + * + * The value is set to `false` on creation of the option, and to `true` + * as soon as a value is assigned to the option. A default value does + * not set the flag to `true`, but assignment that uses + * defaultValueIfSet() does. + * + * The pointer provided should remain valid as long as the associated + * Options object exists. + */ + MyClass &storeIsSet(bool *store) + { setStoreIsSet(store); return me(); } protected: /*! \cond libapi */