Generated on Fri Oct 19 11:25:10 2018 for Gecode by doxygen 1.6.3

edge.hpp

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Christian Schulte <schulte@gecode.org>
00005  *
00006  *  Copyright:
00007  *     Christian Schulte, 2003
00008  *
00009  *  This file is part of Gecode, the generic constraint
00010  *  development environment:
00011  *     http://www.gecode.org
00012  *
00013  *  Permission is hereby granted, free of charge, to any person obtaining
00014  *  a copy of this software and associated documentation files (the
00015  *  "Software"), to deal in the Software without restriction, including
00016  *  without limitation the rights to use, copy, modify, merge, publish,
00017  *  distribute, sublicense, and/or sell copies of the Software, and to
00018  *  permit persons to whom the Software is furnished to do so, subject to
00019  *  the following conditions:
00020  *
00021  *  The above copyright notice and this permission notice shall be
00022  *  included in all copies or substantial portions of the Software.
00023  *
00024  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00025  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00026  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00027  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00028  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00029  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00030  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00031  *
00032  */
00033 
00034 namespace Gecode { namespace Int { namespace ViewValGraph {
00035 
00036   template<class View>
00037   forceinline
00038   Edge<View>::Edge(ValNode<View>* s, ViewNode<View>* d)
00039     : sd(s,d) {
00040     s->add(this);
00041   }
00042   template<class View>
00043   forceinline
00044   Edge<View>::Edge(ValNode<View>* s, ViewNode<View>* d, Edge<View>* n)
00045     : _next_edge(n), sd(s,d) {
00046     s->add(this);
00047   }
00048 
00049   template<class View>
00050   forceinline Node<View>*
00051   Edge<View>::dst(Node<View>* s) const {
00052     return sd.ptr(s);
00053   }
00054 
00055   template<class View>
00056   forceinline void
00057   Edge<View>::revert(Node<View>* d) {
00058     unlink();
00059     d->add(this);
00060   }
00061 
00062   template<class View>
00063   forceinline ViewNode<View>*
00064   Edge<View>::view(ValNode<View>* n) const {
00065     return static_cast<ViewNode<View>*>(sd.ptr(n));
00066   }
00067   template<class View>
00068   forceinline ValNode<View>*
00069   Edge<View>::val(ViewNode<View>* x) const {
00070     return static_cast<ValNode<View>*>(sd.ptr(x));
00071   }
00072 
00073   template<class View>
00074   forceinline bool
00075   Edge<View>::used(Node<View>* v) const {
00076     return sd.is_set() || (v->comp == sd.ptr(v)->comp);
00077   }
00078   template<class View>
00079   forceinline void
00080   Edge<View>::use(void) {
00081     sd.set();
00082   }
00083   template<class View>
00084   forceinline void
00085   Edge<View>::free(void) {
00086     sd.unset();
00087   }
00088 
00089   template<class View>
00090   forceinline Edge<View>*
00091   Edge<View>::next_edge(void) const {
00092     return _next_edge;
00093   }
00094   template<class View>
00095   forceinline Edge<View>**
00096   Edge<View>::next_edge_ref(void) {
00097     return &_next_edge;
00098   }
00099   template<class View>
00100   forceinline Edge<View>*
00101   Edge<View>::next(void) const {
00102     return static_cast<Edge<View>*>(BiLink::next());
00103   }
00104 
00105   template<class View>
00106   forceinline void
00107   Edge<View>::operator delete(void*, size_t) {}
00108   template<class View>
00109   forceinline void
00110   Edge<View>::operator delete(void*,Space&) {}
00111   template<class View>
00112   forceinline void*
00113   Edge<View>::operator new(size_t s, Space& home) {
00114     return home.ralloc(s);
00115   }
00116 
00117 }}}
00118 
00119 // STATISTICS: int-prop
00120