LOOS 4.1.0
The Lightweight Object Oriented Structural analysis library/toolkit
Loading...
Searching...
No Matches
Public Member Functions | List of all members
loos::OptionsFramework::OptionsPackage Class Reference

Base class for options. More...

#include <OptionsFramework.hpp>

Inheritance diagram for loos::OptionsFramework::OptionsPackage:
Inheritance graph
[legend]

Public Member Functions

virtual void addGeneric (po::options_description &opts)
 Appends generic options (those that the user can see)
 
virtual void addHidden (po::options_description &opts)
 Appends hidden options (these generally match positional)
 
virtual void addPositional (po::positional_options_description &opts)
 Appends positional options.
 
virtual std::string print () const
 Returns a string listing the encapsulated options, suitable for logging.
 
virtual bool check (po::variables_map &map)
 Validates passed options, returning true if there is a problem or false if not.
 
virtual bool postConditions (po::variables_map &map)
 Post-processing of options returning true if there were no problems, otherwise false.
 
virtual std::string help () const
 Returns a slice of the example command-line in the help output.
 

Detailed Description

Base class for options.

Options may have a short (1-letter) equivalent. The convention is that core options (i.e. those declared in OptionsFramework.cpp) should all be lower-case. Package options should be in upper-case. Tool-specific options should all be long-form, unless they are commonly used, in which case it's recommended that they be upper-case.

Member Function Documentation

◆ addGeneric()

virtual void loos::OptionsFramework::OptionsPackage::addGeneric ( po::options_description & opts)
inlinevirtual

◆ addHidden()

virtual void loos::OptionsFramework::OptionsPackage::addHidden ( po::options_description & opts)
inlinevirtual

Appends hidden options (these generally match positional)

Reimplemented in ToolOptions.

◆ addPositional()

virtual void loos::OptionsFramework::OptionsPackage::addPositional ( po::positional_options_description & opts)
inlinevirtual

Appends positional options.

Reimplemented in ToolOptions.

◆ check()

virtual bool loos::OptionsFramework::OptionsPackage::check ( po::variables_map & map)
inlinevirtual

Validates passed options, returning true if there is a problem or false if not.

check() is typically used to validate positional options. For example, if you tool needs a command line that looks like:

* tool [options] min-value max-value number-of-bins
* 

then check() would verify that min-value, max-value, and number-of-bins were passed on the command-line. Another example is where there are mutually-exclusive options. This would be checked by check().

Reimplemented in ToolOptions.

◆ help()

virtual std::string loos::OptionsFramework::OptionsPackage::help ( ) const
inlinevirtual

Returns a slice of the example command-line in the help output.

This is used specifically for positional options. If your tool has a command line that looks like:

* tool [options] min-value max-value selection
* 

The required arguments min-value, max-value, and selection are actually "hidden" options and will not be printed out when boost::program_options generates its help message. The AggregateOptions class will build the full command line for the help message by using the help() methods from each OptionsPackage, printing out something like the above on the command line as part of the help output.

Reimplemented in ToolOptions.

◆ postConditions()

virtual bool loos::OptionsFramework::OptionsPackage::postConditions ( po::variables_map & map)
inlinevirtual

Post-processing of options returning true if there were no problems, otherwise false.

postConditions() is called after options parsing and validation is complete. This is a mechanism for a subclass to do additional processing with the options it has been provided. For example, a model option subclass might read in the specified model and copy coordinates from an optionally specified file.

Note that the return value from postConditions() is the opposite of check(). Here, a true is returned if there are no problems.

Reimplemented in loos::OptionsFramework::BasicWater, ToolOptions, ToolOptions, ToolOptions, loos::OptionsFramework::BasicConvergence, and ToolOptions.

◆ print()

virtual std::string loos::OptionsFramework::OptionsPackage::print ( ) const
inlinevirtual

Returns a string listing the encapsulated options, suitable for logging.

Reimplemented in loos::OptionsFramework::BasicConvergence, loos::OptionsFramework::BasicWater, ToolOptions, ToolOptions, ToolOptions, ToolOptions, and ToolOptions.


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