Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

PackArray Class Template Reference

Packed array/vector; saves space and is fast. More...

#include <mpackarray.h>

Inheritance diagram for PackArray:

List of all members.

Public Methods

 PackArray (int siz)
 PackArray (const PackArray &orig)
void make (int siz)
void shallowCopy (const PackArray &orig)
void destroy ()
void empty ()
const TYPE & operator[] (int i) const
TYPE & operator[] (int i)
PackArray< TYPE > & operator= (const PackArray &other)
void resize (int newsize)
virtual void check () const

Detailed Description

template<class TYPE>
class PackArray< TYPE >

Packed array/vector; saves space and is fast.

Especially useful with the primitive types such as int or float. 0-based indexing.

NULL objects are not possible like in Array. Nor is this container as dynamic as Array is.

Definition at line 27 of file mpackarray.h.


Constructor & Destructor Documentation

PackArray int    siz [inline]
 

Creates an packed array with the given mSize.

Definition at line 38 of file mpackarray.h.

PackArray const PackArray< TYPE > &    orig [inline]
 

Copy constructor uses operator= to copy the contained items.

Remember to define the operator= for the object class, as the default operator= does only a shallow copy.

Definition at line 48 of file mpackarray.h.


Member Function Documentation

virtual void check   const [inline, virtual]
 

Implementation for Object.

Definition at line 184 of file mpackarray.h.

void destroy   [inline]
 

Empties the array.

Definition at line 78 of file mpackarray.h.

Referenced by PackArray< NodeLink >::empty(), PackArray< NodeLink >::make(), PackArray< NodeLink >::operator=(), and PackArray< NodeLink >::resize().

void empty   [inline]
 

Empties the array.

Alias for destroy().

Definition at line 85 of file mpackarray.h.

void make int    siz [inline]
 

Creates or recreates the array with the given mSize.

Definition at line 56 of file mpackarray.h.

Referenced by histogram(), PackArray< NodeLink >::PackArray(), PackArray< NodeLink >::shallowCopy(), and solveLinear().

PackArray<TYPE>& operator= const PackArray< TYPE > &    other [inline]
 

Standard copy operator.

Remember to define the operator= for the object class, as the default operator= does only a shallow copy.

Definition at line 112 of file mpackarray.h.

TYPE& operator[] int    i [inline]
 

Returns reference to i:th item in the array.

Non-const version.

Definition at line 101 of file mpackarray.h.

const TYPE& operator[] int    i const [inline]
 

Returns reference to i:th item in the array.

Const version.

Definition at line 92 of file mpackarray.h.

void resize int    newsize [inline]
 

Changes mSize of the array.

Definition at line 139 of file mpackarray.h.

void shallowCopy const PackArray< TYPE > &    orig [inline]
 

Very quick copy operator.

Definition at line 71 of file mpackarray.h.


The documentation for this class was generated from the following file:
Generated on Thu Feb 10 20:06:43 2005 for LibMagiC by doxygen1.2.18