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 143 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 | ( | ) |
Constructor of the graph_edge_iterator class.
Definition at line 275 of file graph.tpp.
{
} // graph_edge_iterator() [constructor]
| 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 | |||
| ) | [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().
: m_vertex_begin(it_begin), m_vertex_end(it_end), m_vertex_iterator(it_s), m_neighbours_iterator(it_d) { if (m_vertex_begin != m_vertex_end) m_edge.set( m_neighbours_iterator->second, m_vertex_iterator->first, m_neighbours_iterator->first ); } // graph_edge_iterator() [constructor on an iterator]
| bool claw::graph< S, A, Comp >::graph_edge_iterator::operator!= | ( | const graph_edge_iterator & | it | ) | const |
| claw::graph< S, A, Comp >::graph_edge_iterator::reference claw::graph< S, A, Comp >::graph_edge_iterator::operator* | ( | ) | const |
Reference.
Definition at line 395 of file graph.tpp.
References claw::graph< S, A, Comp >::graph_edge_iterator::m_edge.
{
return m_edge;
} // operator*()
| claw::graph< S, A, Comp >::graph_edge_iterator & claw::graph< S, A, Comp >::graph_edge_iterator::operator++ | ( | ) |
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().
{
bool ok = true;
++m_neighbours_iterator;
// end of a neighbourhood
if ( m_neighbours_iterator == m_vertex_iterator->second.end() )
{
// find next edge or end.
ok = false;
++m_vertex_iterator;
while ( (m_vertex_iterator != m_vertex_end) && !ok )
if ( !m_vertex_iterator->second.empty() )
{
ok = true;
m_neighbours_iterator = m_vertex_iterator->second.begin();
}
else
++m_vertex_iterator;
}
if (ok)
m_edge.set( m_neighbours_iterator->second, m_vertex_iterator->first,
m_neighbours_iterator->first );
return *this;
} // operator++() [preincrement]
| claw::graph< S, A, Comp >::graph_edge_iterator claw::graph< S, A, Comp >::graph_edge_iterator::operator++ | ( | int | ) |
Postincrement.
Definition at line 323 of file graph.tpp.
{
graph_edge_iterator it_tmp(*this);
++(*this);
return it_tmp;
} // operator++() [postincrement]
| claw::graph< S, A, Comp >::graph_edge_iterator claw::graph< S, A, Comp >::graph_edge_iterator::operator-- | ( | int | ) |
postdecrement.
Definition at line 381 of file graph.tpp.
{
graph_edge_iterator it_tmp(*this);
--(*this);
return it_tmp;
} // operator--() [postdecrement]
| claw::graph< S, A, Comp >::graph_edge_iterator & claw::graph< S, A, Comp >::graph_edge_iterator::operator-- | ( | ) |
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().
{
bool ok = true;
if (m_vertex_iterator == m_vertex_end)
{
--m_vertex_iterator;
m_neighbours_iterator = m_vertex_iterator->second.end();
}
// begining of a neighbourhood
if ( m_neighbours_iterator == m_vertex_iterator->second.begin() )
{
ok = false;
// find previous edge or begining.
while ( (m_vertex_iterator != m_vertex_begin) && !ok )
{
--m_vertex_iterator;
if ( !m_vertex_iterator->second.empty() )
{
ok = true;
m_neighbours_iterator = --m_vertex_iterator->second.end();
}
}
}
else
--m_neighbours_iterator;
if (!ok)
m_vertex_iterator == m_vertex_end;
else
m_edge.set( m_neighbours_iterator->second, m_vertex_iterator->first,
m_neighbours_iterator->first );
return *this;
} // operator--() [predecrement]
| claw::graph< S, A, Comp >::graph_edge_iterator::pointer claw::graph< S, A, Comp >::graph_edge_iterator::operator-> | ( | ) | const |
Pointer.
Definition at line 407 of file graph.tpp.
References claw::graph< S, A, Comp >::graph_edge_iterator::m_edge.
{
return &m_edge;
} // operator->()
| bool claw::graph< S, A, Comp >::graph_edge_iterator::operator== | ( | const graph_edge_iterator & | it | ) | const |
Equality.
| it | Iterator to compare to. |
Definition at line 420 of file graph.tpp.
{
// both are empty
if ( m_vertex_begin == m_vertex_end )
return (it.m_vertex_begin == it.m_vertex_end)
&& (m_vertex_begin == it.m_vertex_begin);
else
if ( it.m_vertex_begin == it.m_vertex_end ) // -it- is empty
return false;
else
// none is empty, perheaps at the end ?
if (m_vertex_iterator == m_vertex_end)
return (it.m_vertex_iterator == it.m_vertex_end)
&& (m_vertex_begin == it.m_vertex_begin);
else
if (it.m_vertex_iterator == it.m_vertex_end)
return false;
else
return m_neighbours_iterator == it.m_neighbours_iterator;
} // 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 213 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 210 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 201 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 204 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 207 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--().
1.7.1