F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
RawTimeInterface.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title Os/RawTimeInterface.hpp
3 // \brief Os::RawTimeHandle and Os::RawTimeInterface definitions
4 // ======================================================================
5 #ifndef OS_RAWTIMEINTERFACE_HPP_
6 #define OS_RAWTIMEINTERFACE_HPP_
7 
11 #include <Os/Os.hpp>
12 #include "config/OsDelegateRawTime.hpp"
13 #include "config/RawTimeSource.hpp"
14 
15 namespace Os {
16 
17 struct RawTimeHandle {};
18 
20  public:
21  // Serialization size for RawTime objects, configured in config/FpConfig.h
23 
24  enum Status {
30  };
31 
33  RawTimeInterface() = default;
34 
36  virtual ~RawTimeInterface() = default;
37 
40  virtual RawTimeHandle* getHandle() = 0;
41 
47  static RawTimeInterface* getDelegate(RawTimeHandleStorage& aligned_new_memory,
48  const RawTimeInterface* to_copy = nullptr,
50 
51  // ------------------------------------------------------------------
52  // RawTime operations to be implemented by an OSAL implementation
53  // ------------------------------------------------------------------
54 
61  virtual Status now() = 0;
62 
71  virtual Status getTimeInterval(const Os::RawTime& other, Fw::TimeInterval& interval) const = 0;
72 
87  Fw::Endianness mode = Fw::Endianness::BIG) const = 0;
88 
104 
105  // ------------------------------------------------------------------
106  // Common virtual functions built on top of OS-specific functions
107  // ------------------------------------------------------------------
108 
121  virtual Status getDiffUsec(const RawTime& other, U32& result) const;
122 
124  virtual bool operator==(const RawTime& other) const;
125 };
126 } // namespace Os
127 
128 #endif // OS_RAWTIMEINTERFACE_HPP_
RawTimeSource
Timer source selection for RawTime.
Platform&#39;s default timer (maintains current behavior)
PlatformSizeType FwSizeType
Operation was successful.
U8 RawTimeHandleStorage[FW_RAW_TIME_HANDLE_MAX_SIZE]
Definition: Os.hpp:21
virtual Status now()=0
Get the current time.
static const FwSizeType SERIALIZED_SIZE
virtual Status getDiffUsec(const RawTime &other, U32 &result) const
Calculate the difference in microseconds between two RawTime objects.
virtual ~RawTimeInterface()=default
default virtual destructor
SerializeStatus
forward declaration for string
RawTime does not support operation.
virtual Fw::SerializeStatus serializeTo(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) const =0
Serialize the contents of the RawTimeInterface object into a buffer.
virtual RawTimeHandle * getHandle()=0
return the underlying RawTime handle (implementation specific)
virtual bool operator==(const RawTime &other) const
Compare whether two RawTime objects are the same (i.e. refer to the same microsecond) ...
Operation result caused an overflow.
RawTimeInterface()=default
default constructor
Parameters invalid for current platform.
static RawTimeInterface * getDelegate(RawTimeHandleStorage &aligned_new_memory, const RawTimeInterface *to_copy=nullptr, RawTimeSource source=RAWTIME_DEFAULT)
provide a pointer to a RawTime delegate object
Endianness
virtual Status getTimeInterval(const Os::RawTime &other, Fw::TimeInterval &interval) const =0
Calculate the time interval between this and another raw time.
virtual Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG)=0
Deserialize the contents of the RawTimeInterface object from a buffer.
Big endian serialization.