Data Structures | Public Member Functions | Private Attributes | Friends

FlowStat Class Reference

Flow statistics telling how much flow should be and was sent along a link. More...

#include <station_base.h>

Inheritance diagram for FlowStat:
MovingAverage< uint >

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 FlowStatoperator+= (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 SaveLoadGetFlowStatDesc ()
 Wrapper function to get the FlowStats's internal structure while some of the variables are private.

Detailed Description

Flow statistics telling how much flow should be and was sent along a link.

Definition at line 157 of file station_base.h.


Constructor & Destructor Documentation

FORCEINLINE FlowStat::FlowStat ( uint  distance = 1,
StationID  st = INVALID_STATION,
uint  planned = 0,
uint  sent = 0 
) [inline]

Create a flow stat.

Parameters:
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 173 of file station_base.h.

FORCEINLINE FlowStat::FlowStat ( const FlowStat prev,
uint  new_plan 
) [inline]

Clone an existing flow stat, changing the plan.

Parameters:
prev Flow stat to be cloned.
new_plan New value for planned.

Definition at line 181 of file station_base.h.


Member Function Documentation

FORCEINLINE void FlowStat::Increase ( uint  sent  )  [inline]

Increase the sent value.

Parameters:
sent Amount to be added to sent.

Definition at line 198 of file station_base.h.

Referenced by GoodsEntry::UpdateFlowStats().

FORCEINLINE FlowStat& FlowStat::operator+= ( const FlowStat other  )  [inline]

Add up two flow stats' planned and sent figures and assign via from the other one to this one.

Parameters:
other Flow stat to add to this one.
Returns:
This flow stat.

Definition at line 259 of file station_base.h.

References planned, sent, and via.

FORCEINLINE uint FlowStat::Planned (  )  const [inline]

Get the amount of cargo planned to be sent along this link in 30 time units.

Returns:
Cargo planned to be sent.

Definition at line 216 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.

Returns:
Cargo sent along this link.

Definition at line 207 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.

Returns:
Remote station.

Definition at line 225 of file station_base.h.

References via.

Referenced by StationViewWindow::BuildFlowList(), GoodsEntry::GetSumFlowVia(), FlowStat::Comparator::operator()(), and StationViewWindow::RecalcDestinations().


Friends And Related Function Documentation

const SaveLoad* GetFlowStatDesc (  )  [friend]

Wrapper function to get the FlowStats's internal structure while some of the variables are private.

Returns:
the saveload description for FlowStat.

Definition at line 268 of file station_sl.cpp.


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