*/
class AbstractOptionSection
{
- protected:
- //! \cond libapi
- //! Initializes option properties with the given name.
- explicit AbstractOptionSection(const char *name) : name_(name) {}
- virtual ~AbstractOptionSection() {}
- /*! \brief
- * Creates a storage object corresponding to this section.
- *
- * Similar to AbstractOption::createStorage().
- */
- virtual std::unique_ptr<IOptionSectionStorage> createStorage() const = 0;
- //! \endcond
-
- private:
- const char *name_;
-
- friend class internal::OptionSectionImpl;
+protected:
+ //! \cond libapi
+ //! Initializes option properties with the given name.
+ explicit AbstractOptionSection(const char* name) : name_(name) {}
+ virtual ~AbstractOptionSection() {}
+ /*! \brief
+ * Creates a storage object corresponding to this section.
+ *
+ * Similar to AbstractOption::createStorage().
+ */
+ virtual std::unique_ptr<IOptionSectionStorage> createStorage() const = 0;
+ //! \endcond
+
+private:
+ const char* name_;
+
+ friend class internal::OptionSectionImpl;
};
/*! \brief
*/
class AbstractOptionSectionHandle : public IOptionsContainerWithSections
{
- public:
- // From IOptionsContainer
- //! \copydoc IOptionsContainer::addGroup()
- IOptionsContainer &addGroup() override;
-
- protected:
- //! \cond libapi
- /*! \brief
- * Returns the storage for a particular type of section.
- *
- * This is intended for use in derived class constructors, where the
- * handle needs access to the actual storage. The handle should know
- * the type of storage created for the section type it deals with, so
- * the cast should always be successful.
- */
- template <typename StorageType>
- static StorageType *getStorage(internal::OptionSectionImpl *section)
- {
- IOptionSectionStorage *storage = getStorage(section);
- StorageType *typedStorage
- = dynamic_cast<StorageType *>(storage);
- GMX_ASSERT(typedStorage != nullptr, "Mismatching section storage type");
- return typedStorage;
- }
-
- //! Wraps a given section storage object.
- explicit AbstractOptionSectionHandle(internal::OptionSectionImpl *section)
- : section_(section)
- {
- }
- //! \endcond
-
- private:
- // From IOptionsContainerWithSections
- internal::OptionSectionImpl *
- addSectionImpl(const AbstractOptionSection §ion) override;
- // From IOptionsContainer
- OptionInfo *addOptionImpl(const AbstractOption &settings) override;
-
- /*! \brief
- * Implementation helper for the template method.
- *
- * This allows encapsulating the implementation within the source file.
- */
- static IOptionSectionStorage *getStorage(internal::OptionSectionImpl *section);
-
- internal::OptionSectionImpl *section_;
+public:
+ // From IOptionsContainer
+ //! \copydoc IOptionsContainer::addGroup()
+ IOptionsContainer& addGroup() override;
+
+protected:
+ //! \cond libapi
+ /*! \brief
+ * Returns the storage for a particular type of section.
+ *
+ * This is intended for use in derived class constructors, where the
+ * handle needs access to the actual storage. The handle should know
+ * the type of storage created for the section type it deals with, so
+ * the cast should always be successful.
+ */
+ template<typename StorageType>
+ static StorageType* getStorage(internal::OptionSectionImpl* section)
+ {
+ IOptionSectionStorage* storage = getStorage(section);
+ StorageType* typedStorage = dynamic_cast<StorageType*>(storage);
+ GMX_ASSERT(typedStorage != nullptr, "Mismatching section storage type");
+ return typedStorage;
+ }
+
+ //! Wraps a given section storage object.
+ explicit AbstractOptionSectionHandle(internal::OptionSectionImpl* section) : section_(section)
+ {
+ }
+ //! \endcond
+
+private:
+ // From IOptionsContainerWithSections
+ internal::OptionSectionImpl* addSectionImpl(const AbstractOptionSection& section) override;
+ // From IOptionsContainer
+ OptionInfo* addOptionImpl(const AbstractOption& settings) override;
+
+ /*! \brief
+ * Implementation helper for the template method.
+ *
+ * This allows encapsulating the implementation within the source file.
+ */
+ static IOptionSectionStorage* getStorage(internal::OptionSectionImpl* section);
+
+ internal::OptionSectionImpl* section_;
};
class AbstractOptionSectionInfo
{
- public:
- //! Wraps a given section storage object.
- explicit AbstractOptionSectionInfo(internal::OptionSectionImpl *section)
- : section_(*section)
- {
- }
+public:
+ //! Wraps a given section storage object.
+ explicit AbstractOptionSectionInfo(internal::OptionSectionImpl* section) : section_(*section) {}
- //! Returns the name of the section.
- const std::string &name() const;
+ //! Returns the name of the section.
+ const std::string& name() const;
- //! Returns the wrapped section storage object.
- internal::OptionSectionImpl §ion() { return section_; }
- //! Returns the wrapped section storage object.
- const internal::OptionSectionImpl §ion() const { return section_; }
+ //! Returns the wrapped section storage object.
+ internal::OptionSectionImpl& section() { return section_; }
+ //! Returns the wrapped section storage object.
+ const internal::OptionSectionImpl& section() const { return section_; }
- private:
- internal::OptionSectionImpl §ion_;
+private:
+ internal::OptionSectionImpl& section_;
- GMX_DISALLOW_COPY_AND_ASSIGN(AbstractOptionSectionInfo);
+ GMX_DISALLOW_COPY_AND_ASSIGN(AbstractOptionSectionInfo);
};
} // namespace gmx