Generated on Sat Jan 12 2019 20:58:51 for Gecode by doxygen 1.8.13
subscribed.hpp
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  *
6  * Copyright:
7  * Christian Schulte, 2016
8  *
9  * This file is part of Gecode, the generic constraint
10  * development environment:
11  * http://www.gecode.org
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining
14  * a copy of this software and associated documentation files (the
15  * "Software"), to deal in the Software without restriction, including
16  * without limitation the rights to use, copy, modify, merge, publish,
17  * distribute, sublicense, and/or sell copies of the Software, and to
18  * permit persons to whom the Software is furnished to do so, subject to
19  * the following conditions:
20  *
21  * The above copyright notice and this permission notice shall be
22  * included in all copies or substantial portions of the Software.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31  */
32 
33 namespace Gecode {
34 
37  protected:
44  public:
46  template<class VIC>
49  template<class View>
52  template<class Var>
55  template<class View>
58  template<class VIC>
59  void init(VarImp<VIC>& x);
61  template<class View>
62  void init(ConstView<View>& x);
64  template<class Var>
65  void init(VarImpView<Var>& x);
67  template<class View>
68  void init(DerivedView<View>& x);
70  bool operator ()(void) const;
72  void operator ++(void);
74  Propagator& propagator(void) const;
75  };
76 
77  template<class VIC>
78  forceinline void
80  c = x.actor(0);
81  ep = x.actorNonZero(x.pc_max+1); ea = x.b.base+x.entries;
82  }
83  template<class VIC>
86  init(x);
87  }
88  template<class View>
89  forceinline void
91  c = ep = ea = NULL;
92  }
93  template<class View>
96  init(x);
97  }
98  template<class Var>
101  init(*x.varimp());
102  }
103  template<class Var>
104  forceinline void
106  init(*x.varimp());
107  }
108  template<class View>
111  init(*x.varimp());
112  }
113  template<class View>
114  forceinline void
116  init(*x.varimp());
117  }
118 
119  forceinline bool
121  return c<ea;
122  }
123  forceinline void
125  c++;
126  }
129  return (c < ep) ? *Propagator::cast(*c) : Advisor::cast(*c)->propagator();
130  }
131 
132 }
133 
134 // STATISTICS: kernel-prop
SubscribedPropagators(VarImp< VIC > &x)
Initialize.
Definition: subscribed.hpp:85
Iterator over subscribed propagators.
Definition: subscribed.hpp:36
ActorLink ** c
Pointing at the current subscription (either propagator or advisor)
Definition: subscribed.hpp:39
Base-class for variable implementations.
Definition: core.hpp:156
void init(VarImp< VIC > &x)
Initialize.
Definition: subscribed.hpp:79
bool operator()(void) const
Test whether there are propagators left.
Definition: subscribed.hpp:120
void varimp(VarImpType *y)
Set variable implementation to y.
Definition: view.hpp:484
Base-class for propagators.
Definition: core.hpp:1023
ActorLink ** base
Subscribed actors.
Definition: core.hpp:232
#define forceinline
Definition: config.hpp:185
Base-class for constant views.
Definition: view.hpp:45
ActorLink ** ep
End of propagator subscriptions.
Definition: subscribed.hpp:41
Base-class for derived views.
Definition: view.hpp:230
Propagator & propagator(void) const
Return propagator.
Definition: subscribed.hpp:128
void operator++(void)
Move iterator to next propagator.
Definition: subscribed.hpp:124
Base-class for variable implementation views.
Definition: view.hpp:133
ActorLink ** ea
End of advisor subscriptions.
Definition: subscribed.hpp:43
Post propagator for SetVar x
Definition: set.hh:767
VarImpType * varimp(void) const
Return variable implementation of view.
Definition: view.hpp:599
Gecode toplevel namespace