OpenTTD Source: LinkGraph::BaseEdgeIterator< Tedge, Tedge_wrapper, Titer > Class Template Reference

OpenTTD Source 12.0-beta1

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. More...
Titer & | operator++ ()
| Prefix-increment. More...
Titer | operator++ (int)
| Postfix-increment. More...
template<class Tother >
bool | operator== (const Tother &other)
| Compare with some other edge iterator. More...
template<class Tother >
bool | operator!= (const Tother &other)
| Compare for inequality with some other edge iterator. More...
std::pair< NodeID, Tedge_wrapper > | operator* () const
| Dereference with operator*. More...
FakePointer | operator-> () const
| Dereference with operator->. More...

## 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

  Tedge | Actual edge class. May be "BaseEdge" or "const BaseEdge".
  Titer | Actual iterator class.

Definition at line 181 of file linkgraph.h.

## Constructor & Destructor Documentation

## ◆ BaseEdgeIterator()

template<class Tedge , class Tedge_wrapper , class Titer >

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

Constructor.

Parameters

  base | Array of edges to be iterated.
  current | ID of current node (to locate the first edge).

Definition at line 214 of file linkgraph.h.

## Member Function Documentation

## ◆ operator!=()

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

  Tother | Class of other iterator.

Parameters

  other | Instance of other iterator.

Returns
  If either the edge arrays or the current nodes differ.

Definition at line 261 of file linkgraph.h.

## ◆ operator*()

template<class Tedge , class Tedge_wrapper , class Titer >

std::pair<NodeID, Tedge_wrapper> LinkGraph::BaseEdgeIterator< Tedge, Tedge_wrapper, Titer >::operator* | ( |  | ) | const
| inline

Dereference with operator*.

Returns
  Pair of current target NodeID and edge object.

Definition at line 270 of file linkgraph.h.

## ◆ operator++() [1/2]

template<class Tedge , class Tedge_wrapper , class Titer >

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

Prefix-increment.

Returns
  This.

Definition at line 223 of file linkgraph.h.

## ◆ operator++() [2/2]

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 233 of file linkgraph.h.

## ◆ operator->()

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.

Definition at line 279 of file linkgraph.h.

## ◆ operator==()

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

  Tother | Class of other iterator.

Parameters

  other | Instance of other iterator.

Returns
  If the iterators have the same edge array and current node.

Definition at line 248 of file linkgraph.h.

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

- src/linkgraph/linkgraph.h