SGParameter.hpp File Reference

Classes for the basic SG parameter engine. More...

#include <string.h>
#include <iostream>
#include "MultiIndex.hpp"
#include "small_matrix.hpp"
#include "MultiArray.hpp"

Include dependency graph for SGParameter.hpp:

This graph shows which files directly or indirectly include this file:


Classes

class  SGParam
 The base class for the parameter types. More...
class  SGParamDir
 The parameter directory class. More...
class  SGIntParam
 Integer parameters (for 'long' numbers). More...
class  SGRealParam
 Real-value parameters (for 'double' numbers). More...
class  SGBoolParam
 Boolean parameters. More...
class  SGStringParam
 String parameters. More...
class  SGIntArrayParam
 Parameter of the type "Array of integers". More...
class  SGRVectorParam
 Small double-vector parameter. More...
class  SGRMatrixParam
 Small double-matrix parameter. More...
class  SGRMultiArrayParam
 MultiArray<double>-parameter. More...

Defines

#define FIND_SG_INT_PARAM(list, name, var)
#define GET_SG_INT_PARAM(list, name, var, default_val)
#define FIND_SG_REAL_PARAM(list, name, var)
#define GET_SG_REAL_PARAM(list, name, var, default_val)
#define FIND_SG_BOOL_PARAM(list, name, var)
#define GET_SG_BOOL_PARAM(list, name, var, default_val)

Detailed Description

Classes for the basic SG parameter engine.

This module supplies a tool for reading problem-dependent parameters from a text file. Every parameter is an object of a class derived from SGParam. The structure of parameters is similar to a file system: There are ordinary parameters and directories of parameters. Every parameter has its own type which is also specified by a character identifier. This type determines a way the user can read the value of the parameter in.

HOW TO USE:
First declare your problem-dependent parameters (including directories). The last declared parameter is the head of the list. Pass this head to the function 'SGParamRead' to read the parameters from the input file. After that you can access the values of the parameters.

Date:
Nov. 26, 2004 - created

Define Documentation

#define FIND_SG_BOOL_PARAM ( list,
name,
var   ) 

Value:

{ \
  SGParam * param; \
  if ((param = SGParam::Find (name, (list))) != NULL) \
   { \
    if (! param->HasType (SGBoolParam::TypeId)) \
     { \
      std::cout << "Type of "; param->PrintPath (std::cout); \
      std::cout << " misdeclared" << endl; \
      SG_FATAL_ERROR ("Misdeclaration of parameter '" name "'"); \
     }; \
    var = ((SGBoolParam *) param)->Value (); \
   } \
  else \
   SG_FATAL_ERROR ("'" name "' not specified"); \
 }

#define FIND_SG_INT_PARAM ( list,
name,
var   ) 

Value:

{ \
  SGParam * param; \
  if ((param = SGParam::Find (name, (list))) != NULL) \
   { \
    if (! param->HasType (SGIntParam::TypeId)) \
     { \
      std::cout << "Type of "; param->PrintPath (std::cout); \
      std::cout << " misdeclared" << endl; \
      SG_FATAL_ERROR ("Misdeclaration of parameter '" name "'"); \
     }; \
    var = ((SGIntParam *) param)->Value (); \
   } \
  else \
   SG_FATAL_ERROR ("'" name "' not specified"); \
 }

#define FIND_SG_REAL_PARAM ( list,
name,
var   ) 

Value:

{ \
  SGParam * param; \
  if ((param = SGParam::Find (name, (list))) != NULL) \
   { \
    if (! param->HasType (SGRealParam::TypeId)) \
     { \
      std::cout << "Type of "; param->PrintPath (std::cout); \
      std::cout << " misdeclared" << endl; \
      SG_FATAL_ERROR ("Misdeclaration of parameter '" name "'"); \
     }; \
    var = ((SGRealParam *) param)->Value (); \
   } \
  else \
   SG_FATAL_ERROR ("'" name "' not specified"); \
 }

#define GET_SG_BOOL_PARAM ( list,
name,
var,
default_val   ) 

Value:

{ \
  SGParam * param; \
  if ((param = SGParam::Find (name, (list))) != NULL) \
   { \
    if (! param->HasType (SGBoolParam::TypeId)) \
     { \
      std::cout << "Type of "; param->PrintPath (std::cout); \
      std::cout << " misdeclared" << endl; \
      SG_FATAL_ERROR ("Misdeclaration of parameter '" name "'"); \
     }; \
    var = ((SGBoolParam *) param)->Value (); \
   } \
  else \
   var = default_val; \
 }

#define GET_SG_INT_PARAM ( list,
name,
var,
default_val   ) 

Value:

{ \
  SGParam * param; \
  if ((param = SGParam::Find (name, (list))) != NULL) \
   { \
    if (! param->HasType (SGIntParam::TypeId)) \
     { \
      std::cout << "Type of "; param->PrintPath (std::cout); \
      std::cout << " misdeclared" << endl; \
      SG_FATAL_ERROR ("Misdeclaration of parameter '" name "'"); \
     }; \
    var = ((SGIntParam *) param)->Value (); \
   } \
  else \
   var = default_val; \
 }

#define GET_SG_REAL_PARAM ( list,
name,
var,
default_val   ) 

Value:

{ \
  SGParam * param; \
  if ((param = SGParam::Find (name, (list))) != NULL) \
   { \
    if (! param->HasType (SGRealParam::TypeId)) \
     { \
      std::cout << "Type of "; param->PrintPath (std::cout); \
      std::cout << " misdeclared" << endl; \
      SG_FATAL_ERROR ("Misdeclaration of parameter '" name "'"); \
     }; \
    var = ((SGRealParam *) param)->Value (); \
   } \
  else \
   var = default_val; \
 }


Generated on Fri Sep 21 12:33:49 2007 for SG2 by  doxygen 1.5.2