main page
modules
namespaces
classes
files
Gecode home
Generated on Thu Mar 13 2014 04:39:34 for Gecode by
doxygen
1.8.1.2
gecode
kernel
advisor.hpp
Go to the documentation of this file.
1
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
/*
3
* Main authors:
4
* Mikael Lagerkvist <lagerkvist@gecode.org>
5
* Christian Schulte <schulte@gecode.org>
6
*
7
* Copyright:
8
* Mikael Lagerkvist, 2006
9
* Christian Schulte, 2007
10
*
11
* Last modified:
12
* $Date: 2010-04-08 20:35:31 +1000 (Thu, 08 Apr 2010) $ by $Author: schulte $
13
* $Revision: 10684 $
14
*
15
* This file is part of Gecode, the generic constraint
16
* development environment:
17
* http://www.gecode.org
18
*
19
* Permission is hereby granted, free of charge, to any person obtaining
20
* a copy of this software and associated documentation files (the
21
* "Software"), to deal in the Software without restriction, including
22
* without limitation the rights to use, copy, modify, merge, publish,
23
* distribute, sublicense, and/or sell copies of the Software, and to
24
* permit persons to whom the Software is furnished to do so, subject to
25
* the following conditions:
26
*
27
* The above copyright notice and this permission notice shall be
28
* included in all copies or substantial portions of the Software.
29
*
30
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
33
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
34
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
35
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
36
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37
*
38
*/
39
40
namespace
Gecode {
41
46
template
<
class
View>
47
class
ViewAdvisor
:
public
Advisor
{
48
protected
:
50
View
x
;
51
public
:
53
template
<
class
A>
54
ViewAdvisor
(
Space
& home,
Propagator
& p,
Council<A>
&
c
, View x0);
56
ViewAdvisor
(
Space
& home,
bool
share,
ViewAdvisor<View>
&
a
);
58
View
view
(
void
)
const
;
60
void
view
(
Space
& home, View y);
62
template
<
class
A>
63
void
dispose
(
Space
& home,
Council<A>
&
c
);
64
};
65
66
67
template
<
class
View>
68
template
<
class
A>
69
forceinline
70
ViewAdvisor<View>::ViewAdvisor
(
Space
& home,
Propagator
& p,
71
Council<A>
&
c
, View x0)
72
:
Advisor
(home,p,c), x(x0) {
73
x
.subscribe(home,*
this
);
74
}
75
template
<
class
View>
76
forceinline
77
ViewAdvisor<View>::ViewAdvisor
(
Space
& home,
bool
share,
78
ViewAdvisor<View>
&
a
)
79
:
Advisor
(home,share,a) {
80
x
.update(home,share,a.
x
);
81
}
82
template
<
class
View>
83
forceinline
View
84
ViewAdvisor<View>::view
(
void
)
const
{
85
return
x;
86
}
87
template
<
class
View>
88
forceinline
void
89
ViewAdvisor<View>::view
(
Space
& home, View y) {
90
x.cancel(home,*
this
); x=y; x.subscribe(home,*
this
);
91
}
92
template
<
class
View>
93
template
<
class
A>
94
forceinline
void
95
ViewAdvisor<View>::dispose
(
Space
& home,
Council<A>
&
c
) {
96
x.cancel(home,*
this
);
97
Advisor::dispose
(home,c);
98
}
99
100
}
101
102
// STATISTICS: kernel-other