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

Gecode::Support::SharedArray< T, fd > Class Template Reference
[Support algorithms and datastructures]

#include <shared-array.hh>

List of all members.


Detailed Description

template<class T, bool fd = false>
class Gecode::Support::SharedArray< T, fd >

Shared array with arbitrary number of elements.

Sharing is implemented by reference counting: the same elements are shared among several objects.

If the template parameter fd is true, the destructors of all objects in the array will be called when the array is deallocated, i.e. when its reference count drops to zero.

Requires

Definition at line 45 of file shared-array.hh.

Public Member Functions

 SharedArray (void)
 Initialize as empty array.
 SharedArray (int n)
 Initialize as array with n elements.
 SharedArray (const SharedArray< T, fd > &a)
 Initialize from shared array a (share elements).
const SharedArrayoperator= (const SharedArray &)
 Initialize from shared array a (share elements).
void update (bool share, SharedArray &a)
 Update this array from array a (share elements if share is true).
 ~SharedArray (void)
 Delete array (elements might be still in use).
T & operator[] (int i)
 Access element at position i.
const T & operator[] (int i) const
 Access element at position i.
int size (void) const
 Return number of elements.
void size (int n)
 Change size to n.
void shrink (int n)
 Shrink array to n elements.
void ensure (int n)
 Ensure that array has at least n elements.


Constructor & Destructor Documentation

template<class T, bool fd>
Gecode::Support::SharedArray< T, fd >::SharedArray void   )  [inline]
 

Initialize as empty array.

Definition at line 143 of file shared-array.hh.

template<class T, bool fd>
Gecode::Support::SharedArray< T, fd >::SharedArray int  n  )  [inline]
 

Initialize as array with n elements.

Definition at line 147 of file shared-array.hh.

template<class T, bool fd>
Gecode::Support::SharedArray< T, fd >::SharedArray const SharedArray< T, fd > &  a  )  [inline]
 

Initialize from shared array a (share elements).

Definition at line 152 of file shared-array.hh.

template<class T, bool fd>
Gecode::Support::SharedArray< T, fd >::~SharedArray void   )  [inline]
 

Delete array (elements might be still in use).

Definition at line 160 of file shared-array.hh.


Member Function Documentation

template<class T, bool fd = false>
const SharedArray& Gecode::Support::SharedArray< T, fd >::operator= const SharedArray< T, fd > &   ) 
 

Initialize from shared array a (share elements).

template<class T, bool fd = false>
void Gecode::Support::SharedArray< T, fd >::update bool  share,
SharedArray< T, fd > &  a
 

Update this array from array a (share elements if share is true).

template<class T, bool fd>
T & Gecode::Support::SharedArray< T, fd >::operator[] int  i  )  [inline]
 

Access element at position i.

Definition at line 194 of file shared-array.hh.

template<class T, bool fd>
const T & Gecode::Support::SharedArray< T, fd >::operator[] int  i  )  const [inline]
 

Access element at position i.

Definition at line 200 of file shared-array.hh.

template<class T, bool fd>
int Gecode::Support::SharedArray< T, fd >::size void   )  const [inline]
 

Return number of elements.

Definition at line 206 of file shared-array.hh.

template<class T, bool fd>
void Gecode::Support::SharedArray< T, fd >::size int  n  )  [inline]
 

Change size to n.

Definition at line 212 of file shared-array.hh.

template<class T, bool fd>
void Gecode::Support::SharedArray< T, fd >::shrink int  n  )  [inline]
 

Shrink array to n elements.

Definition at line 224 of file shared-array.hh.

template<class T, bool fd>
void Gecode::Support::SharedArray< T, fd >::ensure int  n  )  [inline]
 

Ensure that array has at least n elements.

Definition at line 235 of file shared-array.hh.


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