#include <param.h>
Collaboration diagram for Param:
Public Member Functions | |
Param (vector< char * > ¶mfiles_, const char *basedir_="resource/") | |
Constructor for a list of parameter files. | |
Param (const char *paramfile_, const char *basedir_="resource/") | |
Constructor for the name of one parameter file. | |
Param () | |
Standard-Constructor for no parameteter files. | |
Param (Param &P) | |
Copy-Constructor. | |
~Param () | |
Destructor. | |
void | add_file (char *filename) |
Add's a file to the list of the parameter files. | |
int | read () |
Read's all parameter-files, starting with file filenr+1 and stores them in the parameter-tree. | |
Pointer< char > | get (const char *name, const char *def=(const char *) NULL) const |
Get's the value for a parameter-name. | |
double | get_d (const char *name_, double def=0) const |
Get's the value of a parameter from the tree and converts it to a double. | |
int | get_i (const char *name_, int def=0) const |
Get's the value of a parameter from the tree and converts it to an int. | |
void | add (const char *name_, const char *value_) |
Adds a (name, value) pair to the parameter tree. | |
Param & | operator= (const Param &p) |
Assing-Operator. | |
Public Attributes | |
char * | basedir |
Base-directory for the parameter files. | |
Private Attributes | |
int | filenr |
Counter for the number of the files, which were read by now. | |
ifstream * | file |
File to read. | |
vector< char * > | paramfiles |
A list of parameter files to read. | |
ParamTree * | head |
The head of the parameter-tree. | |
Friends | |
ostream & | operator<< (ostream &out, Param &a) |
Print's the read parameters. |
Definition at line 82 of file param.h.
Param::Param | ( | vector< char * > & | paramfiles_, | |
const char * | basedir_ = "resource/" | |||
) | [inline] |
Constructor for a list of parameter files.
Copys the strings form the given argument.
paramfiles_ | The list of parameter files as vector of char*. | |
basedir_ | The base-directory, where the files can be found. |
Definition at line 124 of file param.h.
References paramfiles.
Param::Param | ( | const char * | paramfile_, | |
const char * | basedir_ = "resource/" | |||
) | [inline] |
Constructor for the name of one parameter file.
Copys the pointer to the filename.
paramfile_ | The name of the parameter file. | |
basedir_ | The base-directory, where the files can be found. |
Definition at line 138 of file param.h.
References paramfiles.
Param::Param | ( | ) | [inline] |
Standard-Constructor for no parameteter files.
Param(char*, char*)
Param::Param | ( | Param & | P | ) | [inline] |
Copy-Constructor.
Call's Assign-Operator.
P | The Param to copy. |
Param(vector<char*>&, char*)
Param(char*, char*)
Param::~Param | ( | ) |
void Param::add_file | ( | char * | filename | ) | [inline] |
Add's a file to the list of the parameter files.
filename | The name of the file. |
Definition at line 172 of file param.h.
References paramfiles.
int Param::read | ( | ) |
Read's all parameter-files, starting with file filenr+1 and stores them in the parameter-tree.
Referenced by DualSolver::DualSolver().
Pointer<char> Param::get | ( | const char * | name, | |
const char * | def = (const char*)NULL | |||
) | const [inline] |
Get's the value for a parameter-name.
name | The name of the parameter to look for. | |
def | A default value for the parameter, if it wasn't set, default is NULL. |
Definition at line 187 of file param.h.
References ParamTree::get(), and head.
double Param::get_d | ( | const char * | name_, | |
double | def = 0 | |||
) | const [inline] |
Get's the value of a parameter from the tree and converts it to a double.
name_ | The name of the parameter to look for. | |
def | The default value for the parameter, if it wasn't set, default is 0. |
Definition at line 197 of file param.h.
References get().
Referenced by DualSolver::DualSolver(), and SubGradOpt::SubGradOpt().
int Param::get_i | ( | const char * | name_, | |
int | def = 0 | |||
) | const [inline] |
Get's the value of a parameter from the tree and converts it to an int.
name_ | The name of the parameter to look for. | |
def | The default value for the parameter, if it wasn't set, default is 0. |
Definition at line 210 of file param.h.
References get().
Referenced by DualSolver::DualSolver(), Random::Random(), and SubGradOpt::SubGradOpt().
void Param::add | ( | const char * | name_, | |
const char * | value_ | |||
) | [inline] |
Adds a (name, value) pair to the parameter tree.
The char*'s are copied, using strdup, if not NULL.
name_ | The name of the parameter to look for. | |
value_ | The value of the parameter. |
Definition at line 223 of file param.h.
References ParamTree::add(), and head.
ostream& operator<< | ( | ostream & | out, | |
Param & | a | |||
) | [friend] |
int Param::filenr [private] |
Counter for the number of the files, which were read by now.
-1, when no file was read.
Definition at line 97 of file param.h.
Referenced by operator=().
ifstream* Param::file [private] |
vector<char*> Param::paramfiles [private] |
A list of parameter files to read.
Definition at line 105 of file param.h.
Referenced by add_file(), operator=(), and Param().
ParamTree* Param::head [private] |
The head of the parameter-tree.
Definition at line 109 of file param.h.
Referenced by add(), get(), and operator=().
char* Param::basedir |
Base-directory for the parameter files.
Definition at line 114 of file param.h.
Referenced by operator=().