Classfilter (08/27/02)

CRHM

ClassFilter - observation file object.

class __declspec(dllexport) Classfilter {

public:

Classfilter(ClassData *MyObs, String ToVar, String args, String argtypes = ""); // constructor

virtual ~Classfilter(); // destructor

ClassData *MyObs; // parent observation file object class.

String ToVar;  // variable name to store output from filter.

String argtypes; // initialise by filter constructor to combination of "V" and "C" defining input parameters.

String args; //

long Vs; // number of filter variable inputs.

long Cs;// number of filter constant inputs.

bool Error; // set by  Classfilter::error() on detection of error

long ObsCnt; // dimension of observation variable. Normally one.

long *DataIndx; // array of offsets of observation variables [# of Vs].

long *DataObsCnt; // maximum number of observations of this observation variable

ClassData **ObsFile; // array of pointers to parent observation files of variables used by filter [# of Vs].

float ***Data; // array of pointers to variable data areas [# of Vs].

double *Constants; // array of constants used by filter [# of Cs].

virtual void readargs(void); // interprets filter parameters.

virtual void error(String Mess); // Calls exception handling.

void fixup(void); // after data allocation, it is called by Classmacro::fixup() to

virtual void doFunc(long Obs, long Line){Data [0] [Obs] [Line] = 0.0;} // Execute filter for every observation variable dimensioned.

virtual void doFunctions(long Line); // Executes after every observation file line is read calling doFunc(...).

};

 

Member Functions.

Constructor.

    From filter argtypes allocates memory for constant and variable storage and processing then calls Classfilter::readargs() to process parameters.

Destructor

    Deletes memory allocated for constant and variable storage and processing.

virtual void readargs(void);

    Processes parameter list of filter.  Then instantiates the filter class and adds the object to the FilterList. If there is an error generates a CHMException.

void fixup(void);

    Memory is not allocated until after all header lines in observation file are read. The parent Classmacro object calls all the filter *->fixup() routines which calculate the actual pointers for observation variables used by the filter after allocation.

virtual void doFunc(long Obs, long Line){Data [0] [Obs] [Line] = 0.0;}

    Executes after every observation line is read. Using the FilterList it is able to call the doFunction() of every filter.  Parameters include Line and using ObsCnt multiple calls are made to handle observations dimensioned greater than 1.

virtual void doFunctions(long Line);

    The parent Classmacro object calls all the filter *->doFunctions(..) routines which calls its doFunc(...) for all the variables dimensions.

void error(String Mess);

   Generates a CHMException stopping model execution and reports error.