Public Member Functions | |
LinkGraphJob () | |
Bare constructor, only for save/load. | |
LinkGraphJob (const LinkGraph &orig) | |
Create a link graph job from a link graph. | |
~LinkGraphJob () | |
Join the link graph job and destroy it. | |
bool | IsFinished () const |
Date | JoinDate () const |
const LinkGraphSettings & | Settings () const |
Get the link graph settings for this component. | |
LinkGraph & | Graph () |
Retrieve the link graph object we're working with. | |
EdgeAnnotationMatrix & | Edges () |
NodeAnnotationVector & | Nodes () |
EdgeAnnotation & | GetEdge (NodeID from, NodeID to) |
Get a reference to an edge annotation. | |
NodeAnnotation & | GetNode (NodeID num) |
Get a reference to a node annotation with the specified id. | |
Protected Member Functions | |
void | SpawnThread () |
Spawn a thread if possible and run the link graph job in the thread. | |
void | JoinThread () |
Join the calling thread with this job's thread if threading is enabled. | |
Protected Attributes | |
LinkGraph | link_graph |
LinkGraphSettings | settings |
Copy of _settings_game.linkgraph at spawn time. | |
ThreadObject * | thread |
Thread the job is running in or NULL if it's running in the main thread. | |
Date | join_date |
Date when the job is to be joined. | |
NodeAnnotationVector | nodes |
Extra node data necessary for link graph calculation. | |
EdgeAnnotationMatrix | edges |
Extra edge data necessary for link graph calculation. | |
Private Types | |
typedef SmallVector < NodeAnnotation, 16 > | NodeAnnotationVector |
typedef SmallMatrix < EdgeAnnotation > | EdgeAnnotationMatrix |
Friends | |
class | LinkGraphSchedule |
const SaveLoad * | GetLinkGraphJobDesc () |
Get a SaveLoad array for a link graph job. |
Definition at line 280 of file linkgraph.h.
LinkGraphJob::LinkGraphJob | ( | const LinkGraph & | orig | ) |
Create a link graph job from a link graph.
The link graph will be copied so that the calculations don't interfer with the normal operations on the original. The job is immediately started.
orig | Original LinkGraph to be copied. |
Definition at line 270 of file linkgraph.cpp.
EdgeAnnotation& LinkGraphJob::GetEdge | ( | NodeID | from, | |
NodeID | to | |||
) | [inline] |
Get a reference to an edge annotation.
from | Origin node. | |
to | Destination node. |
Definition at line 345 of file linkgraph.h.
References edges.
Referenced by Path::AddFlow(), MultiCommodityFlow::Dijkstra(), MCF1stPass::EliminateCycle(), MCF1stPass::MCF1stPass(), MCF2ndPass::MCF2ndPass(), InitHandler::Run(), and Scaler::SetDemands().
NodeAnnotation& LinkGraphJob::GetNode | ( | NodeID | num | ) | [inline] |
Get a reference to a node annotation with the specified id.
num | ID of the node. |
Definition at line 355 of file linkgraph.h.
References nodes.
Referenced by Path::AddFlow(), DemandCalculator::CalcDemand(), MCF1stPass::EliminateCycles(), InitHandler::Run(), FlowMapper::Run(), Scaler::SetDemands(), SymmetricScaler::SetDemands(), FlowEdgeIterator::SetNode(), and ~LinkGraphJob().
const LinkGraphSettings& LinkGraphJob::Settings | ( | ) | const [inline] |
Get the link graph settings for this component.
Definition at line 316 of file linkgraph.h.
References settings.
Referenced by DemandCalculator::DemandCalculator(), MCF1stPass::MCF1stPass(), MCF2ndPass::MCF2ndPass(), and FlowMapper::Run().
void LinkGraphJob::SpawnThread | ( | ) | [protected] |
Spawn a thread if possible and run the link graph job in the thread.
If that's not possible run the job right now in the current thread.
Definition at line 379 of file linkgraph.cpp.
References ThreadObject::New(), LinkGraphSchedule::Run(), and thread.
Referenced by LinkGraphSchedule::SpawnNext().
const SaveLoad* GetLinkGraphJobDesc | ( | ) | [friend] |
Get a SaveLoad array for a link graph job.
The settings struct is derived from the global settings saveload array. The exact entries are calculated when the function is called the first time. It's necessary to keep a copy of the settings for each link graph job so that you can change the settings while in-game and still not mess with current link graph runs. Of course the settings have to be saved and loaded, too, to avoid desyncs.
Definition at line 43 of file linkgraph_sl.cpp.