Nektar++
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. More...
 
 ConfigOption ()
 
template<typename T >
as ()
 Re-interpret the value stored in value as some type using boost::lexical_cast. More...
 
 ConfigOption (bool isBool, string defValue, string desc)
 Construct a new configuration option. More...
 
 ConfigOption ()
 
template<typename T >
as ()
 Re-interpret the value stored in value as some type using boost::lexical_cast. More...
 
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. 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...
 
string m_value
 The value of the configuration option. More...
 
string m_defValue
 Default value of the configuration option. More...
 
string m_desc
 Description of the configuration option. More...
 
bool isBool
 True if the configuration option is a boolean (thus does not need additional arguments). More...
 
bool beenSet
 True if the configuration option has been set at command line. If false, the default value will be put into value. More...
 
string value
 The value of the configuration option. More...
 
string defValue
 Default value of the configuration option. More...
 
string desc
 Description of the configuration option. More...
 

Detailed Description

Represents a command-line configuration option.

Definition at line 82 of file 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 91 of file FieldConvert/Module.h.

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

Definition at line 94 of file FieldConvert/Module.h.

94  :
95  m_isBool(false), m_beenSet(false), m_value(),
96  m_defValue(), m_desc() {}
string m_defValue
Default value of the configuration option.
bool m_isBool
True if the configuration option is a boolean (thus does not need additional arguments).
string m_desc
Description of the configuration option.
string m_value
The value of the configuration option.
bool m_beenSet
True if the configuration option has been set at command line. If false, the default value will be pu...
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 MeshConvert/Module.h.

81  :
82  isBool(isBool), beenSet(false), value(), defValue(defValue),
83  desc(desc) {}
bool isBool
True if the configuration option is a boolean (thus does not need additional arguments).
string desc
Description of the configuration option.
bool beenSet
True if the configuration option has been set at command line. If false, the default value will be pu...
string defValue
Default value of the configuration option.
string value
The value of the configuration option.
Nektar::Utilities::ConfigOption::ConfigOption ( )
inline

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

84  :
85  isBool(false), beenSet(false), value(), defValue(), desc() {}
bool isBool
True if the configuration option is a boolean (thus does not need additional arguments).
string desc
Description of the configuration option.
bool beenSet
True if the configuration option has been set at command line. If false, the default value will be pu...
string defValue
Default value of the configuration option.
string value
The value of the configuration option.

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 MeshConvert/Module.h.

References value.

93  {
94  try
95  {
96  return boost::lexical_cast<T>(value);
97  }
98  catch(const std::exception &e)
99  {
100  std::cerr << e.what() << std::endl;
101  abort();
102  }
103  }
string value
The value of the configuration option.
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 103 of file FieldConvert/Module.h.

104  {
105  try
106  {
107  return boost::lexical_cast<T>(m_value);
108  }
109  catch(const exception &e)
110  {
111  cerr << e.what() << endl;
112  abort();
113  }
114  }
string m_value
The value of the configuration option.
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 MeshConvert/Module.h.

References value.

111  {
112  bool returnval = true;
113  try
114  {
115  boost::lexical_cast<T>(value);
116  }
117  catch(const std::exception &e)
118  {
119  returnval = false;
120  }
121 
122  return returnval;
123  }
string value
The value of the configuration option.

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 MeshConvert/Module.h.

string Nektar::Utilities::ConfigOption::defValue

Default value of the configuration option.

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

string Nektar::Utilities::ConfigOption::desc

Description of the configuration option.

Definition at line 137 of file 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 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 121 of file FieldConvert/Module.h.

string Nektar::Utilities::ConfigOption::m_defValue

Default value of the configuration option.

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

string Nektar::Utilities::ConfigOption::m_desc

Description of the configuration option.

Definition at line 127 of file 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 118 of file FieldConvert/Module.h.

string Nektar::Utilities::ConfigOption::m_value

The value of the configuration option.

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

string Nektar::Utilities::ConfigOption::value

The value of the configuration option.

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

Referenced by as(), and isType().