Gadget
Public Member Functions | Protected Attributes | List of all members
StockPtrVector Class Reference

This class implements a dynamic vector of Stock values. More...

#include <stockptrvector.h>

Collaboration diagram for StockPtrVector:
Collaboration graph

Public Member Functions

 StockPtrVector ()
 This is the default StockPtrVector constructor. More...
 
 StockPtrVector (const StockPtrVector &initial)
 This is the StockPtrVector constructor that creates a copy of an existing StockPtrVector. More...
 
 ~StockPtrVector ()
 This is the StockPtrVector destructor. More...
 
void resize (Stock *value)
 This will add one new entry to the vector. More...
 
void Delete (int pos)
 This will delete an entry from the vector. More...
 
int Size () const
 This will return the size of the vector. More...
 
void Reset ()
 This will reset the vector. More...
 
Stock *& operator[] (int pos)
 This will return the value of an element of the vector. More...
 
Stock *const & operator[] (int pos) const
 This will return the value of an element of the vector. More...
 
StockPtrVectoroperator= (const StockPtrVector &sv)
 This operator will set the vector equal to an existing StockPtrVector. More...
 

Protected Attributes

Stock ** v
 This is the vector of Stock values. More...
 
int size
 This is the size of the vector. More...
 

Detailed Description

This class implements a dynamic vector of Stock values.

Constructor & Destructor Documentation

◆ StockPtrVector() [1/2]

StockPtrVector::StockPtrVector ( )
inline

This is the default StockPtrVector constructor.

◆ StockPtrVector() [2/2]

StockPtrVector::StockPtrVector ( const StockPtrVector initial)

This is the StockPtrVector constructor that creates a copy of an existing StockPtrVector.

Parameters
initialis the StockPtrVector to copy

◆ ~StockPtrVector()

StockPtrVector::~StockPtrVector ( )

This is the StockPtrVector destructor.

Note
This will free all the memory allocated to all the elements of the vector

Member Function Documentation

◆ Delete()

void StockPtrVector::Delete ( int  pos)

This will delete an entry from the vector.

Parameters
posis the element of the vector to be deleted
Note
This will free the memory allocated to the deleted element of the vector

◆ operator=()

StockPtrVector & StockPtrVector::operator= ( const StockPtrVector sv)

This operator will set the vector equal to an existing StockPtrVector.

Parameters
svis the StockPtrVector to copy

◆ operator[]() [1/2]

Stock*& StockPtrVector::operator[] ( int  pos)
inline

This will return the value of an element of the vector.

Parameters
posis the element of the vector to be returned
Returns
the value of the specified element

◆ operator[]() [2/2]

Stock* const& StockPtrVector::operator[] ( int  pos) const
inline

This will return the value of an element of the vector.

Parameters
posis the element of the vector to be returned
Returns
the value of the specified element

◆ Reset()

void StockPtrVector::Reset ( )

This will reset the vector.

Note
This will delete every entry from the vector and set the size to zero

◆ resize()

void StockPtrVector::resize ( Stock value)

This will add one new entry to the vector.

Parameters
valueis the value that will be entered for the new entry

◆ Size()

int StockPtrVector::Size ( ) const
inline

This will return the size of the vector.

Returns
the size of the vector

Member Data Documentation

◆ size

int StockPtrVector::size
protected

This is the size of the vector.

◆ v

Stock** StockPtrVector::v
protected

This is the vector of Stock values.


The documentation for this class was generated from the following files: