Generated on Wed Nov 1 15:05:13 2006 for Gecode by doxygen 1.4.5

Gecode::ArgArrayBase< T > Class Template Reference

Inherited by Gecode::PrimArgArray< T >.

List of all members.


Detailed Description

template<class T>
class Gecode::ArgArrayBase< T >

Base-class for argument arrays.

Argument arrays are used as convenient mechanism of passing arguments when calling functions as they combine both the size and the elements of an array. For a small number of elements, memory is allocated by creating an argument array object. Otherwise the memory is allocated from the heap.

This base-class is not to be used directly, use PrimArgArray for argument arrays of primitive types and VarArgArray for argument arrays storing variables.

Definition at line 270 of file array.icc.

Constructors and initialization

 ArgArrayBase (int n)
 Allocate array with n elements.
 ArgArrayBase (const ArgArrayBase< T > &a)
 Initialize from argument array a (copy elements).
const ArgArrayBase< T > & operator= (const ArgArrayBase< T > &a)
 Initialize from view array a (copy elements).

Array size

int size (void) const
 Return size of array (number of elements).

Array elements

T & operator[] (int i)
 Return element at position i.
const T & operator[] (int i) const
 Return element at position i.

Destructor

 ~ArgArrayBase (void)
 Destructor.

Protected Member Functions

T * allocate (int n)
 Allocate memory for n elements.

Protected Attributes

int n
 Number of elements.
T * a
 Element array.
onstack [onstack_size]
 In-array storage for elements.

Static Protected Attributes

static const int onstack_size = 16
 How much elements are possible inside array.


Constructor & Destructor Documentation

template<class T>
Gecode::ArgArrayBase< T >::ArgArrayBase int  n  )  [inline]
 

Allocate array with n elements.

Definition at line 763 of file array.icc.

template<class T>
Gecode::ArgArrayBase< T >::ArgArrayBase const ArgArrayBase< T > &  a  )  [inline]
 

Initialize from argument array a (copy elements).

Definition at line 768 of file array.icc.

template<class T>
Gecode::ArgArrayBase< T >::~ArgArrayBase void   )  [inline]
 

Destructor.

Definition at line 776 of file array.icc.


Member Function Documentation

template<class T>
T * Gecode::ArgArrayBase< T >::allocate int  n  )  [inline, protected]
 

Allocate memory for n elements.

Definition at line 756 of file array.icc.

template<class T>
const ArgArrayBase< T > & Gecode::ArgArrayBase< T >::operator= const ArgArrayBase< T > &  a  )  [inline]
 

Initialize from view array a (copy elements).

Definition at line 783 of file array.icc.

template<class T>
int Gecode::ArgArrayBase< T >::size void   )  const [inline]
 

Return size of array (number of elements).

Definition at line 797 of file array.icc.

template<class T>
T & Gecode::ArgArrayBase< T >::operator[] int  i  )  [inline]
 

Return element at position i.

Reimplemented in Gecode::BoolVarArgs.

Definition at line 803 of file array.icc.

template<class T>
const T & Gecode::ArgArrayBase< T >::operator[] int  i  )  const [inline]
 

Return element at position i.

Reimplemented in Gecode::BoolVarArgs.

Definition at line 810 of file array.icc.


Member Data Documentation

template<class T>
int Gecode::ArgArrayBase< T >::n [protected]
 

Number of elements.

Definition at line 273 of file array.icc.

template<class T>
T* Gecode::ArgArrayBase< T >::a [protected]
 

Element array.

Definition at line 275 of file array.icc.

template<class T>
const int Gecode::ArgArrayBase< T >::onstack_size = 16 [static, protected]
 

How much elements are possible inside array.

Definition at line 277 of file array.icc.

template<class T>
T Gecode::ArgArrayBase< T >::onstack[onstack_size] [protected]
 

In-array storage for elements.

Definition at line 279 of file array.icc.


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