Gadget
stockptrvector.h
Go to the documentation of this file.
1 #ifndef stockptrvector_h
2 #define stockptrvector_h
3 
4 class Stock;
5 
11 public:
15  StockPtrVector() { size = 0; v = 0; };
20  StockPtrVector(const StockPtrVector& initial);
30  void resize(Stock* value);
36  void Delete(int pos);
41  int Size() const { return size; };
46  void Reset();
52  Stock*& operator [] (int pos) { return v[pos]; };
58  Stock* const& operator [] (int pos) const { return v[pos]; };
64 protected:
68  Stock** v;
72  int size;
73 };
74 
75 #endif
This class implements a dynamic vector of Stock values.
Definition: stockptrvector.h:10
Stock *& operator[](int pos)
This will return the value of an element of the vector.
Definition: stockptrvector.h:52
int size
This is the size of the vector.
Definition: stockptrvector.h:72
StockPtrVector & operator=(const StockPtrVector &sv)
This operator will set the vector equal to an existing StockPtrVector.
Definition: stockptrvector.cc:63
StockPtrVector()
This is the default StockPtrVector constructor.
Definition: stockptrvector.h:15
int Size() const
This will return the size of the vector.
Definition: stockptrvector.h:41
~StockPtrVector()
This is the StockPtrVector destructor.
Definition: stockptrvector.cc:15
void Reset()
This will reset the vector.
Definition: stockptrvector.cc:55
void resize(Stock *value)
This will add one new entry to the vector.
Definition: stockptrvector.cc:22
void Delete(int pos)
This will delete an entry from the vector.
Definition: stockptrvector.cc:37
Stock ** v
This is the vector of Stock values.
Definition: stockptrvector.h:68
This is the class used to model a stock within the Gadget model.
Definition: stock.h:33