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
 the station's ID
PathSet paths
 paths through this node
FlowMap flows
 planned flows to other nodes

Private Member Functions

void ExportNewFlows (FlowMap::iterator &it, FlowStatSet &via_set, 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 39 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 350 of file linkgraph.cpp.

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

Referenced by LinkGraph::Join().

void Node::ExportNewFlows ( FlowMap::iterator &  it,
FlowStatSet dest,
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 the flow stats to which the flows shall be exported
cargo the cargo we're exporting flows for (used to check if the link stats for the new flows still exist)

Definition at line 313 of file linkgraph.cpp.

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

Referenced by ExportFlows().

void Node::Init ( StationID  st = INVALID_STATION,
uint  sup = 0,
uint  dem = 0 
)

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: