SORTIE Core C++ Documentation
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
clWorkerBase Class Referenceabstract

WORKER BASE - Version 1.0. More...

#include <WorkerBase.h>

Inheritance diagram for clWorkerBase:
clBehaviorBase clGrid clPlot clPopulationBase clBoleVolumeCalculator clCarbonValueCalculator clClimateChange clClimateImporter clCompetitionHarvest clConditOmegaCalculator clCrownRadiusReporter clDensDepInfestation clDensitySeedSurvival clDetailedSubstrate clDimensionAnalysis clDisperseBase clDisturbance clEstablishment clFoliarChemistry clFuncResponseSeedPredation clGeneralizedHarvestRegime clGermination clGrowthBase clHarvestInterface clInsectInfestation clLightBase clLightFilter clMerchValueCalculator clMicroEstablishment clMortalityBase clNeighborhoodSeedPredation clOutput clPartitionedBiomass clPlant clQualityVigorClassifier clRandomBrowse clRandomSeedLogger clRipleysKCalculator clSeasonalWaterDeficit clSelectionHarvest clShortOutput clSnagDecomp clStateReporter clStochasticGapGrowth clStorm clStormDamageApplier clStormDirectKiller clStormKilledPartitionedBiomass clStormKiller clStormLight clSubstrate clSubstrateDepSeedSurvival clTreeAgeCalculator clTreeRemover clVolumeCalculator clWindstorm clGhostTreePopulation clTreePopulation

Public Member Functions

 clWorkerBase (clSimManager *p_oSimManager)
 Constructor. More...
 
virtual ~clWorkerBase ()
 Destructor. More...
 
std::string GetName ()
 Gets the object's namestring. More...
 
clSimManagerGetSimManager ()
 
void DoObjectSetup (xercesc::DOMDocument *p_oDoc, fileType iFileType)
 Triggers the setup process. More...
 
virtual void TimestepCleanup ()
 Performs any necessary cleanup operations at the end of a timestep. More...
 
virtual void EndOfRunCleanup ()
 Performs any necessary cleanup operations at the end of a run. More...
 

Protected Member Functions

virtual void GetData (xercesc::DOMDocument *p_oDoc)=0
 Performs an object's setup. More...
 
void AssembleFileCode (int iFileType, int iFileVersion, char *cCode)
 Creates the proper identifying filecode for an XML file. More...
 

Protected Attributes

std::string m_sNameString
 If a behavior has registered a command line command with the sim manager, this allows it to be called. More...
 
clSimManagermp_oSimManager
 Pointer to the simulation manager object. More...
 
int * mp_iAllowedFileTypes
 List of the input file types this object can handle. More...
 
int m_iNumAllowedTypes
 Number of input file types this object can handle. More...
 

Detailed Description

WORKER BASE - Version 1.0.

The worker base class serves as a virtual base class for all data and behavior objects. These object types each have their own managers. The managers themselves have a base class and this object allows that manager base class to access the objects.

This class only serves as a parent class for other classes; do not instantiate objects of this class.

In order for the dynamic casting to work, this must be a polymorphic base class, which means it must have a virtual function. So make sure there's always one.

There are is a virtual function that all child classes must overload.

Copyright 2011 Charles D. Canham.

Author
Lora E. Murphy


Edit history:
--------------—
October 20, 2011 - Wiped the slate clean for SORTIE 7.0 (LEM)
November 6, 2012 - Made mp_oSimManager not static. It interfered with testing. (LEM)
November 12, 2012 - Chars became strings (LEM)

Constructor & Destructor Documentation

◆ clWorkerBase()

clWorkerBase::clWorkerBase ( clSimManager p_oSimManager)

Constructor.

The constructor initializes the common variables.

Parameters
p_oSimManagerSim Manager object.

◆ ~clWorkerBase()

virtual clWorkerBase::~clWorkerBase ( )
virtual

Destructor.

Deletes the common variables.

Member Function Documentation

◆ AssembleFileCode()

void clWorkerBase::AssembleFileCode ( int  iFileType,
int  iFileVersion,
char *  cCode 
)
protected

Creates the proper identifying filecode for an XML file.

When objects must read or write XML files, they often need to use a filecode. This is an 8-character string divided into four sets of two characters. The first set of two characters is the model major version; the second set of two characters is the minor versions; the third set of two characters is the file type; and the fourth set is the file version. Given the file type and file version, this will assemble the string and place it in cCode. cCode should be declared to have room for the 8-digit code. AssembleFileCode() will not check for appropriate length.

Parameters
iFileTypeType of file for which to assemble the code.
iFileVersionFile's version number.
cCodeA string into which the finished file code will be placed.

◆ DoObjectSetup()

void clWorkerBase::DoObjectSetup ( xercesc::DOMDocument *  p_oDoc,
fileType  iFileType 
)

Triggers the setup process.

This function should not be overridden.

Parameters
p_oDocDOM tree of parsed input file.
iFileTypeInput file's type.

◆ EndOfRunCleanup()

virtual void clWorkerBase::EndOfRunCleanup ( )
inlinevirtual

Performs any necessary cleanup operations at the end of a run.

Child classes can override this function as necessary.

◆ GetData()

virtual void clWorkerBase::GetData ( xercesc::DOMDocument *  p_oDoc)
protectedpure virtual

◆ GetName()

std::string clWorkerBase::GetName ( )
inline

Gets the object's namestring.

This name can be used to search for the object.

Returns
Namestring.

◆ GetSimManager()

clSimManager* clWorkerBase::GetSimManager ( )
inline

◆ TimestepCleanup()

virtual void clWorkerBase::TimestepCleanup ( )
inlinevirtual

Performs any necessary cleanup operations at the end of a timestep.

Child classes can override this function as necessary.

Reimplemented in clTreePopulation, clMicroEstablishment, clBasalAreaLight, clDensityLight, clGhostTreePopulation, clEstablishment, clQuadratGLILight, clAverageLight, clGapLight, clPlant, and clDisperseBase.

Member Data Documentation

◆ m_iNumAllowedTypes

int clWorkerBase::m_iNumAllowedTypes
protected

Number of input file types this object can handle.

◆ m_sNameString

std::string clWorkerBase::m_sNameString
protected

If a behavior has registered a command line command with the sim manager, this allows it to be called.

Parameters
cCommandCommand string.
cArgumentsAny arguments passed with the command.Object's identifying namestring.

◆ mp_iAllowedFileTypes

int* clWorkerBase::mp_iAllowedFileTypes
protected

List of the input file types this object can handle.

◆ mp_oSimManager

clSimManager* clWorkerBase::mp_oSimManager
protected

Pointer to the simulation manager object.

Allows communication between objects.


The documentation for this class was generated from the following file: