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 DigitalSurfaceBoostGraphInterface.ih
19 * @author Jacques-Olivier Lachaud (\c jacques-olivier.lachaud@univ-savoie.fr )
20 * Laboratory of Mathematics (CNRS, UMR 5127), University of Savoie, France
24 * Implementation of inline methods defined in DigitalSurfaceBoostGraphInterface.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 TDigitalSurfaceContainer >
44 typename boost::graph_traits< DGtal::DigitalSurface< TDigitalSurfaceContainer > >::vertex_iterator,
45 typename boost::graph_traits< DGtal::DigitalSurface< TDigitalSurfaceContainer > >::vertex_iterator
47 boost::vertices( const DGtal::DigitalSurface< TDigitalSurfaceContainer > & digSurf )
49 return std::make_pair( digSurf.begin(), digSurf.end() );
51 //-----------------------------------------------------------------------------
52 template < class TDigitalSurfaceContainer >
54 boost::graph_traits< DGtal::DigitalSurface< TDigitalSurfaceContainer > >::edge_iterator::
58 //-----------------------------------------------------------------------------
59 template < class TDigitalSurfaceContainer >
61 boost::graph_traits< DGtal::DigitalSurface< TDigitalSurfaceContainer > >::edge_iterator::
62 edge_iterator( ConstAlias<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 TDigitalSurfaceContainer >
76 const typename boost::graph_traits< DGtal::DigitalSurface< TDigitalSurfaceContainer > >::Arc &
77 boost::graph_traits< DGtal::DigitalSurface< TDigitalSurfaceContainer > >::edge_iterator::
80 ASSERT( myVertexRange.first != myVertexRange.second );
81 ASSERT( myOutEdgeRange.first != myOutEdgeRange.second );
82 return *( myOutEdgeRange.first );
84 //-----------------------------------------------------------------------------
85 template < class TDigitalSurfaceContainer >
88 boost::graph_traits< DGtal::DigitalSurface< TDigitalSurfaceContainer > >::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 TDigitalSurfaceContainer >
105 boost::graph_traits< DGtal::DigitalSurface< TDigitalSurfaceContainer > >::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 ///////////////////////////////////////////////////////////////////////////////