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_t base_distance
; ///< Base distance for scaling purposes.
18 int32_t mod_dist
; ///< Distance modifier, determines how much demands decrease with distance.
19 int32_t accuracy
; ///< Accuracy of the calculation.
21 template<class Tscaler
>
22 void CalcDemand(LinkGraphJob
&job
, Tscaler scaler
);
26 * Stateless, thread safe demand handler. Doesn't do anything but call DemandCalculator.
28 class DemandHandler
: public ComponentHandler
{
32 * Call the demand calculator on the given component.
33 * @param job Component to calculate the demands for.
35 void Run(LinkGraphJob
&job
) const override
{ DemandCalculator
c(job
); }
38 * Virtual destructor has to be defined because of virtual Run().
40 virtual ~DemandHandler() = default;
43 #endif /* DEMANDS_H */