OKlibrary  0.2.1.6
Support.hpp
Go to the documentation of this file.
00001 // Oliver Kullmann, 8.9.2003 (Swansea)
00002 /* Copyright 2003 - 2007 Oliver Kullmann
00003 This file is part of the OKlibrary. OKlibrary is free software; you can redistribute
00004 it and/or modify it under the terms of the GNU General Public License as published by
00005 the Free Software Foundation and included in this library; either version 3 of the
00006 License, or any later version. */
00007 
00008 #ifndef SUPPORTWAECHTER
00009 
00010 #define SUPPORTWAECHTER
00011 
00012 #include <functional>
00013 #include <cassert>
00014 
00015 #include <boost/graph/graph_traits.hpp>
00016 #include <boost/graph/graph_concepts.hpp>
00017 
00018 #include <boost/concept_check.hpp>
00019 
00020 #include "Concepts_Graphs.hpp"
00021 
00022 namespace Support {
00023 
00024   template <class Graph>
00025   class edge_check : public std::unary_function<typename boost::graph_traits<Graph>::edge_descriptor, bool> {
00026     BOOST_CLASS_REQUIRE(Graph, Concepts_Graphs, EdgeDescriptorGraphConcept);
00027     typedef typename boost::graph_traits<Graph>::edge_descriptor edge_descriptor;
00028     typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_descriptor;
00029     const Graph g;
00030     const vertex_descriptor a, b;
00031   public :
00032     edge_check(const Graph& g, vertex_descriptor a, vertex_descriptor b) : g(g), a(a), b(b) {}
00033     bool operator() (edge_descriptor e) {
00034       return source(e,g) == a and target(e,g) == b;
00035     }
00036   };
00037   
00038   template <class Graph>
00039   inline edge_check<Graph> edge_checker(const Graph& g, typename boost::graph_traits<Graph>::vertex_descriptor a, typename boost::graph_traits<Graph>::vertex_descriptor b) {
00040     return edge_check<Graph>(g, a, b);
00041   }
00042 }
00043 
00044 #endif