Gromacs  2019.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Public Attributes
gmx::internal::OptionSectionImpl Class Reference

#include <gromacs/options/options-impl.h>

+ Inheritance diagram for gmx::internal::OptionSectionImpl:
+ Collaboration diagram for gmx::internal::OptionSectionImpl:

Description

Internal implementation class for storing an option section.

All options are stored within a section: the top-level contents of an Options object are handled within an unnamed, "root" section. This class handles the common functionality for all sections, related to storing the options and subsections. Functionality specific to a section type is provided by IOptionSectionStorage.

Classes

class  Group
 Describes a group of options (see Options::addGroup()). More...
 

Public Types

typedef std::unique_ptr
< AbstractOptionStorage
AbstractOptionStoragePointer
 Smart pointer for managing an AbstractOptionStorage object.
 
typedef std::map< std::string,
AbstractOptionStoragePointer
OptionMap
 Convenience typedef for a map that contains all the options.
 
typedef std::unique_ptr
< OptionSectionImpl
SectionPointer
 Smart pointer for managing subsections.
 
typedef std::vector
< SectionPointer
SectionList
 Convenience typedef for a container for subsections.
 

Public Member Functions

 OptionSectionImpl (const OptionManagerContainer &managers, std::unique_ptr< IOptionSectionStorage > storage, const char *name)
 Creates storage for a new section.
 
OptionSectionImpladdSectionImpl (const AbstractOptionSection &section) override
 Adds a section to this container. More...
 
IOptionsContaineraddGroup () override
 Creates a subgroup of options within the current options. More...
 
OptionInfoaddOptionImpl (const AbstractOption &settings) override
 Adds a recognized option. More...
 
OptionSectionInfo & info ()
 Returns section info object for this section.
 
const OptionSectionInfo & info () const
 Returns section info object for this section.
 
OptionSectionImplfindSection (const char *name) const
 Finds a subsection by name. More...
 
AbstractOptionStoragefindOption (const char *name) const
 Finds an option by name. More...
 
void start ()
 Called when entering the section. More...
 
void finish ()
 Calls AbstractOptionStorage::finish() for all options.
 
- Public Member Functions inherited from gmx::IOptionsContainerWithSections
template<class SectionType >
SectionType::HandleType addSection (const SectionType &section)
 Adds a section to this collection. More...
 
- Public Member Functions inherited from gmx::IOptionsContainer
template<class OptionType >
OptionType::InfoType * addOption (const OptionType &settings)
 Adds a recognized option. More...
 

Public Attributes

const OptionManagerContainermanagers_
 Reference to the option managers in the parent Options object.
 
std::unique_ptr
< IOptionSectionStorage
storage_
 Type-specific storage object for this section.
 
OptionSectionInfo info_
 Info object for this section.
 
std::string name_
 Name of this section (empty and unused for the root section).
 
Group rootGroup_
 Group that contains all options (and subgroups). More...
 
OptionMap optionMap_
 Map from option names to options; owns the option storage objects.
 
SectionList subsections_
 List of subsections, in insertion order.
 
bool storageInitialized_
 Whether initStorage() has been called for storage_.
 

Additional Inherited Members

Member Function Documentation

IOptionsContainer & gmx::internal::OptionSectionImpl::addGroup ( )
overridevirtual

Creates a subgroup of options within the current options.

To add options to the group, use the returned interface.

Currently, this is only used to influence the order of options: all options in a group appear before options in a group added after it, no matter in which order the options are added to the groups. In the future, the groups could also be used to influence the help output.

Implements gmx::IOptionsContainer.

OptionInfo * gmx::internal::OptionSectionImpl::addOptionImpl ( const AbstractOption settings)
overridevirtual

Adds a recognized option.

Parameters
[in]settingsOption description.
Returns
OptionInfo object for the created option (never NULL).
Exceptions
APIErrorif invalid option settings are provided.

This method provides the internal implementation, but the templated method is called from user code. See the templated method for more details.

Implements gmx::IOptionsContainer.

OptionSectionImpl * gmx::internal::OptionSectionImpl::addSectionImpl ( const AbstractOptionSection section)
overridevirtual

Adds a section to this container.

Parameters
[in]sectionSection description.
Returns
Pointer to the internal section representation object.

Implements gmx::IOptionsContainerWithSections.

AbstractOptionStorage * gmx::internal::OptionSectionImpl::findOption ( const char *  name) const

Finds an option by name.

Parameters
[in]nameName to search for.
Returns
Pointer to the found option, or NULL if not found.

Does not throw.

OptionSectionImpl * gmx::internal::OptionSectionImpl::findSection ( const char *  name) const

Finds a subsection by name.

Parameters
[in]nameName to search for.
Returns
Pointer to the found subsection, or NULL if not found.

Does not throw.

void gmx::internal::OptionSectionImpl::start ( )

Called when entering the section.

Calls AbstractOptionStorage::startSource() for all options.

Member Data Documentation

Group gmx::internal::OptionSectionImpl::rootGroup_

Group that contains all options (and subgroups).

This is used to store the insertion order of options.


The documentation for this class was generated from the following files: