Flow statistics telling how much flow should be sent along a link. More...
#include <station_base.h>
Public Types | |
typedef std::map< uint32, StationID > | SharesMap |
Public Member Functions | |
FORCEINLINE | FlowStat (StationID st, uint flow) |
FORCEINLINE void | AddShare (StationID st, uint flow) |
Add some flow. | |
uint | GetShare (StationID st) const |
Get flow for a station. | |
void | EraseShare (StationID st) |
Erase shares for specified station. | |
FORCEINLINE const SharesMap * | GetShares () const |
FORCEINLINE StationID | GetVia () const |
Get a station a package can be routed to. | |
Private Attributes | |
SharesMap | shares |
Shares of flow to be sent via specified station (or consumed locally). |
Flow statistics telling how much flow should be sent along a link.
This is done by creating "flow shares" and using std::map's upper_bound() method to look them up with a random number. A flow share is the difference between a key in a map and the previous key. So one key in the map doesn't actually mean anything by itself.
Definition at line 161 of file station_base.h.
FORCEINLINE void FlowStat::AddShare | ( | StationID | st, | |
uint | flow | |||
) | [inline] |
Add some flow.
st | Remote station. | |
flow | Amount of flow to be added. |
Definition at line 178 of file station_base.h.
References shares.
Referenced by Node::ExportFlows().
void FlowStat::EraseShare | ( | StationID | st | ) |
Erase shares for specified station.
st | Next Hop to be removed. |
Definition at line 3895 of file station_cmd.cpp.
References shares.
Referenced by DeleteStaleFlows().
uint FlowStat::GetShare | ( | StationID | st | ) | const |
Get flow for a station.
st | Station to get flow for. |
Definition at line 3878 of file station_cmd.cpp.
References shares.
FORCEINLINE StationID FlowStat::GetVia | ( | ) | const [inline] |
Get a station a package can be routed to.
This done by drawing a random number between 0 and sum_shares and then looking that up in the map with lower_bound. So each share gets selected with a probability dependent on its flow.
Definition at line 197 of file station_base.h.
References shares.