This class describes a time point with respect to some time reference frame.
More...
#include <time.hpp>
|
| Time | operator+ (Time time_1, const Time &time_2) |
| | Add an operator + for two time points. More...
|
| |
| template<typename IntT , typename DurationT > |
| Time | operator+ (const Time &time, const std::chrono::duration< IntT, DurationT > &duration) |
| | Overload operator +. More...
|
| |
| template<typename IntT , typename DurationT > |
| Time | operator- (const Time &time, const std::chrono::duration< IntT, DurationT > &duration) |
| | Overload operator -. More...
|
| |
template<TimeReferenceFrame kTimeReferenceFrame>
class autoware::prediction::Time< kTimeReferenceFrame >
This class describes a time point with respect to some time reference frame.
- Template Parameters
-
| kTimeReferenceFrame | A reference frame for the stored time_point. |
◆ Time() [1/2]
template<TimeReferenceFrame kTimeReferenceFrame>
◆ Time() [2/2]
template<TimeReferenceFrame kTimeReferenceFrame>
Constructs a new instance from a time_point.
- Parameters
-
| [in] | time_point | A time point. |
◆ is_valid()
template<TimeReferenceFrame kTimeReferenceFrame>
Determines if the stored time_point is valid.
- Returns
- True if valid, False otherwise.
◆ operator+ [1/2]
template<TimeReferenceFrame kTimeReferenceFrame>
template<typename IntT , typename DurationT >
| Time operator+ |
( |
const Time< kTimeReferenceFrame > & |
time, |
|
|
const std::chrono::duration< IntT, DurationT > & |
duration |
|
) |
| |
|
friend |
Overload operator +.
We cannot use the operator for the base class as we want to still return Time, not
an ordinary std::chrono::time_point.
- Parameters
-
| [in] | time | The base time point. |
| [in] | duration | The duration to add to the time point. |
- Template Parameters
-
| IntT | Help integer type to pass into the duration template. |
| DurationT | Type of ratio used as a duration. |
- Returns
- A new time point which represents the input time with duration added to it.
- Note
- This must be templated as otherwise the compiler gets confused as to which overload to pick in case the duration is not std::chrono::nanoseconds. If it does not match then the duration parameter matches better with an overload from std::chrono, while the first argument matches this class better. The compiler cannot pick the best one and throws a warning. Thus we template this function to make this choice ideal when used with Time class.
◆ operator+ [2/2]
template<TimeReferenceFrame kTimeReferenceFrame>
| Time operator+ |
( |
Time< kTimeReferenceFrame > |
time_1, |
|
|
const Time< kTimeReferenceFrame > & |
time_2 |
|
) |
| |
|
friend |
Add an operator + for two time points.
- Returns
- A new time point which is a sum of input ones.
◆ operator-
template<TimeReferenceFrame kTimeReferenceFrame>
template<typename IntT , typename DurationT >
| Time operator- |
( |
const Time< kTimeReferenceFrame > & |
time, |
|
|
const std::chrono::duration< IntT, DurationT > & |
duration |
|
) |
| |
|
friend |
Overload operator -.
We cannot use the operator for the base class as we want to still return Time, not
an ordinary std::chrono::time_point.
- Parameters
-
| [in] | time | The base time point. |
| [in] | duration | The duration to subtract from the time point. |
- Template Parameters
-
| IntT | Help integer type to pass into the duration template. |
| DurationT | Type of ratio used as a duration. |
- Returns
- A new time point which represents the input time with duration subtracted from it.
- Note
- This must be templated as otherwise the compiler gets confused as to which overload to pick in case the duration is not std::chrono::nanoseconds. If it does not match then the duration parameter matches better with an overload from std::chrono, while the first argument matches this class better. The compiler cannot pick the best one and throws a warning. Thus we template this function to make this choice ideal when used with Time class.
The documentation for this class was generated from the following file: