Iterator on the graph's edges. More...
#include <graph.hpp>
Classes | |
class | edge |
Value pointed by the iterator. More... | |
Public Types | |
typedef const edge | value_type |
typedef const edge & | reference |
typedef const edge *const | pointer |
typedef ptrdiff_t | difference_type |
typedef std::bidirectional_iterator_tag | iterator_category |
Public Member Functions | |
graph_edge_iterator () | |
Constructor of the graph_edge_iterator class. | |
graph_edge_iterator & | operator++ () |
Preincrement. | |
graph_edge_iterator | operator++ (int) |
Postincrement. | |
graph_edge_iterator & | operator-- () |
Predecrement. | |
graph_edge_iterator | operator-- (int) |
postdecrement. | |
reference | operator* () const |
Reference. | |
pointer | operator-> () const |
Pointer. | |
bool | operator== (const graph_edge_iterator &it) const |
Equality. | |
bool | operator!= (const graph_edge_iterator &it) const |
Difference. | |
Private Member Functions | |
graph_edge_iterator (typename graph_content::const_iterator it_begin, typename graph_content::const_iterator it_end, typename graph_content::const_iterator it_s, typename neighbours_list::const_iterator it_d) | |
Constructor with an iterator on graph class data. | |
Private Attributes | |
graph_content::const_iterator | m_vertex_begin |
Iterator of the first node. | |
graph_content::const_iterator | m_vertex_end |
Iterator of the last node. | |
graph_content::const_iterator | m_vertex_iterator |
Iterator on the list of vertex. | |
neighbours_list::const_iterator | m_neighbours_iterator |
Iterator on the list of edges. | |
edge | m_edge |
Current edge. | |
Friends | |
class | graph< vertex_type, edge_type, vertex_compare > |
Iterator on the graph's edges.
Definition at line 142 of file graph.hpp.
typedef ptrdiff_t claw::graph< S, A, Comp >::graph_edge_iterator::difference_type |
typedef std::bidirectional_iterator_tag claw::graph< S, A, Comp >::graph_edge_iterator::iterator_category |
typedef const edge* const claw::graph< S, A, Comp >::graph_edge_iterator::pointer |
typedef const edge& claw::graph< S, A, Comp >::graph_edge_iterator::reference |
typedef const edge claw::graph< S, A, Comp >::graph_edge_iterator::value_type |
claw::graph< S, A, Comp >::graph_edge_iterator::graph_edge_iterator | ( | ) | [inline] |
Constructor of the graph_edge_iterator class.
claw::graph< S, A, Comp >::graph_edge_iterator::graph_edge_iterator | ( | typename graph_content::const_iterator | it_begin, | |
typename graph_content::const_iterator | it_end, | |||
typename graph_content::const_iterator | it_s, | |||
typename neighbours_list::const_iterator | it_d | |||
) | [inline, explicit, private] |
Constructor with an iterator on graph class data.
it_begin | Iterator on the first node. | |
it_end | Iterator on the last node. | |
it_s | Iterator on current edge's source. | |
it_d | Iterator where scan starts. |
Definition at line 464 of file graph.tpp.
References claw::graph< S, A, Comp >::graph_edge_iterator::edge::set().
00468 : m_vertex_begin(it_begin), m_vertex_end(it_end), 00469 m_vertex_iterator(it_s), m_neighbours_iterator(it_d) 00470 { 00471 if (m_vertex_begin != m_vertex_end) 00472 m_edge.set( m_neighbours_iterator->second, m_vertex_iterator->first, 00473 m_neighbours_iterator->first ); 00474 } // graph_edge_iterator() [constructor on an iterator]
bool claw::graph< S, A, Comp >::graph_edge_iterator::operator!= | ( | const graph_edge_iterator & | it | ) | const [inline] |
claw::graph< S, A, Comp >::graph_edge_iterator::reference claw::graph< S, A, Comp >::graph_edge_iterator::operator* | ( | ) | const [inline] |
Reference.
Definition at line 395 of file graph.tpp.
References claw::graph< S, A, Comp >::graph_edge_iterator::m_edge.
00396 { 00397 return m_edge; 00398 } // operator*()
claw::graph< S, A, Comp >::graph_edge_iterator claw::graph< S, A, Comp >::graph_edge_iterator::operator++ | ( | int | ) | [inline] |
Postincrement.
Definition at line 323 of file graph.tpp.
00324 { 00325 graph_edge_iterator it_tmp(*this); 00326 ++(*this); 00327 return it_tmp; 00328 } // operator++() [postincrement]
claw::graph< S, A, Comp >::graph_edge_iterator & claw::graph< S, A, Comp >::graph_edge_iterator::operator++ | ( | ) | [inline] |
Preincrement.
Definition at line 287 of file graph.tpp.
References claw::graph< S, A, Comp >::graph_edge_iterator::m_edge, claw::graph< S, A, Comp >::graph_edge_iterator::m_neighbours_iterator, claw::graph< S, A, Comp >::graph_edge_iterator::m_vertex_end, claw::graph< S, A, Comp >::graph_edge_iterator::m_vertex_iterator, and claw::graph< S, A, Comp >::graph_edge_iterator::edge::set().
00288 { 00289 bool ok = true; 00290 ++m_neighbours_iterator; 00291 00292 // end of a neighbourhood 00293 if ( m_neighbours_iterator == m_vertex_iterator->second.end() ) 00294 { 00295 // find next edge or end. 00296 ok = false; 00297 ++m_vertex_iterator; 00298 00299 while ( (m_vertex_iterator != m_vertex_end) && !ok ) 00300 if ( !m_vertex_iterator->second.empty() ) 00301 { 00302 ok = true; 00303 m_neighbours_iterator = m_vertex_iterator->second.begin(); 00304 } 00305 else 00306 ++m_vertex_iterator; 00307 } 00308 00309 if (ok) 00310 m_edge.set( m_neighbours_iterator->second, m_vertex_iterator->first, 00311 m_neighbours_iterator->first ); 00312 00313 return *this; 00314 } // operator++() [preincrement]
claw::graph< S, A, Comp >::graph_edge_iterator claw::graph< S, A, Comp >::graph_edge_iterator::operator-- | ( | int | ) | [inline] |
postdecrement.
Definition at line 381 of file graph.tpp.
00382 { 00383 graph_edge_iterator it_tmp(*this); 00384 --(*this); 00385 return it_tmp; 00386 } // operator--() [postdecrement]
claw::graph< S, A, Comp >::graph_edge_iterator & claw::graph< S, A, Comp >::graph_edge_iterator::operator-- | ( | ) | [inline] |
Predecrement.
Definition at line 337 of file graph.tpp.
References claw::graph< S, A, Comp >::graph_edge_iterator::m_edge, claw::graph< S, A, Comp >::graph_edge_iterator::m_neighbours_iterator, claw::graph< S, A, Comp >::graph_edge_iterator::m_vertex_begin, claw::graph< S, A, Comp >::graph_edge_iterator::m_vertex_end, claw::graph< S, A, Comp >::graph_edge_iterator::m_vertex_iterator, and claw::graph< S, A, Comp >::graph_edge_iterator::edge::set().
00338 { 00339 bool ok = true; 00340 00341 if (m_vertex_iterator == m_vertex_end) 00342 { 00343 --m_vertex_iterator; 00344 m_neighbours_iterator = m_vertex_iterator->second.end(); 00345 } 00346 00347 // begining of a neighbourhood 00348 if ( m_neighbours_iterator == m_vertex_iterator->second.begin() ) 00349 { 00350 ok = false; 00351 // find previous edge or begining. 00352 while ( (m_vertex_iterator != m_vertex_begin) && !ok ) 00353 { 00354 --m_vertex_iterator; 00355 if ( !m_vertex_iterator->second.empty() ) 00356 { 00357 ok = true; 00358 m_neighbours_iterator = --m_vertex_iterator->second.end(); 00359 } 00360 } 00361 } 00362 else 00363 --m_neighbours_iterator; 00364 00365 if (!ok) 00366 m_vertex_iterator == m_vertex_end; 00367 else 00368 m_edge.set( m_neighbours_iterator->second, m_vertex_iterator->first, 00369 m_neighbours_iterator->first ); 00370 00371 return *this; 00372 } // operator--() [predecrement]
claw::graph< S, A, Comp >::graph_edge_iterator::pointer claw::graph< S, A, Comp >::graph_edge_iterator::operator-> | ( | ) | const [inline] |
Pointer.
Definition at line 407 of file graph.tpp.
References claw::graph< S, A, Comp >::graph_edge_iterator::m_edge.
00408 { 00409 return &m_edge; 00410 } // operator->()
bool claw::graph< S, A, Comp >::graph_edge_iterator::operator== | ( | const graph_edge_iterator & | it | ) | const [inline] |
Equality.
it | Iterator to compare to. |
Definition at line 420 of file graph.tpp.
00421 { 00422 // both are empty 00423 if ( m_vertex_begin == m_vertex_end ) 00424 return (it.m_vertex_begin == it.m_vertex_end) 00425 && (m_vertex_begin == it.m_vertex_begin); 00426 else 00427 if ( it.m_vertex_begin == it.m_vertex_end ) // -it- is empty 00428 return false; 00429 else 00430 // none is empty, perheaps at the end ? 00431 if (m_vertex_iterator == m_vertex_end) 00432 return (it.m_vertex_iterator == it.m_vertex_end) 00433 && (m_vertex_begin == it.m_vertex_begin); 00434 else 00435 if (it.m_vertex_iterator == it.m_vertex_end) 00436 return false; 00437 else 00438 return m_neighbours_iterator == it.m_neighbours_iterator; 00439 } // operator==()
friend class graph< vertex_type, edge_type, vertex_compare > [friend] |
edge claw::graph< S, A, Comp >::graph_edge_iterator::m_edge [private] |
Current edge.
Definition at line 212 of file graph.hpp.
Referenced by claw::graph< S, A, Comp >::graph_edge_iterator::operator*(), claw::graph< S, A, Comp >::graph_edge_iterator::operator++(), claw::graph< S, A, Comp >::graph_edge_iterator::operator--(), and claw::graph< S, A, Comp >::graph_edge_iterator::operator->().
neighbours_list::const_iterator claw::graph< S, A, Comp >::graph_edge_iterator::m_neighbours_iterator [private] |
Iterator on the list of edges.
Definition at line 209 of file graph.hpp.
Referenced by claw::graph< S, A, Comp >::graph_edge_iterator::operator++(), and claw::graph< S, A, Comp >::graph_edge_iterator::operator--().
graph_content::const_iterator claw::graph< S, A, Comp >::graph_edge_iterator::m_vertex_begin [private] |
Iterator of the first node.
Definition at line 200 of file graph.hpp.
Referenced by claw::graph< S, A, Comp >::graph_edge_iterator::operator--().
graph_content::const_iterator claw::graph< S, A, Comp >::graph_edge_iterator::m_vertex_end [private] |
Iterator of the last node.
Definition at line 203 of file graph.hpp.
Referenced by claw::graph< S, A, Comp >::graph_edge_iterator::operator++(), and claw::graph< S, A, Comp >::graph_edge_iterator::operator--().
graph_content::const_iterator claw::graph< S, A, Comp >::graph_edge_iterator::m_vertex_iterator [private] |
Iterator on the list of vertex.
Definition at line 206 of file graph.hpp.
Referenced by claw::graph< S, A, Comp >::graph_edge_iterator::operator++(), and claw::graph< S, A, Comp >::graph_edge_iterator::operator--().