main page
modules
namespaces
classes
files
Gecode home
Generated on Fri Aug 31 2012 16:21:31 for Gecode by
doxygen
1.8.1.2
gecode
int
view-val-graph
edge.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, 2003
8
*
9
* Last modified:
10
* $Date: 2011-08-18 04:37:38 +1000 (Thu, 18 Aug 2011) $ by $Author: schulte $
11
* $Revision: 12299 $
12
*
13
* This file is part of Gecode, the generic constraint
14
* development environment:
15
* http://www.gecode.org
16
*
17
* Permission is hereby granted, free of charge, to any person obtaining
18
* a copy of this software and associated documentation files (the
19
* "Software"), to deal in the Software without restriction, including
20
* without limitation the rights to use, copy, modify, merge, publish,
21
* distribute, sublicense, and/or sell copies of the Software, and to
22
* permit persons to whom the Software is furnished to do so, subject to
23
* the following conditions:
24
*
25
* The above copyright notice and this permission notice shall be
26
* included in all copies or substantial portions of the Software.
27
*
28
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35
*
36
*/
37
38
namespace
Gecode {
namespace
Int {
namespace
ViewValGraph {
39
40
template
<
class
View>
41
forceinline
42
Edge<View>::Edge
(
ValNode<View>
* s,
ViewNode<View>
*
d
)
43
: sd(s,d) {
44
s->
add
(
this
);
45
}
46
template
<
class
View>
47
forceinline
48
Edge<View>::Edge
(
ValNode<View>
* s,
ViewNode<View>
*
d
,
Edge<View>
* n)
49
: _next_edge(n), sd(s,d) {
50
s->
add
(
this
);
51
}
52
53
template
<
class
View>
54
forceinline
Node<View>
*
55
Edge<View>::dst
(
Node<View>
* s)
const
{
56
return
sd.ptr(s);
57
}
58
59
template
<
class
View>
60
forceinline
void
61
Edge<View>::revert
(
Node<View>
*
d
) {
62
unlink();
63
d->
add
(
this
);
64
}
65
66
template
<
class
View>
67
forceinline
ViewNode<View>
*
68
Edge<View>::view
(
ValNode<View>
* n)
const
{
69
return
static_cast<
ViewNode<View>
*
>
(sd.ptr(n));
70
}
71
template
<
class
View>
72
forceinline
ValNode<View>
*
73
Edge<View>::val
(
ViewNode<View>
* x)
const
{
74
return
static_cast<
ValNode<View>
*
>
(sd.ptr(x));
75
}
76
77
template
<
class
View>
78
forceinline
bool
79
Edge<View>::used
(
Node<View>
*
v
)
const
{
80
return
sd.is_set() || (v->
comp
== sd.ptr(v)->comp);
81
}
82
template
<
class
View>
83
forceinline
void
84
Edge<View>::use
(
void
) {
85
sd.set();
86
}
87
template
<
class
View>
88
forceinline
void
89
Edge<View>::free
(
void
) {
90
sd.unset();
91
}
92
93
template
<
class
View>
94
forceinline
Edge<View>
*
95
Edge<View>::next_edge
(
void
)
const
{
96
return
_next_edge;
97
}
98
template
<
class
View>
99
forceinline
Edge<View>
**
100
Edge<View>::next_edge_ref
(
void
) {
101
return
&_next_edge;
102
}
103
template
<
class
View>
104
forceinline
Edge<View>
*
105
Edge<View>::next
(
void
)
const
{
106
return
static_cast<
Edge<View>
*
>
(
BiLink::next
());
107
}
108
109
template
<
class
View>
110
forceinline
void
111
Edge<View>::operator
delete
(
void
*, size_t) {}
112
template
<
class
View>
113
forceinline
void
114
Edge<View>::operator
delete
(
void
*,
Space
&) {}
115
template
<
class
View>
116
forceinline
void
*
117
Edge<View>::operator
new
(
size_t
s,
Space
& home) {
118
return
home.ralloc(s);
119
}
120
121
}}}
122
123
// STATISTICS: int-prop
124