OpenTTD

Public Member Functions | Private Attributes
LinkGraphJob::Node Class Reference

Link graph job node. More...

`#include <linkgraphjob.h>`

Inheritance diagram for LinkGraphJob::Node:

## Public Member Functions
| Node (LinkGraphJob *lgj, NodeID node)
| Constructor. More...
Edge | operator[] (NodeID to) const
| Retrieve an edge starting at this node. More...
EdgeIterator | Begin () const
| Iterator for the "begin" of the edge array. More...
EdgeIterator | End () const
| Iterator for the "end" of the edge array. More...
uint | UndeliveredSupply () const
| Get amount of supply that hasn't been delivered, yet. More...
FlowStatMap & | Flows ()
| Get the flows running through this node. More...
const FlowStatMap & | Flows () const
| Get a constant version of the flows running through this node. More...
PathList & | Paths ()
| Get the paths this node is part of. More...
const PathList & | Paths () const
| Get a constant version of the paths this node is part of. More...
void | DeliverSupply (NodeID to, uint amount)
| Deliver some supply, adding demand to the respective edge. More...
Public Member Functions inherited from LinkGraph::ConstNode
| ConstNode (const LinkGraph *lg, NodeID node)
| Constructor. More...
ConstEdge | operator[] (NodeID to) const
| Get a ConstEdge. More...
ConstEdgeIterator | Begin () const
| Get an iterator pointing to the start of the edges array. More...
ConstEdgeIterator | End () const
| Get an iterator pointing beyond the end of the edges array. More...
Public Member Functions inherited from LinkGraph::NodeWrapper< const BaseNode, const BaseEdge >
| NodeWrapper (const BaseNode &node, const BaseEdge *edges, NodeID index)
| Wrap a node. More...
uint | Supply () const
| Get supply of wrapped node. More...
uint | Demand () const
| Get demand of wrapped node. More...
StationID | Station () const
| Get ID of station belonging to wrapped node. More...
Date | LastUpdate () const
| Get node's last update. More...
TileIndex | XY () const
| Get the location of the station associated with the node. More...

## Private Attributes
NodeAnnotation & | node_anno
| Annotation being wrapped.
EdgeAnnotation * | edge_annos
| Edge annotations belonging to this node.

## Additional Inherited Members
Protected Attributes inherited from LinkGraph::NodeWrapper< const BaseNode, const BaseEdge >
const BaseNode & | node
| Node being wrapped.
const BaseEdge * | edges
| Outgoing edges for wrapped node.
NodeID | index
| ID of wrapped node.

## Detailed Description

Link graph job node.

Wraps a constant link graph node and a modifiable node annotation.

Definition at line 184 of file linkgraphjob.h.

## Constructor & Destructor Documentation

## ◆ Node()

LinkGraphJob::Node::Node | ( | LinkGraphJob * | lgj,
|  | NodeID | node
| ) |  |
| inline

Constructor.

Parameters

  lgj | Job to take the node from.
  node | ID of the node.

Definition at line 195 of file linkgraphjob.h.

## Member Function Documentation

## ◆ Begin()

EdgeIterator LinkGraphJob::Node::Begin | ( |  | ) | const
| inline

Iterator for the "begin" of the edge array.

Only edges with capacity are iterated. The others are skipped.

Returns
  Iterator pointing to the first edge.

Definition at line 213 of file linkgraphjob.h.

Referenced by LinkGraphJob::~LinkGraphJob().

## ◆ DeliverSupply()

void LinkGraphJob::Node::DeliverSupply | ( | NodeID | to,
|  | uint | amount
| ) |  |
| inline

Deliver some supply, adding demand to the respective edge.

Parameters

  to | Destination for supply.
  amount | Amount of supply to be delivered.

Definition at line 258 of file linkgraphjob.h.

References LinkGraphJob::NodeAnnotation::undelivered_supply.

## ◆ End()

EdgeIterator LinkGraphJob::Node::End | ( |  | ) | const
| inline

Iterator for the "end" of the edge array.

Only edges with capacity are iterated. The others are skipped.

Returns
  Iterator pointing beyond the last edge.

Definition at line 220 of file linkgraphjob.h.

Referenced by LinkGraphJob::~LinkGraphJob().

## ◆ Flows() [1/2]

FlowStatMap& LinkGraphJob::Node::Flows | ( |  | ) |
| inline

Get the flows running through this node.

Returns
  Flows.

Definition at line 232 of file linkgraphjob.h.

References LinkGraphJob::NodeAnnotation::flows.

Referenced by LinkGraphJob::~LinkGraphJob().

## ◆ Flows() [2/2]

const FlowStatMap& LinkGraphJob::Node::Flows | ( |  | ) | const
| inline

Get a constant version of the flows running through this node.

Returns
  Flows.

Definition at line 238 of file linkgraphjob.h.

References LinkGraphJob::NodeAnnotation::flows.

## ◆ operator[]()

Edge LinkGraphJob::Node::operator[] | ( | NodeID | to | ) | const
| inline

Retrieve an edge starting at this node.

Mind that this returns an object, not a reference.

Parameters

  to | Remote end of the edge.

Returns
  Edge between this node and "to".

Definition at line 206 of file linkgraphjob.h.

## ◆ Paths() [1/2]

PathList& LinkGraphJob::Node::Paths | ( |  | ) |
| inline

Get the paths this node is part of.

Paths are always expected to be sorted so that those with flow == 0 are in the back of the list.

Returns
  Paths.

Definition at line 245 of file linkgraphjob.h.

References LinkGraphJob::NodeAnnotation::paths.

## ◆ Paths() [2/2]

const PathList& LinkGraphJob::Node::Paths | ( |  | ) | const
| inline

Get a constant version of the paths this node is part of.

Returns
  Paths.

Definition at line 251 of file linkgraphjob.h.

References LinkGraphJob::NodeAnnotation::paths.

## ◆ UndeliveredSupply()

uint LinkGraphJob::Node::UndeliveredSupply | ( |  | ) | const
| inline

Get amount of supply that hasn't been delivered, yet.

Returns
  Undelivered supply.

Definition at line 226 of file linkgraphjob.h.

References LinkGraphJob::NodeAnnotation::undelivered_supply.

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

- src/linkgraph/linkgraphjob.h