previous next Up Title Contents

Setting the Process Modules

Setting up the process modules to be used by the simulation, stage (v) of the standard program format, provides an illustration of the second important generic programming command, DoFun..(...), see figure [11].

	DoFun1( ReadPars, stimulus, stParFile);
	DoFun( PrintPars, stimulus );

	DoFun1( ReadPars, pEFilter, pEParFile);
	DoFun( PrintPars, pEFilter );

	DoFun1( ReadPars, bMFilter, bMParFile);
	DoFun( PrintPars, bMFilter );

	DoFun1( ReadPars, recptPotn, rPParFile);
	DoFun( PrintPars, recptPotn );
	DoFun1( ReadPars, hairCell, hCParFile);
	DoFun( PrintPars, hairCell );

Figure [11]: AudPerGen.c - Using the DoFun...(...) command.

The DoFun...(...) command allows access to the function routines associated with an EarObject's particular process module, whether it be a stimulus generation/reading paradigm or a model. The command format is shown in figure [12].

Figure [12]: The DoFun(...) Command

or, for module functions with arguments as shown in figure [13].

Figure [13]: The DoFun1(...) command. Because the module management system uses function overloading, there are no excessive overheads for calling function routines in this way: no more time is taken accessing a routine than if it were called directly using the full module function name. Each module type has its own specific functions, some of which my also be contained in other module types, i.e. all of the stimulus generation modules have a SetSamplingInterval routine, thus some modules are completely interchangeable, regardless of the functions called used. The use of any routines specific to a particular module, however will reduce the generic quality of a program. The respective functions are listed for each module in the reference section of this manual.

Every module has ReadPars and PrintPars routines. The ReadPars routine reads the parameters required by a module, associated with an EarObject, from a specified parameter file. This is an important feature of the generic programming level, as it means that the same `generic' command can be used to set the parameters of a module. In the example shown above the parameters for the module associated with the "stimulus" EarObject are read from the file name in the "stParFile" string variable. Each module has its own parameter file format. (The parameter file formats can be found in the reference section of the manual.)

The PrintPars command has no arguments and prints the parameters of the module associated with the respective EarObject. The output from this command can be seen in the screen output from the example program (see above). The screen output also shows that, though the ReadPars and PrintPars routines are called for the "recptPotn" EarObject, no parameters have been read nor are any parameters printed out. This is because "recptPotn" was associated with the "null" module at initialisation, which does no processing and hence needs no parameters.

previous next Up Title Contents