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:

## 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.

## Detailed Description

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

Definition at line 167 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 183 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 191 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 208 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 268 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 226 of file station_base.h.

References planned.

Referenced by FlowStat::Comparator::operator()().

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 217 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 235 of file station_base.h.

References via.

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

## 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:
  Saveload description for FlowStat.

Definition at line 267 of file station_sl.cpp.

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

- src/station_base.h