1 : |
agomez |
1 |
#ifndef optinfoptrvector_h
|
2 : |
|
|
#define optinfoptrvector_h
|
3 : |
|
|
|
4 : |
|
|
class OptInfo;
|
5 : |
|
|
|
6 : |
|
|
/**
|
7 : |
|
|
* \class OptInfoPtrVector
|
8 : |
|
|
* \brief This class implements a dynamic vector of OptInfo values
|
9 : |
|
|
*/
|
10 : |
|
|
class OptInfoPtrVector {
|
11 : |
|
|
public:
|
12 : |
|
|
/**
|
13 : |
|
|
* \brief This is the default OptInfoPtrVector constructor
|
14 : |
|
|
*/
|
15 : |
|
|
OptInfoPtrVector() { size = 0; v = 0; };
|
16 : |
|
|
/**
|
17 : |
|
|
* \brief This is the OptInfoPtrVector constructor that creates a copy of an existing OptInfoPtrVector
|
18 : |
|
|
* \param initial is the OptInfoPtrVector to copy
|
19 : |
|
|
*/
|
20 : |
|
|
OptInfoPtrVector(const OptInfoPtrVector& initial);
|
21 : |
|
|
/**
|
22 : |
|
|
* \brief This is the OptInfoPtrVector destructor
|
23 : |
|
|
* \note This will free all the memory allocated to all the elements of the vector
|
24 : |
|
|
*/
|
25 : |
|
|
~OptInfoPtrVector();
|
26 : |
|
|
/**
|
27 : |
|
|
* \brief This will add one new entry to the vector
|
28 : |
|
|
* \param value is the value that will be entered for the new entry
|
29 : |
|
|
*/
|
30 : |
|
|
void resize(OptInfo* value);
|
31 : |
|
|
/**
|
32 : |
|
|
* \brief This will delete an entry from the vector
|
33 : |
|
|
* \param pos is the element of the vector to be deleted
|
34 : |
|
|
* \note This will free the memory allocated to the deleted element of the vector
|
35 : |
|
|
*/
|
36 : |
|
|
void Delete(int pos);
|
37 : |
|
|
/**
|
38 : |
|
|
* \brief This will return the size of the vector
|
39 : |
|
|
* \return the size of the vector
|
40 : |
|
|
*/
|
41 : |
|
|
int Size() const { return size; };
|
42 : |
|
|
/**
|
43 : |
|
|
* \brief This will return the value of an element of the vector
|
44 : |
|
|
* \param pos is the element of the vector to be returned
|
45 : |
|
|
* \return the value of the specified element
|
46 : |
|
|
*/
|
47 : |
|
|
OptInfo*& operator [] (int pos) { return v[pos]; };
|
48 : |
|
|
/**
|
49 : |
|
|
* \brief This will return the value of an element of the vector
|
50 : |
|
|
* \param pos is the element of the vector to be returned
|
51 : |
|
|
* \return the value of the specified element
|
52 : |
|
|
*/
|
53 : |
|
|
OptInfo* const& operator [] (int pos) const { return v[pos]; };
|
54 : |
|
|
protected:
|
55 : |
|
|
/**
|
56 : |
|
|
* \brief This is the vector of OptInfo values
|
57 : |
|
|
*/
|
58 : |
|
|
OptInfo** v;
|
59 : |
|
|
/**
|
60 : |
|
|
* \brief This is the size of the vector
|
61 : |
|
|
*/
|
62 : |
|
|
int size;
|
63 : |
|
|
};
|
64 : |
|
|
|
65 : |
|
|
#endif
|