Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Friends

LinkGraphJob Class Reference

Inheritance diagram for LinkGraphJob:
Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_link_graph_job_pool >

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 LinkGraphSettingsSettings () const
 Get the link graph settings for this component.
LinkGraphGraph ()
 Retrieve the link graph object we're working with.
EdgeAnnotationMatrixEdges ()
NodeAnnotationVectorNodes ()
EdgeAnnotationGetEdge (NodeID from, NodeID to)
 Get a reference to an edge annotation.
NodeAnnotationGetNode (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.
ThreadObjectthread
 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 SaveLoadGetLinkGraphJobDesc ()
 Get a SaveLoad array for a link graph job.

Detailed Description

Definition at line 280 of file linkgraph.h.


Constructor & Destructor Documentation

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.

Parameters:
orig Original LinkGraph to be copied.

Definition at line 267 of file linkgraph.cpp.


Member Function Documentation

EdgeAnnotation& LinkGraphJob::GetEdge ( NodeID  from,
NodeID  to 
) [inline]

Get a reference to an edge annotation.

Parameters:
from Origin node.
to Destination node.
Returns:
Edge annotation between from and to.

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.

Parameters:
num ID of the node.
Returns:
the Requested node annotation.

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.

Returns:
Settings.

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 376 of file linkgraph.cpp.

References ThreadObject::New(), LinkGraphSchedule::Run(), and thread.

Referenced by LinkGraphSchedule::SpawnNext().


Friends And Related Function Documentation

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.

Returns:
Array of SaveLoad structs.

Definition at line 43 of file linkgraph_sl.cpp.


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