Generated on Sat May 25 2013 18:00:36 for Gecode by doxygen 1.8.3.1
channel.hh
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Denys Duchier <denys.duchier@univ-orleans.fr>
5  * Guido Tack <tack@gecode.org>
6  * Christian Schulte <schulte@gecode.org>
7  *
8  * Copyright:
9  * Denys Duchier, 2011
10  * Guido Tack, 2011
11  * Christian Schulte, 2004
12  *
13  * Last modified:
14  * $Date: 2011-11-03 11:52:07 +0100 (Thu, 03 Nov 2011) $ by $Author: tack $
15  * $Revision: 12452 $
16  *
17  * This file is part of Gecode, the generic constraint
18  * development environment:
19  * http://www.gecode.org
20  *
21  * Permission is hereby granted, free of charge, to any person obtaining
22  * a copy of this software and associated documentation files (the
23  * "Software"), to deal in the Software without restriction, including
24  * without limitation the rights to use, copy, modify, merge, publish,
25  * distribute, sublicense, and/or sell copies of the Software, and to
26  * permit persons to whom the Software is furnished to do so, subject to
27  * the following conditions:
28  *
29  * The above copyright notice and this permission notice shall be
30  * included in all copies or substantial portions of the Software.
31  *
32  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
33  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
35  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
36  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
37  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
38  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39  *
40  */
41 
42 #ifndef __GECODE_SET_CHANNEL_HH__
43 #define __GECODE_SET_CHANNEL_HH__
44 
45 #include <gecode/set.hh>
46 
47 namespace Gecode { namespace Set { namespace Channel {
48 
63  template<class View>
64  class ChannelSorted : public Propagator {
65  protected:
67  View x0;
70 
72  ChannelSorted(Space& home, bool share,ChannelSorted& p);
75  public:
77  virtual Actor* copy(Space& home,bool);
79  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
81  virtual size_t dispose(Space& home);
83  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
85  static ExecStatus post(Home home, View s,
87  };
88 
106  template<class View>
107  class ChannelInt : public Propagator {
108  protected:
113 
115  ChannelInt(Space& home, bool share,ChannelInt& p);
117  ChannelInt(Home home,
120  public:
122  virtual Actor* copy(Space& home,bool);
124  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
126  virtual size_t dispose(Space& home);
128  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
130  static ExecStatus post(Home home,
134  };
135 
147  template<class View>
149  : public MixNaryOnePropagator<Gecode::Int::BoolView,
150  Gecode::Int::PC_BOOL_VAL,
151  View,PC_GEN_NONE> {
152  protected:
156  using Super::x;
157  using Super::y;
158 
160  ChannelBool(Space& home, bool share,ChannelBool& p);
163  View);
164 
166  class IndexAdvisor : public Advisor {
167  protected:
169  int idx;
170  public:
172  template<class A>
174  int index);
176  IndexAdvisor(Space& home, bool share, IndexAdvisor& a);
178  int index(void) const;
180  template<class A>
181  void dispose(Space& home, Council<A>& c);
182  };
183 
193  bool running;
194  public:
196  virtual Actor* copy(Space& home,bool);
198  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
200  virtual size_t dispose(Space& home);
202  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
204  virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
207  View y);
208  };
209 
223  template<typename View>
224  class ChannelSet: public Propagator {
225  protected:
230 
232  ChannelSet(Space& home, bool share, ChannelSet& p);
234  ChannelSet(Home home,
237  public:
239  virtual Actor* copy(Space& home, bool);
241  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
243  virtual size_t dispose(Space& home);
245  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
247  static ExecStatus post(Home home,
250  };
251 
252 }}}
253 
258 
259 #endif
260 
261 // STATISTICS: set-prop