View arrays. More...
#include <array.hpp>
Public Member Functions | |
bool | assigned (void) const |
Test if all variables are assigned. More... | |
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. More... | |
Associated types | |
typedef View | value_type |
Type of the view stored in this array. More... | |
typedef View & | reference |
Type of a reference to the value type. More... | |
typedef const View & | const_reference |
Type of a constant reference to the value type. More... | |
typedef View * | pointer |
Type of a pointer to the value type. More... | |
typedef const View * | const_pointer |
Type of a read-only pointer to the value type. More... | |
typedef View * | iterator |
Type of the iterator used to iterate through this array's elements. More... | |
typedef const View * | const_iterator |
Type of the iterator used to iterate read-only through this array's elements. More... | |
typedef std::reverse_iterator< View * > | reverse_iterator |
Type of the iterator used to iterate backwards through this array's elements. More... | |
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. More... | |
Constructors and initialization | |
ViewArray (void) | |
Default constructor (array of size 0) More... | |
ViewArray (Space &home, int m) | |
Allocate array with m views. More... | |
ViewArray (Region &r, int m) | |
Allocate array with m views. More... | |
ViewArray (const ViewArray< View > &a) | |
Initialize from view array a (share elements) More... | |
ViewArray (Space &home, const ViewArray< View > &a) | |
Initialize from view array a (copy elements) More... | |
ViewArray (Region &r, const ViewArray< View > &a) | |
Initialize from view array a (copy elements) More... | |
const ViewArray< View > & | operator= (const ViewArray< View > &a) |
Initialize from view array a (share elements) More... | |
template<class Var > | |
ViewArray (Space &home, const VarArgArray< Var > &a) | |
Initialize from variable argument array a (copy elements) More... | |
template<class Var > | |
ViewArray (Region &r, const VarArgArray< Var > &a) | |
Initialize from variable argument array a (copy elements) More... | |
Array size | |
int | size (void) const |
Return size of array (number of elements) More... | |
void | size (int n) |
Decrease size of array (number of elements) More... | |
Array elements | |
View & | operator[] (int i) |
Return view at position i. More... | |
const View & | operator[] (int i) const |
Return view at position i. More... | |
Array iteration | |
iterator | begin (void) |
Return an iterator at the beginning of the array. More... | |
const_iterator | begin (void) const |
Return a read-only iterator at the beginning of the array. More... | |
iterator | end (void) |
Return an iterator past the end of the array. More... | |
const_iterator | end (void) const |
Return a read-only iterator past the end of the array. More... | |
reverse_iterator | rbegin (void) |
Return a reverse iterator at the end of the array. More... | |
const_reverse_iterator | rbegin (void) const |
Return a reverse and read-only iterator at the end of the array. More... | |
reverse_iterator | rend (void) |
Return a reverse iterator past the beginning of the array. More... | |
const_reverse_iterator | rend (void) const |
Return a reverse and read-only iterator past the beginning of the array. More... | |
Dependencies | |
void | subscribe (Space &home, Propagator &p, PropCond pc, bool process=true) |
Subscribe propagator p with propagation condition pc to variable. More... | |
void | cancel (Space &home, Propagator &p, PropCond pc) |
Cancel subscription of propagator p with propagation condition pc to all views. More... | |
void | subscribe (Space &home, Advisor &a) |
Subscribe advisor a to variable. More... | |
void | cancel (Space &home, Advisor &a) |
Cancel subscription of advisor a. More... | |
Cloning | |
void | update (Space &, bool share, ViewArray< View > &a) |
Update array to be a clone of array a. More... | |
Moving elements | |
void | move_fst (int i) |
Move view from position 0 to position i (shift elements to the left) More... | |
void | move_lst (int i) |
Move view from position size()-1 to position i (truncate array by one) More... | |
void | move_fst (int i, Space &home, Propagator &p, PropCond pc) |
Move view from position 0 to position i (shift elements to the left) More... | |
void | move_lst (int i, Space &home, Propagator &p, PropCond pc) |
Move view from position size()-1 to position i (truncate array by one) More... | |
void | move_fst (int i, Space &home, Advisor &a) |
Move view from position 0 to position i (shift elements to the left) More... | |
void | move_lst (int i, Space &home, Advisor &a) |
Move view from position size()-1 to position i (truncate array by one) More... | |
Dropping elements | |
void | drop_fst (int i) |
Drop views from positions 0 to i-1 from array. More... | |
void | drop_lst (int i) |
Drop views from positions i+1 to size()-1 from array. More... | |
void | drop_fst (int i, Space &home, Propagator &p, PropCond pc) |
Drop views from positions 0 to i-1 from array. More... | |
void | drop_lst (int i, Space &home, Propagator &p, PropCond pc) |
Drop assigned views from positions i+1 to size()-1 from array. More... | |
void | drop_fst (int i, Space &home, Advisor &a) |
Drop views from positions 0 to i-1 from array. More... | |
void | drop_lst (int i, Space &home, Advisor &a) |
Drop assigned views from positions i+1 to size()-1 from array. More... | |
View equality | |
bool | same (const Space &home) const |
Test whether array has multiple occurence of the same view. More... | |
bool | same (const Space &home, const View &y) const |
Test whether array contains a view being the same as y. More... | |
void | unique (const Space &home) |
Remove all duplicate views from array (changes element order) More... | |
View sharing | |
bool | shared (const Space &home) const |
Test whether array contains shared views. More... | |
template<class ViewY > | |
bool | shared (const Space &home, const ViewY &y) const |
Test whether array contains a view being shared with y. More... | |
template<class ViewY > | |
bool | shared (const Space &home, const ViewArray< ViewY > &y) const |
Test whether array together with array y contains shared views. More... | |
View arrays.
View arrays store views. They are typically used for storing the views with which propagators and branchers compute.
typedef View Gecode::ViewArray< View >::value_type |
typedef View& Gecode::ViewArray< View >::reference |
typedef const View& Gecode::ViewArray< View >::const_reference |
typedef View* Gecode::ViewArray< View >::pointer |
typedef const View* Gecode::ViewArray< View >::const_pointer |
typedef View* Gecode::ViewArray< View >::iterator |
typedef const View* Gecode::ViewArray< View >::const_iterator |
typedef std::reverse_iterator<View*> Gecode::ViewArray< View >::reverse_iterator |
typedef std::reverse_iterator<const View*> Gecode::ViewArray< View >::const_reverse_iterator |
|
inline |
|
inline |
|
inline |
|
inline |
Gecode::ViewArray< View >::ViewArray | ( | Space & | home, |
const ViewArray< View > & | a | ||
) |
Gecode::ViewArray< View >::ViewArray | ( | Region & | r, |
const ViewArray< View > & | a | ||
) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void Gecode::ViewArray< View >::subscribe | ( | Space & | home, |
Propagator & | p, | ||
PropCond | pc, | ||
bool | process = true |
||
) |
void Gecode::ViewArray< View >::cancel | ( | Space & | home, |
Propagator & | p, | ||
PropCond | pc | ||
) |
void Gecode::ViewArray< View >::subscribe | ( | Space & | home, |
Advisor & | a | ||
) |
void Gecode::ViewArray< View >::cancel | ( | Space & | home, |
Advisor & | a | ||
) |
void Gecode::ViewArray< View >::update | ( | Space & | home, |
bool | share, | ||
ViewArray< View > & | a | ||
) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void Gecode::ViewArray< View >::drop_fst | ( | int | i, |
Space & | home, | ||
Propagator & | p, | ||
PropCond | pc | ||
) |
void Gecode::ViewArray< View >::drop_lst | ( | int | i, |
Space & | home, | ||
Propagator & | p, | ||
PropCond | pc | ||
) |
void Gecode::ViewArray< View >::drop_fst | ( | int | i, |
Space & | home, | ||
Advisor & | a | ||
) |
void Gecode::ViewArray< View >::drop_lst | ( | int | i, |
Space & | home, | ||
Advisor & | a | ||
) |
|
inline |
bool Gecode::ViewArray< View >::same | ( | const Space & | home | ) | const |
bool Gecode::ViewArray< View >::same | ( | const Space & | home, |
const View & | y | ||
) | const |
void Gecode::ViewArray< View >::unique | ( | const Space & | home | ) |
bool Gecode::ViewArray< View >::shared | ( | const Space & | home | ) | const |
bool Gecode::ViewArray< View >::shared | ( | const Space & | home, |
const ViewY & | y | ||
) | const |
bool Gecode::ViewArray< View >::shared | ( | const Space & | home, |
const ViewArray< ViewY > & | y | ||
) | const |
|
related |