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

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

#include <popratiomatrix.h>

Collaboration diagram for PopRatioMatrix:
Collaboration graph

Public Member Functions

 PopRatioMatrix ()
 This is the default PopRatioMatrix constructor. More...
 
 PopRatioMatrix (int nr, int nc, PopRatio initial)
 This is the PopRatioMatrix constructor for a specified size. More...
 
 PopRatioMatrix (const PopRatioMatrix &initial)
 This is the PopRatioMatrix constructor that creates a copy of an existing PopRatioMatrix. More...
 
 ~PopRatioMatrix ()
 This is the PopRatioMatrix destructor. More...
 
int Ncol (int i=0) const
 This will return the number of columns in row i of the vector. More...
 
int Nrow () const
 This will return the number of rows of the vector. More...
 
PopRatioVectoroperator[] (int pos)
 This will return the value of an element of the vector. More...
 
const PopRatioVectoroperator[] (int pos) const
 This will return the value of an element of the vector. More...
 
void AddRows (int add, int length, PopRatio value)
 This will add new entries to the vector. More...
 
void Delete (int pos)
 This will delete an entry from the vector. More...
 

Protected Attributes

int nrow
 This is number of rows of the vector. More...
 
PopRatioVector ** v
 This is the vector of PopRatioVector values. More...
 

Detailed Description

This class implements a dynamic vector of PopRatioVector values.

Constructor & Destructor Documentation

◆ PopRatioMatrix() [1/3]

PopRatioMatrix::PopRatioMatrix ( )
inline

This is the default PopRatioMatrix constructor.

◆ PopRatioMatrix() [2/3]

PopRatioMatrix::PopRatioMatrix ( int  nr,
int  nc,
PopRatio  initial 
)

This is the PopRatioMatrix constructor for a specified size.

Parameters
nris the size of the vector to be created
ncis the length of each row to be created (ie. the size of the PopRatioVector to be created for each row)
initialis the initial value for all the entries of the vector

◆ PopRatioMatrix() [3/3]

PopRatioMatrix::PopRatioMatrix ( const PopRatioMatrix initial)

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

Parameters
initialis the PopRatioMatrix to copy

◆ ~PopRatioMatrix()

PopRatioMatrix::~PopRatioMatrix ( )

This is the PopRatioMatrix destructor.

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

Member Function Documentation

◆ AddRows()

void PopRatioMatrix::AddRows ( int  add,
int  length,
PopRatio  value 
)

This will add new entries to the vector.

Parameters
addis the number of new entries to the vector
lengthis the number of entries to the PopRatioVector that is created
valueis the value that will be entered for the new entries

◆ Delete()

void PopRatioMatrix::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

◆ Ncol()

int PopRatioMatrix::Ncol ( int  i = 0) const
inline

This will return the number of columns in row i of the vector.

Parameters
iis the row of the vector to have the number of columns counted
Returns
the number of columns in row i of the vector
Note
This is the number of entries in the PopRatioVector that is entry i of the PopRatioMatrix

◆ Nrow()

int PopRatioMatrix::Nrow ( ) const
inline

This will return the number of rows of the vector.

Returns
the number of rows of the vector

◆ operator[]() [1/2]

PopRatioVector& PopRatioMatrix::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]

const PopRatioVector& PopRatioMatrix::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

Member Data Documentation

◆ nrow

int PopRatioMatrix::nrow
protected

This is number of rows of the vector.

◆ v

PopRatioVector** PopRatioMatrix::v
protected

This is the vector of PopRatioVector values.


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