Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | List of all members
Nektar::Utilities::ConfigOption Struct Reference

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

#include <Module.h>

Collaboration diagram for Nektar::Utilities::ConfigOption:
Collaboration graph
[legend]

Public Member Functions

 ConfigOption (bool isBool, string defValue, string desc)
 Construct a new configuration option.
 ConfigOption ()
template<typename T >
as ()
 Re-interpret the value stored in value as some type using boost::lexical_cast.
 ConfigOption (bool isBool, string defValue, string desc)
 Construct a new configuration option.
 ConfigOption ()
template<typename T >
as ()
 Re-interpret the value stored in value as some type using boost::lexical_cast.
template<typename T >
bool isType ()
 Interpret the value stored in value as some type using boost::lexical_cast and return true of false depending on cast.

Public Attributes

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

Detailed Description

Represents a command-line configuration option.

Definition at line 80 of file PostProcessing/FieldConvert/Module.h.

Constructor & Destructor Documentation

Nektar::Utilities::ConfigOption::ConfigOption ( bool  isBool,
string  defValue,
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 89 of file PostProcessing/FieldConvert/Module.h.

Nektar::Utilities::ConfigOption::ConfigOption ( )
inline

Definition at line 92 of file PostProcessing/FieldConvert/Module.h.

:
m_isBool(false), m_beenSet(false), m_value(),
m_defValue(), m_desc() {}
Nektar::Utilities::ConfigOption::ConfigOption ( bool  isBool,
string  defValue,
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 81 of file PreProcessing/MeshConvert/Module.h.

Nektar::Utilities::ConfigOption::ConfigOption ( )
inline

Definition at line 84 of file PreProcessing/MeshConvert/Module.h.

:
isBool(false), beenSet(false), value(), defValue(), desc() {}

Member Function Documentation

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

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

Definition at line 92 of file PreProcessing/MeshConvert/Module.h.

References value.

{
try
{
return boost::lexical_cast<T>(value);
}
catch(const std::exception &e)
{
std::cerr << e.what() << std::endl;
abort();
}
}
template<typename T >
T Nektar::Utilities::ConfigOption::as ( )
inline

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

Definition at line 101 of file PostProcessing/FieldConvert/Module.h.

{
try
{
return boost::lexical_cast<T>(m_value);
}
catch(const exception &e)
{
cerr << e.what() << endl;
abort();
}
}
template<typename T >
bool Nektar::Utilities::ConfigOption::isType ( )
inline

Interpret the value stored in value as some type using boost::lexical_cast and return true of false depending on cast.

Definition at line 110 of file PreProcessing/MeshConvert/Module.h.

References value.

{
bool returnval = true;
try
{
boost::lexical_cast<T>(value);
}
catch(const std::exception &e)
{
returnval = false;
}
return returnval;
}

Member Data Documentation

bool Nektar::Utilities::ConfigOption::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 131 of file PreProcessing/MeshConvert/Module.h.

string Nektar::Utilities::ConfigOption::defValue

Default value of the configuration option.

Definition at line 135 of file PreProcessing/MeshConvert/Module.h.

string Nektar::Utilities::ConfigOption::desc

Description of the configuration option.

Definition at line 137 of file PreProcessing/MeshConvert/Module.h.

bool Nektar::Utilities::ConfigOption::isBool

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

Definition at line 128 of file PreProcessing/MeshConvert/Module.h.

bool Nektar::Utilities::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 119 of file PostProcessing/FieldConvert/Module.h.

string Nektar::Utilities::ConfigOption::m_defValue

Default value of the configuration option.

Definition at line 123 of file PostProcessing/FieldConvert/Module.h.

string Nektar::Utilities::ConfigOption::m_desc

Description of the configuration option.

Definition at line 125 of file PostProcessing/FieldConvert/Module.h.

bool Nektar::Utilities::ConfigOption::m_isBool

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

Definition at line 116 of file PostProcessing/FieldConvert/Module.h.

string Nektar::Utilities::ConfigOption::m_value

The value of the configuration option.

Definition at line 121 of file PostProcessing/FieldConvert/Module.h.

string Nektar::Utilities::ConfigOption::value

The value of the configuration option.

Definition at line 133 of file PreProcessing/MeshConvert/Module.h.

Referenced by as(), and isType().