Overture  Version 25
Public Member Functions | List of all members
VectorSimple< T > Class Template Reference

A class for one dimensional dynamically allocated arrays. More...

#include <VectorSimple.h>

Public Member Functions

 VectorSimple ()
 default constructor
 
EXPLICIT VectorSimple (const int &s)
 basic constructor with size information
 
 VectorSimple (const VectorSimple< T > &a)
 copy constructor
 
 ~VectorSimple ()
 destructor
 
int size () const
 return the length of the array
 
T * ptr ()
 get the data pointer
 
VectorSimple< T > & operator= (const VectorSimple< T > &a)
 assignment operator
 
VectorSimple< T > & operator= (const T &a)
 
T & operator() (const int &i)
 index operator
 
const T & operator() (const int &i) const
 const index operator
 
T & operator[] (const int &i)
 yet another index operator
 
const T & operator[] (const int &i) const
 yet another const index operator
 

Detailed Description

template<class T>
class VectorSimple< T >

A class for one dimensional dynamically allocated arrays.

VectorSimple provides templatized, dynamically allocated 1D arrays. It takes only one template parameter specifying the type contained in the array.

Constructor & Destructor Documentation

template<class T>
VectorSimple< T >::VectorSimple ( )
inline

default constructor

creates an instance suitable only for copying into

template<class T>
EXPLICIT VectorSimple< T >::VectorSimple ( const int &  s)
inline

basic constructor with size information

create an array of a specified size

Parameters
sthe requested size of the array

References s.

template<class T>
VectorSimple< T >::VectorSimple ( const VectorSimple< T > &  a)
inline

copy constructor

perform a deep copy of one VectorSimple<T> into another, only allocate new space if the size of the sink array is different from the source.

Parameters
athe source array

References s, and VectorSimple< T >::size().

template<class T>
VectorSimple< T >::~VectorSimple ( )
inline

destructor

Member Function Documentation

template<class T>
T& VectorSimple< T >::operator() ( const int &  i)
inline

index operator

Parameters
ithe requested index
Returns
data item at index i

References assert, and RANGE_CHK.

template<class T>
const T& VectorSimple< T >::operator() ( const int &  i) const
inline

const index operator

Parameters
ithe requested index
Returns
const reference to the item at index i

References assert, and RANGE_CHK.

template<class T>
VectorSimple<T>& VectorSimple< T >::operator= ( const VectorSimple< T > &  a)
inline

assignment operator

Perform an assignment of the sink array into the current instance. A deep copy is conducted, resizing the current array to the source if neccessary

Returns
the copied array

References s, and VectorSimple< T >::size().

template<class T>
VectorSimple<T>& VectorSimple< T >::operator= ( const T &  a)
inline

References s.

template<class T>
T& VectorSimple< T >::operator[] ( const int &  i)
inline

yet another index operator

offered for consistency with the other ArraySimple classes

Parameters
ithe requested index
Returns
reference to the item at index i

References assert, and RANGE_CHK.

template<class T>
const T& VectorSimple< T >::operator[] ( const int &  i) const
inline

yet another const index operator

offered for consistency with the other ArraySimple classes

Parameters
ithe requested index
Returns
const reference to the item at index i

References assert, and RANGE_CHK.

template<class T>
T* VectorSimple< T >::ptr ( )
inline

get the data pointer

this method is usefull for communicating the data to other languages/libraries

Returns
pointer to the data
template<class T>
int VectorSimple< T >::size ( ) const
inline

return the length of the array

Returns
the length of the array

Referenced by VectorSimple< T >::operator=(), and VectorSimple< T >::VectorSimple().


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