clTree Class Reference

Tree class - Version 1.0. More...

#include <Tree.h>

List of all members.

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.
clTreeGetTaller ()
 Get tree taller than this one.
clTreeGetShorter ()
 Get tree shorter than this one.
clDeadTreeMakeDeadClone ()
 Makes a dead clone of this tree.

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.
clTreemp_oNext
 Pointer to next tree in linked list of tree population.
clTreemp_oPrevious
 Pointer to previous tree in linked list of tree pop.

Static Protected Attributes

static clTreePopulationmp_oTreePop
 Tree population.

Friends

class clTreePopulation
class clTreeTestBehavior
 For automated testing.


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:
-----------------
April 28, 2004 - Submitted as beta (LEM)
May 20, 2004 - Created support for overriding automatic allometry updating (LEM)
December 21, 2010 - Added clone function (LEM)

Constructor & Destructor Documentation

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.

Parameters:
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.
Exceptions:
BAD_DATA error if a value is less than zero.

clTree::~clTree (  )  [protected]

Destructor.

Deletes arrays.


Member Function Documentation

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

Sets an integer value.

Parameters:
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.

Parameters:
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.

Parameters:
iCode Data member code.
bValue Value to set.

void clTree::SetValue ( short int  iCode,
char *  cValue 
)

Sets a character value.

Parameters:
iCode Data member code.
cValue Value to set.

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

Gets an integer value.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
iCode Data member code.
p_cValHolder Variable into which to place the value.

short unsigned int clTree::GetSpecies (  )  [inline]

Get species of tree.

Returns:
Species.

short unsigned int clTree::GetType (  )  [inline]

Get type of tree.

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

clTree* clTree::GetTaller (  )  [inline]

Get tree taller than this one.

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

clTree* clTree::GetShorter (  )  [inline]

Get tree shorter than this one.

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

clDeadTree* clTree::MakeDeadClone (  ) 

Makes a dead clone of this tree.

Returns:
Clone.


Friends And Related Function Documentation

friend class clTreePopulation [friend]

friend class clTreeTestBehavior [friend]

For automated testing.


Member Data Documentation

short unsigned int clTree::m_iSpecies [protected]

Species.

short unsigned int clTree::m_iType [protected]

Type.

float* clTree::mp_fFloatValues [protected]

Array of float data members.

int* clTree::mp_iIntValues [protected]

Array of integer data members.

char** clTree::mp_cCharValues [protected]

Array of char data members.

bool* clTree::mp_bBoolValues [protected]

Array of bool data members.

clTreePopulation* clTree::mp_oTreePop [static, protected]

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

clTree* clTree::mp_oNext [protected]

Pointer to next tree in linked list of tree population.

Pointer to previous tree in linked list of tree pop.


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

Generated on Tue Apr 19 13:56:18 2011 for SORTIE Core C++ Documentation by  doxygen 1.5.6