OPTPP::OptppArray< T > Class Template Reference

#include <OptppArray.h>

List of all members.

Public Member Functions

 OptppArray ()
 OptppArray (int n)
 OptppArray (int n, const T *cOptppArray)
 OptppArray (int n, const T &t)
 ~OptppArray ()
 explicit copy destructor needed to prevent memory corruption
 OptppArray (const OptppArray< T > &other)
 explicit copy constructor needed to prevent memory corruption
const OptppArray< T > & operator= (const OptppArray< T > &other)
 explicit assignment needed to prevent memory corruption
void resize (int newN)
 resize the OptppArray
void reserve (int n)
 reserve n slots in OptppArray
int reserve () const
 return numbered of reserved slots in OptppArray
OptppArray< T > & append (const T &rhs)
 add a new entry.
T & operator[] (int i)
const T & operator[] (int i) const
bool get (int i, T &value) const
bool put (int i, const T &value)
int length () const
bool bcast (int sender)
bool send (int tag, int dest)
bool recv (int tag, int src)

Private Member Functions

void indexCheckCrash (int i) const
bool indexCheckNoCrash (int i) const

Private Attributes

T * data_
 T class pointer to the data.
int len_
 Length of array.
int reserve_
 Amount of reserved space.


Detailed Description

template<class T>
class OPTPP::OptppArray< T >

Simple array class.

Bounds checking is ON by default. To turn it off (for optimal performance) do -DNOBOUNDSCHECK on the compilation command line.

Parallel support for primitive types relies on template specialization. If your compiler supports template specialization, define TEMPLATE_SPECIALIZATION and use the code here. Otherwise, use the workaround routines in BadCompilerHacks.[cpp,h]. IRIX CC 7.2 and egcs both support specialization. IRIX CC 7.1 appears not to (though the documentation says otherwise).


Constructor & Destructor Documentation

template<class T>
OPTPP::OptppArray< T >::OptppArray (  )  [inline]

Default Constructor

See also:
OptppArray(int n)

OptppArray(int n, const T* cOptppArray)

OptppArray(int n, const T& t)

template<class T>
OPTPP::OptppArray< T >::OptppArray ( int  n  )  [inline]

Parameters:
n an integer argument

template<class T>
OPTPP::OptppArray< T >::OptppArray ( int  n,
const T *  cOptppArray 
) [inline]

Parameters:
n an integer argument
cOptppArray a pointer to class T

template<class T>
OPTPP::OptppArray< T >::OptppArray ( int  n,
const T &  t 
) [inline]

Parameters:
n an integer argument
t a reference to class T

template<class T>
OPTPP::OptppArray< T >::~OptppArray (  )  [inline]

explicit copy destructor needed to prevent memory corruption

template<class T>
OPTPP::OptppArray< T >::OptppArray ( const OptppArray< T > &  other  )  [inline]

explicit copy constructor needed to prevent memory corruption


Member Function Documentation

template<class T>
OptppArray< T > & OPTPP::OptppArray< T >::append ( const T &  rhs  )  [inline]

add a new entry.

template<class T>
bool OPTPP::OptppArray< T >::bcast ( int  sender  ) 

accessors that return error codes if there are problems with parallel processing

Returns:
1 OK

0 error

template<class T>
bool OPTPP::OptppArray< T >::get ( int  i,
T &  value 
) const [inline]

accessors that return error codes upon bounds violations (if NOBOUNDSCHECK is not set):

Returns:
1 OK

0 error

template<class T>
void OPTPP::OptppArray< T >::indexCheckCrash ( int  i  )  const [inline, private]

template<class T>
bool OPTPP::OptppArray< T >::indexCheckNoCrash ( int  i  )  const [inline, private]

template<class T>
int OPTPP::OptppArray< T >::length (  )  const [inline]

Returns:
Length of array

template<class T>
const OptppArray< T > & OPTPP::OptppArray< T >::operator= ( const OptppArray< T > &  other  )  [inline]

explicit assignment needed to prevent memory corruption

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

template<class T>
T & OPTPP::OptppArray< T >::operator[] ( int  i  )  [inline]

simple accessors. If NOBOUNDSCHECK is not set and a bounds error occurs, crash. In cases where error handling is to be used, and exceptions are not supported, use get and put instead.

template<class T>
bool OPTPP::OptppArray< T >::put ( int  i,
const T &  value 
) [inline]

template<class T>
bool OPTPP::OptppArray< T >::recv ( int  tag,
int  src 
)

template<class T>
int OPTPP::OptppArray< T >::reserve (  )  const [inline]

return numbered of reserved slots in OptppArray

template<class T>
void OPTPP::OptppArray< T >::reserve ( int  n  )  [inline]

reserve n slots in OptppArray

template<class T>
void OPTPP::OptppArray< T >::resize ( int  newN  )  [inline]

resize the OptppArray

template<class T>
bool OPTPP::OptppArray< T >::send ( int  tag,
int  dest 
)


Member Data Documentation

template<class T>
T* OPTPP::OptppArray< T >::data_ [private]

T class pointer to the data.

template<class T>
int OPTPP::OptppArray< T >::len_ [private]

Length of array.

template<class T>
int OPTPP::OptppArray< T >::reserve_ [private]

Amount of reserved space.


The documentation for this class was generated from the following file:
Bug Reports    OPT++ Developers    Copyright Information    GNU Lesser General Public License
Documentation, generated by , last revised August 30, 2006.