GCC Code Coverage Report


Directory: ./
File: Stub/RawTime.hpp
Date: 2026-09-03 22:13:09
Exec Total Coverage
Lines: 0 2 0.0%
Functions: 0 2 0.0%
Branches: 0 0 -%

Line Branch Exec Source
1 // ======================================================================
2 // \title Os/Stub/RawTime.hpp
3 // \brief stub definitions for Os::RawTime
4 // ======================================================================
5 #ifndef OS_STUB_RAWTIME_HPP
6 #define OS_STUB_RAWTIME_HPP
7
8 #include "Os/RawTime.hpp"
9
10 namespace Os {
11 namespace Stub {
12 namespace RawTime {
13
14 struct StubRawTimeHandle : public RawTimeHandle {};
15
16 //! \brief stub implementation of Os::RawTime
17 //!
18 //! Stub implementation of `RawTimeInterface`.
19 //!
20 class StubRawTime : public RawTimeInterface {
21 public:
22 //! \brief constructor
23 //!
24 StubRawTime() = default;
25
26 //! \brief destructor
27 //!
28 ~StubRawTime() override = default;
29
30 //! \brief return the underlying RawTime handle (implementation specific)
31 //! \return internal RawTime handle representation
32 RawTimeHandle* getHandle() override;
33
34 // ------------------------------------------------------------
35 // Implementation-specific RawTime overrides
36 // ------------------------------------------------------------
37 //! \brief Get the current time.
38 //!
39 //! This function retrieves the current time and stores it in the RawTime object.
40 //! Each implementation should define its RawTimeHandle type for storing the time.
41 //!
42 //! \return Status indicating the result of the operation.
43 Status now() override;
44
45 //! \brief Calculate the time interval between this and another raw time.
46 //!
47 //! This function calculates the time interval between the current raw time and another
48 //! specified raw time. The result is stored in the provided (output) interval object.
49 //!
50 //! \param other The other RawTimeHandle to compare against.
51 //! \param interval Output parameter to store the calculated time interval.
52 //! \return Status indicating the result of the operation.
53 Status getTimeInterval(const Os::RawTime& other, Fw::TimeInterval& interval) const override;
54
55 //! \brief Serialize the contents of the RawTimeInterface object into a buffer.
56 //!
57 //! This function serializes the contents of the RawTimeInterface object into the provided
58 //! buffer.
59 //!
60 //! \note The serialization must fit within `FW_RAW_TIME_SERIALIZATION_MAX_SIZE` bytes. This value is
61 //! defined in FpConfig.h. For example, Posix systems use a pair of U32 (sec, nanosec) and can therefore
62 //! serialize in 8 bytes. Should an OSAL implementation require more than this, the project must increase
63 //! that value in its config/ folder.
64 //!
65 //! \param buffer The buffer to serialize the contents into.
66 //! \return Fw::SerializeStatus indicating the result of the serialization.
67 Fw::SerializeStatus serializeTo(Fw::SerialBufferBase& buffer,
68 Fw::Endianness mode = Fw::Endianness::BIG) const override;
69
70 //! \brief Deserialize the contents of the RawTimeInterface object from a buffer.
71 //!
72 //! This function deserializes the contents of the RawTimeInterface object from the provided
73 //! buffer.
74 //!
75 //! \note The serialization must fit within `FW_RAW_TIME_SERIALIZATION_MAX_SIZE` bytes. This value is
76 //! defined in FpConfig.h. For example, Posix systems use a pair of U32 (sec, nanosec) and can therefore
77 //! serialize in 8 bytes. Should an OSAL implementation require more than this, the project must increase
78 //! that value in its config/ folder.
79 //!
80 //! \param buffer The buffer to deserialize the contents from.
81 //! \return Fw::SerializeStatus indicating the result of the deserialization.
82 Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase& buffer,
83 Fw::Endianness mode = Fw::Endianness::BIG) override;
84
85 private:
86 //! Handle for StubRawTime
87 StubRawTimeHandle m_handle;
88 };
89
90 } // namespace RawTime
91 } // namespace Stub
92 } // namespace Os
93 #endif // OS_STUB_RAWTIME_HPP
94