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

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

#include <preyptrvector.h>

Collaboration diagram for PreyPtrVector:
Collaboration graph

Public Member Functions

 PreyPtrVector ()
 This is the default PreyPtrVector constructor. More...
 
 PreyPtrVector (const PreyPtrVector &initial)
 This is the PreyPtrVector constructor that creates a copy of an existing PreyPtrVector. More...
 
 ~PreyPtrVector ()
 This is the PreyPtrVector destructor. More...
 
void resizeBlank (int addsize)
 This will add new blank (ie. NULL) entries to the vector. More...
 
void resize (Prey *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...
 
Prey *& operator[] (int pos)
 This will return the value of an element of the vector. More...
 
Prey *const & operator[] (int pos) const
 This will return the value of an element of the vector. More...
 

Protected Attributes

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

Detailed Description

This class implements a dynamic vector of Prey values.

Constructor & Destructor Documentation

◆ PreyPtrVector() [1/2]

PreyPtrVector::PreyPtrVector ( )
inline

This is the default PreyPtrVector constructor.

◆ PreyPtrVector() [2/2]

PreyPtrVector::PreyPtrVector ( const PreyPtrVector initial)

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

Parameters
initialis the PreyPtrVector to copy

◆ ~PreyPtrVector()

PreyPtrVector::~PreyPtrVector ( )

This is the PreyPtrVector destructor.

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

Member Function Documentation

◆ Delete()

void PreyPtrVector::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[]() [1/2]

Prey*& PreyPtrVector::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]

Prey* const& PreyPtrVector::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

◆ resize()

void PreyPtrVector::resize ( Prey value)

This will add one new entry to the vector.

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

◆ resizeBlank()

void PreyPtrVector::resizeBlank ( int  addsize)

This will add new blank (ie. NULL) entries to the vector.

Parameters
addsizeis the number of blank entries that will be entered

◆ Size()

int PreyPtrVector::Size ( ) const
inline

This will return the size of the vector.

Returns
the size of the vector

Member Data Documentation

◆ size

int PreyPtrVector::size
protected

This is the size of the vector.

◆ v

Prey** PreyPtrVector::v
protected

This is the vector of Prey values.


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