F´ Flight Software - C/C++ Documentation NASA-v1.6.0
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
TimerVal.cpp
Go to the documentation of this file.
1/*
2 * TimerVal.cpp
3 *
4 * Created on: Aug 5, 2015
5 * Author: timothycanham
6 */
7
9#include <cstring>
10
11namespace Svc {
12
13 TimerVal::TimerVal() : Fw::Serializable() {
14 this->m_timerVal.upper = 0;
15 this->m_timerVal.lower = 0;
16 }
17
18 TimerVal::TimerVal(U32 upper, U32 lower) {
19 this->m_timerVal.upper = upper;
20 this->m_timerVal.lower = lower;
21 }
22
23 TimerVal::TimerVal(const TimerVal& other) : Fw::Serializable() {
24 this->m_timerVal.upper = other.m_timerVal.upper;
25 this->m_timerVal.lower = other.m_timerVal.lower;
26 }
27
29 this->m_timerVal.upper = other.m_timerVal.upper;
30 this->m_timerVal.lower = other.m_timerVal.lower;
31 return *this;
32 }
33
35 return this->m_timerVal;
36 }
37
39 Os::IntervalTimer::getRawTime(this->m_timerVal);
40 }
41
42 U32 TimerVal::diffUSec(const TimerVal& time) {
43 return Os::IntervalTimer::getDiffUsec(this->m_timerVal,time.m_timerVal);
44 }
45
47 Fw::SerializeStatus stat = buffer.serialize(this->m_timerVal.upper);
48 if (stat != Fw::FW_SERIALIZE_OK) {
49 return stat;
50 }
51 return buffer.serialize(this->m_timerVal.lower);
52 }
53
55 Fw::SerializeStatus stat = buffer.deserialize(this->m_timerVal.upper);
56 if (stat != Fw::FW_SERIALIZE_OK) {
57 return stat;
58 }
59 return buffer.deserialize(this->m_timerVal.lower);
60 }
61
62
63
64} /* namespace Svc */
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
static void getRawTime(RawTime &time)
Serializable class for carrying timer values.
Definition TimerVal.hpp:22
TimerVal()
Default constructor.
Definition TimerVal.cpp:13
Os::IntervalTimer::RawTime getTimerVal() const
Returns the current timer value.
Definition TimerVal.cpp:34
Fw::SerializeStatus serialize(Fw::SerializeBufferBase &buffer) const
Serialization function.
Definition TimerVal.cpp:46
TimerVal & operator=(const TimerVal &other)
Timer equal operator.
Definition TimerVal.cpp:28
void take()
Function to store a timer value.
Definition TimerVal.cpp:38
U32 diffUSec(const TimerVal &time)
Compute difference function.
Definition TimerVal.cpp:42
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase &buffer)
Deserialization function.
Definition TimerVal.cpp:54
Definition Buffer.cpp:21
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.
U32 lower
Lower 32-bits part of time value. Platform dependent.
U32 upper
Upper 32-bits part of time value. Platform dependent.