Generated on Thu Jan 16 2025 00:00:00 for Gecode by doxygen 1.14.0
Gecode::ViewArray< View > Class Template Reference

View arrays. More...

#include <array.hpp>

(Note that these are not member symbols.)

template<class ViewX, class ViewY>
bool shared (ViewArray< ViewX > x, ViewArray< ViewY > y)
 Test whether array x together with array y contains shared views.
template<class ViewX, class ViewY>
bool shared (ViewArray< ViewX > x, ViewY y)
 Test whether array x contains a view shared with y.
template<class ViewX, class ViewY>
bool shared (ViewX x, ViewArray< ViewY > y)
 Test whether array y contains a view shared with x.
template<class View>
bool shared (ViewArray< View > x)
 Test whether array x contains shared views.
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 Viewreference
 Type of a reference to the value type.
typedef const Viewconst_reference
 Type of a constant reference to the value type.
typedef Viewpointer
 Type of a pointer to the value type.
typedef const Viewconst_pointer
 Type of a read-only pointer to the value type.
typedef Viewiterator
 Type of the iterator used to iterate through this array's elements.
typedef const Viewconst_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

Viewoperator[] (int i)
 Return view at position i.
const Viewoperator[] (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 schedule=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.
void reschedule (Space &home, Propagator &p, PropCond pc)
 Re-schedule propagator p with propagation condition pc.

Cloning

void update (Space &home, 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.
bool assigned (void) const
 Test if all variables are assigned.

View equality

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

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

Member Typedef Documentation

◆ value_type

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

Type of the view stored in this array.

Definition at line 263 of file array.hpp.

◆ reference

template<class View>
typedef View& Gecode::ViewArray< View >::reference

Type of a reference to the value type.

Definition at line 265 of file array.hpp.

◆ const_reference

template<class View>
typedef const View& Gecode::ViewArray< View >::const_reference

Type of a constant reference to the value type.

Definition at line 267 of file array.hpp.

◆ pointer

template<class View>
typedef View* Gecode::ViewArray< View >::pointer

Type of a pointer to the value type.

Definition at line 269 of file array.hpp.

◆ const_pointer

template<class View>
typedef const View* Gecode::ViewArray< View >::const_pointer

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

Definition at line 271 of file array.hpp.

◆ iterator

template<class View>
typedef View* Gecode::ViewArray< View >::iterator

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

Definition at line 273 of file array.hpp.

◆ const_iterator

template<class View>
typedef const View* Gecode::ViewArray< View >::const_iterator

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

Definition at line 275 of file array.hpp.

◆ reverse_iterator

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

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

Definition at line 277 of file array.hpp.

◆ const_reverse_iterator

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

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

Definition at line 279 of file array.hpp.

Constructor & Destructor Documentation

◆ ViewArray() [1/8]

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

Default constructor (array of size 0)

Definition at line 1110 of file array.hpp.

◆ ViewArray() [2/8]

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

Allocate array with m views.

Definition at line 1114 of file array.hpp.

◆ ViewArray() [3/8]

template<class View>
Gecode::ViewArray< View >::ViewArray ( Region & r,
int m )
inline

Allocate array with m views.

Definition at line 1120 of file array.hpp.

◆ ViewArray() [4/8]

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

Initialize from view array a (share elements)

Definition at line 1150 of file array.hpp.

◆ ViewArray() [5/8]

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

Initialize from view array a (copy elements)

Definition at line 1126 of file array.hpp.

◆ ViewArray() [6/8]

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

Initialize from view array a (copy elements)

Definition at line 1137 of file array.hpp.

◆ ViewArray() [7/8]

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

◆ ViewArray() [8/8]

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

Member Function Documentation

◆ operator=()

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

◆ size() [1/2]

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

Return size of array (number of elements)

Definition at line 1162 of file array.hpp.

◆ size() [2/2]

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

Decrease size of array (number of elements)

Definition at line 1168 of file array.hpp.

◆ operator[]() [1/2]

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

Return view at position i.

Definition at line 1174 of file array.hpp.

◆ operator[]() [2/2]

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

Return view at position i.

Definition at line 1181 of file array.hpp.

◆ begin() [1/2]

template<class View>
ViewArray< View >::iterator Gecode::ViewArray< View >::begin ( void )
inline

Return an iterator at the beginning of the array.

Definition at line 1188 of file array.hpp.

◆ begin() [2/2]

template<class View>
ViewArray< View >::const_iterator Gecode::ViewArray< View >::begin ( void ) const
inline

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

Definition at line 1194 of file array.hpp.

◆ end() [1/2]

template<class View>
ViewArray< View >::iterator Gecode::ViewArray< View >::end ( void )
inline

Return an iterator past the end of the array.

Definition at line 1200 of file array.hpp.

◆ end() [2/2]

template<class View>
ViewArray< View >::const_iterator Gecode::ViewArray< View >::end ( void ) const
inline

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

Definition at line 1206 of file array.hpp.

◆ rbegin() [1/2]

template<class View>
ViewArray< View >::reverse_iterator Gecode::ViewArray< View >::rbegin ( void )
inline

Return a reverse iterator at the end of the array.

Definition at line 1212 of file array.hpp.

◆ rbegin() [2/2]

template<class View>
ViewArray< View >::const_reverse_iterator Gecode::ViewArray< View >::rbegin ( void ) const
inline

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

Definition at line 1218 of file array.hpp.

◆ rend() [1/2]

template<class View>
ViewArray< View >::reverse_iterator Gecode::ViewArray< View >::rend ( void )
inline

Return a reverse iterator past the beginning of the array.

Definition at line 1224 of file array.hpp.

◆ rend() [2/2]

template<class View>
ViewArray< View >::const_reverse_iterator Gecode::ViewArray< View >::rend ( void ) const
inline

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

Definition at line 1230 of file array.hpp.

◆ subscribe() [1/2]

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

Subscribe propagator p with propagation condition pc to variable.

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

Definition at line 1347 of file array.hpp.

◆ cancel() [1/2]

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

◆ subscribe() [2/2]

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

Subscribe advisor a to variable.

Definition at line 1362 of file array.hpp.

◆ cancel() [2/2]

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

Cancel subscription of advisor a.

Definition at line 1369 of file array.hpp.

◆ reschedule()

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

Re-schedule propagator p with propagation condition pc.

Definition at line 1376 of file array.hpp.

◆ update()

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

Update array to be a clone of array a.

Definition at line 1334 of file array.hpp.

◆ move_fst() [1/3]

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

◆ move_lst() [1/3]

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

◆ move_fst() [2/3]

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

◆ move_lst() [2/3]

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

◆ move_fst() [3/3]

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

◆ move_lst() [3/3]

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

◆ drop_fst() [1/3]

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

◆ drop_lst() [1/3]

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

◆ drop_fst() [2/3]

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

◆ drop_lst() [2/3]

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

◆ drop_fst() [3/3]

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

◆ drop_lst() [3/3]

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

◆ assigned()

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

Test if all variables are assigned.

Definition at line 1383 of file array.hpp.

◆ same() [1/2]

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

Test whether array has multiple occurence of the same view.

Note that assigned views are ignored.

Definition at line 1392 of file array.hpp.

◆ same() [2/2]

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

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

Note that assigned views are ignored.

Definition at line 1412 of file array.hpp.

◆ unique()

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

Remove all duplicate views from array (changes element order)

Definition at line 1423 of file array.hpp.

◆ shared() [1/4]

template<class ViewX, class ViewY>
bool shared ( ViewArray< ViewX > x,
ViewArray< ViewY > y )
related

Test whether array x together with array y contains shared views.

Note that assigned views are ignored.

Definition at line 1472 of file array.hpp.

◆ shared() [2/4]

template<class ViewX, class ViewY>
bool shared ( ViewArray< ViewX > x,
ViewY y )
related

Test whether array x contains a view shared with y.

Note that assigned views are ignored.

Definition at line 1495 of file array.hpp.

◆ shared() [3/4]

template<class ViewX, class ViewY>
bool shared ( ViewX x,
ViewArray< ViewY > y )
related

Test whether array y contains a view shared with x.

Note that assigned views are ignored.

Definition at line 1506 of file array.hpp.

◆ shared() [4/4]

template<class View>
bool shared ( ViewArray< View > x)
related

Test whether array x contains shared views.

Note that assigned views are ignored.

Definition at line 1512 of file array.hpp.

◆ operator<<()

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


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