Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:42:49

0001 //=======================================================================
0002 // Copyright 2002 Indiana University.
0003 // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
0004 //
0005 // Distributed under the Boost Software License, Version 1.0. (See
0006 // accompanying file LICENSE_1_0.txt or copy at
0007 // http://www.boost.org/LICENSE_1_0.txt)
0008 //=======================================================================
0009 
0010 #ifndef BOOST_ADJACENCY_ITERATOR_HPP
0011 #define BOOST_ADJACENCY_ITERATOR_HPP
0012 
0013 #include <iterator>
0014 #include <boost/iterator/iterator_adaptor.hpp>
0015 #include <boost/graph/graph_traits.hpp>
0016 
0017 namespace boost
0018 {
0019 
0020 template < class Graph, class Vertex, class OutEdgeIter, class Difference >
0021 struct adjacency_iterator
0022 : iterator_adaptor<
0023       adjacency_iterator< Graph, Vertex, OutEdgeIter, Difference >, OutEdgeIter,
0024       Vertex, use_default, Vertex, Difference >
0025 {
0026     typedef iterator_adaptor<
0027         adjacency_iterator< Graph, Vertex, OutEdgeIter, Difference >,
0028         OutEdgeIter, Vertex, use_default, Vertex, Difference >
0029         super_t;
0030 
0031     inline adjacency_iterator() {}
0032     inline adjacency_iterator(OutEdgeIter const& i, const Graph* g)
0033     : super_t(i), m_g(g)
0034     {
0035     }
0036 
0037     inline Vertex dereference() const { return target(*this->base(), *m_g); }
0038 
0039     const Graph* m_g;
0040 };
0041 
0042 template < class Graph,
0043     class Vertex = typename graph_traits< Graph >::vertex_descriptor,
0044     class OutEdgeIter = typename graph_traits< Graph >::out_edge_iterator >
0045 class adjacency_iterator_generator
0046 {
0047     typedef
0048         typename std::iterator_traits< OutEdgeIter >::difference_type
0049             difference_type;
0050 
0051 public:
0052     typedef adjacency_iterator< Graph, Vertex, OutEdgeIter, difference_type >
0053         type;
0054 };
0055 
0056 template < class Graph, class Vertex, class InEdgeIter, class Difference >
0057 struct inv_adjacency_iterator
0058 : iterator_adaptor<
0059       inv_adjacency_iterator< Graph, Vertex, InEdgeIter, Difference >,
0060       InEdgeIter, Vertex, use_default, Vertex, Difference >
0061 {
0062     typedef iterator_adaptor<
0063         inv_adjacency_iterator< Graph, Vertex, InEdgeIter, Difference >,
0064         InEdgeIter, Vertex, use_default, Vertex, Difference >
0065         super_t;
0066 
0067     inline inv_adjacency_iterator() {}
0068     inline inv_adjacency_iterator(InEdgeIter const& i, const Graph* g)
0069     : super_t(i), m_g(g)
0070     {
0071     }
0072 
0073     inline Vertex dereference() const { return source(*this->base(), *m_g); }
0074 
0075     const Graph* m_g;
0076 };
0077 
0078 template < class Graph,
0079     class Vertex = typename graph_traits< Graph >::vertex_descriptor,
0080     class InEdgeIter = typename graph_traits< Graph >::in_edge_iterator >
0081 class inv_adjacency_iterator_generator
0082 {
0083     typedef
0084         typename std::iterator_traits< InEdgeIter >::difference_type
0085             difference_type;
0086 
0087 public:
0088     typedef inv_adjacency_iterator< Graph, Vertex, InEdgeIter, difference_type >
0089         type;
0090 };
0091 
0092 } // namespace boost
0093 
0094 #endif // BOOST_DETAIL_ADJACENCY_ITERATOR_HPP