Eclipse SUMO - Simulation of Urban MObility
|
#include <ValueTimeLine.h>
Public Member Functions | |
void | add (double begin, double end, T value) |
Adds a value for a time interval into the container. | |
bool | describesTime (double 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. | |
double | getSplitTime (double low, double high) const |
Returns the time point at which the value changes. | |
T | getValue (double time) const |
Returns the value for the given time. | |
ValueTimeLine () | |
Constructor. | |
~ValueTimeLine () | |
Destructor. | |
Private Types | |
typedef std::map< double, 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 43 of file ValueTimeLine.h.
|
private |
Sorted map from start of intervals to values.
Definition at line 166 of file ValueTimeLine.h.
|
private |
Value of time line, indicating validity.
Definition at line 163 of file ValueTimeLine.h.
|
inline |
Constructor.
Definition at line 46 of file ValueTimeLine.h.
|
inline |
Destructor.
Definition at line 49 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 59 of file ValueTimeLine.h.
References ValueTimeLine< T >::myValues.
Referenced by ROEdge::addEffort(), ROEdge::addTravelTime(), ROMAEdge::setFlow(), and ROMAEdge::setHelpFlow().
|
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 111 of file ValueTimeLine.h.
References ValueTimeLine< T >::myValues.
Referenced by ROEdge::getStoredEffort(), ROEdge::getTravelTime(), ROEdge::hasLoadedTravelTime(), 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 145 of file ValueTimeLine.h.
References ValueTimeLine< T >::myValues.
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 130 of file ValueTimeLine.h.
References ValueTimeLine< T >::myValues.
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 93 of file ValueTimeLine.h.
References ValueTimeLine< T >::myValues.
Referenced by ROMAEdge::getFlow(), ROMAEdge::getHelpFlow(), ROEdge::getStoredEffort(), ROEdge::getTravelTime(), MSEdgeWeightsStorage::retrieveExistingEffort(), and MSEdgeWeightsStorage::retrieveExistingTravelTime().
|
private |
The list of time periods (with values)
Definition at line 169 of file ValueTimeLine.h.
Referenced by ValueTimeLine< T >::add(), ValueTimeLine< T >::describesTime(), ValueTimeLine< T >::fillGaps(), ValueTimeLine< T >::getSplitTime(), and ValueTimeLine< T >::getValue().