|
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 50 of file ValueTimeLine.h.
typedef std::map<SUMOReal, ValidValue> ValueTimeLine< T >::TimedValueMap [private] |
Sorted map from start of intervals to values.
Definition at line 173 of file ValueTimeLine.h.
typedef std::pair<bool, T> ValueTimeLine< T >::ValidValue [private] |
Value of time line, indicating validity.
Definition at line 170 of file ValueTimeLine.h.
| ValueTimeLine< T >::ValueTimeLine | ( | ) | [inline] |
Constructor.
Definition at line 53 of file ValueTimeLine.h.
| ValueTimeLine< T >::~ValueTimeLine | ( | ) | [inline] |
Destructor.
Definition at line 56 of file ValueTimeLine.h.
| void ValueTimeLine< T >::add | ( | SUMOReal | begin, |
| SUMOReal | end, | ||
| T | value | ||
| ) | [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 66 of file ValueTimeLine.h.
| bool ValueTimeLine< T >::describesTime | ( | SUMOReal | 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.
| [in] | the | time for which the value should be retrieved |
Definition at line 118 of file ValueTimeLine.h.
Referenced by MSEdgeWeightsStorage::retrieveExistingEffort(), and MSEdgeWeightsStorage::retrieveExistingTravelTime().
| void ValueTimeLine< T >::fillGaps | ( | T | value, |
| bool | extendOverBoundaries = false |
||
| ) | [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 152 of file ValueTimeLine.h.
| SUMOReal ValueTimeLine< T >::getSplitTime | ( | SUMOReal | low, |
| SUMOReal | 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.
| [in] | low | the time in the first interval |
| [in] | high | the time in the second interval |
Definition at line 137 of file ValueTimeLine.h.
| T ValueTimeLine< T >::getValue | ( | SUMOReal | 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.
| [in] | the | time for which the value should be retrieved |
Definition at line 100 of file ValueTimeLine.h.
Referenced by MSEdgeWeightsStorage::retrieveExistingEffort(), and MSEdgeWeightsStorage::retrieveExistingTravelTime().
TimedValueMap ValueTimeLine< T >::myValues [private] |
The list of time periods (with values)
Definition at line 176 of file ValueTimeLine.h.
Referenced by ValueTimeLine< SUMOReal >::add(), ValueTimeLine< SUMOReal >::describesTime(), ValueTimeLine< SUMOReal >::fillGaps(), ValueTimeLine< SUMOReal >::getSplitTime(), and ValueTimeLine< SUMOReal >::getValue().