F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Fw::Time Class Reference

#include <Fw/Time/Time.hpp>

Inheritance diagram for Fw::Time:
Fw::Serializable

Public Types

enum  { SERIALIZED_SIZE = sizeof(FwTimeBaseStoreType) + sizeof(FwTimeContextStoreType) + sizeof(U32) + sizeof(U32) }
 
- Public Types inherited from Fw::Serializable
using SizeType = FwSizeType
 

Public Member Functions

 Time ()
 
 Time (const Time &other)
 
 Time (U32 seconds, U32 useconds)
 
 Time (TimeBase timeBase, U32 seconds, U32 useconds)
 
 Time (TimeBase timeBase, FwTimeContextStoreType context, U32 seconds, U32 useconds)
 
virtual ~Time ()
 
void set (U32 seconds, U32 useconds)
 
void set (TimeBase timeBase, U32 seconds, U32 useconds)
 
void set (TimeBase timeBase, FwTimeContextStoreType context, U32 seconds, U32 useconds)
 
void setTimeBase (TimeBase timeBase)
 
void setTimeContext (FwTimeContextStoreType context)
 
U32 getSeconds () const
 
U32 getUSeconds () const
 
TimeBase getTimeBase () const
 
FwTimeContextStoreType getContext () 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...
 
bool operator== (const Time &other) const
 
bool operator!= (const Time &other) const
 
bool operator> (const Time &other) const
 
bool operator< (const Time &other) const
 
bool operator>= (const Time &other) const
 
bool operator<= (const Time &other) const
 
Timeoperator= (const Time &other)
 
void add (U32 seconds, U32 mseconds)
 
- Public Member Functions inherited from Fw::Serializable
Serializableoperator= (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 Time zero (TimeBase timeBase=TimeBase::TB_NONE)
 The type of a comparison result. More...
 
static TimeComparison compare (const Time &time1, const Time &time2)
 
static Time add (const Time &a, const Time &b)
 
static Time sub (const Time &minuend, const Time &subtrahend)
 

Friends

class TimeTester
 

Additional Inherited Members

- Protected Member Functions inherited from Fw::Serializable
 Serializable ()
 Default constructor. More...
 
virtual ~Serializable ()
 Virtual destructor. More...
 

Detailed Description

Definition at line 12 of file Time.hpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
SERIALIZED_SIZE 

Definition at line 16 of file Time.hpp.

Constructor & Destructor Documentation

◆ Time() [1/5]

Fw::Time::Time ( )

Definition at line 7 of file Time.cpp.

◆ Time() [2/5]

Fw::Time::Time ( const Time other)

Definition at line 16 of file Time.cpp.

◆ Time() [3/5]

Fw::Time::Time ( U32  seconds,
U32  useconds 
)

Definition at line 21 of file Time.cpp.

◆ Time() [4/5]

Fw::Time::Time ( TimeBase  timeBase,
U32  seconds,
U32  useconds 
)

Definition at line 25 of file Time.cpp.

◆ Time() [5/5]

Fw::Time::Time ( TimeBase  timeBase,
FwTimeContextStoreType  context,
U32  seconds,
U32  useconds 
)

Definition at line 37 of file Time.cpp.

◆ ~Time()

Fw::Time::~Time ( )
virtual

Definition at line 14 of file Time.cpp.

Member Function Documentation

◆ add() [1/2]

Time Fw::Time::add ( const Time a,
const Time b 
)
static

Add two times

Returns
The result
Parameters
aTime a
bTime b

Definition at line 134 of file Time.cpp.

◆ add() [2/2]

void Fw::Time::add ( U32  seconds,
U32  mseconds 
)

Definition at line 184 of file Time.cpp.

◆ compare()

TimeComparison Fw::Time::compare ( const Time time1,
const Time time2 
)
static

Compare two times

Returns
The result
Parameters
time1Time 1
time2Time 2

Definition at line 109 of file Time.cpp.

◆ deserializeFrom()

SerializeStatus Fw::Time::deserializeFrom ( SerialBufferBase buffer,
Fw::Endianness  mode = Fw::Endianness::BIG 
)
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().

Parameters
bufferReference to the SerialBufferBase from which data will be deserialized
modeEndianness mode for deserialization (default is Endianness::BIG)
Returns
SerializeStatus indicating the result of the operation

Implements Fw::Serializable.

Definition at line 84 of file Time.cpp.

◆ getContext()

FwTimeContextStoreType Fw::Time::getContext ( ) const

Definition at line 100 of file Time.cpp.

◆ getSeconds()

U32 Fw::Time::getSeconds ( ) const

Definition at line 88 of file Time.cpp.

◆ getTimeBase()

TimeBase Fw::Time::getTimeBase ( ) const

Definition at line 96 of file Time.cpp.

◆ getUSeconds()

U32 Fw::Time::getUSeconds ( ) const

Definition at line 92 of file Time.cpp.

◆ operator!=()

bool Fw::Time::operator!= ( const Time other) const

Definition at line 58 of file Time.cpp.

◆ operator<()

bool Fw::Time::operator< ( const Time other) const

Definition at line 66 of file Time.cpp.

◆ operator<=()

bool Fw::Time::operator<= ( const Time other) const

Definition at line 75 of file Time.cpp.

◆ operator=()

Time & Fw::Time::operator= ( const Time other)

Definition at line 47 of file Time.cpp.

◆ operator==()

bool Fw::Time::operator== ( const Time other) const

Definition at line 54 of file Time.cpp.

◆ operator>()

bool Fw::Time::operator> ( const Time other) const

Definition at line 62 of file Time.cpp.

◆ operator>=()

bool Fw::Time::operator>= ( const Time other) const

Definition at line 70 of file Time.cpp.

◆ serializeTo()

SerializeStatus Fw::Time::serializeTo ( SerialBufferBase buffer,
Fw::Endianness  mode = Fw::Endianness::BIG 
) const
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.

Parameters
bufferReference to the SerialBufferBase where data will be serialized
modeEndianness mode for serialization (default is Endianness::BIG)
Returns
SerializeStatus indicating the result of the operation

Implements Fw::Serializable.

Definition at line 80 of file Time.cpp.

◆ set() [1/3]

void Fw::Time::set ( U32  seconds,
U32  useconds 
)

Definition at line 29 of file Time.cpp.

◆ set() [2/3]

void Fw::Time::set ( TimeBase  timeBase,
U32  seconds,
U32  useconds 
)

Definition at line 33 of file Time.cpp.

◆ set() [3/3]

void Fw::Time::set ( TimeBase  timeBase,
FwTimeContextStoreType  context,
U32  seconds,
U32  useconds 
)

Definition at line 41 of file Time.cpp.

◆ setTimeBase()

void Fw::Time::setTimeBase ( TimeBase  timeBase)

Definition at line 195 of file Time.cpp.

◆ setTimeContext()

void Fw::Time::setTimeContext ( FwTimeContextStoreType  context)

Definition at line 199 of file Time.cpp.

◆ sub()

Time Fw::Time::sub ( const Time minuend,
const Time subtrahend 
)
static

Subtract subtrahend from minuend

Returns
The result
Parameters
minuendValue being subtracted from
subtrahendValue being subtracted

Definition at line 157 of file Time.cpp.

◆ zero()

Time Fw::Time::zero ( TimeBase  timeBase = TimeBase::TB_NONE)
static

The type of a comparison result.

Returns
time zero

Definition at line 104 of file Time.cpp.

Friends And Related Function Documentation

◆ TimeTester

friend class TimeTester
friend

Definition at line 13 of file Time.hpp.


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