Generated on Fri Jan 28 2022 04:43:06 for Gecode by doxygen 1.8.13
idx-view.hh
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Christian Schulte <schulte@gecode.org>
5  * Guido Tack <tack@gecode.org>
6  *
7  * Copyright:
8  * Christian Schulte, 2004
9  * Guido Tack, 2004
10  *
11  * This file is part of Gecode, the generic constraint
12  * development environment:
13  * http://www.gecode.org
14  *
15  * Permission is hereby granted, free of charge, to any person obtaining
16  * a copy of this software and associated documentation files (the
17  * "Software"), to deal in the Software without restriction, including
18  * without limitation the rights to use, copy, modify, merge, publish,
19  * distribute, sublicense, and/or sell copies of the Software, and to
20  * permit persons to whom the Software is furnished to do so, subject to
21  * the following conditions:
22  *
23  * The above copyright notice and this permission notice shall be
24  * included in all copies or substantial portions of the Software.
25  *
26  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
30  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
31  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
32  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33  *
34  */
35 
36 #ifndef __GECODE_INT_IDX_VIEW_HH__
37 #define __GECODE_INT_IDX_VIEW_HH__
38 
39 #include <gecode/int.hh>
40 
41 namespace Gecode { namespace Int {
42 
47  template<class View>
48  class IdxView {
49  public:
51  int idx;
53  View view;
55  static IdxView* allocate(Space& home, int n);
56  };
57 
59  template<class View>
60  class ViewToVarArg {};
61 
66  template<class View>
67  class IdxViewArray {
68  private:
70  IdxView<View>* xs;
72  int n;
73  public:
75  IdxViewArray(void);
79  IdxViewArray(Space& home, const typename ViewToVarArg<View>::argtype& x);
81  IdxViewArray(Space& home, int n);
82 
84  int size(void) const;
86  void size(int n);
87 
89  IdxView<View>& operator [](int n);
91  const IdxView<View>& operator [](int) const;
92 
97  void subscribe(Space& home, Propagator& p, PropCond pc, bool process=true);
102  void cancel(Space& home, Propagator& p, PropCond pc);
104  void reschedule(Space& home, Propagator& p, PropCond pc);
105 
107  void update(Space& home, IdxViewArray<View>& x);
108  };
109 
114  template<class Char, class Traits, class View>
115  std::basic_ostream<Char,Traits>&
116  operator <<(std::basic_ostream<Char,Traits>& os,
117  const IdxViewArray<View>& x);
118 
119 }}
120 
121 #include <gecode/int/idx-view.hpp>
122 
123 #endif
124 
125 
126 // STATISTICS: int-prop
127 
void cancel(Space &home, Propagator &p, IntSet &y)
Definition: rel.hpp:81
Base-class for propagators.
Definition: core.hpp:1023
static IdxView * allocate(Space &home, int n)
Allocate memory for n index-view pairs.
Definition: idx-view.hpp:61
Computation spaces.
Definition: core.hpp:1701
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:232
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:234
View view
Thhe view.
Definition: idx-view.hh:53
int PropCond
Type for propagation conditions.
Definition: core.hpp:72
void subscribe(Space &home, Propagator &p, IntSet &y)
Definition: rel.hpp:71
unsigned int size(I &i)
Size of all ranges of range iterator i.
int idx
The index.
Definition: idx-view.hh:51
Post propagator for SetVar x
Definition: set.hh:767
An array of IdxView pairs.
Definition: idx-view.hh:67
Gecode toplevel namespace
void reschedule(Space &home, Propagator &p, IntSet &y)
Definition: rel.hpp:92
Class to map VarArg type to view.
Definition: idx-view.hh:60
Class for pair of index and view.
Definition: idx-view.hh:48
void update(IntSet &y, Space &home, IntSet &py)
Definition: rel.hpp:103