#include <Tree.h>
Public Member Functions | |
void | SetValue (short int iCode, int iValue) |
Sets an integer value. | |
void | SetValue (short int iCode, float fValue, bool bUpdateNow=true, bool bUpdateAllometry=true) |
Sets a float value. | |
void | SetValue (short int iCode, bool bValue) |
Sets a boolean value. | |
void | SetValue (short int iCode, char *cValue) |
Sets a character value. | |
void | GetValue (short int iCode, int *p_iValHolder) |
Gets an integer value. | |
void | GetValue (short int iCode, float *p_fValHolder) |
Gets a float value. | |
void | GetValue (short int iCode, bool *p_bValHolder) |
Gets a boolean value. | |
void | GetValue (short int iCode, char *p_cValHolder) |
Gets a char value. | |
short unsigned int | GetSpecies () |
Get species of tree. | |
short unsigned int | GetType () |
Get type of tree. | |
clTree * | GetTaller () |
Get tree taller than this one. | |
clTree * | GetShorter () |
Get tree shorter than this one. | |
Protected Member Functions | |
clTree (int iType, int iSpecies, int iNumFloats, int iNumInts, int iNumChars, int iNumBools, clTreePopulation *p_oTreePop) | |
Constructor. | |
~clTree () | |
Destructor. | |
Protected Attributes | |
short unsigned int | m_iSpecies |
Species. | |
short unsigned int | m_iType |
Type. | |
float * | mp_fFloatValues |
Array of float data members. | |
int * | mp_iIntValues |
Array of integer data members. | |
char ** | mp_cCharValues |
Array of char data members. | |
bool * | mp_bBoolValues |
Array of bool data members. | |
clTree * | mp_oNext |
Pointer to next tree in linked list of tree population. | |
clTree * | mp_oPrevious |
Pointer to previous tree in linked list of tree pop. | |
Static Protected Attributes | |
static clTreePopulation * | mp_oTreePop |
Tree population. | |
Friends | |
class | clTreePopulation |
class | clTreeTestBehavior |
For automated testing. |
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.
clTree::clTree | ( | int | iType, | |
int | iSpecies, | |||
int | iNumFloats, | |||
int | iNumInts, | |||
int | iNumChars, | |||
int | iNumBools, | |||
clTreePopulation * | p_oTreePop | |||
) | [protected] |
Constructor.
Arrays are sized here. All values will be initialized to 0, empty string, and false.
iType | New tree's type. | |
iSpecies | New tree's species. | |
iNumFloats | Number of floats this tree will have. | |
iNumInts | Number of integers this tree will have. | |
iNumChars | Number of chars this tree will have. | |
iNumBools | Number of bools this tree will have. | |
p_oTreePop | Tree population object. |
BAD_DATA | error if a value is less than zero. |
clTree::~clTree | ( | ) | [protected] |
Destructor.
Deletes arrays.
void clTree::SetValue | ( | short int | iCode, | |
int | iValue | |||
) |
Sets an integer value.
iCode | Data member code. | |
iValue | Value to set. |
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.
iCode | Data member code. | |
fValue | Value to set. | |
bUpdateNow | Whether or not, if there are allometric changes to make, they need to be performed immediately or can wait (so changes could be grouped). | |
bUpdateAllometry | If 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. |
void clTree::SetValue | ( | short int | iCode, | |
bool | bValue | |||
) |
Sets a boolean value.
iCode | Data member code. | |
bValue | Value to set. |
void clTree::SetValue | ( | short int | iCode, | |
char * | cValue | |||
) |
Sets a character value.
iCode | Data member code. | |
cValue | Value to set. |
void clTree::GetValue | ( | short int | iCode, | |
int * | p_iValHolder | |||
) |
Gets an integer value.
iCode | Data member code. | |
p_iValHolder | Variable into which to place the value. |
void clTree::GetValue | ( | short int | iCode, | |
float * | p_fValHolder | |||
) |
Gets a float value.
iCode | Data member code. | |
p_fValHolder | Variable into which to place the value. |
void clTree::GetValue | ( | short int | iCode, | |
bool * | p_bValHolder | |||
) |
Gets a boolean value.
iCode | Data member code. | |
p_bValHolder | Variable into which to place the value. |
void clTree::GetValue | ( | short int | iCode, | |
char * | p_cValHolder | |||
) |
Gets a char value.
iCode | Data member code. | |
p_cValHolder | Variable into which to place the value. |
short unsigned int clTree::GetSpecies | ( | ) | [inline] |
Get species of tree.
short unsigned int clTree::GetType | ( | ) | [inline] |
clTree* clTree::GetTaller | ( | ) | [inline] |
Get tree taller than this one.
clTree* clTree::GetShorter | ( | ) | [inline] |
Get tree shorter than this one.
clTreePopulation* clTree::mp_oTreePop [static, protected] |
Tree population.
Declare as static