Generated on Tue Jul 27 2010 21:59:25 for Gecode by doxygen 1.7.1

Gecode::ViewArray< View > Class Template Reference
[Programming actors]

View arrays. More...

#include <array.hpp>

List of all members.

Public Member Functions

bool assigned (void) const
 Test if all variables are assigned.

Related Functions

(Note that these are not member functions.)



template<class Char , class Traits , class View >
std::basic_ostream< Char,
Traits > & 
operator<< (std::basic_ostream< Char, Traits > &os, const ViewArray< View > &x)
 Print array elements enclosed in curly brackets.

Constructors and initialization



 ViewArray (void)
 Default constructor (array of size 0).
 ViewArray (Space &home, int m)
 Allocate array with m views.
 ViewArray (const ViewArray< View > &a)
 Initialize from view array a (share elements).
 ViewArray (Space &home, const ViewArray< View > &a)
 Initialize from view array a (copy elements).
const ViewArray< View > & operator= (const ViewArray< View > &a)
 Initialize from view array a (share elements).
template<class Var >
 ViewArray (Space &home, const VarArgArray< Var > &a)
 Initialize from variable argument array a (copy elements).

Array size



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

Array elements



View & operator[] (int i)
 Return view at position i.
const View & operator[] (int i) const
 Return view at position i.

Dependencies



void subscribe (Space &home, Propagator &p, PropCond pc, bool process=true)
 Subscribe propagator p with propagation condition pc to variable.
void cancel (Space &home, Propagator &p, PropCond pc)
 Cancel subscription of propagator p with propagation condition pc to all views.
void subscribe (Space &home, Advisor &a)
 Subscribe advisor a to variable.
void cancel (Space &home, Advisor &a)
 Cancel subscription of advisor a.

Cloning



void update (Space &, bool share, ViewArray< View > &a)
 Update array to be a clone of array a.

Moving elements



void move_fst (int i)
 Move view from position 0 to position i (shift elements to the left).
void move_lst (int i)
 Move view from position size()-1 to position i (truncate array by one).
void move_fst (int i, Space &home, Propagator &p, PropCond pc)
 Move view from position 0 to position i (shift elements to the left).
void move_lst (int i, Space &home, Propagator &p, PropCond pc)
 Move view from position size()-1 to position i (truncate array by one).
void move_fst (int i, Space &home, Advisor &a)
 Move view from position 0 to position i (shift elements to the left).
void move_lst (int i, Space &home, Advisor &a)
 Move view from position size()-1 to position i (truncate array by one).

Dropping elements



void drop_fst (int i)
 Drop views from positions 0 to i-1 from array.
void drop_lst (int i)
 Drop views from positions i+1 to size()-1 from array.
void drop_fst (int i, Space &home, Propagator &p, PropCond pc)
 Drop views from positions 0 to i-1 from array.
void drop_lst (int i, Space &home, Propagator &p, PropCond pc)
 Drop assigned views from positions i+1 to size()-1 from array.
void drop_fst (int i, Space &home, Advisor &a)
 Drop views from positions 0 to i-1 from array.
void drop_lst (int i, Space &home, Advisor &a)
 Drop assigned views from positions i+1 to size()-1 from array.

View equality



bool same (const Space &home) const
 Test whether array has multiple occurence of the same view.
bool same (const Space &home, const View &y) const
 Test whether array contains a view being the same as y.
void unique (const Space &home)
 Remove all duplicate views from array (changes element order).

View sharing



bool shared (const Space &home) const
 Test whether array contains shared views.
template<class ViewY >
bool shared (const Space &home, const ViewY &y) const
 Test whether array contains a view being shared with y.
template<class ViewY >
bool shared (const Space &home, const ViewArray< ViewY > &y) const
 Test whether array together with array y contains shared views.

Detailed Description

template<class View>
class Gecode::ViewArray< View >

View arrays.

