GWOLLUM  4.2.0
Tools for gravitational-wave analyses
GwollumOption Class Reference

Single option. More...

#include <GwollumOptions.h>

Public Member Functions

void Add (const double aValue)
 Adds the option value (double). More...
 
void Add (const int aValue)
 Adds an option value (int). More...
 
void Add (const string aValue)
 Adds the option value (string). More...
 
void Add (const unsigned int aValue)
 Adds the option value (unsigned int). More...
 
double GetDefaultD (void)
 Returns the option default value (double). More...
 
int GetDefaultI (void)
 Returns the option default value (int). More...
 
string GetDefaultS (void)
 Returns the option default value (string). More...
 
unsigned int GetDefaultU (void)
 Returns the option default value (unsigned int). More...
 
string GetKey (void)
 Returns the option key. More...
 
unsigned int GetNumberOfValues (void)
 Returns the number of values. More...
 
string GetOptionName (const unsigned int aValIndex)
 Returns a codified option name. More...
 
unsigned int GetSize (void)
 Returns the option size. More...
 
string GetTag (void)
 Returns the option tag. More...
 
char GetType (void)
 Returns the option type. More...
 
double GetValueD (const unsigned int aValIndex=0)
 Returns the option value (double). More...
 
bool GetValueD (double &aValue, const unsigned int aValIndex)
 Returns the option value (double). More...
 
int GetValueI (const unsigned int aValIndex=0)
 Returns the option value (int). More...
 
bool GetValueI (int &aValue, const unsigned int aValIndex)
 Returns the option value (int). More...
 
string GetValueS (const unsigned int aValIndex=0)
 Returns the option value (string). More...
 
bool GetValueS (string &aValue, const unsigned int aValIndex)
 Returns the option value (string). More...
 
vector< double > GetValuesD (void)
 Returns the list of option values (double). More...
 
vector< int > GetValuesI (void)
 Returns the list of option values (int). More...
 
vector< string > GetValuesS (void)
 Returns the list of option values (string). More...
 
vector< unsigned int > GetValuesU (void)
 Returns the list of option values (unsigned int). More...
 
unsigned int GetValueU (const unsigned int aValIndex=0)
 Returns the option value (unsigned int). More...
 
bool GetValueU (unsigned int &aValue, const unsigned int aValIndex)
 Returns the option value (unsigned int). More...
 
bool IsProvided (void)
 Tests whether an option value was provided. More...
 
void Reset (void)
 Resets the option. More...
 
void Set (const unsigned int aValIndex, const double aValue)
 Updates an option value (double). More...
 
void Set (const unsigned int aValIndex, const int aValue)
 Updates an option value (int). More...
 
void Set (const unsigned int aValIndex, const string aValue)
 Updates an option value (string). More...
 
void Set (const unsigned int aValIndex, const unsigned int aValue)
 Updates an option value (unsigned int). More...
 
void SetDefault (void)
 Set option to default values. More...
 
Constructors and destructors
 GwollumOption (const string aTag, const string aKey, const int aDefaultValue, const unsigned int aSize=0)
 Constructor of the GwollumOption class (int). More...
 
 GwollumOption (const string aTag, const string aKey, const unsigned int aDefaultValue, const unsigned int aSize=0)
 Constructor of the GwollumOption class (unsigned int). More...
 
 GwollumOption (const string aTag, const string aKey, const double aDefaultValue, const unsigned int aSize=0)
 Constructor of the GwollumOption class (double). More...
 
 GwollumOption (const string aTag, const string aKey, const string aDefaultValue, const unsigned int aSize=0)
 Constructor of the GwollumOption class (string). More...
 
virtual ~GwollumOption (void)
 Destructor of the GwollumOption class. More...
 

Private Attributes

double ddef
 Option double default value. More...
 
vector< double > dvec
 Option double vector. More...
 
int idef
 Option integer default value. More...
 
vector< int > ivec
 Option integer vector. More...
 
