F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
TimeIntervalValueSerializableAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title TimeIntervalValueSerializableAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for TimeIntervalValue struct
5 // ======================================================================
6 
8 #include "Fw/Types/Assert.hpp"
9 
10 namespace Fw {
11 
12  // ----------------------------------------------------------------------
13  // Constructors
14  // ----------------------------------------------------------------------
15 
18  Serializable(),
19  m_seconds(0),
20  m_useconds(0)
21  {
22 
23  }
24 
27  U32 seconds,
28  U32 useconds
29  ) :
30  Serializable(),
31  m_seconds(seconds),
32  m_useconds(useconds)
33  {
34 
35  }
36 
39  Serializable(),
40  m_seconds(obj.m_seconds),
41  m_useconds(obj.m_useconds)
42  {
43 
44  }
45 
46  // ----------------------------------------------------------------------
47  // Operators
48  // ----------------------------------------------------------------------
49 
52  {
53  if (this == &obj) {
54  return *this;
55  }
56 
57  set(obj.m_seconds, obj.m_useconds);
58  return *this;
59  }
60 
62  operator==(const TimeIntervalValue& obj) const
63  {
64  if (this == &obj) { return true; }
65  return (
66  (this->m_seconds == obj.m_seconds) &&
67  (this->m_useconds == obj.m_useconds)
68  );
69  }
70 
72  operator!=(const TimeIntervalValue& obj) const
73  {
74  return !(*this == obj);
75  }
76 
77 #ifdef BUILD_UT
78 
79  std::ostream& operator<<(std::ostream& os, const TimeIntervalValue& obj) {
80  Fw::String s;
81  obj.toString(s);
82  os << s.toChar();
83  return os;
84  }
85 
86 #endif
87 
88  // ----------------------------------------------------------------------
89  // Member functions
90  // ----------------------------------------------------------------------
91 
94  {
95  Fw::SerializeStatus status;
96 
97  status = buffer.serialize(this->m_seconds);
98  if (status != Fw::FW_SERIALIZE_OK) {
99  return status;
100  }
101  status = buffer.serialize(this->m_useconds);
102  if (status != Fw::FW_SERIALIZE_OK) {
103  return status;
104  }
105 
106  return status;
107  }
108 
111  {
112  Fw::SerializeStatus status;
113 
114  status = buffer.deserialize(this->m_seconds);
115  if (status != Fw::FW_SERIALIZE_OK) {
116  return status;
117  }
118  status = buffer.deserialize(this->m_useconds);
119  if (status != Fw::FW_SERIALIZE_OK) {
120  return status;
121  }
122 
123  return status;
124  }
125 
126 #if FW_SERIALIZABLE_TO_STRING
127 
128  void TimeIntervalValue ::
129  toString(Fw::StringBase& sb) const
130  {
131  Fw::String tmp;
132  sb = "( ";
133 
134  // Format seconds
135  sb += "seconds = ";
136  tmp.format("%" PRIu32 "", this->m_seconds);
137  sb += tmp;
138  sb += ", ";
139 
140  // Format useconds
141  sb += "useconds = ";
142  tmp.format("%" PRIu32 "", this->m_useconds);
143  sb += tmp;
144  sb += " )";
145  }
146 
147 #endif
148 
149  // ----------------------------------------------------------------------
150  // Setter functions
151  // ----------------------------------------------------------------------
152 
155  U32 seconds,
156  U32 useconds
157  )
158  {
159  this->m_seconds = seconds;
160  this->m_useconds = useconds;
161  }
162 
164  setseconds(U32 seconds)
165  {
166  this->m_seconds = seconds;
167  }
168 
170  setuseconds(U32 useconds)
171  {
172  this->m_useconds = useconds;
173  }
174 
175 }
Serialization/Deserialization operation was successful.
Data structure for Time Interval.
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase &buffer)
Deserialization.
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
const char * toChar() const
Definition: String.hpp:50
Fw::SerializeStatus serialize(Fw::SerializeBufferBase &buffer) const
Serialization.
TimeIntervalValue & operator=(const TimeIntervalValue &obj)
Copy assignment operator.
SerializeStatus
forward declaration for string
bool operator==(const TimeIntervalValue &obj) const
Equality operator.
void setseconds(U32 seconds)
Set member seconds.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
void set(U32 seconds, U32 useconds)
Set all members.
TimeIntervalValue()
Constructor (default value)
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
void setuseconds(U32 useconds)
Set member useconds.
bool operator!=(const TimeIntervalValue &obj) const
Inequality operator.
forward declaration