2 * This program is free software: you can redistribute it and/or modify
3 * it under the terms of the GNU Lesser General Public License as
4 * published by the Free Software Foundation, either version 3 of the
5 * License, or (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 * @file ObjectBoostGraphInterface.ih
19 * @author Pablo Hernandez-Cerdan. Institute of Fundamental Sciences.
20 * Massey University. Palmerston North, New Zealand
24 * Implementation of inline methods defined in ObjectBoostGraphInterface.h
26 * This file is part of the DGtal library.
30 //////////////////////////////////////////////////////////////////////////////
32 //////////////////////////////////////////////////////////////////////////////
34 ///////////////////////////////////////////////////////////////////////////////
35 // IMPLEMENTATION of inline methods.
36 ///////////////////////////////////////////////////////////////////////////////
38 ///////////////////////////////////////////////////////////////////////////////
39 // ----------------------- Standard services ------------------------------
41 template < class TDigitalTopology, class TDigitalSet >
44 typename boost::graph_traits< DGtal::Object< TDigitalTopology, TDigitalSet > >::vertex_iterator,
45 typename boost::graph_traits< DGtal::Object< TDigitalTopology, TDigitalSet > >::vertex_iterator
47 boost::vertices( const DGtal::Object< TDigitalTopology, TDigitalSet > & obj )
49 return std::make_pair( obj.begin(), obj.end() );
51 //-----------------------------------------------------------------------------
52 template < class TDigitalTopology, class TDigitalSet >
54 boost::graph_traits< DGtal::Object< TDigitalTopology, TDigitalSet > >::edge_iterator::
58 //-----------------------------------------------------------------------------
59 template < class TDigitalTopology, class TDigitalSet >
61 boost::graph_traits< DGtal::Object< TDigitalTopology, TDigitalSet > >::edge_iterator::
62 edge_iterator( const Adapted & graph,
63 const vertex_iterator & itB, const vertex_iterator & itE )
65 myVertexRange( itB, itE ),
68 if ( myVertexRange.first != myVertexRange.second )
70 myOutEdgeRange = boost::out_edges( *myVertexRange.first, *myGraph );
73 //-----------------------------------------------------------------------------
74 template < class TDigitalTopology, class TDigitalSet >
76 const typename boost::graph_traits< DGtal::Object< TDigitalTopology, TDigitalSet > >::Edge &
77 boost::graph_traits< DGtal::Object< TDigitalTopology, TDigitalSet > >::edge_iterator::
80 ASSERT( myVertexRange.first != myVertexRange.second );
81 ASSERT( myOutEdgeRange.first != myOutEdgeRange.second );
82 return *( myOutEdgeRange.first );
84 //-----------------------------------------------------------------------------
85 template < class TDigitalTopology, class TDigitalSet >
88 boost::graph_traits< DGtal::Object< TDigitalTopology, TDigitalSet > >::edge_iterator::
89 equal( const edge_iterator & other ) const
91 bool thisAtEnd = ( myVertexRange.first == myVertexRange.second );
92 bool otherAtEnd = ( other.myVertexRange.first == other.myVertexRange.second );
93 if ( thisAtEnd || otherAtEnd ) return thisAtEnd && otherAtEnd;
96 ASSERT( myOutEdgeRange.first != myOutEdgeRange.second );
97 ASSERT( other.myOutEdgeRange.first != other.myOutEdgeRange.second );
98 return *myOutEdgeRange.first == *other.myOutEdgeRange.first;
101 //-----------------------------------------------------------------------------
102 template < class TDigitalTopology, class TDigitalSet >
105 boost::graph_traits< DGtal::Object< TDigitalTopology, TDigitalSet > >::edge_iterator::
108 ++myOutEdgeRange.first;
109 if ( myOutEdgeRange.first == myOutEdgeRange.second )
111 ++myVertexRange.first;
112 if ( myVertexRange.first != myVertexRange.second )
113 myOutEdgeRange = boost::out_edges( *myVertexRange.first, *myGraph );
118 ///////////////////////////////////////////////////////////////////////////////