Public Member Functions | Data Fields | Private Member Functions

# Node Class Reference

Node of the link graph. More...

`#include <linkgraph.h>`

## Public Member Functions
| ~Node ()
| Clear a node on destruction to delete paths that might remain.
void | Init (StationID st=INVALID_STATION, uint sup=0, uint dem=0)
| Create a node or clear it.
void | ExportFlows (CargoID cargo)
| Export all flows of this node to the main game state.
## Data Fields
uint | supply
| Supply at the station.
uint | undelivered_supply
| Amount of supply that hasn't been distributed yet.
uint | demand
| Acceptance at the station.
StationID | station
| Station ID.
PathSet | paths
| Paths through this node.
FlowMap | flows
| Planned flows to other nodes.
## Private Member Functions
void | ExportFlows (FlowMap::iterator &it, FlowStatMap &station_flows, CargoID cargo)
| Exports all entries in the FlowViaMap pointed to by "source_flows_it", erases the source flows and increments the iterator afterwards.

## Detailed Description

Node of the link graph.

contains all relevant information from the associated station. It's copied so that the link graph job can work on its own data set in a separate thread.

Definition at line 38 of file linkgraph.h.

## Member Function Documentation

void Node::ExportFlows | ( | CargoID | cargo | ) |

Export all flows of this node to the main game state.

Parameters:

  | cargo | The cargo we're exporting flows for.

Definition at line 353 of file linkgraph.cpp.

References flows, GoodsEntry::flows, SpecializedStation< Station, false >::Get(), Station::goods, and station.

Referenced by LinkGraph::Join().

void Node::ExportFlows | ( | FlowMap::iterator & | it,
|  | FlowStatMap & | station_flows,
|  | CargoID | cargo |
| ) |  |  | `[private]`

Exports all entries in the FlowViaMap pointed to by "source_flows_it", erases the source flows and increments the iterator afterwards.

Parameters:

  | it | Iterator pointing to the flows to be exported into the main game state.
  | dest | Flow stats to which the flows shall be exported.
  | cargo | Cargo we're exporting flows for (used to check if the link stats for the new flows still exist).

Definition at line 314 of file linkgraph.cpp.

References FlowStat::AddShare(), flows, SpecializedStation< Station, false >::Get(), SpecializedStation< Station, false >::GetIfValid(), Station::goods, SpecializedStation< Station, false >::IsValidID(), GoodsEntry::link_stats, and station.

void Node::Init | ( | StationID | st = `INVALID_STATION`,
|  | uint | sup = `0`,
|  | uint | dem = `0` |
| ) |  |  | `[inline]`

Create a node or clear it.

Parameters:

  | st | ID of the associated station.
  | sup | Supply of cargo at the station last month.
  | dem | Acceptance for cargo at the station.

Definition at line 40 of file linkgraph.cpp.

References demand, flows, paths, station, supply, and undelivered_supply.

Referenced by ~Node().

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

- src/linkgraph/linkgraph.h
- src/linkgraph/linkgraph.cpp