#include <inputOutput.hh>
Public Member Functions | |
InOutParameters () | |
Constructor. | |
InOutParameters (const InOutParameters &i) | |
Copy constructor. | |
void | append (const InOutParameters &inout, bool arrayAppend=true) |
void | addDouble (const char *name, const double value) |
Adds a double to the hash of doubles. | |
void | addComplex (const char *name, const std::complex< double > value) |
Adds a complex double to the hash of doubles. | |
void | addString (const char *name, const char *value) |
Adds a string to the hash of strings. | |
void | addInt (const char *name, const int value) |
Adds an int to the hash of ints. | |
void | addBool (const char *name, const int value) |
Adds a bool to the hash of bools. | |
double | getDouble (const char *name) const |
Returns a double from the hash of doubles. | |
double | getDouble (const char *name, const double value) const |
std::complex< double > | getComplex (const char *name) const |
Returns a complex double from the hash of doubles. | |
std::string | getString (const char *name, const char *value=0) const |
int | getInt (const char *name, const int value=INT_MAX) const |
bool | getBool (const char *name) const |
Returns a bool from the hash of bools. | |
bool | getBool (const char *name, const bool value) const |
void | addArrayDouble (const char *array, const bool newArray=false) |
void | addArrayComplex (const char *array, const bool newArray=false) |
void | addArrayString (const char *array, const bool newArray=false) |
void | addArrayInt (const char *array, const bool newArray=false) |
void | addArrayBool (const char *array, const bool newArray=false) |
void | addArrayDouble (const char *array, const int number, const double value) |
void | addArrayComplex (const char *array, const int number, const std::complex< double > value) |
void | addArrayString (const char *array, const int number, const char *value) |
void | addArrayInt (const char *array, const int number, const int value) |
void | addArrayBool (const char *array, const int number, const int value) |
double | getArrayDouble (const char *array, const int number) const |
std::complex< double > | getArrayComplex (const char *array, const int number) const |
std::string | getArrayString (const char *array, const int number) const |
int | getArrayInt (const char *array, const int number) const |
bool | getArrayBool (const char *array, const int number) const |
const std::map< int, double > & | getMapDouble (const char *array) const |
const std::map< int, std::complex< double > > & | getMapComplex (const char *array) const |
const std::map< int, std::string > & | getMapString (const char *array) const |
const std::map< int, int > & | getMapInt (const char *array) const |
const std::map< int, bool > & | getMapBool (const char *array) const |
void | addMatrixDouble (const char *array, const bool newMatrix=false) |
void | addMatrixInt (const char *array, const bool newMatrix=false) |
void | addMatrixDouble (const char *matrix, const int i, const int j, const double value) |
void | addMatrixInt (const char *matrix, const int i, const int j, const int value) |
double | getMatrixDouble (const char *array, const int i, const int j) const |
int | getMatrixInt (const char *array, const int i, const int j) const |
void | clear () |
clears the object | |
void | storeMatlab (const char *filename, const std::string description="") const |
std::ostream & | storeMatlab (std::ostream &os, const char *name, const std::string description="") const |
Protected Member Functions | |
virtual std::ostream & | info (std::ostream &os) const |
Returns information in an output stream. | |
Holds parameters in hashes. This class has four hashes to hold integer, double, bool and string parameters and four hashes to hold arrays of integers, doubles, bools and strings. It does therefore store (name, value) pairs in the hashes and (name, number, value) triples in the arrays.
The main usage of this class is by inputParser which reads an input file and enters the parameters into such an object.
If a parameter already exists and is added a second time, the value is simply overwritten. The same is true for the entries in the arrays. If an array is created a second time, nothing happens.
The output operator writes the contents of the whole class to the output stream in the format of the input file. The output is not in the order of the input file.
Definition at line 75 of file inputOutput.hh.
|
inline |
Constructor.
Definition at line 78 of file inputOutput.hh.
Creates an emtpy array for bools if necessary
If newArray
is true, the array entries will be deleted
void concepts::InOutParameters::addArrayBool | ( | const char * | array, |
const int | number, | ||
const int | value | ||
) |
Adds a bool to an array.
array | Name of the array |
number | Number of the entry |
value | Value of the entry |
Creates an empty array for complex doubles if necessary
If newArray
is true, the array entries will be deleted
void concepts::InOutParameters::addArrayComplex | ( | const char * | array, |
const int | number, | ||
const std::complex< double > | value | ||
) |
Adds a complex double to an array.
array | Name of the array |
number | Number of the entry |
value | Value of the entry |
Creates an empty array for doubles if necessary
If newArray
is true, the array entries will be deleted
void concepts::InOutParameters::addArrayDouble | ( | const char * | array, |
const int | number, | ||
const double | value | ||
) |
Adds a double to an array.
array | Name of the array |
number | Number of the entry |
value | Value of the entry |
Creates an empty array for ints if necessary
If newArray
is true, the array entries will be deleted
void concepts::InOutParameters::addArrayInt | ( | const char * | array, |
const int | number, | ||
const int | value | ||
) |
Adds an int to an array.
array | Name of the array |
number | Number of the entry |
value | Value of the entry |
Creates an empty array for strings if necessary
If newArray
is true, the array entries will be deleted
void concepts::InOutParameters::addArrayString | ( | const char * | array, |
const int | number, | ||
const char * | value | ||
) |
Adds a string to an array.
array | Name of the array |
number | Number of the entry |
value | Value of the entry |
void concepts::InOutParameters::addMatrixDouble | ( | const char * | array, |
const bool | newMatrix = false |
||
) |
Creates an empty matrix for doubles if necessary
If newMatrix
is true, the array entries will be deleted
void concepts::InOutParameters::addMatrixDouble | ( | const char * | matrix, |
const int | i, | ||
const int | j, | ||
const double | value | ||
) |
Adds a double to an matrix.
array | Name of the matrix |
i | Row index of the entry in the matrix |
j | Column index of the entry in the matrix |
value | Value of the entry |
Creates an empty matrix for integer if necessary
If newMatrix
is true, the array entries will be deleted
void concepts::InOutParameters::addMatrixInt | ( | const char * | matrix, |
const int | i, | ||
const int | j, | ||
const int | value | ||
) |
Adds a integer to an matrix.
array | Name of the matrix |
i | Row index of the entry in the matrix |
j | Column index of the entry in the matrix |
value | Value of the entry |
void concepts::InOutParameters::append | ( | const InOutParameters & | inout, |
bool | arrayAppend = true |
||
) |
Appends inout
arrayAppend | true: append array values, false: overwrite arrays |
Returns a bool from an array.
array | Name of the array |
number | Number of the entry in the array |
std::complex< double > concepts::InOutParameters::getArrayComplex | ( | const char * | array, |
const int | number | ||
) | const |
Returns a complex double from an array.
array | Name of the array |
number | Number of the entry in the array |
Returns a double from an array.
array | Name of the array |
number | Number of the entry in the array |
Returns a int from an array.
array | Name of the array |
number | Number of the entry in the array |
std::string concepts::InOutParameters::getArrayString | ( | const char * | array, |
const int | number | ||
) | const |
Returns a string from an array.
array | Name of the array |
number | Number of the entry in the array |
Returns a bool from the hash of bools
If name
does not exist take value
.
Returns a double from the hash of doubles
If name
does not exist take value
.
Returns an int from the hash of ints
If name
does not exist take value
.
Returns a reference to the requested map.
MissingParameter |
const std::map< int, std::complex< double > > & concepts::InOutParameters::getMapComplex | ( | const char * | array | ) | const |
Returns a reference to the requested map.
MissingParameter |
Returns a reference to the requested map.
MissingParameter |
Returns a reference to the requested map.
MissingParameter |
const std::map< int, std::string > & concepts::InOutParameters::getMapString | ( | const char * | array | ) | const |
Returns a reference to the requested map.
MissingParameter |
double concepts::InOutParameters::getMatrixDouble | ( | const char * | array, |
const int | i, | ||
const int | j | ||
) | const |
Returns a double from an matrix.
array | Name of the matrix |
i | Row index of the entry in the matrix |
j | Column index of the entry in the matrix |
Returns a integer from an matrix.
array | Name of the matrix |
i | Row index of the entry in the matrix |
j | Column index of the entry in the matrix |
std::string concepts::InOutParameters::getString | ( | const char * | name, |
const char * | value = 0 |
||
) | const |
Returns a string from the hash of strings
If string name
does not exist take value
.
|
protectedvirtual |
Returns information in an output stream.
Reimplemented from concepts::OutputOperator.
void concepts::InOutParameters::storeMatlab | ( | const char * | filename, |
const std::string | description = "" |
||
) | const |
Output as matlab function, which gives a object back
filename | name of the output file, ending .m is added |
std::ostream & concepts::InOutParameters::storeMatlab | ( | std::ostream & | os, |
const char * | name, | ||
const std::string | description = "" |
||
) | const |
Output as matlab function, which gives a object back
os | output stream |
name | name of the function |