Generated on Wed Nov 1 15:04:33 2006 for Gecode by doxygen 1.4.5

edge.icc

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Christian Schulte <schulte@gecode.org>
00004  *
00005  *  Copyright:
00006  *     Christian Schulte, 2003
00007  *
00008  *  Last modified:
00009  *     $Date: 2006-08-04 16:03:26 +0200 (Fri, 04 Aug 2006) $ by $Author: schulte $
00010  *     $Revision: 3512 $
00011  *
00012  *  This file is part of Gecode, the generic constraint
00013  *  development environment:
00014  *     http://www.gecode.org
00015  *
00016  *  See the file "LICENSE" for information on usage and
00017  *  redistribution of this file, and for a
00018  *     DISCLAIMER OF ALL WARRANTIES.
00019  *
00020  */
00021 
00022 namespace Gecode { namespace Int { namespace Distinct {
00023 
00024   template <class View>
00025   forceinline
00026   Edge<View>::Edge(Node<View>* s, Node<View>* d)
00027     : sd(s,d) {
00028     s->add(this);
00029   }
00030 
00031   template <class View>
00032   forceinline Node<View>*
00033   Edge<View>::dst(Node<View>* s) const {
00034     return sd.ptr(s);
00035   }
00036 
00037   template <class View>
00038   forceinline void
00039   Edge<View>::revert(Node<View>* d) {
00040     unlink();
00041     d->add(this);
00042   }
00043 
00044   template <class View>
00045   forceinline ViewNode<View>*
00046   Edge<View>::view(ValNode<View>* n) const {
00047     return static_cast<ViewNode<View>*>(sd.ptr(n));
00048   }
00049   template <class View>
00050   forceinline ValNode<View>*
00051   Edge<View>::val(ViewNode<View>* x) const {
00052     return static_cast<ValNode<View>*>(sd.ptr(x));
00053   }
00054 
00055   template <class View>
00056   forceinline bool
00057   Edge<View>::used(Node<View>* v) const {
00058     return sd.is_set() || (v->comp == sd.ptr(v)->comp);
00059   }
00060   template <class View>
00061   forceinline void
00062   Edge<View>::use(void) {
00063     sd.set();
00064   }
00065   template <class View>
00066   forceinline void
00067   Edge<View>::free(void) {
00068     sd.unset();
00069   }
00070 
00071   template <class View>
00072   forceinline Edge<View>*
00073   Edge<View>::next_edge(void) const {
00074     return _next_edge;
00075   }
00076   template <class View>
00077   forceinline Edge<View>**
00078   Edge<View>::next_edge_ref(void) {
00079     return &_next_edge;
00080   }
00081   template <class View>
00082   forceinline Edge<View>*
00083   Edge<View>::next(void) const {
00084     return static_cast<Edge<View>*>(BiLink::next());
00085   }
00086 
00087   template <class View>
00088   forceinline void*
00089   Edge<View>::operator new(size_t, void* p) {
00090     return p;
00091   }
00092 
00093 }}}
00094 
00095 // STATISTICS: int-prop
00096