SGParam Class Reference

The base class for the parameter types. More...

#include <SGParameter.hpp>

Inheritance diagram for SGParam:

Inheritance graph
[legend]
Collaboration diagram for SGParam:

Collaboration graph
[legend]
List of all members.

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 SGParamFind (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

Detailed Description

The base class for the parameter types.

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:

  1. read_param should read, parse and interpret the tokens of the parameter specification in the input file,
  2. print_param should print the value of the parameter to a given output stream,
  3. broadcast_param should send the value of the parameter in a parallelized application from the peer processor to the other ones.


Constructor & Destructor Documentation

SGParam::SGParam ( char *  the_name,
char *  the_type,
SGParam the_tl,
bool  hdv = 0 
) [inline]

Constructor.

Parameters:
[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.


Member Function Documentation

bool SGParam::HasType ( char *  the_type  )  [inline]

Checks whether the parameter has a given type.

Parameters:
[in] the_type The type to check.
Returns:
true if [type] == [the_type]

std::ostream& SGParam::PrintPath ( std::ostream &  s  ) 

Prints the path to the parameter with the name.

Parameters:
[in] s The stream to print to

SGParam * SGParam::Find ( char *  path,
SGParam list 
) [static]

Looks for a parameter having a given path in a given list.

Parameters:
[in] path The path to find
[in] list The list of the parameters
Returns:
The pointer to the parameter or NULL if not found:

void SGParam::Read ( char *  file_name,
SGParam list 
) [static]

Reads all the parameters to a given list from a file.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.


Friends And Related Function Documentation

friend class SGParamDir [friend]


Member Data Documentation

SGParam::name

The idetifier of the parameter.


The documentation for this class was generated from the following files:
Generated on Fri Sep 21 12:34:31 2007 for SG2 by  doxygen 1.5.2