F´ Flight Software - C/C++ Documentation
devel
A framework for building embedded system applications to NASA flight quality standards.
|
#include <Fw/Time/TimeInterval.hpp>
Public Types | |
enum | { SERIALIZED_SIZE = sizeof(U32) * 2 } |
enum | Comparison { LT = -1 , EQ = 0 , GT = 1 , INCOMPARABLE = 2 } |
The type of a comparison result. More... | |
Public Types inherited from Fw::Serializable | |
using | SizeType = NATIVE_UINT_TYPE |
Public Member Functions | |
TimeInterval ()=default | |
~TimeInterval ()=default | |
TimeInterval (const TimeInterval &other) | |
TimeInterval (U32 seconds, U32 useconds) | |
void | set (U32 seconds, U32 useconds) |
U32 | getSeconds () const |
U32 | getUSeconds () const |
SerializeStatus | serialize (SerializeBufferBase &buffer) const |
serialize contents More... | |
SerializeStatus | deserialize (SerializeBufferBase &buffer) |
deserialize to contents More... | |
void | add (U32 seconds, U32 mseconds) |
bool | operator== (const TimeInterval &other) const |
bool | operator!= (const TimeInterval &other) const |
bool | operator> (const TimeInterval &other) const |
bool | operator< (const TimeInterval &other) const |
bool | operator>= (const TimeInterval &other) const |
bool | operator<= (const TimeInterval &other) const |
TimeInterval & | operator= (const TimeInterval &other) |
Static Public Member Functions | |
static Comparison | compare (const TimeInterval &time1, const TimeInterval &time2) |
static TimeInterval | add (const TimeInterval &a, const TimeInterval &b) |
static TimeInterval | sub (const TimeInterval &t1, const TimeInterval &t2) |
Additional Inherited Members | |
Protected Member Functions inherited from Fw::Serializable | |
Serializable () | |
Default constructor. More... | |
virtual | ~Serializable () |
destructor More... | |
Definition at line 18 of file TimeInterval.hpp.
anonymous enum |
Enumerator | |
---|---|
SERIALIZED_SIZE |
Definition at line 21 of file TimeInterval.hpp.
The type of a comparison result.
Enumerator | |
---|---|
LT | |
EQ | |
GT | |
INCOMPARABLE |
Definition at line 44 of file TimeInterval.hpp.
|
default |
|
default |
TimeInterval::TimeInterval | ( | const TimeInterval & | other | ) |
Definition at line 5 of file TimeInterval.cpp.
TimeInterval::TimeInterval | ( | U32 | seconds, |
U32 | useconds | ||
) |
Definition at line 9 of file TimeInterval.cpp.
|
static |
Add two time intervals Adds the seconds and microseconds fields of two time intervals together
a | TimeInterval a |
b | TimeInterval b |
Definition at line 104 of file TimeInterval.cpp.
void TimeInterval::add | ( | U32 | seconds, |
U32 | mseconds | ||
) |
Definition at line 141 of file TimeInterval.cpp.
|
static |
Compare two time intervals A time interval is considered greater than another if it spans a longer duration The comparison is done on the seconds first, then the microseconds if the seconds are equal
time1 | TimeInterval 1 |
time2 | TimeInterval 2 |
Definition at line 80 of file TimeInterval.cpp.
|
virtual |
deserialize to contents
Implements Fw::Serializable.
Definition at line 61 of file TimeInterval.cpp.
U32 TimeInterval::getSeconds | ( | ) | const |
Definition at line 72 of file TimeInterval.cpp.
U32 TimeInterval::getUSeconds | ( | ) | const |
Definition at line 76 of file TimeInterval.cpp.
bool TimeInterval::operator!= | ( | const TimeInterval & | other | ) | const |
Definition at line 29 of file TimeInterval.cpp.
bool TimeInterval::operator< | ( | const TimeInterval & | other | ) | const |
Definition at line 37 of file TimeInterval.cpp.
bool TimeInterval::operator<= | ( | const TimeInterval & | other | ) | const |
Definition at line 46 of file TimeInterval.cpp.
TimeInterval & TimeInterval::operator= | ( | const TimeInterval & | other | ) |
Definition at line 18 of file TimeInterval.cpp.
bool TimeInterval::operator== | ( | const TimeInterval & | other | ) | const |
Definition at line 25 of file TimeInterval.cpp.
bool TimeInterval::operator> | ( | const TimeInterval & | other | ) | const |
Definition at line 33 of file TimeInterval.cpp.
bool TimeInterval::operator>= | ( | const TimeInterval & | other | ) | const |
Definition at line 41 of file TimeInterval.cpp.
|
virtual |
void TimeInterval::set | ( | U32 | seconds, |
U32 | useconds | ||
) |
Definition at line 13 of file TimeInterval.cpp.
|
static |
Subtract two time intervals This computes the absolute value of the difference between two time intervals For example if t1=(0s, 5us) and t2=(0s, 3us), the result is (0s, 2us). This operation is commutative, i.e. the result is the same regardless of the order of the arguments.
t1 | TimeInterval 1 |
t2 | TimeInterval 2 |
Definition at line 121 of file TimeInterval.cpp.