#include <SGParameter.hpp>
Inheritance diagram for SGParam:


Public Member Functions | |
| bool | HasType (char *the_type) |
| Checks whether the parameter has a given type. | |
| std::ostream & | PrintPath (std::ostream &s) |
| Prints the path to the parameter with the name. | |
| SGParam (char *the_name, char *the_type, SGParam *the_tl, bool hdv=0) | |
| Constructor. | |
| virtual | ~SGParam () |
| Virtual destructor. | |
Static Public Member Functions | |
| static SGParam * | Find (char *path, SGParam *list) |
| Looks for a parameter having a given path in a given list. | |
| static void | Read (char *file_name, SGParam *list) |
| Reads all the parameters to a given list from a file. | |
| static void | Print (SGParam *list, std::ostream &s, short indent=0) |
| Print - prints the parameter names and values to a given stream. | |
Public Attributes | |
| char * | name |
| The idetifier of the parameter. | |
Protected Member Functions | |
| virtual void | read_param ()=0 |
| Reads a value of the parameter from the input stream. | |
| virtual void | print_param (std::ostream &s, short indent)=0 |
| Prints the name and the value of the parameter with a given indent. | |
Friends | |
| class | SGParamDir |
In an application, all parameters are objects of classes derived from SGParam. Every parameter has two essential features: its name and its type. The name is a null-terminated text string specified by the user. The type (i.e. what for a parameter - integer, real etc. it is) is defined by the implementation of the derived class. But the base class stores a symbolic identifier of the type (as a null-terminated string).
All parameters in the same directory should be arranged in a single-linked list. The pointer to the successor in this list is stored in the base class SGParam, too.
The derived classes should implement three main virtual functions:
read_param should read, parse and interpret the tokens of the parameter specification in the input file,print_param should print the value of the parameter to a given output stream,broadcast_param should send the value of the parameter in a parallelized application from the peer processor to the other ones.
| SGParam::SGParam | ( | char * | the_name, | |
| char * | the_type, | |||
| SGParam * | the_tl, | |||
| bool | hdv = 0 | |||
| ) | [inline] |
Constructor.
| [in] | the_name | The name of the parameter |
| [in] | the_type | The character type id |
| [in] | the_tl | The next parameter in the list |
| [in] | hdv | if the parameter has a default value |
| virtual SGParam::~SGParam | ( | ) | [inline, virtual] |
Virtual destructor.
| bool SGParam::HasType | ( | char * | the_type | ) | [inline] |
Checks whether the parameter has a given type.
| [in] | the_type | The type to check. |
[type] == [the_type] | std::ostream& SGParam::PrintPath | ( | std::ostream & | s | ) |
Prints the path to the parameter with the name.
| [in] | s | The stream to print to |
Looks for a parameter having a given path in a given list.
| [in] | path | The path to find |
| [in] | list | The list of the parameters |
| void SGParam::Read | ( | char * | file_name, | |
| SGParam * | list | |||
| ) | [static] |
Reads all the parameters to a given list from a file.
| [in] | file_name | The file to read the parameters from |
| [in] | list | The list of the parameters |
| static void SGParam::Print | ( | SGParam * | list, | |
| std::ostream & | s, | |||
| short | indent = 0 | |||
| ) | [static] |
Print - prints the parameter names and values to a given stream.
| [in] | list | The list of the parameters |
| [in] | s | The stream to write the values |
| [in] | indent | The indent for the parameters |
| virtual void SGParam::read_param | ( | ) | [protected, pure virtual] |
Reads a value of the parameter from the input stream.
Implemented in SGDisplayParam, SGIntParam, SGRealParam, SGBoolParam, SGStringParam, SGIntArrayParam, SGRVectorParam, SGRMatrixParam, and SGRMultiArrayParam.
| virtual void SGParam::print_param | ( | std::ostream & | s, | |
| short | indent | |||
| ) | [protected, pure virtual] |
Prints the name and the value of the parameter with a given indent.
| [in] | s | The stream to print to |
| [in] | indent | The indent for the output lines |
Implemented in SGDisplayParam, SGIntParam, SGRealParam, SGBoolParam, SGStringParam, SGIntArrayParam, SGRVectorParam, SGRMatrixParam, and SGRMultiArrayParam.
friend class SGParamDir [friend] |
The idetifier of the parameter.
1.5.2