-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDeadTree.h
More file actions
134 lines (117 loc) · 3.75 KB
/
DeadTree.h
File metadata and controls
134 lines (117 loc) · 3.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
//---------------------------------------------------------------------------
#ifndef DeadTreeH
#define DeadTreeH
#include <string>
#include "DataTypes.h"
using namespace whyDead;
/**
* Dead tree class - Version 1.0
*
* One object of this class represents one individual dead 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 2011 Charles D. Canham.
* @author Lora E. Murphy
*
* <br>Edit history:
* <br>-----------------
* <br>January 6, 2011 - Created (LEM)
*/
class clDeadTree {
friend class clTreePopulation;
friend class clGhostTreePopulation;
friend class clTree;
public:
/**
* Gets an integer value.
*
* @param iCode Data member code.
* @param p_iValHolder Variable into which to place the value.
*/
void GetValue(short int iCode, int *p_iValHolder);
/**
* Gets a float value.
*
* @param iCode Data member code.
* @param p_fValHolder Variable into which to place the value.
*/
void GetValue(short int iCode, float *p_fValHolder);
/**
* Gets a boolean value.
*
* @param iCode Data member code.
* @param p_bValHolder Variable into which to place the value.
*/
void GetValue(short int iCode, bool *p_bValHolder);
/**
* Gets a string value.
*
* @param iCode Data member code.
* @param p_sValHolder Variable into which to place the value.
*/
void GetValue(short int iCode, std::string *p_sValHolder);
/**
* Get species of tree.
* @return Species.
*/
short unsigned int GetSpecies(){return m_iSpecies;};
/**
* Get type of tree.
* @return Type, as a member of clTreePopulation::iTreeType.
*/
short unsigned int GetType(){return m_iType;};
/**
* Get death reason code of tree.
* @return Type, as a member of whyDead.
*/
deadCode GetDeadReasonCode(){return m_iDeadCode;};
/**
* Set death reason code of tree.
* @param iCode Code, as a member of whyDead.
*/
void SetDeadReasonCode(deadCode &iCode) {m_iDeadCode = iCode;};
/**
* Get tree taller than this one.
* @return Next taller tree, or NULL if there isn't one.
*/
clDeadTree* GetNext() {return mp_oNext;};
protected:
/**
* Constructor. Arrays are sized here. All values will be initialized
* to 0, empty string, and false.
*
* @param iType New tree's type.
* @param iSpecies New tree's species.
* @param iNumFloats Number of floats this tree will have.
* @param iNumInts Number of integers this tree will have.
* @param iNumStrings Number of chars this tree will have.
* @param iNumBools Number of bools this tree will have.
*/
clDeadTree(int iType, int iSpecies, int iNumFloats, int iNumInts, int iNumStrings,
int iNumBools);
/**
* Destructor. Deletes arrays.
*/
~clDeadTree();
short unsigned int m_iSpecies; /**<Species*/
short unsigned int m_iType; /**<Type*/
deadCode m_iDeadCode; /**<Death reason code*/
//These are the arrays of values that can be registered as part of this class
//The char array should be an array of pointers, not actual values - thus the
//double pointer
float *mp_fFloatValues; /**<Array of float data members*/
int *mp_iIntValues; /**<Array of integer data members*/
std::string *mp_sStringValues; /**<Array of string data members*/
bool *mp_bBoolValues; /**<Array of bool data members*/
clDeadTree* mp_oNext; /**<Pointer to next tree in linked list of tree population*/
}; //end of class clDeadTree
//---------------------------------------------------------------------------
#endif