View arrays store views. They are typically used for storing the views with which propagators and branchers compute.

Definition at line 185 of file array.hpp.


Constructor & Destructor Documentation

template<class View >
Gecode::ViewArray< View >::ViewArray ( void   )  [inline]

Default constructor (array of size 0).

Definition at line 943 of file array.hpp.

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

Allocate array with m views.

Definition at line 947 of file array.hpp.

template<class View>
Gecode::ViewArray< View >::ViewArray ( const ViewArray< View > &  a  )  [inline]

Initialize from view array a (share elements).

Definition at line 966 of file array.hpp.

template<class View>
Gecode::ViewArray< View >::ViewArray ( Space home,
const ViewArray< View > &  a 
)

Initialize from view array a (copy elements).

Definition at line 953 of file array.hpp.

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

Initialize from variable argument array a (copy elements).

Note that the view type View must provide a constructor for the associated Var type.

Definition at line 219 of file array.hpp.


Member Function Documentation

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

Initialize from view array a (share elements).

Definition at line 971 of file array.hpp.

template<class View >
int Gecode::ViewArray< View >::size ( void   )  const [inline]

Return size of array (number of elements).

Definition at line 978 of file array.hpp.

template<class View >
void Gecode::ViewArray< View >::size ( int  n  )  [inline]

Decrease size of array (number of elements).

Definition at line 984 of file array.hpp.

template<class View >
View & Gecode::ViewArray< View >::operator[] ( int  i  )  [inline]

Return view at position i.

Definition at line 990 of file array.hpp.

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

Return view at position i.

Definition at line 997 of file array.hpp.

template<class View >
void Gecode::ViewArray< View >::subscribe ( Space home,
Propagator p,
PropCond  pc,
bool  process = true 
)

Subscribe propagator p with propagation condition pc to variable.

In case process is false, the propagator is just subscribed but not processed for execution (this must be used when creating subscriptions during propagation).

Definition at line 1115 of file array.hpp.

template<class View >
void Gecode::ViewArray< View >::cancel ( Space home,
Propagator p,
PropCond  pc 
)

Cancel subscription of propagator p with propagation condition pc to all views.

Definition at line 1123 of file array.hpp.

template<class View >
void Gecode::ViewArray< View >::subscribe ( Space home,
Advisor a 
)

Subscribe advisor a to variable.

Definition at line 1130 of file array.hpp.

template<class View >
void Gecode::ViewArray< View >::cancel ( Space home,
Advisor a 
)

Cancel subscription of advisor a.

Definition at line 1137 of file array.hpp.

template<class View>
void Gecode::ViewArray< View >::update ( Space home,
bool  share,
ViewArray< View > &  a 
)

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 1102 of file array.hpp.

template<class View >
void Gecode::ViewArray< View >::move_fst ( int  i  )  [inline]

Move view from position 0 to position i (shift elements to the left).

Definition at line 1004 of file array.hpp.

template<class View >
void Gecode::ViewArray< View >::move_lst ( int  i  )  [inline]

Move view from position size()-1 to position i (truncate array by one).

Definition at line 1010 of file array.hpp.

template<class View >
void Gecode::ViewArray< View >::move_fst ( int  i,
Space home,
Propagator p,
PropCond  pc 
) [inline]

Move view from position 0 to position i (shift elements to the left).

Before moving, cancel subscription of propagator p with propagation condition pc to view at position i.

Definition at line 1030 of file array.hpp.

template<class View >
void Gecode::ViewArray< View >::move_lst ( int  i,
Space home,
Propagator p,
PropCond  pc 
) [inline]

Move view from position size()-1 to position i (truncate array by one).

Before moving, cancel subscription of propagator p with propagation condition pc to view at position i.

Definition at line 1038 of file array.hpp.

template<class View >
void Gecode::ViewArray< View >::move_fst ( int  i,
Space home,
Advisor a 
) [inline]

Move view from position 0 to position i (shift elements to the left).