string key
 Option key. More...
 
unsigned int osize
 Option size (number of fixed values). More...
 
bool provided
 Set to true if the option was explicitly given. More...
 
string sdef
 Option string default value. More...
 
vector< string > svec
 Option string vector. More...
 
string tag
 Option tag. More...
 
unsigned int udef
 Option unsigned integer default value. More...
 
vector< unsigned int > uvec
 Option unsigned integer vector. More...
 
char valtype
 Option value type. More...
 

Detailed Description

Single option.

A single option is defined by:

  • A TAG string
  • A KEY string
  • A type: int (i), unsigned int (u), double (d), string (s)
  • A size: an option can be given a fixed size. Use 0 for an option with a variable size.
  • A default value
  • A list of values

Constructor & Destructor Documentation

◆ GwollumOption() [1/4]

GwollumOption::GwollumOption ( const string  aTag,
const string  aKey,
const int  aDefaultValue,
const unsigned int  aSize = 0 
)

Constructor of the GwollumOption class (int).

The option is uniquely identified by a TAG and a KEY string. It is given a default value. It is possible to fix the number of values for the option. If the size is equal to 0, the number of values is not fixed.

Parameters
[in]aTagOption tag. Do not use "_"; they will be removed.
[in]aKeyOption aKey. Do not use "_"; they will be removed.
[in]aDefaultValueDefault value.
[in]aSizeNumber of values for this option. Use 0 for a variable size.

◆ GwollumOption() [2/4]

GwollumOption::GwollumOption ( const string  aTag,
const string  aKey,
const unsigned int  aDefaultValue,
const unsigned int  aSize = 0 
)

Constructor of the GwollumOption class (unsigned int).

The option is uniquely identified by a TAG and a KEY string. It is given a default value. It is possible to fix the number of values for the option. If the size is equal to 0, the number of values is not fixed.

Parameters
[in]aTagOption tag. Do not use "_"; they will be removed.
[in]aKeyOption aKey. Do not use "_"; they will be removed.
[in]aDefaultValueDefault value.
[in]aSizeNumber of values for this option. Use 0 for a variable size.

◆ GwollumOption() [3/4]

GwollumOption::GwollumOption ( const string  aTag,
const string  aKey,
const double  aDefaultValue,
const unsigned int  aSize = 0 
)

Constructor of the GwollumOption class (double).

The option is uniquely identified by a TAG and a KEY string. It is given a default value. It is possible to fix the number of values for the option. If the size is equal to 0, the number of values is not fixed.

Parameters
[in]aTagOption tag. Do not use "_"; they will be removed.
[in]aKeyOption aKey. Do not use "_"; they will be removed.
[in]aDefaultValueDefault value.
[in]aSizeNumber of values for this option. Use 0 for a variable size.

◆ GwollumOption() [4/4]

GwollumOption::GwollumOption ( const string  aTag,
const string  aKey,
const string  aDefaultValue,
const unsigned int  aSize = 0 
)

Constructor of the GwollumOption class (string).

The option is uniquely identified by a TAG and a KEY string. It is given a default value. It is possible to fix the number of values for the option. If the size is equal to 0, the number of values is not fixed.

Parameters
[in]aTagOption tag. Do not use "_"; they will be removed.
[in]aKeyOption aKey. Do not use "_"; they will be removed.
[in]aDefaultValueDefault value.
[in]aSizeNumber of values for this option. Use 0 for a variable size.

◆ ~GwollumOption()

GwollumOption::~GwollumOption ( void  )
virtual

Destructor of the GwollumOption class.

Member Function Documentation

◆ Add() [1/4]

void GwollumOption::Add ( const double  aValue)
inline

Adds the option value (double).

Appends the value to the list of option values.

Warning
This function only works for variable-size options. Use the Set() function for fixed-sized options.
Parameters
[in]aValueOption value.

◆ Add() [2/4]

void GwollumOption::Add ( const int  aValue)
inline

Adds an option value (int).

