Eclipse SUMO - Simulation of Urban MObility
ValueTimeLine< T > Class Template Reference

#include <ValueTimeLine.h>

Public Member Functions

void add (double begin, double end, T value)
 Adds a value for a time interval into the container. More...
 
bool describesTime (double time) const
 Returns whether a value for the given time is known. More...
 
void fillGaps (T value, bool extendOverBoundaries=false)
 Sets a default value for all unset intervals. More...
 
double getSplitTime (double low, double high) const
 Returns the time point at which the value changes. More...
 
getValue (double time) const
 Returns the value for the given time. More...
 
 ValueTimeLine ()
 Constructor. More...
 
 ~ValueTimeLine ()
 Destructor. More...
 

Private Types

typedef std::map< double, ValidValueTimedValueMap
 Sorted map from start of intervals to values. More...
 
typedef std::pair< bool, T > ValidValue
 Value of time line, indicating validity. More...
 

Private Attributes

TimedValueMap myValues
 The list of time periods (with values) More...
 

Detailed Description

template<typename T>
class ValueTimeLine< T >

A time line being a sorted container of non-overlapping time-ranges with assigned values. The container is sorted by the first value of the time-range while being filled. Every new inserted time range may overwrite or split one or multiple earlier intervals.

Definition at line 43 of file ValueTimeLine.h.

Member Typedef Documentation

◆ TimedValueMap

template<typename T >
typedef std::map<double, ValidValue> ValueTimeLine< T >::TimedValueMap
private

Sorted map from start of intervals to values.

Definition at line 166 of file ValueTimeLine.h.

◆ ValidValue

template<typename T >
typedef std::pair<bool, T> ValueTimeLine< T >::ValidValue
private

Value of time line, indicating validity.

Definition at line 163 of file ValueTimeLine.h.

Constructor & Destructor Documentation

◆ ValueTimeLine()

template<typename T >
ValueTimeLine< T >::ValueTimeLine ( )
inline

Constructor.

Definition at line 46 of file ValueTimeLine.h.

◆ ~ValueTimeLine()

template<typename T >
ValueTimeLine< T >::~ValueTimeLine ( )
inline

Destructor.

Definition at line 49 of file ValueTimeLine.h.

Member Function Documentation

◆ add()

template<typename T >
void ValueTimeLine< T >::add ( double  begin,
double  end,
value 
)
inline

Adds a value for a time interval into the container.

Make sure that begin >= 0 and begin < end.

Parameters
[in]beginthe start time of the time range (inclusive)
[in]endthe end time of the time range (exclusive)
[in]valuethe value to store

Definition at line 59 of file ValueTimeLine.h.

References ValueTimeLine< T >::myValues.

Referenced by ROEdge::addEffort(), ROEdge::addTravelTime(), ROMAEdge::setFlow(), and ROMAEdge::setHelpFlow().

Here is the caller graph for this function:

◆ describesTime()

template<typename T >
bool ValueTimeLine< T >::describesTime ( double  time) const
inline

Returns whether a value for the given time is known.

This method implements the bounds checking. It returns true if and only if an explicit value was set for the given time using add. Default values stemming from fillGaps are not considered valid.

Parameters
[in]thetime for which the value should be retrieved
Returns
whether a valid value was set

Definition at line 111 of file ValueTimeLine.h.

References ValueTimeLine< T >::myValues.

Referenced by ROEdge::getStoredEffort(), ROEdge::getTravelTime(), ROEdge::hasLoadedTravelTime(), MSEdgeWeightsStorage::retrieveExistingEffort(), and MSEdgeWeightsStorage::retrieveExistingTravelTime().

Here is the caller graph for this function:

◆ fillGaps()

template<typename T >
void ValueTimeLine< T >::fillGaps ( value,
bool  extendOverBoundaries = false 
)
inline

Sets a default value for all unset intervals.

Parameters
[in]valuethe value to store
[in]extendOverBoundarieswhether the first/last value should be valid for later / earlier times as well

Definition at line 145 of file ValueTimeLine.h.

References ValueTimeLine< T >::myValues.

Referenced by ROEdge::buildTimeLines().

Here is the caller graph for this function:

◆ getSplitTime()

template<typename T >
double ValueTimeLine< T >::getSplitTime ( double  low,
double  high 
) const
inline

Returns the time point at which the value changes.

If the two input parameters lie in two consecutive time intervals, this method returns the point at which the interval changes. In any other case -1 is returned.

Parameters
[in]lowthe time in the first interval
[in]highthe time in the second interval
Returns
the split point

Definition at line 130 of file ValueTimeLine.h.

References ValueTimeLine< T >::myValues.

Referenced by ROEdge::getStoredEffort(), and ROEdge::getTravelTime().

Here is the caller graph for this function:

◆ getValue()

template<typename T >
T ValueTimeLine< T >::getValue ( double  time) const
inline

Returns the value for the given time.

There is no bounds checking applied! If there was no value set, the return value is undefined, the method may even segfault.

Parameters
[in]thetime for which the value should be retrieved
Returns
the value for the time

Definition at line 93 of file ValueTimeLine.h.

References ValueTimeLine< T >::myValues.

Referenced by ROMAEdge::getFlow(), ROMAEdge::getHelpFlow(), ROEdge::getStoredEffort(), ROEdge::getTravelTime(), MSEdgeWeightsStorage::retrieveExistingEffort(), and MSEdgeWeightsStorage::retrieveExistingTravelTime().

Here is the caller graph for this function:

Field Documentation

◆ myValues

template<typename T >
TimedValueMap ValueTimeLine< T >::myValues
private

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