OpenTTD
Data Structures | Public Member Functions | Protected Attributes
LinkGraph::BaseEdgeIterator< Tedge, Tedge_wrapper, Titer > Class Template Reference

Base class for iterating across outgoing edges of a node. More...

#include <linkgraph.h>

Data Structures

class  FakePointer
 A "fake" pointer to enable operator-> on temporaries. More...

Public Member Functions

 BaseEdgeIterator (Tedge *base, NodeID current)
 Constructor.
Titer & operator++ ()
 Prefix-increment.
Titer operator++ (int)
 Postfix-increment.
template<class Tother >
bool operator== (const Tother &other)
 Compare with some other edge iterator.
template<class Tother >
bool operator!= (const Tother &other)
 Compare for inequality with some other edge iterator.
SmallPair< NodeID, Tedge_wrapper > operator* () const
 Dereference with operator*.
FakePointer operator-> () const
 Dereference with operator->.

Protected Attributes

Tedge * base
 Array of edges being iterated.
NodeID current
 Current offset in edges array.

Detailed Description

template<class Tedge, class Tedge_wrapper, class Titer>
class LinkGraph::BaseEdgeIterator< Tedge, Tedge_wrapper, Titer >

Base class for iterating across outgoing edges of a node.

Only the real edges (those with capacity) are iterated. The ones with only distance information are skipped.

Template Parameters
TedgeActual edge class. May be "BaseEdge" or "const BaseEdge".
TiterActual iterator class.

Definition at line 182 of file linkgraph.h.

Constructor & Destructor Documentation

template<class Tedge, class Tedge_wrapper, class Titer>
LinkGraph::BaseEdgeIterator< Tedge, Tedge_wrapper, Titer >::BaseEdgeIterator ( Tedge *  base,
NodeID  current 
)
inline

Constructor.

Parameters
baseArray of edges to be iterated.
currentID of current node (to locate the first edge).

Definition at line 215 of file linkgraph.h.

Member Function Documentation

template<class Tedge, class Tedge_wrapper, class Titer>
template<class Tother >
bool LinkGraph::BaseEdgeIterator< Tedge, Tedge_wrapper, Titer >::operator!= ( const Tother &  other)
inline

Compare for inequality with some other edge iterator.

The other one may be of a child class.

Template Parameters
TotherClass of other iterator.
Parameters
otherInstance of other iterator.
Returns
If either the edge arrays or the current nodes differ.

Definition at line 262 of file linkgraph.h.

template<class Tedge, class Tedge_wrapper, class Titer>
SmallPair<NodeID, Tedge_wrapper> LinkGraph::BaseEdgeIterator< Tedge, Tedge_wrapper, Titer >::operator* ( ) const
inline

Dereference with operator*.

Returns
Pair of current target NodeID and edge object.

Reimplemented in LinkGraphJob::EdgeIterator.

Definition at line 271 of file linkgraph.h.

template<class Tedge, class Tedge_wrapper, class Titer>
Titer& LinkGraph::BaseEdgeIterator< Tedge, Tedge_wrapper, Titer >::operator++ ( )
inline

Prefix-increment.

Returns
This.

Definition at line 224 of file linkgraph.h.

template<class Tedge, class Tedge_wrapper, class Titer>
Titer LinkGraph::BaseEdgeIterator< Tedge, Tedge_wrapper, Titer >::operator++ ( int  )
inline

Postfix-increment.

Returns
Version of this before increment.

Definition at line 234 of file linkgraph.h.

template<class Tedge, class Tedge_wrapper, class Titer>
FakePointer LinkGraph::BaseEdgeIterator< Tedge, Tedge_wrapper, Titer >::operator-> ( ) const
inline

Dereference with operator->.

Returns
Fake pointer to Pair of current target NodeID and edge object.

Reimplemented in LinkGraphJob::EdgeIterator.

Definition at line 280 of file linkgraph.h.

template<class Tedge, class Tedge_wrapper, class Titer>
template<class Tother >
bool LinkGraph::BaseEdgeIterator< Tedge, Tedge_wrapper, Titer >::operator== ( const Tother &  other)
inline

Compare with some other edge iterator.

The other one may be of a child class.

Template Parameters
TotherClass of other iterator.
Parameters
otherInstance of other iterator.
Returns
If the iterators have the same edge array and current node.

Definition at line 249 of file linkgraph.h.


The documentation for this class was generated from the following file: