main page
modules
namespaces
classes
files
Gecode home
Generated on Tue Mar 24 2020 14:04:04 for Gecode by
doxygen
1.8.17
gecode
kernel
propagator
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
36
class
SubscribedPropagators
{
37
protected
:
39
ActorLink
**
c
;
41
ActorLink
**
ep
;
43
ActorLink
**
ea
;
44
public
:
46
template
<
class
VIC>
47
SubscribedPropagators
(
VarImp<VIC>
&
x
);
49
template
<
class
View>
50
SubscribedPropagators
(
ConstView<View>
&
x
);
52
template
<
class
Var>
53
SubscribedPropagators
(
VarImpView<Var>
&
x
);
55
template
<
class
View>
56
SubscribedPropagators
(
DerivedView<View>
&
x
);
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
79
SubscribedPropagators::init
(
VarImp<VIC>
&
x
) {
80
c
=
x
.actor(0);
81
ep
=
x
.actorNonZero(
x
.pc_max+1);
ea
=
x
.b.base+
x
.entries;
82
}
83
template
<
class
VIC>
84
forceinline
85
SubscribedPropagators::SubscribedPropagators
(
VarImp<VIC>
&
x
) {
86
init
(
x
);
87
}
88
template
<
class
View>
89
forceinline
void
90
SubscribedPropagators::init
(
ConstView<View>
&) {
91
c
=
ep
=
ea
= NULL;
92
}
93
template
<
class
View>
94
forceinline
95
SubscribedPropagators::SubscribedPropagators
(
ConstView<View>
&
x
) {
96
init
(
x
);
97
}
98
template
<
class
Var>
99
forceinline
100
SubscribedPropagators::SubscribedPropagators
(
VarImpView<Var>
&
x
) {
101
init
(*
x
.
varimp
());
102
}
103
template
<
class
Var>
104
forceinline
void
105
SubscribedPropagators::init
(
VarImpView<Var>
&
x
) {
106
init
(*
x
.
varimp
());
107
}
108
template
<
class
View>
109
forceinline
110
SubscribedPropagators::SubscribedPropagators
(
DerivedView<View>
&
x
) {
111
init
(*
x
.
varimp
());
112
}
113
template
<
class
View>
114
forceinline
void
115
SubscribedPropagators::init
(
DerivedView<View>
&
x
) {
116
init
(*
x
.
varimp
());
117
}
118
119
forceinline
bool
120
SubscribedPropagators::operator ()
(
void
)
const
{
121
return
c
<
ea
;
122
}
123
forceinline
void
124
SubscribedPropagators::operator ++
(
void
) {
125
c
++;
126
}
127
forceinline
Propagator
&
128
SubscribedPropagators::propagator
(
void
)
const
{
129
return
(
c
<
ep
) ? *Propagator::cast(*
c
) : Advisor::cast(*c)->propagator();
130
}
131
132
}
133
134
// STATISTICS: kernel-prop
Gecode::x
Post propagator for SetVar x
Definition:
set.hh:767
Gecode::SubscribedPropagators::ea
ActorLink ** ea
End of advisor subscriptions.
Definition:
subscribed.hpp:43
Gecode::SubscribedPropagators::operator()
bool operator()(void) const
Test whether there are propagators left.
Definition:
subscribed.hpp:120
Gecode::SubscribedPropagators::init
void init(VarImp< VIC > &x)
Initialize.
Definition:
subscribed.hpp:79
Gecode::ActorLink
Double-linked list for actors.
Definition:
core.hpp:589
Gecode::DerivedView
Base-class for derived views.
Definition:
view.hpp:230
Gecode::ConstView
Base-class for constant views.
Definition:
view.hpp:45
Gecode
Gecode toplevel namespace
Gecode::Propagator
Base-class for propagators.
Definition:
core.hpp:1064
Gecode::SubscribedPropagators::operator++
void operator++(void)
Move iterator to next propagator.
Definition:
subscribed.hpp:124
Gecode::VarImpVar::varimp
VarImp * varimp(void) const
Return variable implementation of variable.
Definition:
var.hpp:96
Gecode::SubscribedPropagators::propagator
Propagator & propagator(void) const
Return propagator.
Definition:
subscribed.hpp:128
Gecode::SubscribedPropagators
Iterator over subscribed propagators.
Definition:
subscribed.hpp:36
Gecode::SubscribedPropagators::c
ActorLink ** c
Pointing at the current subscription (either propagator or advisor)
Definition:
subscribed.hpp:39
forceinline
#define forceinline
Definition:
config.hpp:185
Gecode::SubscribedPropagators::ep
ActorLink ** ep
End of propagator subscriptions.
Definition:
subscribed.hpp:41
Gecode::VarImp
Base-class for variable implementations.
Definition:
core.hpp:157
Gecode::SubscribedPropagators::SubscribedPropagators
SubscribedPropagators(VarImp< VIC > &x)
Initialize.
Definition:
subscribed.hpp:85
Gecode::VarImpView
Base-class for variable implementation views.
Definition:
view.hpp:133