Before moving, cancel subscription of advisor a to view at position i.

Definition at line 1066 of file array.hpp.

template<class View >
void Gecode::ViewArray< View >::move_lst ( int  i,
Space home,
Advisor a 
) [inline]

Move view from position size()-1 to position i (truncate array by one).

Before moving, cancel subscription of advisor a to view at position i.

Definition at line 1074 of file array.hpp.

template<class View >
void Gecode::ViewArray< View >::drop_fst ( int  i  )  [inline]

Drop views from positions 0 to i-1 from array.

Definition at line 1016 of file array.hpp.

template<class View >
void Gecode::ViewArray< View >::drop_lst ( int  i  )  [inline]

Drop views from positions i+1 to size()-1 from array.

Definition at line 1023 of file array.hpp.

template<class View >
void Gecode::ViewArray< View >::drop_fst ( int  i,
Space home,
Propagator p,
PropCond  pc 
)

Drop views from positions 0 to i-1 from array.

Before moving, cancel subscription of propagator p with propagation condition pc to views at positions 0 to i-1.

Definition at line 1046 of file array.hpp.

template<class View >
void Gecode::ViewArray< View >::drop_lst ( int  i,
Space home,
Propagator p,
PropCond  pc 
)

Drop assigned views from positions i+1 to size()-1 from array.

Before moving, cancel subscription of propagator p with propagation condition pc to views at positions i+1 to size()-1.

Definition at line 1056 of file array.hpp.

template<class View >
void Gecode::ViewArray< View >::drop_fst ( int  i,
Space home,
Advisor a 
)

Drop views from positions 0 to i-1 from array.

Before moving, cancel subscription of advisor a to views at positions 0 to i-1.

Definition at line 1082 of file array.hpp.

template<class View >
void Gecode::ViewArray< View >::drop_lst ( int  i,
Space home,
Advisor a 
)

Drop assigned views from positions i+1 to size()-1 from array.

Before moving, cancel subscription of advisor a to views at positions i+1 to size()-1.

Definition at line 1092 of file array.hpp.

template<class View >
bool Gecode::ViewArray< View >::assigned ( void   )  const [inline]

Test if all variables are assigned.

Definition at line 1144 of file array.hpp.

template<class View >
bool Gecode::ViewArray< View >::same ( const Space home  )  const

Test whether array has multiple occurence of the same view.

Note that assigned views are ignored.

Definition at line 1183 of file array.hpp.

template<class View>
bool Gecode::ViewArray< View >::same ( const Space home,
const View &  y 
) const

Test whether array contains a view being the same as y.

Note that assigned views are ignored.

Definition at line 1202 of file array.hpp.

template<class View >
void Gecode::ViewArray< View >::unique ( const Space home  ) 

Remove all duplicate views from array (changes element order).

Definition at line 1213 of file array.hpp.

template<class View >
bool Gecode::ViewArray< View >::shared ( const Space home  )  const

Test whether array contains shared views.

Note that assigned views are ignored.

Definition at line 1226 of file array.hpp.

template<class View >
template<class ViewY >
bool Gecode::ViewArray< View >::shared ( const Space home,
const ViewY &  y 
) const

Test whether array contains a view being shared with y.

Note that assigned views are ignored.

Definition at line 1245 of file array.hpp.

template<class View >
template<class ViewY >
bool Gecode::ViewArray< View >::shared ( const Space home,
const ViewArray< ViewY > &  y 
) const

Test whether array together with array y contains shared views.

Note that assigned views are ignored.

Definition at line 1256 of file array.hpp.


Friends And Related Function Documentation

template<class Char , class Traits , class View >
std::basic_ostream< Char, Traits > & operator<< ( std::basic_ostream< Char, Traits > &  os,
const ViewArray< View > &  x 
) [related]

Print array elements enclosed in curly brackets.

Definition at line 1786 of file array.hpp.


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