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_WORKSTATION_TIME))
50  || ((e >= TB_DONT_CARE) && (e <= TB_DONT_CARE));
51 }
52 
55 {
56  const Fw::SerializeStatus status = buffer.serializeFrom(
57  static_cast<SerialType>(this->e)
58  );
59  return status;
60 }
61 
64 {
65  SerialType es;
66  Fw::SerializeStatus status = buffer.deserializeTo(es);
67  if (status == Fw::FW_SERIALIZE_OK) {
68  this->e = static_cast<T>(es);
69  if (!this->isValid()) {
71  }
72  }
73  return status;
74 }
75 
76 #if FW_SERIALIZABLE_TO_STRING
77 
78 void TimeBase ::
79  toString(Fw::StringBase& sb) const
80 {
81  Fw::String s;
82  switch (e) {
83  case TB_NONE:
84  s = "TB_NONE";
85  break;
86  case TB_PROC_TIME:
87  s = "TB_PROC_TIME";
88  break;
90  s = "TB_WORKSTATION_TIME";
91  break;
92  case TB_DONT_CARE:
93  s = "TB_DONT_CARE";
94  break;
95  default:
96  s = "[invalid]";
97  break;
98  }
99  sb.format("%s (%" PRIu16 ")", s.toChar(), e);
100 }
101 
102 #elif FW_ENABLE_TEXT_LOGGING
103 
104 void TimeBase ::
105  toString(Fw::StringBase& sb) const
106 {
107  sb.format("%" PRIu16 "", e);
108 }
109 
110 #endif
Serialization/Deserialization operation was successful.
Fw::SerializeStatus serializeTo(Fw::SerializeBufferBase &buffer) const
Serialize raw enum value to SerialType.
const char * toChar() const
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)
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
Time as reported on workstation where software is running. For testing. (Required) ...
Fw::SerializeStatus deserializeFrom(Fw::SerializeBufferBase &buffer)
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:55
Indicates time is processor cycle time. Not tied to external time.
U16 SerialType
The serial representation type.
SerializeStatus serializeFrom(U8 val)
serialize 8-bit unsigned int
Define enumeration for Time base types.
SerializeStatus deserializeTo(U8 &val)
deserialize 8-bit unsigned int