1 /** @file demands.h Declaration of demand calculating link graph handler. */
6 #include "linkgraphjob_base.h"
9 * Calculate the demands. This class has a state, but is recreated for each
10 * call to of DemandHandler::Run.
12 class DemandCalculator
{
14 DemandCalculator(LinkGraphJob
&job
);
17 int32 max_distance
; ///< Maximum distance possible on the map.
18 int32 mod_dist
; ///< Distance modifier, determines how much demands decrease with distance.
19 int32 accuracy
; ///< Accuracy of the calculation.
21 template<class Tscaler
>
22 void CalcDemand(LinkGraphJob
&job
, Tscaler scaler
);
26 * Stateless, thread safe demand hander. Doesn't do anything but call DemandCalculator.
28 class DemandHandler
: public ComponentHandler
{
32 * Call the demand calculator on the given component.
33 * @param graph Component to calculate the demands for.
35 virtual void Run(LinkGraphJob
&job
) const { DemandCalculator
c(job
); }
38 * Virtual destructor has to be defined because of virtual Run().
40 virtual ~DemandHandler() {}
43 #endif /* DEMANDS_H */