1 : |
agomez |
1 |
#ifndef timevariablevector_h
|
2 : |
|
|
#define timevariablevector_h
|
3 : |
|
|
|
4 : |
|
|
#include "timevariable.h" |
5 : |
|
|
|
6 : |
|
|
/**
|
7 : |
|
|
* \class TimeVariableVector
|
8 : |
|
|
* \brief This class implements a dynamic vector of TimeVariable values
|
9 : |
|
|
*/
|
10 : |
|
|
class TimeVariableVector {
|
11 : |
|
|
public:
|
12 : |
|
|
/**
|
13 : |
|
|
* \brief This is the default TimeVariableVector constructor
|
14 : |
|
|
*/
|
15 : |
|
|
TimeVariableVector() { size = 0; v = 0; };
|
16 : |
|
|
/**
|
17 : |
|
|
* \brief This is the TimeVariableVector destructor
|
18 : |
|
|
* \note This will free all the memory allocated to all the elements of the vector
|
19 : |
|
|
*/
|
20 : |
|
|
~TimeVariableVector();
|
21 : |
|
|
/**
|
22 : |
|
|
* \brief This will add new empty entries to the vector
|
23 : |
|
|
* \param addsize is the number of new entries to the vector
|
24 : |
|
|
* \note All elements of the vector will be created, and set to zero
|
25 : |
|
|
*/
|
26 : |
|
|
void setsize(int addsize);
|
27 : |
|
|
/**
|
28 : |
|
|
* \brief This will add new empty entries to the vector and inform Keeper of the change
|
29 : |
|
|
* \param addsize is the number of new entries to the vector
|
30 : |
|
|
* \param keeper is the Keeper for the current model
|
31 : |
|
|
* \note The new elements of the vector will be created, and set to zero
|
32 : |
|
|
*/
|
33 : |
|
|
void resize(int addsize, Keeper* const keeper);
|
34 : |
|
|
/**
|
35 : |
|
|
* \brief This will add one new entry to the vector and inform Keeper of the change
|
36 : |
|
|
* \param tvar is the new TimeVariable entry to the vector
|
37 : |
|
|
* \param keeper is the Keeper for the current model
|
38 : |
|
|
*/
|
39 : |
|
|
void resize(const TimeVariable& tvar, Keeper* const keeper);
|
40 : |
|
|
/**
|
41 : |
|
|
* \brief This will return the size of the vector
|
42 : |
|
|
* \return the size of the vector
|
43 : |
|
|
*/
|
44 : |
|
|
int Size() const { return size; };
|
45 : |
|
|
/**
|
46 : |
|
|
* \brief This function will read the value of the TimeVariable entries from file
|
47 : |
|
|
* \param infile is the CommentStream to read the parameters from
|
48 : |
|
|
* \param TimeInfo is the TimeClass for the current model
|
49 : |
|
|
* \param keeper is the Keeper for the current model
|
50 : |
|
|
*/
|
51 : |
|
|
void read(CommentStream& infile, const TimeClass* const TimeInfo, Keeper* const keeper);
|
52 : |
|
|
/**
|
53 : |
|
|
* \brief This will return the value of an element of the vector
|
54 : |
|
|
* \param pos is the element of the vector to be returned
|
55 : |
|
|
* \return the value of the specified element
|
56 : |
|
|
*/
|
57 : |
|
|
TimeVariable& operator [] (int pos) { return v[pos]; };
|
58 : |
|
|
/**
|
59 : |
|
|
* \brief This will return the value of an element of the vector
|
60 : |
|
|
* \param pos is the element of the vector to be returned
|
61 : |
|
|
* \return the value of the specified element
|
62 : |
|
|
*/
|
63 : |
|
|
const TimeVariable& operator [] (int pos) const { return v[pos]; };
|
64 : |
|
|
/**
|
65 : |
|
|
* \brief This function will check to see if the TimeVariable values have changed
|
66 : |
|
|
* \param TimeInfo is the TimeClass for the current model
|
67 : |
|
|
* \return 1 if the values have changed, 0 otherwise
|
68 : |
|
|
*/
|
69 : |
|
|
int didChange(const TimeClass* const TimeInfo) const;
|
70 : |
|
|
/**
|
71 : |
|
|
* \brief This function will update the TimeVariable values
|
72 : |
|
|
* \param TimeInfo is the TimeClass for the current model
|
73 : |
|
|
*/
|
74 : |
|
|
void Update(const TimeClass* const TimeInfo);
|
75 : |
|
|
protected:
|
76 : |
|
|
/**
|
77 : |
|
|
* \brief This is the size of the vector
|
78 : |
|
|
*/
|
79 : |
|
|
int size;
|
80 : |
|
|
/**
|
81 : |
|
|
* \brief This is the vector of TimeVariable values
|
82 : |
|
|
*/
|
83 : |
|
|
TimeVariable* v;
|
84 : |
|
|
};
|
85 : |
|
|
|
86 : |
|
|
#endif
|