Appends the value to the list of option values.

Warning
This function only works for variable-size options. Use the Set() function for fixed-sized options.
Parameters
[in]aValueOption value.

◆ Add() [3/4]

void GwollumOption::Add ( const string  aValue)
inline

Adds the option value (string).

Appends the value to the list of option values.

Warning
This function only works for variable-size options. Use the Set() function for fixed-sized options.
Parameters
[in]aValueOption value.

◆ Add() [4/4]

void GwollumOption::Add ( const unsigned int  aValue)
inline

Adds the option value (unsigned int).

Appends the value to the list of option values.

Warning
This function only works for variable-size options. Use the Set() function for fixed-sized options.
Parameters
[in]aValueOption value.

◆ GetDefaultD()

double GwollumOption::GetDefaultD ( void  )
inline

Returns the option default value (double).

◆ GetDefaultI()

int GwollumOption::GetDefaultI ( void  )
inline

Returns the option default value (int).

◆ GetDefaultS()

string GwollumOption::GetDefaultS ( void  )
inline

Returns the option default value (string).

◆ GetDefaultU()

unsigned int GwollumOption::GetDefaultU ( void  )
inline

Returns the option default value (unsigned int).

◆ GetKey()

string GwollumOption::GetKey ( void  )
inline

Returns the option key.

◆ GetNumberOfValues()

unsigned int GwollumOption::GetNumberOfValues ( void  )
inline

Returns the number of values.

◆ GetOptionName()

string GwollumOption::GetOptionName ( const unsigned int  aValIndex)

Returns a codified option name.

The option name is codified: [TAG]_[KEY]_[INDEX]_[SIZE]:

  • [TAG]: option tag word.
  • [KEY]: option key word.
  • [INDEX]: option value index.
  • [SIZE]: option size (0 for variable option).
Parameters
[in]aValIndexOption value index.

◆ GetSize()

unsigned int GwollumOption::GetSize ( void  )
inline

Returns the option size.

Returns
0 for variable-size options. Use GetNumberOfValues() to get the actual number of option values.

◆ GetTag()

string GwollumOption::GetTag ( void  )
inline

Returns the option tag.

◆ GetType()

char GwollumOption::GetType ( void  )
inline

Returns the option type.

◆ GetValueD() [1/2]

double GwollumOption::GetValueD ( const unsigned int  aValIndex = 0)
inline

Returns the option value (double).

Warning
Only call this function for double options!
Parameters
[in]aValIndexOption index.
Returns
The default value if the index is out of range.

◆ GetValueD() [2/2]

bool GwollumOption::GetValueD ( double &  aValue,
const unsigned int  aValIndex 
)
inline

Returns the option value (double).

Warning
Only call this function for double options!
Returns
true if the value exists, false otherwise.
Parameters
[out]aValueReturned value.
[in]aValIndexValue index.

◆ GetValueI() [1/2]

int GwollumOption::GetValueI ( const unsigned int  aValIndex = 0)
inline

Returns the option value (int).

Warning
Only call this function for int options!
Parameters
[in]aValIndexValue index.
Returns
The default value if the index is out of range.

◆ GetValueI() [2/2]

bool GwollumOption::GetValueI ( int &  aValue,
const unsigned int  aValIndex 
)
inline

Returns the option value (int).

Warning
Only call this function for int options!
Returns
true if the value exists, false otherwise.
Parameters
[out]aValueReturned value.
[in]aValIndexValue index.

◆ GetValueS() [1/2]

string GwollumOption::GetValueS ( const unsigned int  aValIndex = 0)
inline

Returns the option value (string).

Warning
Only call this function for string options!
Parameters
[in]aValIndexOption index.
Returns
The default value if the index is out of range.

◆ GetValueS() [2/2]

bool GwollumOption::GetValueS ( string &  aValue,
const unsigned int  aValIndex 
)
inline

Returns the option value (string).

