/usr/include/gecode/kernel/var-imp.hpp is in libgecode-dev 3.7.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | /*
* CAUTION:
* This file has been automatically generated. Do not edit,
* edit the following files instead:
* - ./gecode/int/var-imp/int.vis
* - ./gecode/int/var-imp/bool.vis
* - ./gecode/set/var-imp/set.vis
*
* This file contains generated code fragments which are
* copyrighted as follows:
*
* Main author:
* Christian Schulte <schulte@gecode.org>
*
* Copyright:
* Christian Schulte, 2007
*
* The generated code fragments are part of Gecode, the generic
* constraint development environment:
* http://www.gecode.org
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#ifdef GECODE_HAS_INT_VARS
namespace Gecode { namespace Int {
/// Base-class for Int-variable implementations
class IntVarImpBase : public Gecode::VarImp<Gecode::Int::IntVarImpConf> {
protected:
/// Constructor for cloning \a x
IntVarImpBase(Gecode::Space& home, bool share, IntVarImpBase& x);
public:
/// Constructor for creating static instance of variable
IntVarImpBase(void);
/// Constructor for creating variable
IntVarImpBase(Gecode::Space& home);
/// \name Dependencies
//@{
/** \brief Subscribe propagator \a p with propagation condition \a pc
*
* In case \a schedule is false, the propagator is just subscribed but
* not scheduled for execution (this must be used when creating
* subscriptions during propagation).
*
* In case the variable is assigned (that is, \a assigned is
* true), the subscribing propagator is scheduled for execution.
* Otherwise, the propagator subscribes and is scheduled for execution
* with modification event \a me provided that \a pc is different
* from \a PC_INT_VAL.
*/
void subscribe(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned, bool schedule);
/// Subscribe advisor \a a if \a assigned is false.
void subscribe(Gecode::Space& home, Gecode::Advisor& a, bool assigned);
/// Notify that variable implementation has been modified with modification event \a me and delta information \a d
Gecode::ModEvent notify(Gecode::Space& home, Gecode::ModEvent me, Gecode::Delta& d);
//@}
};
}}
#endif
#ifdef GECODE_HAS_INT_VARS
namespace Gecode { namespace Int {
/// Base-class for Bool-variable implementations
class BoolVarImpBase : public Gecode::VarImp<Gecode::Int::BoolVarImpConf> {
protected:
/// Constructor for cloning \a x
BoolVarImpBase(Gecode::Space& home, bool share, BoolVarImpBase& x);
public:
/// Constructor for creating static instance of variable
BoolVarImpBase(void);
/// Constructor for creating variable
BoolVarImpBase(Gecode::Space& home);
/// \name Dependencies
//@{
/** \brief Subscribe propagator \a p with propagation condition \a pc
*
* In case \a schedule is false, the propagator is just subscribed but
* not scheduled for execution (this must be used when creating
* subscriptions during propagation).
*
* In case the variable is assigned (that is, \a assigned is
* true), the subscribing propagator is scheduled for execution.
* Otherwise, the propagator subscribes and is scheduled for execution
* with modification event \a me provided that \a pc is different
* from \a PC_BOOL_VAL.
*/
void subscribe(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned, bool schedule);
/// Subscribe advisor \a a if \a assigned is false.
void subscribe(Gecode::Space& home, Gecode::Advisor& a, bool assigned);
/// Notify that variable implementation has been modified with modification event \a me and delta information \a d
Gecode::ModEvent notify(Gecode::Space& home, Gecode::ModEvent me, Gecode::Delta& d);
//@}
};
}}
#endif
#ifdef GECODE_HAS_SET_VARS
namespace Gecode { namespace Set {
/// Base-class for Set-variable implementations
class SetVarImpBase : public Gecode::VarImp<Gecode::Set::SetVarImpConf> {
protected:
/// Constructor for cloning \a x
SetVarImpBase(Gecode::Space& home, bool share, SetVarImpBase& x);
public:
/// Constructor for creating static instance of variable
SetVarImpBase(void);
/// Constructor for creating variable
SetVarImpBase(Gecode::Space& home);
/// \name Dependencies
//@{
/** \brief Subscribe propagator \a p with propagation condition \a pc
*
* In case \a schedule is false, the propagator is just subscribed but
* not scheduled for execution (this must be used when creating
* subscriptions during propagation).
*
* In case the variable is assigned (that is, \a assigned is
* true), the subscribing propagator is scheduled for execution.
* Otherwise, the propagator subscribes and is scheduled for execution
* with modification event \a me provided that \a pc is different
* from \a PC_SET_VAL.
*/
void subscribe(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned, bool schedule);
/// Subscribe advisor \a a if \a assigned is false.
void subscribe(Gecode::Space& home, Gecode::Advisor& a, bool assigned);
/// Notify that variable implementation has been modified with modification event \a me and delta information \a d
Gecode::ModEvent notify(Gecode::Space& home, Gecode::ModEvent me, Gecode::Delta& d);
//@}
};
}}
#endif
#ifdef GECODE_HAS_INT_VARS
namespace Gecode { namespace Int {
forceinline
IntVarImpBase::IntVarImpBase(void) {}
forceinline
IntVarImpBase::IntVarImpBase(Gecode::Space& home)
: Gecode::VarImp<Gecode::Int::IntVarImpConf>(home) {}
forceinline
IntVarImpBase::IntVarImpBase(Gecode::Space& home, bool share, IntVarImpBase& x)
: Gecode::VarImp<Gecode::Int::IntVarImpConf>(home,share,x) {}
forceinline void
IntVarImpBase::subscribe(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned, bool schedule) {
Gecode::VarImp<Gecode::Int::IntVarImpConf>::subscribe(home,p,pc,assigned,ME_INT_BND,schedule);
}
forceinline void
IntVarImpBase::subscribe(Gecode::Space& home, Gecode::Advisor& a, bool assigned) {
Gecode::VarImp<Gecode::Int::IntVarImpConf>::subscribe(home,a,assigned);
}
forceinline Gecode::ModEvent
IntVarImpBase::notify(Gecode::Space& home, Gecode::ModEvent me, Gecode::Delta& d) {
switch (me) {
case ME_INT_VAL:
// Conditions: VAL, BND, DOM
schedule(home,PC_INT_VAL,PC_INT_DOM,ME_INT_VAL);
if (!Gecode::VarImp<Gecode::Int::IntVarImpConf>::advise(home,ME_INT_VAL,d))
return ME_INT_FAILED;
cancel(home);
break;
case ME_INT_BND:
// Conditions: BND, DOM
schedule(home,PC_INT_BND,PC_INT_DOM,ME_INT_BND);
if (!Gecode::VarImp<Gecode::Int::IntVarImpConf>::advise(home,ME_INT_BND,d))
return ME_INT_FAILED;
break;
case ME_INT_DOM:
// Conditions: DOM
schedule(home,PC_INT_DOM,PC_INT_DOM,ME_INT_DOM);
if (!Gecode::VarImp<Gecode::Int::IntVarImpConf>::advise(home,ME_INT_DOM,d))
return ME_INT_FAILED;
break;
default: GECODE_NEVER;
}
return me;
}
}}
#endif
#ifdef GECODE_HAS_INT_VARS
namespace Gecode { namespace Int {
forceinline
BoolVarImpBase::BoolVarImpBase(void) {}
forceinline
BoolVarImpBase::BoolVarImpBase(Gecode::Space& home)
: Gecode::VarImp<Gecode::Int::BoolVarImpConf>(home) {}
forceinline
BoolVarImpBase::BoolVarImpBase(Gecode::Space& home, bool share, BoolVarImpBase& x)
: Gecode::VarImp<Gecode::Int::BoolVarImpConf>(home,share,x) {}
forceinline void
BoolVarImpBase::subscribe(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned, bool schedule) {
Gecode::VarImp<Gecode::Int::BoolVarImpConf>::subscribe(home,p,pc,assigned,ME_BOOL_VAL,schedule);
}
forceinline void
BoolVarImpBase::subscribe(Gecode::Space& home, Gecode::Advisor& a, bool assigned) {
Gecode::VarImp<Gecode::Int::BoolVarImpConf>::subscribe(home,a,assigned);
}
forceinline Gecode::ModEvent
BoolVarImpBase::notify(Gecode::Space& home, Gecode::ModEvent, Gecode::Delta& d) {
schedule(home,PC_BOOL_VAL,PC_BOOL_VAL,ME_BOOL_VAL);
if (!Gecode::VarImp<Gecode::Int::BoolVarImpConf>::advise(home,ME_BOOL_VAL,d))
return ME_BOOL_FAILED;
cancel(home);
return ME_BOOL_VAL;
}
}}
#endif
#ifdef GECODE_HAS_SET_VARS
namespace Gecode { namespace Set {
forceinline
SetVarImpBase::SetVarImpBase(void) {}
forceinline
SetVarImpBase::SetVarImpBase(Gecode::Space& home)
: Gecode::VarImp<Gecode::Set::SetVarImpConf>(home) {}
forceinline
SetVarImpBase::SetVarImpBase(Gecode::Space& home, bool share, SetVarImpBase& x)
: Gecode::VarImp<Gecode::Set::SetVarImpConf>(home,share,x) {}
forceinline void
SetVarImpBase::subscribe(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned, bool schedule) {
Gecode::VarImp<Gecode::Set::SetVarImpConf>::subscribe(home,p,pc,assigned,ME_SET_CBB,schedule);
}
forceinline void
SetVarImpBase::subscribe(Gecode::Space& home, Gecode::Advisor& a, bool assigned) {
Gecode::VarImp<Gecode::Set::SetVarImpConf>::subscribe(home,a,assigned);
}
forceinline Gecode::ModEvent
SetVarImpBase::notify(Gecode::Space& home, Gecode::ModEvent me, Gecode::Delta& d) {
switch (me) {
case ME_SET_VAL:
// Conditions: VAL, CARD, CLUB, CGLB, ANY
schedule(home,PC_SET_VAL,PC_SET_ANY,ME_SET_VAL);
if (!Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise(home,ME_SET_VAL,d))
return ME_SET_FAILED;
cancel(home);
break;
case ME_SET_CARD:
// Conditions: CARD, CLUB, CGLB, ANY
schedule(home,PC_SET_CARD,PC_SET_ANY,ME_SET_CARD);
if (!Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise(home,ME_SET_CARD,d))
return ME_SET_FAILED;
break;
case ME_SET_LUB:
// Conditions: CLUB, ANY
schedule(home,PC_SET_CLUB,PC_SET_CLUB,ME_SET_LUB);
schedule(home,PC_SET_ANY,PC_SET_ANY,ME_SET_LUB);
if (!Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise(home,ME_SET_LUB,d))
return ME_SET_FAILED;
break;
case ME_SET_GLB:
// Conditions: CGLB, ANY
schedule(home,PC_SET_CGLB,PC_SET_ANY,ME_SET_GLB);
if (!Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise(home,ME_SET_GLB,d))
return ME_SET_FAILED;
break;
case ME_SET_BB:
// Conditions: CLUB, CGLB, ANY
schedule(home,PC_SET_CLUB,PC_SET_ANY,ME_SET_BB);
if (!Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise(home,ME_SET_BB,d))
return ME_SET_FAILED;
break;
case ME_SET_CLUB:
// Conditions: CARD, CLUB, CGLB, ANY
schedule(home,PC_SET_CARD,PC_SET_ANY,ME_SET_CLUB);
if (!Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise(home,ME_SET_CLUB,d))
return ME_SET_FAILED;
break;
case ME_SET_CGLB:
// Conditions: CARD, CLUB, CGLB, ANY
schedule(home,PC_SET_CARD,PC_SET_ANY,ME_SET_CGLB);
if (!Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise(home,ME_SET_CGLB,d))
return ME_SET_FAILED;
break;
case ME_SET_CBB:
// Conditions: CARD, CLUB, CGLB, ANY
schedule(home,PC_SET_CARD,PC_SET_ANY,ME_SET_CBB);
if (!Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise(home,ME_SET_CBB,d))
return ME_SET_FAILED;
break;
default: GECODE_NEVER;
}
return me;
}
}}
#endif
namespace Gecode {
forceinline void
Space::update(ActorLink** sub) {
#ifdef GECODE_HAS_INT_VARS
Gecode::VarImp<Gecode::Int::IntVarImpConf>::update(*this,sub);
#endif
#ifdef GECODE_HAS_INT_VARS
Gecode::VarImp<Gecode::Int::BoolVarImpConf>::update(*this,sub);
#endif
#ifdef GECODE_HAS_SET_VARS
Gecode::VarImp<Gecode::Set::SetVarImpConf>::update(*this,sub);
#endif
}
}
// STATISTICS: kernel-var
|