Generated on Sat Feb 7 2015 02:01:26 for Gecode by doxygen 1.8.9.1
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-17 20:37:38 +0200 (Wed, 17 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>
43  : sd(s,d) {
44  s->add(this);
45  }
46  template<class View>
49  : _next_edge(n), sd(s,d) {
50  s->add(this);
51  }
52 
53  template<class View>
56  return sd.ptr(s);
57  }
58 
59  template<class View>
60  forceinline void
62  unlink();
63  d->add(this);
64  }
65 
66  template<class View>
69  return static_cast<ViewNode<View>*>(sd.ptr(n));
70  }
71  template<class View>
74  return static_cast<ValNode<View>*>(sd.ptr(x));
75  }
76 
77  template<class View>
78  forceinline bool
80  return sd.is_set() || (v->comp == sd.ptr(v)->comp);
81  }
82  template<class View>
83  forceinline void
85  sd.set();
86  }
87  template<class View>
88  forceinline void
90  sd.unset();
91  }
92 
93  template<class View>
95  Edge<View>::next_edge(void) const {
96  return _next_edge;
97  }
98  template<class View>
101  return &_next_edge;
102  }
103  template<class 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 
Edge< View > * next_edge(void) const
Return next edge in list of value edges.
Definition: edge.hpp:95
ValNode< View > * val(ViewNode< View > *x) const
Return value node when view node x is given.
Definition: edge.hpp:73
Edge< View > ** next_edge_ref(void)
Return reference to next edge in list of value edges.
Definition: edge.hpp:100
Edge< View > * next(void) const
Return next edge in list of edges per node.
Definition: edge.hpp:105
ViewNode< View > * view(ValNode< View > *v) const
Return view node when value node v is given.
Definition: edge.hpp:68
Edges in view-value graph.
Computation spaces.
Definition: core.hpp:1362
Gecode::IntSet d(v, 7)
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
View nodes in view-value graph.
void revert(Node< View > *d)
Revert edge to node d for matching.
Definition: edge.hpp:61
bool used(Node< View > *v) const
Whether edge is used (marked or between nodes from the same scc)
Definition: edge.hpp:79
const int v[7]
Definition: distinct.cpp:207
void use(void)
Mark node as used.
Definition: edge.hpp:84
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
Value nodes in view-value graph.
#define forceinline
Definition: config.hpp:132
void free(void)
Unmark node as used.
Definition: edge.hpp:89
Gecode toplevel namespace
Node< View > * dst(Node< View > *s) const
Return destination of edge when source s is given.
Definition: edge.hpp:55
Edge(ValNode< View > *v, ViewNode< View > *x)
Construct new edge between x and v.
Definition: edge.hpp:42
Base-class for nodes (both view and value nodes)