Warning
Only call this function for string options!
Returns
true if the value exists, false otherwise.
Parameters
[out]aValueReturned value.
[in]aValIndexValue index.

◆ GetValuesD()

vector<double> GwollumOption::GetValuesD ( void  )
inline

Returns the list of option values (double).

Warning
Only call this function for double options!

◆ GetValuesI()

vector<int> GwollumOption::GetValuesI ( void  )
inline

Returns the list of option values (int).

Warning
Only call this function for int options!

◆ GetValuesS()

vector<string> GwollumOption::GetValuesS ( void  )
inline

Returns the list of option values (string).

Warning
Only call this function for string options!

◆ GetValuesU()

vector<unsigned int> GwollumOption::GetValuesU ( void  )
inline

Returns the list of option values (unsigned int).

Warning
Only call this function for unsigned int options!

◆ GetValueU() [1/2]

unsigned int GwollumOption::GetValueU ( const unsigned int  aValIndex = 0)
inline

Returns the option value (unsigned int).

Warning
Only call this function for unsigned int options!
Parameters
[in]aValIndexOption index.
Returns
The default value if the index is out of range.

◆ GetValueU() [2/2]

bool GwollumOption::GetValueU ( unsigned int &  aValue,
const unsigned int  aValIndex 
)
inline

Returns the option value (unsigned int).

Warning
Only call this function for unsigned int options!
Returns
true if the value exists, false otherwise.
Parameters
[out]aValueReturned value.
[in]aValIndexValue index.

◆ IsProvided()

bool GwollumOption::IsProvided ( void  )
inline

Tests whether an option value was provided.

This applies if at least one value was provided with Set() or Add().

Returns
true if this is the case.

◆ Reset()

void GwollumOption::Reset ( void  )

Resets the option.

All the option values are removed. Fixed-size option values are set to default. Variable-size options are simply empty.

◆ Set() [1/4]

void GwollumOption::Set ( const unsigned int  aValIndex,
const double  aValue 
)
inline

Updates an option value (double).

Parameters
[in]aValIndexOption index.
[in]aValueOption value.

◆ Set() [2/4]

void GwollumOption::Set ( const unsigned int  aValIndex,
const int  aValue 
)
inline

Updates an option value (int).

Parameters
[in]aValIndexOption index.
[in]aValueOption value.

◆ Set() [3/4]

void GwollumOption::Set ( const unsigned int  aValIndex,
const string  aValue 
)
inline

Updates an option value (string).

Parameters
[in]aValIndexOption index.
[in]aValueOption value.

◆ Set() [4/4]

void GwollumOption::Set ( const unsigned int  aValIndex,
const unsigned int  aValue 
)
inline

Updates an option value (unsigned int).

Parameters
[in]aValIndexOption index.
[in]aValueOption value.

◆ SetDefault()

void GwollumOption::SetDefault ( void  )

Set option to default values.

For fixed-size options, all values are set to default. For variable-size options, the option is given one single value set to default.

Member Data Documentation

◆ ddef

double GwollumOption::ddef
private

Option double default value.

◆ dvec

vector<double> GwollumOption::dvec
private

Option double vector.

◆ idef

int GwollumOption::idef
private

Option integer default value.

◆ ivec

vector<int> GwollumOption::ivec
private

Option integer vector.

◆ key

string GwollumOption::key
private

Option key.

◆ osize

unsigned int GwollumOption::osize
private

Option size (number of fixed values).

◆ provided

bool GwollumOption::provided
private

Set to true if the option was explicitly given.

◆ sdef

string GwollumOption::sdef
private

Option string default value.

◆ svec

vector<string> GwollumOption::svec
private

Option string vector.

◆ tag

string GwollumOption::tag
private

Option tag.

◆ udef

unsigned int GwollumOption::udef
private

Option unsigned integer default value.

◆ uvec

vector<unsigned int> GwollumOption::uvec
private

Option unsigned integer vector.

◆ valtype

char GwollumOption::valtype
private

Option value type.


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