1 : |
agomez |
1 |
#ifndef suitfuncptrvector_h
|
2 : |
|
|
#define suitfuncptrvector_h
|
3 : |
|
|
|
4 : |
|
|
#include "suitfunc.h" |
5 : |
|
|
|
6 : |
|
|
class SuitFunc;
|
7 : |
|
|
|
8 : |
|
|
/**
|
9 : |
|
|
* \class SuitFuncPtrVector
|
10 : |
|
|
* \brief This class implements a dynamic vector of SuitFunc values
|
11 : |
|
|
*/
|
12 : |
|
|
class SuitFuncPtrVector {
|
13 : |
|
|
public:
|
14 : |
|
|
/**
|
15 : |
|
|
* \brief This is the default SuitFuncPtrVector constructor
|
16 : |
|
|
*/
|
17 : |
|
|
SuitFuncPtrVector() { size = 0; v = 0; };
|
18 : |
|
|
/**
|
19 : |
|
|
* \brief This is the SuitFuncPtrVector destructor
|
20 : |
|
|
* \note This will free all the memory allocated to all the elements of the vector
|
21 : |
|
|
*/
|
22 : |
|
|
~SuitFuncPtrVector();
|
23 : |
|
|
/**
|
24 : |
|
|
* \brief This will add one new entry to the vector
|
25 : |
|
|
* \param value is the value that will be entered for the new entry
|
26 : |
|
|
*/
|
27 : |
|
|
void resize(SuitFunc* value);
|
28 : |
|
|
/**
|
29 : |
|
|
* \brief This will delete an entry from the vector
|
30 : |
|
|
* \param pos is the element of the vector to be deleted
|
31 : |
|
|
* \param keeper is the Keeper for the current model
|
32 : |
|
|
* \note This will free the memory allocated to the deleted element of the vector
|
33 : |
|
|
*/
|
34 : |
|
|
void Delete(int pos, Keeper* const keeper);
|
35 : |
|
|
/**
|
36 : |
|
|
* \brief This will return the size of the vector
|
37 : |
|
|
* \return the size of the vector
|
38 : |
|
|
*/
|
39 : |
|
|
int Size() const { return size; };
|
40 : |
|
|
/**
|
41 : |
|
|
* \brief This will return the value of an element of the vector
|
42 : |
|
|
* \param pos is the element of the vector to be returned
|
43 : |
|
|
* \return the value of the specified element
|
44 : |
|
|
*/
|
45 : |
|
|
SuitFunc*& operator [] (int pos) { return v[pos]; };
|
46 : |
|
|
/**
|
47 : |
|
|
* \brief This will return the value of an element of the vector
|
48 : |
|
|
* \param pos is the element of the vector to be returned
|
49 : |
|
|
* \return the value of the specified element
|
50 : |
|
|
*/
|
51 : |
|
|
SuitFunc* const& operator [] (int pos) const { return v[pos]; };
|
52 : |
|
|
/**
|
53 : |
|
|
* \brief This function will read SuitFunc data from the input file
|
54 : |
|
|
* \param infile is the CommentStream to read suitability function data from
|
55 : |
|
|
* \param suitname is the name for the suitability function
|
56 : |
|
|
* \param TimeInfo is the TimeClass for the current model
|
57 : |
|
|
* \param keeper is the Keeper for the current model
|
58 : |
|
|
*/
|
59 : |
|
|
void readSuitFunction(CommentStream& infile, const char* suitname,
|
60 : |
|
|
const TimeClass* const TimeInfo, Keeper* const keeper);
|
61 : |
|
|
protected:
|
62 : |
|
|
/**
|
63 : |
|
|
* \brief This is the vector of SuitFunc values
|
64 : |
|
|
*/
|
65 : |
|
|
SuitFunc** v;
|
66 : |
|
|
/**
|
67 : |
|
|
* \brief This is the size of the vector
|
68 : |
|
|
*/
|
69 : |
|
|
int size;
|
70 : |
|
|
};
|
71 : |
|
|
|
72 : |
|
|
#endif
|