Generated on Tue Sep 25 2012 20:53:25 for Gecode by doxygen 1.7.5
Gecode::ViewArray Class Reference

View arrays. More...

#include <array.hpp>

List of all members.

Classes

class  ViewLess
 Sort order for views. More...

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.

Associated types

typedef View value_type
 Type of the view stored in this array.
typedef View & reference
 Type of a reference to the value type.
typedef const View & const_reference
 Type of a constant reference to the value type.
typedef View * pointer
 Type of a pointer to the value type.
typedef const View * const_pointer
 Type of a read-only pointer to the value type.
typedef View * iterator
 Type of the iterator used to iterate through this array's elements.
typedef const View * const_iterator
 Type of the iterator used to iterate read-only through this array's elements.
typedef std::reverse_iterator
< View * > 
reverse_iterator
 Type of the iterator used to iterate backwards through this array's elements.
typedef std::reverse_iterator
< const View * > 
const_reverse_iterator
 Type of the iterator used to iterate backwards and read-only through this array's elements.

Constructors and initialization

 ViewArray (void)
 Default constructor (array of size 0)
 ViewArray (Space &home, int m)
 Allocate array with m views.
 ViewArray (Region &r, 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)
 ViewArray (Region &r, 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)
template<class Var >
 ViewArray (Region &r, 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.

Array iteration

iterator begin (void)
 Return an iterator at the beginning of the array.
const_iterator begin (void) const
 Return a read-only iterator at the beginning of the array.
iterator end (void)
 Return an iterator past the end of the array.
const_iterator end (void) const
 Return a read-only iterator past the end of the array.
reverse_iterator rbegin (void)
 Return a reverse iterator at the end of the array.
const_reverse_iterator rbegin (void) const
 Return a reverse and read-only iterator at the end of the array.
reverse_iterator rend (void)
 Return a reverse iterator past the beginning of the array.
const_reverse_iterator rend (void) const
 Return a reverse and read-only iterator past the beginning of the array.

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

View arrays.

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


Member Typedef Documentation

Type of the view stored in this array.

Definition at line 251 of file array.hpp.

Type of a reference to the value type.

Definition at line 253 of file array.hpp.

Type of a constant reference to the value type.

Definition at line 255 of file array.hpp.

Type of a pointer to the value type.

Definition at line 257 of file array.hpp.

typedef const View* Gecode::ViewArray::const_pointer

Type of a read-only pointer to the value type.

Definition at line 259 of file array.hpp.

Type of the iterator used to iterate through this array's elements.

Definition at line 261 of file array.hpp.

typedef const View* Gecode::ViewArray::const_iterator

Type of the iterator used to iterate read-only through this array's elements.

Definition at line 263 of file array.hpp.

typedef std::reverse_iterator<View*> Gecode::ViewArray::reverse_iterator

Type of the iterator used to iterate backwards through this array's elements.

Definition at line 265 of file array.hpp.

typedef std::reverse_iterator<const View*> Gecode::ViewArray::const_reverse_iterator

Type of the iterator used to iterate backwards and read-only through this array's elements.

Definition at line 267 of file array.hpp.


Constructor & Destructor Documentation

Gecode::ViewArray::ViewArray ( void  ) [inline]

Default constructor (array of size 0)

Definition at line 1145 of file array.hpp.

Gecode::ViewArray::ViewArray ( Space home,
int  m 
) [inline]

Allocate array with m views.

Definition at line 1149 of file array.hpp.

Gecode::ViewArray::ViewArray ( Region r,
int  m 
) [inline]

Allocate array with m views.

Definition at line 1155 of file array.hpp.

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

Initialize from view array a (share elements)

Definition at line 1185 of file array.hpp.

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

Initialize from view array a (copy elements)

Definition at line 1161 of file array.hpp.

Gecode::ViewArray::ViewArray ( Region r,
const ViewArray< View > &  a 
)

Initialize from view array a (copy elements)

Definition at line 1172 of file array.hpp.

template<class Var >
Gecode::ViewArray::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 293 of file array.hpp.

template<class Var >
Gecode::ViewArray::ViewArray ( Region r,
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 311 of file array.hpp.


Member Function Documentation

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

Initialize from view array a (share elements)

Definition at line 1190 of file array.hpp.

int Gecode::ViewArray::size ( void  ) const [inline]

Return size of array (number of elements)

Definition at line 1197 of file array.hpp.

void Gecode::ViewArray::size ( int  n) [inline]

Decrease size of array (number of elements)

Definition at line 1203 of file array.hpp.

View & Gecode::ViewArray::operator[] ( int  i) [inline]

Return view at position i.

Definition at line 1209 of file array.hpp.

const View & Gecode::ViewArray::operator[] ( int  i) const [inline]

Return view at position i.

Definition at line 1216 of file array.hpp.

ViewArray< View >::iterator Gecode::ViewArray::begin ( void  ) [inline]

Return an iterator at the beginning of the array.

Definition at line 1223 of file array.hpp.

ViewArray< View >::const_iterator Gecode::ViewArray::begin ( void  ) const [inline]

Return a read-only iterator at the beginning of the array.

Definition at line 1229 of file array.hpp.

ViewArray< View >::iterator Gecode::ViewArray::end ( void  ) [inline]

Return an iterator past the end of the array.

Definition at line 1235 of file array.hpp.

ViewArray< View >::const_iterator Gecode::ViewArray::end ( void  ) const [inline]

Return a read-only iterator past the end of the array.

Definition at line 1241 of file array.hpp.

ViewArray< View >::reverse_iterator Gecode::ViewArray::rbegin ( void  ) [inline]

Return a reverse iterator at the end of the array.

Definition at line 1247 of file array.hpp.

ViewArray< View >::const_reverse_iterator Gecode::ViewArray::rbegin ( void  ) const [inline]

Return a reverse and read-only iterator at the end of the array.

Definition at line 1253 of file array.hpp.

ViewArray< View >::reverse_iterator Gecode::ViewArray::rend ( void  ) [inline]

Return a reverse iterator past the beginning of the array.

Definition at line 1259 of file array.hpp.

ViewArray< View >::const_reverse_iterator Gecode::ViewArray::rend ( void  ) const [inline]

Return a reverse and read-only iterator past the beginning of the array.

Definition at line 1265 of file array.hpp.

void Gecode::ViewArray::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 1382 of file array.hpp.

void Gecode::ViewArray::cancel ( Space home,
Propagator p,
PropCond  pc 
)

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

Definition at line 1390 of file array.hpp.

void Gecode::ViewArray::subscribe ( Space home,
Advisor a 
)

Subscribe advisor a to variable.

Definition at line 1397 of file array.hpp.

void Gecode::ViewArray::cancel ( Space home,
Advisor a 
)

Cancel subscription of advisor a.

Definition at line 1404 of file array.hpp.

void Gecode::ViewArray::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 1369 of file array.hpp.

void Gecode::ViewArray::move_fst ( int  i) [inline]

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

Definition at line 1271 of file array.hpp.

void Gecode::ViewArray::move_lst ( int  i) [inline]

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

Definition at line 1277 of file array.hpp.

void Gecode::ViewArray::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 1297 of file array.hpp.

void Gecode::ViewArray::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 1305 of file array.hpp.

void Gecode::ViewArray::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 1333 of file array.hpp.

void Gecode::ViewArray::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 1341 of file array.hpp.

void Gecode::ViewArray::drop_fst ( int  i) [inline]

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

Definition at line 1283 of file array.hpp.

void Gecode::ViewArray::drop_lst ( int  i) [inline]

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

Definition at line 1290 of file array.hpp.

void Gecode::ViewArray::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 1313 of file array.hpp.

void Gecode::ViewArray::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 1323 of file array.hpp.

void Gecode::ViewArray::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 1349 of file array.hpp.

void Gecode::ViewArray::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 1359 of file array.hpp.

bool Gecode::ViewArray::assigned ( void  ) const [inline]

Test if all variables are assigned.

Definition at line 1411 of file array.hpp.

bool Gecode::ViewArray::same ( const Space home) const

Test whether array has multiple occurence of the same view.

Note that assigned views are ignored.

Definition at line 1450 of file array.hpp.

bool Gecode::ViewArray::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 1469 of file array.hpp.

void Gecode::ViewArray::unique ( const Space home)

Remove all duplicate views from array (changes element order)

Definition at line 1480 of file array.hpp.

bool Gecode::ViewArray::shared ( const Space home) const

Test whether array contains shared views.

Note that assigned views are ignored.

Definition at line 1493 of file array.hpp.

template<class ViewY >
bool Gecode::ViewArray::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 1512 of file array.hpp.

template<class ViewY >
bool Gecode::ViewArray::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 1523 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 2101 of file array.hpp.


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