SORTIE Core C++ Documentation
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
clTree Class Reference

Tree class - Version 1.0. More...

#include <Tree.h>

Public Member Functions

void SetValue (short int iCode, int iValue)
 Sets an integer value. More...
 
void SetValue (short int iCode, float fValue, bool bUpdateNow=true, bool bUpdateAllometry=true)
 Sets a float value. More...
 
void SetValue (short int iCode, bool bValue)
 Sets a boolean value. More...
 
void SetValue (short int iCode, std::string sValue)
 Sets a string value. More...
 
void GetValue (short int iCode, int *p_iValHolder)
 Gets an integer value. More...
 
void GetValue (short int iCode, float *p_fValHolder)
 Gets a float value. More...
 
void GetValue (short int iCode, bool *p_bValHolder)
 Gets a boolean value. More...
 
void GetValue (short int iCode, std::string *p_sValHolder)
 Gets a string value. More...
 
short unsigned int GetSpecies ()
 Get species of tree. More...
 
short unsigned int GetType ()
 Get type of tree. More...
 
clTreeGetTaller ()
 Get tree taller than this one. More...
 
clTreeGetShorter ()
 Get tree shorter than this one. More...
 
clDeadTreeMakeDeadClone ()
 Makes a dead clone of this tree. More...
 

Protected Member Functions

 clTree (int iType, int iSpecies, int iNumFloats, int iNumInts, int iNumStrings, int iNumBools, clTreePopulation *p_oTreePop)
 Constructor. More...
 
 ~clTree ()
 Destructor. More...
 

Protected Attributes

short unsigned int m_iSpecies
 Species. More...
 
short unsigned int m_iType
 Type. More...
 
float * mp_fFloatValues
 Array of float data members. More...
 
int * mp_iIntValues
 Array of integer data members. More...
 
std::string * mp_sStringValues
 Array of string data members. More...
 
bool * mp_bBoolValues
 Array of bool data members. More...
 
clTreemp_oNext
 Pointer to next tree in linked list of tree population. More...
 
clTreemp_oPrevious
 Pointer to previous tree in linked list of tree pop. More...
 

Static Protected Attributes

static clTreePopulationmp_oTreePop
 Tree population. More...
 

Friends

class clTreePopulation
 
class clTreeTestBehavior
 For automated testing. More...
 

Detailed Description

Tree class - Version 1.0.

One object of this class represents one individual tree in the model. The tree is essentially a data structure; the only actions it takes are to communicate changes in its status to the tree population in order to keep itself updated.

The number of data members a tree has is dynamic; very little is defined ahead of time. Species and type are, because these must be known to locate other values.

Trees can't be created or destroyed except by the tree population.

Copyright 2003 Charles D. Canham.

Author
Lora E. Murphy


Edit history:
--------------—
October 20, 2011 - Wiped the slate clean for SORTIE 7.0 (LEM)
November 12, 2012 - Chars became strings (LEM)

Constructor & Destructor Documentation

◆ clTree()

clTree::clTree ( int  iType,
int  iSpecies,
int  iNumFloats,
int  iNumInts,
int  iNumStrings,
int  iNumBools,
clTreePopulation p_oTreePop 
)
protected

Constructor.

Arrays are sized here. All values will be initialized to 0, empty string, and false.

Parameters
iTypeNew tree's type.
iSpeciesNew tree's species.
iNumFloatsNumber of floats this tree will have.
iNumIntsNumber of integers this tree will have.
iNumStringsNumber of strings this tree will have.
iNumBoolsNumber of bools this tree will have.
p_oTreePopTree population object.
Exceptions
BAD_DATAerror if a value is less than zero.

◆ ~clTree()

clTree::~clTree ( )
protected

Destructor.

Deletes arrays.

Member Function Documentation

◆ GetShorter()

clTree* clTree::GetShorter ( )
inline

Get tree shorter than this one.

Returns
Next shorter tree, or NULL if there isn't one.

◆ GetSpecies()

short unsigned int clTree::GetSpecies ( )
inline

Get species of tree.

Returns
Species.

◆ GetTaller()

clTree* clTree::GetTaller ( )
inline

Get tree taller than this one.

Returns
Next taller tree, or NULL if there isn't one.

◆ GetType()

short unsigned int clTree::GetType ( )
inline

Get type of tree.

Returns
Type, as a member of clTreePopulation::iTreeType.

◆ GetValue() [1/4]

