SUMO - Simulation of Urban MObility
|
#include <ValueTimeLine.h>
Public Member Functions | |
void | add (SUMOReal begin, SUMOReal end, T value) |
Adds a value for a time interval into the container. | |
bool | describesTime (SUMOReal time) const |
Returns whether a value for the given time is known. | |
void | fillGaps (T value, bool extendOverBoundaries=false) |
Sets a default value for all unset intervals. | |
SUMOReal | getSplitTime (SUMOReal low, SUMOReal high) const |
Returns the time point at which the value changes. | |
T | getValue (SUMOReal time) const |
Returns the value for the given time. | |
ValueTimeLine () | |
Constructor. | |
~ValueTimeLine () | |
Destructor. |
Private Types | |
typedef std::map< SUMOReal, ValidValue > | TimedValueMap |
Sorted map from start of intervals to values. | |
typedef std::pair< bool, T > | ValidValue |
Value of time line, indicating validity. |
Private Attributes | |
TimedValueMap | myValues |
The list of time periods (with values) |
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 53 of file ValueTimeLine.h.
|
private |
Sorted map from start of intervals to values.
Definition at line 176 of file ValueTimeLine.h.
|
private |
Value of time line, indicating validity.
Definition at line 173 of file ValueTimeLine.h.
|
inline |
Constructor.
Definition at line 56 of file ValueTimeLine.h.
|
inline |
Destructor.
Definition at line 59 of file ValueTimeLine.h.
|
inline |
Adds a value for a time interval into the container.
Make sure that begin >= 0 and begin < end.
[in] | begin | the start time of the time range (inclusive) |
[in] | end | the end time of the time range (exclusive) |
[in] | value | the value to store |
Definition at line 69 of file ValueTimeLine.h.
Referenced by ROEdge::addEffort(), and ROEdge::addTravelTime().
|
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.
[in] | the | time for which the value should be retrieved |
Definition at line 121 of file ValueTimeLine.h.
Referenced by ROEdge::getStoredEffort(), ROEdge::getTravelTime(), MSEdgeWeightsStorage::retrieveExistingEffort(), and MSEdgeWeightsStorage::retrieveExistingTravelTime().
|
inline |
Sets a default value for all unset intervals.
[in] | value | the value to store |
[in] | extendOverBoundaries | whether the first/last value should be valid for later / earlier times as well |
Definition at line 155 of file ValueTimeLine.h.
Referenced by ROEdge::buildTimeLines().
|
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.
[in] | low | the time in the first interval |
[in] | high | the time in the second interval |
Definition at line 140 of file ValueTimeLine.h.
Referenced by ROEdge::getStoredEffort(), and ROEdge::getTravelTime().
|
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.
[in] | the | time for which the value should be retrieved |
Definition at line 103 of file ValueTimeLine.h.
Referenced by ROEdge::getStoredEffort(), ROEdge::getTravelTime(), MSEdgeWeightsStorage::retrieveExistingEffort(), and MSEdgeWeightsStorage::retrieveExistingTravelTime().
|
private |
The list of time periods (with values)
Definition at line 179 of file ValueTimeLine.h.
Referenced by ValueTimeLine< SUMOReal >::add(), ValueTimeLine< SUMOReal >::describesTime(), ValueTimeLine< SUMOReal >::fillGaps(), ValueTimeLine< SUMOReal >::getSplitTime(), and ValueTimeLine< SUMOReal >::getValue().