NEML2 1.4.0
Loading...
Searching...
No Matches
OptionSet::OptionBase::Metadata Struct Reference

Detailed Description

Metadata associated with this option

#include <OptionSet.h>

Public Member Functions

bool operator== (const Metadata &other) const
 

Public Attributes

std::string name = ""
 Name of the option.
 
std::string type = ""
 Type of the option.
 
std::string doc = ""
 Option's doc string.
 
bool suppressed = false
 Whether this option is suppressed.
 

Member Function Documentation

◆ operator==()

bool operator== ( const Metadata & other) const
inline

Member Data Documentation

◆ doc

std::string doc = ""

Option's doc string.

When we build the documentation for NEML2, we automatically extract the syntax and convert it to a markdown file. The syntax of NEML2 is just the collection of expected options of all the registered objects. Doxygen will then render the markdown syntax to the target output format, e.g., html, tex, etc. This implies that the docstring can contain anything that the Doxygen's markdown renderer can understand. For more information, see https://www.doxygen.nl/manual/markdown.html

◆ name

std::string name = ""

Name of the option.

For example, in a HIT input file, this is the field name that appears on the left-hand side

[foo]
type = SomeModel
bar = 123
[]

where "bar" is the option name

◆ suppressed

bool suppressed = false

Whether this option is suppressed.

By default an option is not suppressed. However, it is sometimes desirable for a derived object to suppress certain option. A suppressed option cannot be modified by the user. It is up to the specific Parser to decide what happens when a user attempts to set a suppressed option, e.g., the parser can choose to throw an exception, print a warning and accept it, or print a warning and ignores it.

◆ type

std::string type = ""

Type of the option.

We use RTTI to determine the type of the option. Most importantly, two options are considered different if they have different types, even if they have the same name. For example, if you specify an option of name "foo" of type int as an expected option, later if you attempt to retrieve an option of name "foo" but of type string, an exception will be thrown saying that the option does not exist.