void clTree::GetValue ( short int  iCode,
int *  p_iValHolder 
)

Gets an integer value.

Parameters
iCodeData member code.
p_iValHolderVariable into which to place the value.

◆ GetValue() [2/4]

void clTree::GetValue ( short int  iCode,
float *  p_fValHolder 
)

Gets a float value.

Parameters
iCodeData member code.
p_fValHolderVariable into which to place the value.

◆ GetValue() [3/4]

void clTree::GetValue ( short int  iCode,
bool *  p_bValHolder 
)

Gets a boolean value.

Parameters
iCodeData member code.
p_bValHolderVariable into which to place the value.

◆ GetValue() [4/4]

void clTree::GetValue ( short int  iCode,
std::string *  p_sValHolder 
)

Gets a string value.

Parameters
iCodeData member code.
p_sValHolderVariable into which to place the value.

◆ MakeDeadClone()

clDeadTree* clTree::MakeDeadClone ( )

Makes a dead clone of this tree.

Returns
Clone.

◆ SetValue() [1/4]

void clTree::SetValue ( short int  iCode,
int  iValue 
)

Sets an integer value.

Parameters
iCodeData member code.
iValueValue to set.

◆ SetValue() [2/4]

void clTree::SetValue ( short int  iCode,
float  fValue,
bool  bUpdateNow = true,
bool  bUpdateAllometry = true 
)

Sets a float value.

If the value being set is a size parameter (height, DBH, etc), the default is for the other parameters to also be updated based on allometric relationships (for instance, if DBH is changed, height will automatically be updated too). If the update causes a tree move to a new life history stage, it will automatically be transitioned. So, if setting a value of either diam10 or height on a seedling causes it to be greater than the seedling height cutoff, the tree will become a sapling and all of its allometric parameters will be recalculated to match the value that was set.

You can override automatic allometry updating. If you do that, be aware that none of the other tree data members will be updated and you will need to do that yourself. Be especially careful when there is a possibility of tree type transition. If the tree is a seedling and you set its height to a value greater than the height cutoff, it will transition, but its diam10 will not change and it will have a DBH value of zero. If the tree is a sapling and you set its DBH to be greater than the minimum adult DBH, it will transition. The setting of any other value will not cause transition. So, if you give a seedling a diam10 value that would, under automatic allometry updating, give it a height greater than the cutoff and cause it to become a sapling, the seedling will not become a sapling unless you explicitly set the height too.

Parameters
iCodeData member code.
fValueValue to set.
bUpdateNowWhether or not, if there are allometric changes to make, they need to be performed immediately or can wait (so changes could be grouped).
bUpdateAllometryIf the change involves allometric changes, whether or not to automatically update the tree's other dimensions. For example, if this is set to false and you are updating a DBH value, tree height will not automatically be re-calculated.

◆ SetValue() [3/4]

void clTree::SetValue ( short int  iCode,
bool  bValue 
)

Sets a boolean value.

Parameters
iCodeData member code.
bValueValue to set.

◆ SetValue() [4/4]

void clTree::SetValue ( short int  iCode,
std::string  sValue 
)

Sets a string value.

Parameters
iCodeData member code.
sValueValue to set.

Friends And Related Function Documentation

◆ clTreePopulation

friend class clTreePopulation
friend

◆ clTreeTestBehavior

friend class clTreeTestBehavior
friend

For automated testing.

Member Data Documentation

◆ m_iSpecies

short unsigned int clTree::m_iSpecies
protected

Species.

◆ m_iType

short unsigned int clTree::m_iType
protected

Type.

◆ mp_bBoolValues

bool* clTree::mp_bBoolValues
protected

Array of bool data members.

◆ mp_fFloatValues

float* clTree::mp_fFloatValues
protected

Array of float data members.

◆ mp_iIntValues

int* clTree::mp_iIntValues
protected

Array of integer data members.

◆ mp_oNext

clTree* clTree::mp_oNext
protected

Pointer to next tree in linked list of tree population.

◆ mp_oPrevious

clTree* clTree::mp_oPrevious
protected

Pointer to previous tree in linked list of tree pop.

◆ mp_oTreePop

clTreePopulation* clTree::mp_oTreePop
staticprotected

Tree population.

Declare as static

  • we don't need a bazillion copies of this running around. This is somewhat dangerous as we have to depend on the tree population to NULL this pointer in its own destructor - but worth it

◆ mp_sStringValues

std::string* clTree::mp_sStringValues
protected

Array of string data members.


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