Flow statistics telling how much flow should be and was sent along a link. More...
#include <station_base.h>
Data Structures | |
struct | Comparator |
Comparator for two flow stats for ordering them in a way that makes the next flow stat to sent cargo for show up as first element. More... | |
Public Member Functions | |
FORCEINLINE | FlowStat (uint distance=1, StationID st=INVALID_STATION, uint planned=0, uint sent=0) |
Create a flow stat. | |
FORCEINLINE | FlowStat (const FlowStat &prev, uint new_plan) |
Clone an existing flow stat, changing the plan. | |
FORCEINLINE FlowStat | GetDecreasedCopy () const |
Prevents one copy operation when moving a flowstat from one set to another and decreasing it at the same time. | |
FORCEINLINE void | Increase (uint sent) |
Increase the sent value. | |
FORCEINLINE uint | Sent () const |
Get an estimate of cargo sent along this link during the last 30 time units. | |
FORCEINLINE uint | Planned () const |
Get the amount of cargo planned to be sent along this link in 30 time units. | |
FORCEINLINE StationID | Via () const |
Get the station this link is connected to. | |
FORCEINLINE FlowStat & | operator+= (const FlowStat &other) |
Add up two flow stats' planned and sent figures and assign via from the other one to this one. | |
FORCEINLINE void | Clear () |
Clear this flow stat. | |
Private Attributes | |
uint | planned |
Cargo planned to be sent along a link each "month" (30 units of time, determined by moving average). | |
uint | sent |
Moving average of cargo being sent. | |
StationID | via |
Other end of the link. Can be this station, then it means "deliver here". | |
Friends | |
const SaveLoad * | GetFlowStatDesc () |
Wrapper function to get the FlowStats's internal structure while some of the variables are private. |
Flow statistics telling how much flow should be and was sent along a link.
Definition at line 156 of file station_base.h.
FORCEINLINE FlowStat::FlowStat | ( | uint | distance = 1 , |
|
StationID | st = INVALID_STATION , |
|||
uint | planned = 0 , |
|||
uint | sent = 0 | |||
) | [inline] |
Create a flow stat.
distance | Distance to be used as length of moving average. | |
st | Remote station. | |
planned | Cargo planned to be sent along this link. | |
sent | Cargo already sent along this link. |
Definition at line 172 of file station_base.h.
FORCEINLINE FlowStat::FlowStat | ( | const FlowStat & | prev, | |
uint | new_plan | |||
) | [inline] |
Clone an existing flow stat, changing the plan.
prev | Flow stat to be cloned. | |
new_plan | New value for planned. |
Definition at line 180 of file station_base.h.
FORCEINLINE void FlowStat::Increase | ( | uint | sent | ) | [inline] |
Increase the sent value.
sent | Amount to be added to sent. |
Definition at line 197 of file station_base.h.
Referenced by GoodsEntry::UpdateFlowStats().
Add up two flow stats' planned and sent figures and assign via from the other one to this one.
other | Flow stat to add to this one. |
Definition at line 258 of file station_base.h.
FORCEINLINE uint FlowStat::Planned | ( | ) | const [inline] |
Get the amount of cargo planned to be sent along this link in 30 time units.
Definition at line 215 of file station_base.h.
References planned.
Referenced by LinkGraphOverlay::AddStats(), FlowStat::Comparator::operator()(), and StationViewWindow::RecalcDestinations().
FORCEINLINE uint FlowStat::Sent | ( | ) | const [inline] |
Get an estimate of cargo sent along this link during the last 30 time units.
Definition at line 206 of file station_base.h.
References MovingAverage< uint >::Monthly(), and sent.
Referenced by FlowStat::Comparator::operator()().
FORCEINLINE StationID FlowStat::Via | ( | ) | const [inline] |
Get the station this link is connected to.
Definition at line 224 of file station_base.h.
References via.
Referenced by StationViewWindow::BuildFlowList(), GoodsEntry::GetSumFlowVia(), FlowStat::Comparator::operator()(), and StationViewWindow::RecalcDestinations().
const SaveLoad* GetFlowStatDesc | ( | ) | [friend] |
Wrapper function to get the FlowStats's internal structure while some of the variables are private.
Definition at line 268 of file station_sl.cpp.