Generated on Mon Aug 25 11:35:48 2008 for Gecode by doxygen 1.5.6

Gecode::VarArray< Var > Class Template Reference
[Programming variables]

Inherited by Gecode::BoolVarArray, Gecode::CpltSetVarArray, Gecode::IntVarArray, and Gecode::SetVarArray.

List of all members.


Detailed Description

template<class Var>
class Gecode::VarArray< Var >

Variable arrays

Variable arrays store variables. They are typically used for storing the variables being part of a solution.

Never use them for temporary purposes, use argument arrays instead.

Definition at line 59 of file array.icc.


Constructors and initialization

 VarArray (void)
 Default constructor (array of size 0).
 VarArray (Space *, int m)
 Allocate array with m variables.
 VarArray (Space *, const VarArgArray< Var > &)
 Initialize from variable argument array a (copy elements).
 VarArray (const VarArray< Var > &a)
 Initialize from variable array a (share elements).
const VarArray< Var > & operator= (const VarArray< Var > &a)
 Initialize from variable array a (share elements).
 ~VarArray (void)
 Destructor.

Array size

int size (void) const
 Return size of array (number of elements).
void resize (Space *home, int m)
 Insert or remove (uninitialized!) elements at the end such that size becomes m.

Array elements

Var & operator[] (int i)
 Return variable at position i.
const Var & operator[] (int i) const
 Return variable at position i.
void add (Space *home, const Var &v)
 Insert a new element v at the end of the array (increase size by 1).

Cloning

void update (Space *, bool share, VarArray< Var > &a)
 Update array to be a clone of array a.

Protected Attributes

int used
 Number of variables (size).
int n
 Allocated size of the array.
Var * x
 Array of variables.

Constructor & Destructor Documentation

template<class Var>
Gecode::VarArray< Var >::VarArray ( void   )  [inline]

Default constructor (array of size 0).

Definition at line 535 of file array.icc.

template<class Var>
Gecode::VarArray< Var >::VarArray ( Space home,
int  m 
) [inline]

Allocate array with m variables.

Definition at line 539 of file array.icc.

template<class Var>
Gecode::VarArray< Var >::VarArray ( Space home,
const VarArgArray< Var > &  a 
) [inline]

Initialize from variable argument array a (copy elements).

Definition at line 1178 of file array.icc.

template<class Var>
Gecode::VarArray< Var >::VarArray ( const VarArray< Var > &  a  )  [inline]

Initialize from variable array a (share elements).

Definition at line 546 of file array.icc.

template<class Var>
Gecode::VarArray< Var >::~VarArray ( void   )  [inline]

Destructor.

Definition at line 552 of file array.icc.


Member Function Documentation

template<class Var>
const VarArray< Var > & Gecode::VarArray< Var >::operator= ( const VarArray< Var > &  a  )  [inline]

Initialize from variable array a (share elements).

Definition at line 561 of file array.icc.

template<class Var>
int Gecode::VarArray< Var >::size ( void   )  const [inline]

Return size of array (number of elements).

Definition at line 568 of file array.icc.

template<class Var>
void Gecode::VarArray< Var >::resize ( Space home,
int  m 
) [inline]

Insert or remove (uninitialized!) elements at the end such that size becomes m.

Definition at line 574 of file array.icc.

template<class Var>
Var & Gecode::VarArray< Var >::operator[] ( int  i  )  [inline]

Return variable at position i.

Definition at line 597 of file array.icc.

template<class Var>
const Var & Gecode::VarArray< Var >::operator[] ( int  i  )  const [inline]

Return variable at position i.

Definition at line 604 of file array.icc.

template<class Var>
void Gecode::VarArray< Var >::add ( Space home,
const Var &  v 
) [inline]

Insert a new element v at the end of the array (increase size by 1).

Definition at line 611 of file array.icc.

template<class Var>
void Gecode::VarArray< Var >::update ( Space home,
bool  share,
VarArray< Var > &  a 
) [inline]

Update array to be a clone of array a.

If share is true, sharing is retained for all shared data structures. Otherwise, for each of them an independent copy is created.

Definition at line 618 of file array.icc.


Member Data Documentation

template<class Var>
int Gecode::VarArray< Var >::used [protected]

Number of variables (size).

Definition at line 62 of file array.icc.

template<class Var>
int Gecode::VarArray< Var >::n [protected]

Allocated size of the array.

Definition at line 64 of file array.icc.

template<class Var>
Var* Gecode::VarArray< Var >::x [protected]

Array of variables.

Definition at line 66 of file array.icc.


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