Nektar++
Public Member Functions | Public Attributes | List of all members
Nektar::FieldUtils::ConfigOption Struct Reference

Represents a command-line configuration option. More...

#include <Module.h>

Public Member Functions

 ConfigOption (bool isBool, std::string defValue, std::string desc)
 Construct a new configuration option. More...
 
 ConfigOption ()
 
template<typename T >
as () const
 Re-interpret the value stored in #value as some type using boost::lexical_cast. More...
 

Public Attributes

bool m_isBool
 True if the configuration option is a boolean (thus does not need additional arguments). More...
 
bool m_beenSet
 True if the configuration option has been set at command line. If false, the default value will be put into #value. More...
 
std::string m_value
 The value of the configuration option. More...
 
std::string m_defValue
 Default value of the configuration option. More...
 
std::string m_desc
 Description of the configuration option. More...
 

Detailed Description

Represents a command-line configuration option.

Definition at line 128 of file Module.h.

Constructor & Destructor Documentation

◆ ConfigOption() [1/2]

Nektar::FieldUtils::ConfigOption::ConfigOption ( bool  isBool,
std::string  defValue,
std::string  desc 
)
inline

Construct a new configuration option.

Parameters
isBoolTrue if the option is boolean type.
defValueDefault value of the option.
descDescription of the option.

Definition at line 137 of file Module.h.

138 : m_isBool(isBool), m_beenSet(false), m_value(), m_defValue(defValue),
139 m_desc(desc)
140 {
141 }
std::string m_value
The value of the configuration option.
Definition: Module.h:173
bool m_beenSet
True if the configuration option has been set at command line. If false, the default value will be pu...
Definition: Module.h:171
std::string m_defValue
Default value of the configuration option.
Definition: Module.h:175
std::string m_desc
Description of the configuration option.
Definition: Module.h:177
bool m_isBool
True if the configuration option is a boolean (thus does not need additional arguments).
Definition: Module.h:168

◆ ConfigOption() [2/2]

Nektar::FieldUtils::ConfigOption::ConfigOption ( )
inline

Definition at line 142 of file Module.h.

143 : m_isBool(false), m_beenSet(false), m_value(), m_defValue(), m_desc()
144 {
145 }

Member Function Documentation

◆ as()

template<typename T >
T Nektar::FieldUtils::ConfigOption::as ( ) const
inline

Re-interpret the value stored in #value as some type using boost::lexical_cast.

Definition at line 151 of file Module.h.

152 {
153 try
154 {
155 return boost::lexical_cast<T>(m_value);
156 }
157 catch (const std::exception &e)
158 {
159 std::cerr << "We are not able to cast m_value " << m_value << " to "
160 << typeid(T).name() << std::endl
161 << e.what() << std::endl;
162 abort();
163 }
164 }

References m_value, and CellMLToNektar.pycml::name.

Member Data Documentation

◆ m_beenSet

bool Nektar::FieldUtils::ConfigOption::m_beenSet

True if the configuration option has been set at command line. If false, the default value will be put into #value.

Definition at line 171 of file Module.h.

Referenced by Nektar::FieldUtils::Module::RegisterConfig().

◆ m_defValue

std::string Nektar::FieldUtils::ConfigOption::m_defValue

Default value of the configuration option.

Definition at line 175 of file Module.h.

◆ m_desc

std::string Nektar::FieldUtils::ConfigOption::m_desc

Description of the configuration option.

Definition at line 177 of file Module.h.

◆ m_isBool

bool Nektar::FieldUtils::ConfigOption::m_isBool

True if the configuration option is a boolean (thus does not need additional arguments).

Definition at line 168 of file Module.h.

◆ m_value

std::string Nektar::FieldUtils::ConfigOption::m_value

The value of the configuration option.

Definition at line 173 of file Module.h.

Referenced by as(), and Nektar::FieldUtils::Module::RegisterConfig().