F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
Os::RawTime Class Referencefinal

#include <Os/RawTime.hpp>

Inheritance diagram for Os::RawTime:
Os::RawTimeInterface Fw::Serializable

Public Member Functions

 RawTime ()
 Constructor. More...
 
 ~RawTime () final
 Destructor. More...
 
 RawTime (const RawTime &other)
 copy constructor that copies the internal representation More...
 
RawTimeoperator= (const RawTime &other)
 assignment operator that copies the internal representation More...
 
RawTimeHandlegetHandle () override
 return the underlying RawTime handle (implementation specific) More...
 
Status now () override
 Get the current time. More...
 
Status getTimeInterval (const Os::RawTime &other, Fw::TimeInterval &interval) const override
 Calculate the time interval between this and another raw time. More...
 
Fw::SerializeStatus serialize (Fw::SerializeBufferBase &buffer) const override
 Serialize the contents of the RawTimeInterface object into a buffer. More...
 
Fw::SerializeStatus deserialize (Fw::SerializeBufferBase &buffer) override
 Deserialize the contents of the RawTimeInterface object from a buffer. More...
 
Status getDiffUsec (const RawTime &other, U32 &result) const
 Calculate the difference in microseconds between two RawTime objects. More...
 
- Public Member Functions inherited from Os::RawTimeInterface
 RawTimeInterface ()=default
 default constructor More...
 
virtual ~RawTimeInterface ()=default
 default virtual destructor More...
 

Additional Inherited Members

- Public Types inherited from Os::RawTimeInterface
enum  Status { OP_OK , OP_OVERFLOW , INVALID_PARAMS , OTHER_ERROR }
 
- Public Types inherited from Fw::Serializable
using SizeType = NATIVE_UINT_TYPE
 
- Static Public Member Functions inherited from Os::RawTimeInterface
static RawTimeInterfacegetDelegate (RawTimeHandleStorage &aligned_new_memory, const RawTimeInterface *to_copy=nullptr)
 provide a pointer to a RawTime delegate object More...
 
- Static Public Attributes inherited from Os::RawTimeInterface
static const FwSizeType SERIALIZED_SIZE = FW_RAW_TIME_SERIALIZATION_MAX_SIZE
 
- Protected Member Functions inherited from Fw::Serializable
 Serializable ()
 Default constructor. More...
 
virtual ~Serializable ()
 destructor More...
 

Detailed Description

Definition at line 99 of file RawTime.hpp.

Constructor & Destructor Documentation

◆ RawTime() [1/2]

Os::RawTime::RawTime ( )

Constructor.

Definition at line 10 of file RawTime.cpp.

◆ ~RawTime()

Os::RawTime::~RawTime ( )
final

Destructor.

Definition at line 14 of file RawTime.cpp.

◆ RawTime() [2/2]

Os::RawTime::RawTime ( const RawTime other)

copy constructor that copies the internal representation

Definition at line 19 of file RawTime.cpp.

Member Function Documentation

◆ deserialize()

Fw::SerializeStatus Os::RawTime::deserialize ( Fw::SerializeBufferBase buffer)
overridevirtual

Deserialize the contents of the RawTimeInterface object from a buffer.

This function deserializes the contents of the RawTimeInterface object from the provided buffer.

Note
The serialization must fit within FW_RAW_TIME_SERIALIZATION_MAX_SIZE bytes. This value is defined in FpConfig.h. For example, Posix systems use a pair of U32 (sec, nanosec) and can therefore serialize in 8 bytes. Should an OSAL implementation require more than this, the project must increase that value in its config/ folder.
Parameters
bufferThe buffer to deserialize the contents from.
Returns
Fw::SerializeStatus indicating the result of the deserialization.

Implements Os::RawTimeInterface.

Definition at line 51 of file RawTime.cpp.

◆ getDiffUsec()

RawTime::Status Os::RawTime::getDiffUsec ( const RawTime other,
U32 &  result 
) const

Calculate the difference in microseconds between two RawTime objects.

This function calculates the difference in microseconds between the current RawTime object and another RawTime object provided as a parameter.

Warning
This function will return Status::OP_OVERFLOW if the time difference is too large to fit in a U32.
This means the largest time difference that can be measured is 2^32 microseconds (about 71 minutes).
Users should prefer getTimeInterval() for larger intervals.
Parameters
otherThe other RawTime object to compare against.
resultA reference to a U32 variable where the result will be stored.
Returns
Status indicating the result of the operation.

Definition at line 56 of file RawTime.cpp.

◆ getHandle()

RawTimeHandle * Os::RawTime::getHandle ( )
overridevirtual

return the underlying RawTime handle (implementation specific)

Returns
internal RawTime handle representation

Implements Os::RawTimeInterface.

Definition at line 31 of file RawTime.cpp.

◆ getTimeInterval()

RawTime::Status Os::RawTime::getTimeInterval ( const Os::RawTime other,
Fw::TimeInterval interval 
) const
overridevirtual

Calculate the time interval between this and another raw time.

This function calculates the time interval between the current raw time and another specified raw time. The result is stored in the provided (output) interval object.

Parameters
otherThe other RawTimeHandle to compare against.
intervalOutput parameter to store the calculated time interval.
Returns
Status indicating the result of the operation.

Implements Os::RawTimeInterface.

Definition at line 41 of file RawTime.cpp.

◆ now()

RawTime::Status Os::RawTime::now ( )
overridevirtual

Get the current time.

This function retrieves the current time and stores it in the RawTime object. Each implementation should define its RawTimeHandle type for storing the time.

Returns
Status indicating the result of the operation.

Implements Os::RawTimeInterface.

Definition at line 36 of file RawTime.cpp.

◆ operator=()

RawTime & Os::RawTime::operator= ( const RawTime other)

assignment operator that copies the internal representation

Definition at line 24 of file RawTime.cpp.

◆ serialize()

Fw::SerializeStatus Os::RawTime::serialize ( Fw::SerializeBufferBase buffer) const
overridevirtual

Serialize the contents of the RawTimeInterface object into a buffer.

This function serializes the contents of the RawTimeInterface object into the provided buffer.

Note
The serialization must fit within FW_RAW_TIME_SERIALIZATION_MAX_SIZE bytes. This value is defined in FpConfig.h. For example, Posix systems use a pair of U32 (sec, nanosec) and can therefore serialize in 8 bytes. Should an OSAL implementation require more than this, the project must increase that value in its config/ folder.
Parameters
bufferThe buffer to serialize the contents into.
Returns
Fw::SerializeStatus indicating the result of the serialization.

Implements Os::RawTimeInterface.

Definition at line 46 of file RawTime.cpp.


The documentation for this class was generated from the following files: