![]() |
F´ Flight Software - C/C++ Documentation
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 = FwSizeType |
Public Member Functions | |
| TimeInterval ()=default | |
| ~TimeInterval ()=default | |
| TimeInterval (const TimeInterval &other) | |
| TimeInterval (U32 seconds, U32 useconds) | |
| TimeInterval (const Time &start, const Time &end) | |
| void | set (U32 seconds, U32 useconds) |
| U32 | getSeconds () const |
| U32 | getUSeconds () const |
| SerializeStatus | serializeTo (SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) const override |
| Serialize the contents of this object to a buffer. More... | |
| SerializeStatus | deserializeFrom (SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) override |
| Deserialize the contents of this object from a buffer. 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) |
| TimeIntervalValue | asTimeIntervalValue () const |
| get the underlying TimeIntervalValue More... | |
Public Member Functions inherited from Fw::Serializable | |
| Serializable & | operator= (const Serializable &src)=default |
| TODO: this operator should be deleted, this must be done after RawTime is modified though. More... | |
| DEPRECATED (SerializeStatus serialize(SerialBufferBase &buffer) const, "Use serializeTo(SerialBufferBase& buffer) instead") | |
| DEPRECATED (SerializeStatus deserialize(SerialBufferBase &buffer), "Use deserializeFrom(SerialBufferBase& buffer) instead") | |
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 () |
| Virtual destructor. More... | |
Definition at line 20 of file TimeInterval.hpp.
| anonymous enum |
| Enumerator | |
|---|---|
| SERIALIZED_SIZE | |
Definition at line 22 of file TimeInterval.hpp.
The type of a comparison result.
| Enumerator | |
|---|---|
| LT | |
| EQ | |
| GT | |
| INCOMPARABLE | |
Definition at line 51 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.
Definition at line 13 of file TimeInterval.cpp.
| void TimeInterval::add | ( | U32 | seconds, |
| U32 | mseconds | ||
| ) |
Definition at line 126 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 97 of file TimeInterval.cpp.
| TimeIntervalValue TimeInterval::asTimeIntervalValue | ( | ) | const |
get the underlying TimeIntervalValue
Definition at line 56 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 78 of file TimeInterval.cpp.
|
overridevirtual |
Deserialize the contents of this object from a buffer.
This method reads serialized data from the provided buffer and reconstructs the object's data from it. The buffer should contain data in the format produced by serializeTo().
| buffer | Reference to the SerialBufferBase from which data will be deserialized |
| mode | Endianness mode for deserialization (default is Endianness::BIG) |
Implements Fw::Serializable.
Definition at line 65 of file TimeInterval.cpp.
| U32 TimeInterval::getSeconds | ( | ) | const |
Definition at line 70 of file TimeInterval.cpp.
| U32 TimeInterval::getUSeconds | ( | ) | const |
Definition at line 74 of file TimeInterval.cpp.
| bool TimeInterval::operator!= | ( | const TimeInterval & | other | ) | const |
Definition at line 34 of file TimeInterval.cpp.
| bool TimeInterval::operator< | ( | const TimeInterval & | other | ) | const |
Definition at line 42 of file TimeInterval.cpp.
| bool TimeInterval::operator<= | ( | const TimeInterval & | other | ) | const |
Definition at line 51 of file TimeInterval.cpp.
| TimeInterval & TimeInterval::operator= | ( | const TimeInterval & | other | ) |
Definition at line 23 of file TimeInterval.cpp.
| bool TimeInterval::operator== | ( | const TimeInterval & | other | ) | const |
Definition at line 30 of file TimeInterval.cpp.
| bool TimeInterval::operator> | ( | const TimeInterval & | other | ) | const |
Definition at line 38 of file TimeInterval.cpp.
| bool TimeInterval::operator>= | ( | const TimeInterval & | other | ) | const |
Definition at line 46 of file TimeInterval.cpp.
|
overridevirtual |
Serialize the contents of this object to a buffer.
This method serializes the object's data into the provided buffer. The serialization process converts the object's data into a format that can be stored or transmitted, and then writes it to the buffer.
| buffer | Reference to the SerialBufferBase where data will be serialized |
| mode | Endianness mode for serialization (default is Endianness::BIG) |
Implements Fw::Serializable.
Definition at line 60 of file TimeInterval.cpp.
| void TimeInterval::set | ( | U32 | seconds, |
| U32 | useconds | ||
| ) |
Definition at line 17 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 109 of file TimeInterval.cpp.