Param Class Reference
Class for reading parameter-files and storing them in a tree (ParamTree).
More...
#include <param.h>
List of all members.
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.
|
Detailed Description
Class for reading parameter-files and storing them in a tree (ParamTree).
Definition at line 82 of file param.h.
Constructor & Destructor Documentation
| Param::Param |
( |
vector< char * > & |
paramfiles_, |
|
|
const char * |
basedir_ = "resource/" | |
|
) |
| | [inline] |
Constructor for a list of parameter files.
Copys the strings form the given argument.
- Parameters:
-
| paramfiles_ | The list of parameter files as vector of char*. |
| basedir_ | The base-directory, where the files can be found. |
- See also:
- Param(char*, char*)
-
Param()
-
Param(Param&)
Definition at line 124 of file param.h.
| Param::Param |
( |
const char * |
paramfile_, |
|
|
const char * |
basedir_ = "resource/" | |
|
) |
| | [inline] |
Constructor for the name of one parameter file.
Copys the pointer to the filename.
- Parameters:
-
| paramfile_ | The name of the parameter file. |
| basedir_ | The base-directory, where the files can be found. |
- See also:
- Param(vector<char*>&, char*)
-
Param()
-
Param(Param&)
Definition at line 138 of file param.h.
| Param::Param |
( |
|
) |
[inline] |
Standard-Constructor for no parameteter files.
- See also:
- Param(vector<char*>&, char*)
-
Param(char*, char*)
-
Param(Param&)
Definition at line 149 of file param.h.
| Param::Param |
( |
Param & |
P |
) |
[inline] |
Member Function Documentation
| void Param::add_file |
( |
char * |
filename |
) |
[inline] |
Add's a file to the list of the parameter files.
- Parameters:
-
| filename | The name of the file. |
Definition at line 172 of file param.h.
Read's all parameter-files, starting with file filenr+1 and stores them in the parameter-tree.
- Returns:
- 0, if everything went right; -1, if there was an error when opening a file; or the number of parse-errors.
- See also:
- head
| Pointer<char> Param::get |
( |
const char * |
name, |
|
|
const char * |
def = (const char*)NULL | |
|
) |
| | const [inline] |
Get's the value for a parameter-name.
- Parameters:
-
| name | The name of the parameter to look for. |
| def | A default value for the parameter, if it wasn't set, default is NULL. |
- Returns:
- A copy of the value of the parameter or NULL, if no parameter of the specific name was read.
Definition at line 187 of file param.h.
| 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.
- Parameters:
-
| name_ | The name of the parameter to look for. |
| def | The default value for the parameter, if it wasn't set, default is 0. |
- Returns:
- The value of the parameter, converted to a double.
Definition at line 197 of file param.h.
| 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.
- Parameters:
-
| name_ | The name of the parameter to look for. |
| def | The default value for the parameter, if it wasn't set, default is 0. |
- Returns:
- The value of the parameter, converted to an integer.
Definition at line 210 of file param.h.
| 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.
- Parameters:
-
| name_ | The name of the parameter to look for. |
| value_ | The value of the parameter. |
Definition at line 223 of file param.h.
| Param& Param::operator= |
( |
const Param & |
p |
) |
[inline] |
Assing-Operator.
Copy's the basedir, file list, the parameter-tree and filenr.
- Parameters:
-
| p | The SnoptParam to copy. |
Definition at line 233 of file param.h.
Friends And Related Function Documentation
| ostream& operator<< |
( |
ostream & |
out, |
|
|
Param & |
a | |
|
) |
| | [friend] |
Member Data Documentation
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.
File to read.
Definition at line 101 of file param.h.
A list of parameter files to read.
Definition at line 105 of file param.h.
The head of the parameter-tree.
Definition at line 109 of file param.h.
Base-directory for the parameter files.
Definition at line 114 of file param.h.
The documentation for this class was generated from the following file: