F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
TimeBaseEnumAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title TimeBaseEnumAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for TimeBase enum
5 // ======================================================================
6 
7 #include <cstring>
8 #include <limits>
9 
10 #include "Fw/Types/Assert.hpp"
12 
13 // ----------------------------------------------------------------------
14 // Operators
15 // ----------------------------------------------------------------------
16 
18  operator=(const TimeBase& obj)
19 {
20  this->e = obj.e;
21  return *this;
22 }
23 
26 {
27  this->e = e1;
28  return *this;
29 }
30 
31 #ifdef BUILD_UT
32 
33 std::ostream& operator<<(std::ostream& os, const TimeBase& obj) {
34  Fw::String s;
35  obj.toString(s);
36  os << s;
37  return os;
38 }
39 
40 #endif
41 
42 // ----------------------------------------------------------------------
43 // Member functions
44 // ----------------------------------------------------------------------
45 
46 bool TimeBase ::
47  isValid() const
48 {
49  return ((e >= TB_NONE) && (e <= TB_SC_TIME))
50  || ((e >= TB_DONT_CARE) && (e <= TB_DONT_CARE));
51 }
52 
55  Fw::SerialBufferBase& buffer,
56  Fw::Endianness mode
57  ) const
58 {
59  const Fw::SerializeStatus status = buffer.serializeFrom(
60  static_cast<SerialType>(this->e),
61  mode
62  );
63  return status;
64 }
65 
68  Fw::SerialBufferBase& buffer,
69  Fw::Endianness mode
70  )
71 {
72  SerialType es;
73  Fw::SerializeStatus status = buffer.deserializeTo(es, mode);
74  if (status == Fw::FW_SERIALIZE_OK) {
75  this->e = static_cast<T>(es);
76  if (!this->isValid()) {
78  }
79  }
80  return status;
81 }
82 
83 #if FW_SERIALIZABLE_TO_STRING
84 
85 void TimeBase ::
86  toString(Fw::StringBase& sb) const
87 {
88  Fw::String s;
89  switch (e) {
90  case TB_NONE:
91  s = "TB_NONE";
92  break;
93  case TB_PROC_TIME:
94  s = "TB_PROC_TIME";
95  break;
97  s = "TB_WORKSTATION_TIME";
98  break;
99  case TB_SC_TIME:
100  s = "TB_SC_TIME";
101  break;
102  case TB_DONT_CARE:
103  s = "TB_DONT_CARE";
104  break;
105  default:
106  s = "[invalid]";
107  break;
108  }
109  sb.format("%s (%" PRIu16 ")", s.toChar(), e);
110 }
111 
112 #elif FW_ENABLE_TEXT_LOGGING
113 
114 void TimeBase ::
115  toString(Fw::StringBase& sb) const
116 {
117  sb.format("%" PRIu16 "", e);
118 }
119 
120 #endif
Serialization/Deserialization operation was successful.
const char * toChar() const
Convert to a C-style char*.
Definition: String.hpp:50
Don&#39;t care value for sequences. If FwTimeBaseStoreType is changed, value should be changed (Required)...
Deserialization data had incorrect values (unexpected data types)
No time base has been established (Required)
virtual SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG)=0
Serialize an 8-bit unsigned integer value.
T
The raw enum type.
bool isValid() const
Check raw enum value for validity.
T e
The raw enum value.
SerializeStatus
forward declaration for string
virtual SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG)=0
Deserialize an 8-bit unsigned integer value.
Time as reported on workstation where software is running. For testing. (Required) ...
Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG)
Deserialize raw enum value from SerialType.
TimeBase & operator=(const TimeBase &obj)
Copy assignment operator (object)
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
Fw::SerializeStatus serializeTo(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) const
Serialize raw enum value to SerialType.
Indicates time is processor cycle time. Not tied to external time.
U16 SerialType
The serial representation type.
Endianness
Time as reported by the spacecraft clock.
Define enumeration for Time base types.