GCC Code Coverage Report


Directory: Fw/Types/
File: Serializable.cpp
Date: 2026-09-23 21:11:53
Exec Total Coverage
Lines: 325 576 56.4%
Functions: 44 101 43.6%
Branches: 89 208 42.8%

Line Branch Exec Source
1 #include <Fw/FPrimeBasicTypes.hpp>
2 #include <Fw/Types/Assert.hpp>
3 #include <Fw/Types/Serializable.hpp>
4 #include <Fw/Types/StringType.hpp>
5 #include <cstdio>
6 #include <cstring> // memcpy
7 #ifdef BUILD_UT
8 #include <Fw/Types/String.hpp>
9 #include <iomanip>
10 #endif
11
12 namespace Fw {
13
14 139 Serializable::Serializable() {}
15
16 278 Serializable::~Serializable() {}
17
18 // ----------------------------------------------------------------------
19 #if FW_SERIALIZABLE_TO_STRING || FW_ENABLE_TEXT_LOGGING || BUILD_UT
20
21 ✗ void Serializable::toString(StringBase& text) const {
22 ✗ text = "NOSPEC"; // set to not specified.
23 ✗ }
24
25 #endif
26
27 #ifdef BUILD_UT
28 ✗ std::ostream& operator<<(std::ostream& os, const Serializable& val) {
29 ✗ Fw::String out;
30 ✗ val.toString(out);
31
32 ✗ os << out;
33
34 ✗ return os;
35 ✗ }
36 #endif
37
38 22 SerialBufferBase::~SerialBufferBase() {}
39
40 11 LinearBufferBase::LinearBufferBase(U8* buffAddr, Serializable::SizeType capacity)
41 11 : m_buffAddr(buffAddr), m_capacity(capacity), m_serLoc(0), m_deserLoc(0) {
42 // Ensure buffAddr & capacity are consistent
43 11 FW_ASSERT((buffAddr == nullptr) == (capacity == 0), static_cast<FwAssertArgType>(capacity));
44 11 }
45
46 22 LinearBufferBase::~LinearBufferBase() {}
47
48 ✗ void LinearBufferBase::copyFrom(const LinearBufferBase& src) {
49 ✗ this->m_serLoc = src.m_serLoc;
50 ✗ this->m_deserLoc = src.m_deserLoc;
51 ✗ const U8* srcBuffAddr = src.m_buffAddr;
52 ✗ U8* thisBuffAddr = this->m_buffAddr;
53 ✗ FW_ASSERT(srcBuffAddr != nullptr);
54 ✗ FW_ASSERT(thisBuffAddr != nullptr);
55 // destination has to be same or bigger
56 ✗ FW_ASSERT(src.m_serLoc <= this->m_capacity, static_cast<FwAssertArgType>(src.m_serLoc),
57 static_cast<FwAssertArgType>(this->m_capacity));
58 ✗ (void)memcpy(thisBuffAddr, srcBuffAddr, static_cast<size_t>(this->m_serLoc));
59 ✗ }
60
61 // Copy constructor doesn't make sense in this virtual class as there is nothing to copy. Derived classes should
62 // call the empty constructor and then call their own copy function
63 ✗ LinearBufferBase& LinearBufferBase::operator=(const LinearBufferBase& src) { // lgtm[cpp/rule-of-two]
64 ✗ this->copyFrom(src);
65 ✗ return *this;
66 }
67
68 // serialization routines
69
70 2000077 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(U8 val, Endianness mode) {
71
2/2
✓ Branch 8 taken 1999996 times.
✓ Branch 9 taken 81 times.
2000077 if (this->m_serLoc + static_cast<Serializable::SizeType>(sizeof(val)) - 1 >= this->m_capacity) {
72 1999996 return FW_SERIALIZE_NO_ROOM_LEFT;
73 }
74 81 U8* buffAddr = this->m_buffAddr;
75 81 FW_ASSERT(buffAddr != nullptr);
76 81 buffAddr[this->m_serLoc] = val;
77 81 this->m_serLoc += static_cast<Serializable::SizeType>(sizeof(val));
78 81 this->m_deserLoc = 0;
79
80 81 return FW_SERIALIZE_OK;
81 }
82
83 4 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(I8 val, Endianness mode) {
84 4 return serializeFrom(static_cast<U8>(val), mode);
85 }
86
87 #if FW_HAS_16_BIT == 1
88 2000010 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(U16 val, Endianness mode) {
89
2/2
✓ Branch 8 taken 1999995 times.
✓ Branch 9 taken 15 times.
2000010 if (this->m_serLoc + static_cast<Serializable::SizeType>(sizeof(val)) - 1 >= this->m_capacity) {
90 1999995 return FW_SERIALIZE_NO_ROOM_LEFT;
91 }
92 15 U8* buffAddr = this->m_buffAddr;
93 15 FW_ASSERT(buffAddr != nullptr);
94
2/3
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
15 switch (mode) {
95 12 case Endianness::BIG:
96 // MSB first
97 12 buffAddr[this->m_serLoc + 0] = static_cast<U8>(val >> 8);
98 12 buffAddr[this->m_serLoc + 1] = static_cast<U8>(val);
99 12 break;
100 3 case Endianness::LITTLE:
101 // LSB first
102 3 buffAddr[this->m_serLoc + 0] = static_cast<U8>(val);
103 3 buffAddr[this->m_serLoc + 1] = static_cast<U8>(val >> 8);
104 3 break;
105 ✗ default:
106 ✗ FW_ASSERT(false);
107 ✗ break;
108 }
109 15 this->m_serLoc += static_cast<Serializable::SizeType>(sizeof(val));
110 15 this->m_deserLoc = 0;
111 15 return FW_SERIALIZE_OK;
112 }
113
114 6 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(I16 val, Endianness mode) {
115 6 return serializeFrom(static_cast<U16>(val), mode);
116 }
117 #endif
118 #if FW_HAS_32_BIT == 1
119 4000016 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(U32 val, Endianness mode) {
120
2/2
✓ Branch 8 taken 3999990 times.
✓ Branch 9 taken 26 times.
4000016 if (this->m_serLoc + static_cast<Serializable::SizeType>(sizeof(val)) - 1 >= this->m_capacity) {
121 3999990 return FW_SERIALIZE_NO_ROOM_LEFT;
122 }
123 26 U8* buffAddr = this->m_buffAddr;
124 26 FW_ASSERT(buffAddr != nullptr);
125
2/3
✓ Branch 0 taken 22 times.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
26 switch (mode) {
126 22 case Endianness::BIG:
127 // MSB first
128 22 buffAddr[this->m_serLoc + 0] = static_cast<U8>(val >> 24);
129 22 buffAddr[this->m_serLoc + 1] = static_cast<U8>(val >> 16);
130 22 buffAddr[this->m_serLoc + 2] = static_cast<U8>(val >> 8);
131 22 buffAddr[this->m_serLoc + 3] = static_cast<U8>(val);
132 22 break;
133 4 case Endianness::LITTLE:
134 // LSB first
135 4 buffAddr[this->m_serLoc + 0] = static_cast<U8>(val);
136 4 buffAddr[this->m_serLoc + 1] = static_cast<U8>(val >> 8);
137 4 buffAddr[this->m_serLoc + 2] = static_cast<U8>(val >> 16);
138 4 buffAddr[this->m_serLoc + 3] = static_cast<U8>(val >> 24);
139 4 break;
140 ✗ default:
141 ✗ FW_ASSERT(false);
142 ✗ break;
143 }
144 26 this->m_serLoc += static_cast<Serializable::SizeType>(sizeof(val));
145 26 this->m_deserLoc = 0;
146 26 return FW_SERIALIZE_OK;
147 }
148
149 6 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(I32 val, Endianness mode) {
150 6 return serializeFrom(static_cast<U32>(val), mode);
151 }
152 #endif
153
154 #if FW_HAS_64_BIT == 1
155 3000023 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(U64 val, Endianness mode) {
156
2/2
✓ Branch 8 taken 1999995 times.
✓ Branch 9 taken 1000028 times.
3000023 if (this->m_serLoc + static_cast<Serializable::SizeType>(sizeof(val)) - 1 >= this->m_capacity) {
157 1999995 return FW_SERIALIZE_NO_ROOM_LEFT;
158 }
159 1000028 U8* buffAddr = this->m_buffAddr;
160 1000028 FW_ASSERT(buffAddr != nullptr);
161
2/3
✓ Branch 0 taken 1000022 times.
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
1000028 switch (mode) {
162 1000022 case Endianness::BIG:
163 // MSB first
164 1000022 buffAddr[this->m_serLoc + 0] = static_cast<U8>(val >> 56);
165 1000022 buffAddr[this->m_serLoc + 1] = static_cast<U8>(val >> 48);
166 1000022 buffAddr[this->m_serLoc + 2] = static_cast<U8>(val >> 40);
167 1000022 buffAddr[this->m_serLoc + 3] = static_cast<U8>(val >> 32);
168 1000022 buffAddr[this->m_serLoc + 4] = static_cast<U8>(val >> 24);
169 1000022 buffAddr[this->m_serLoc + 5] = static_cast<U8>(val >> 16);
170 1000022 buffAddr[this->m_serLoc + 6] = static_cast<U8>(val >> 8);
171 1000022 buffAddr[this->m_serLoc + 7] = static_cast<U8>(val);
172 1000022 break;
173 6 case Endianness::LITTLE:
174 // LSB first
175 6 buffAddr[this->m_serLoc + 0] = static_cast<U8>(val);
176 6 buffAddr[this->m_serLoc + 1] = static_cast<U8>(val >> 8);
177 6 buffAddr[this->m_serLoc + 2] = static_cast<U8>(val >> 16);
178 6 buffAddr[this->m_serLoc + 3] = static_cast<U8>(val >> 24);
179 6 buffAddr[this->m_serLoc + 4] = static_cast<U8>(val >> 32);
180 6 buffAddr[this->m_serLoc + 5] = static_cast<U8>(val >> 40);
181 6 buffAddr[this->m_serLoc + 6] = static_cast<U8>(val >> 48);
182 6 buffAddr[this->m_serLoc + 7] = static_cast<U8>(val >> 56);
183 6 break;
184 ✗ default:
185 ✗ FW_ASSERT(false);
186 ✗ break;
187 }
188 1000028 this->m_serLoc += static_cast<Serializable::SizeType>(sizeof(val));
189 1000028 this->m_deserLoc = 0;
190 1000028 return FW_SERIALIZE_OK;
191 }
192
193 6 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(I64 val, Endianness mode) {
194 6 return serializeFrom(static_cast<U64>(val), mode);
195 }
196 #endif
197
198 1000004 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(F64 val, Endianness mode) {
199 // floating point values need to be byte-swapped as well, so copy to U64 and use that routine
200 1000004 U64 u64Val;
201 1000004 (void)memcpy(&u64Val, &val, sizeof(val));
202
1/1
✓ Branch 7 taken 1000004 times.
2000008 return this->serializeFrom(u64Val, mode);
203 }
204
205 2000004 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(F32 val, Endianness mode) {
206 // floating point values need to be byte-swapped as well, so copy to U32 and use that routine
207 2000004 U32 u32Val;
208 2000004 (void)memcpy(&u32Val, &val, sizeof(val));
209
1/1
✓ Branch 7 taken 2000004 times.
4000008 return this->serializeFrom(u32Val, mode);
210 }
211
212 6 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(bool val, Endianness mode) {
213 // booleans are encoded as a single byte
214 static_assert(FW_SERIALIZE_TRUE_VALUE <= 0xFF && FW_SERIALIZE_FALSE_VALUE <= 0xFF,
215 "boolean wire values must fit in one byte");
216 static_assert(static_cast<int>(FW_SERIALIZE_TRUE_VALUE) != static_cast<int>(FW_SERIALIZE_FALSE_VALUE),
217 "boolean wire values must be distinct");
218
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 times.
6 const U8 byteVal = val ? static_cast<U8>(FW_SERIALIZE_TRUE_VALUE) : static_cast<U8>(FW_SERIALIZE_FALSE_VALUE);
219 6 return this->serializeFrom(byteVal, mode);
220 }
221
222 5 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(const void* val, Endianness mode) {
223 // pointers are serialized as their integer representation
224 5 return this->serializeFrom(reinterpret_cast<PlatformPointerCastType>(val), mode);
225 }
226
227 2000002 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(const U8* buff,
228 Serializable::SizeType length,
229 Endianness endianMode) {
230 2000002 return this->serializeFrom(buff, static_cast<FwSizeType>(length), Serialization::INCLUDE_LENGTH, endianMode);
231 }
232
233 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus
234 2000002 LinearBufferBase::serializeFrom(const U8* buff,
235 FwSizeType length,
236 Serialization::t lengthMode,
237 Endianness endianMode) { // First serialize length
238 SerializeStatus stat;
239
1/2
✓ Branch 0 taken 2000002 times.
✗ Branch 1 not taken.
2000002 if (lengthMode == Serialization::INCLUDE_LENGTH) {
240 2000002 stat = this->serializeFrom(static_cast<FwSizeStoreType>(length), endianMode);
241
2/2
✓ Branch 0 taken 1999994 times.
✓ Branch 1 taken 8 times.
2000002 if (stat != FW_SERIALIZE_OK) {
242 1999994 return stat;
243 }
244 }
245
246 // make sure we have enough space
247 // Note: m_serLoc <= m_capacity is a class invariant, so this subtraction cannot underflow.
248
1/2
✗ Branch 8 not taken.
✓ Branch 9 taken 8 times.
8 if (length > this->m_capacity - this->m_serLoc) {
249 ✗ return FW_SERIALIZE_NO_ROOM_LEFT;
250 }
251
252
1/2
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
8 if (length > 0) {
253 8 FW_ASSERT(buff != nullptr);
254 }
255 8 U8* buffAddr = this->m_buffAddr;
256 8 FW_ASSERT(buffAddr != nullptr);
257 // copy buffer to our buffer; memmove is used because the source may overlap this buffer
258
2/4
✗ Branch 5 not taken.
✓ Branch 6 taken 8 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 8 times.
8 (void)memmove(&buffAddr[this->m_serLoc], buff, static_cast<size_t>(length));
259 8 this->m_serLoc += static_cast<Serializable::SizeType>(length);
260 8 this->m_deserLoc = 0;
261
262 8 return FW_SERIALIZE_OK;
263 }
264
265 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(const Serializable& val,
266 Endianness mode) {
267 ✗ return val.serializeTo(*this, mode);
268 }
269
270 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(const LinearBufferBase& val,
271 Endianness mode) {
272 ✗ Serializable::SizeType size = val.getSize();
273 // Note: m_serLoc <= m_capacity is a class invariant, so this subtraction cannot underflow.
274 ✗ Serializable::SizeType available = this->m_capacity - this->m_serLoc;
275 ✗ if (size > available || static_cast<Serializable::SizeType>(sizeof(FwSizeStoreType)) > available - size) {
276 ✗ return FW_SERIALIZE_NO_ROOM_LEFT;
277 }
278
279 // First, serialize size
280 ✗ SerializeStatus stat = this->serializeFrom(static_cast<FwSizeStoreType>(size), mode);
281 ✗ if (stat != FW_SERIALIZE_OK) {
282 ✗ return stat;
283 }
284
285 ✗ U8* thisBuffAddr = this->m_buffAddr;
286 ✗ const U8* valBuffAddr = val.getBuffAddr();
287 ✗ FW_ASSERT(thisBuffAddr != nullptr);
288 ✗ FW_ASSERT(valBuffAddr != nullptr);
289 // serialize buffer
290 ✗ (void)memcpy(&thisBuffAddr[this->m_serLoc], valBuffAddr, static_cast<size_t>(size));
291 ✗ this->m_serLoc += size;
292 ✗ this->m_deserLoc = 0;
293
294 ✗ return FW_SERIALIZE_OK;
295 }
296
297 2 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeSize(const FwSizeType size, Endianness mode) {
298 2 SerializeStatus status = FW_SERIALIZE_OK;
299
3/6
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
2 if ((size < std::numeric_limits<FwSizeStoreType>::min()) || (size > std::numeric_limits<FwSizeStoreType>::max())) {
300 ✗ status = FW_SERIALIZE_FORMAT_ERROR;
301 }
302
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (status == FW_SERIALIZE_OK) {
303 2 status = this->serializeFrom(static_cast<FwSizeStoreType>(size), mode);
304 }
305 2 return status;
306 }
307
308 // deserialization routines
309
310 33 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(U8& val, Endianness mode) {
311 // check for room
312 33 const Serializable::SizeType size = this->m_serLoc;
313
2/2
✓ Branch 4 taken 3 times.
✓ Branch 5 taken 30 times.
33 if (size == this->m_deserLoc) {
314 3 return FW_DESERIALIZE_BUFFER_EMPTY;
315
1/2
✗ Branch 4 not taken.
✓ Branch 5 taken 30 times.
30 } else if (size - this->m_deserLoc < static_cast<Serializable::SizeType>(sizeof(val))) {
316 ✗ return FW_DESERIALIZE_SIZE_MISMATCH;
317 }
318 // read from current location
319 30 U8* buffAddr = this->m_buffAddr;
320 30 FW_ASSERT(buffAddr != nullptr);
321 30 val = buffAddr[this->m_deserLoc + 0];
322 30 this->m_deserLoc += static_cast<Serializable::SizeType>(sizeof(val));
323 30 return FW_SERIALIZE_OK;
324 }
325
326 4 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(I8& val, Endianness mode) {
327 // check for room
328 4 const Serializable::SizeType size = this->m_serLoc;
329
1/2
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
4 if (size == this->m_deserLoc) {
330 ✗ return FW_DESERIALIZE_BUFFER_EMPTY;
331
1/2
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
4 } else if (size - this->m_deserLoc < static_cast<Serializable::SizeType>(sizeof(val))) {
332 ✗ return FW_DESERIALIZE_SIZE_MISMATCH;
333 }
334 // read from current location
335 4 U8* buffAddr = this->m_buffAddr;
336 4 FW_ASSERT(buffAddr != nullptr);
337 4 val = static_cast<I8>(buffAddr[this->m_deserLoc + 0]);
338 4 this->m_deserLoc += static_cast<Serializable::SizeType>(sizeof(val));
339 4 return FW_SERIALIZE_OK;
340 }
341
342 #if FW_HAS_16_BIT == 1
343 10 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(U16& val, Endianness mode) {
344 // check for room
345 10 const Serializable::SizeType size = this->m_serLoc;
346
1/2
✗ Branch 4 not taken.
✓ Branch 5 taken 10 times.
10 if (size == this->m_deserLoc) {
347 ✗ return FW_DESERIALIZE_BUFFER_EMPTY;
348
1/2
✗ Branch 4 not taken.
✓ Branch 5 taken 10 times.
10 } else if (size - this->m_deserLoc < static_cast<Serializable::SizeType>(sizeof(val))) {
349 ✗ return FW_DESERIALIZE_SIZE_MISMATCH;
350 }
351 // read from current location
352 10 U8* buffAddr = this->m_buffAddr;
353 10 FW_ASSERT(buffAddr != nullptr);
354
2/3
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
10 switch (mode) {
355 7 case Endianness::BIG:
356 // MSB first
357
2/4
✗ Branch 6 not taken.
✓ Branch 7 taken 7 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 7 times.
7 val = static_cast<U16>(((buffAddr[this->m_deserLoc + 1]) << 0) | ((buffAddr[this->m_deserLoc + 0]) << 8));
358 7 break;
359 3 case Endianness::LITTLE:
360 // LSB first
361
2/4
✗ Branch 6 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 3 times.
3 val = static_cast<U16>(((buffAddr[this->m_deserLoc + 0]) << 0) | ((buffAddr[this->m_deserLoc + 1]) << 8));
362 3 break;
363 ✗ default:
364 ✗ FW_ASSERT(false);
365 ✗ break;
366 }
367 10 this->m_deserLoc += static_cast<Serializable::SizeType>(sizeof(val));
368 10 return FW_SERIALIZE_OK;
369 }
370
371 6 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(I16& val, Endianness mode) {
372 6 U16 unsignVal = 0;
373
1/1
✓ Branch 7 taken 6 times.
6 SerializeStatus res = deserializeTo(unsignVal, mode);
374
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (res == SerializeStatus::FW_SERIALIZE_OK) {
375 6 val = static_cast<I16>(unsignVal);
376 }
377 6 return res;
378 }
379 #endif
380 #if FW_HAS_32_BIT == 1
381 15 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(U32& val, Endianness mode) {
382 // check for room
383 15 const Serializable::SizeType size = this->m_serLoc;
384
1/2
✗ Branch 4 not taken.
✓ Branch 5 taken 15 times.
15 if (size == this->m_deserLoc) {
385 ✗ return FW_DESERIALIZE_BUFFER_EMPTY;
386
1/2
✗ Branch 4 not taken.
✓ Branch 5 taken 15 times.
15 } else if (size - this->m_deserLoc < static_cast<Serializable::SizeType>(sizeof(val))) {
387 ✗ return FW_DESERIALIZE_SIZE_MISMATCH;
388 }
389 // read from current location
390 15 U8* buffAddr = this->m_buffAddr;
391 15 FW_ASSERT(buffAddr != nullptr);
392
2/3
✓ Branch 0 taken 11 times.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
15 switch (mode) {
393 11 case Endianness::BIG:
394 // MSB first
395 11 val = (static_cast<U32>(buffAddr[this->m_deserLoc + 3]) << 0) |
396 11 (static_cast<U32>(buffAddr[this->m_deserLoc + 2]) << 8) |
397 11 (static_cast<U32>(buffAddr[this->m_deserLoc + 1]) << 16) |
398 11 (static_cast<U32>(buffAddr[this->m_deserLoc + 0]) << 24);
399 11 break;
400 4 case Endianness::LITTLE:
401 // LSB first
402 4 val = (static_cast<U32>(buffAddr[this->m_deserLoc + 0]) << 0) |
403 4 (static_cast<U32>(buffAddr[this->m_deserLoc + 1]) << 8) |
404 4 (static_cast<U32>(buffAddr[this->m_deserLoc + 2]) << 16) |
405 4 (static_cast<U32>(buffAddr[this->m_deserLoc + 3]) << 24);
406 4 break;
407 ✗ default:
408 ✗ FW_ASSERT(false);
409 ✗ break;
410 }
411 15 this->m_deserLoc += static_cast<Serializable::SizeType>(sizeof(val));
412 15 return FW_SERIALIZE_OK;
413 }
414
415 6 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(I32& val, Endianness mode) {
416 6 U32 unsignVal = 0;
417
1/1
✓ Branch 7 taken 6 times.
6 SerializeStatus res = deserializeTo(unsignVal, mode);
418
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (res == SerializeStatus::FW_SERIALIZE_OK) {
419 6 val = static_cast<I32>(unsignVal);
420 }
421 6 return res;
422 }
423 #endif
424
425 #if FW_HAS_64_BIT == 1
426
427 1000022 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(U64& val, Endianness mode) {
428 // check for room
429
1/2
✗ Branch 8 not taken.
✓ Branch 9 taken 1000022 times.
1000022 if (this->m_serLoc == this->m_deserLoc) {
430 ✗ return FW_DESERIALIZE_BUFFER_EMPTY;
431
1/2
✗ Branch 8 not taken.
✓ Branch 9 taken 1000022 times.
1000022 } else if (this->m_serLoc - this->m_deserLoc < static_cast<Serializable::SizeType>(sizeof(val))) {
432 ✗ return FW_DESERIALIZE_SIZE_MISMATCH;
433 }
434 // read from current location
435 1000022 U8* buffAddr = this->m_buffAddr;
436 1000022 FW_ASSERT(buffAddr != nullptr);
437
2/3
✓ Branch 0 taken 1000016 times.
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
1000022 switch (mode) {
438 1000016 case Endianness::BIG:
439 // MSB first
440 1000016 val = (static_cast<U64>(buffAddr[this->m_deserLoc + 7]) << 0) |
441 1000016 (static_cast<U64>(buffAddr[this->m_deserLoc + 6]) << 8) |
442 1000016 (static_cast<U64>(buffAddr[this->m_deserLoc + 5]) << 16) |
443 1000016 (static_cast<U64>(buffAddr[this->m_deserLoc + 4]) << 24) |
444 1000016 (static_cast<U64>(buffAddr[this->m_deserLoc + 3]) << 32) |
445 1000016 (static_cast<U64>(buffAddr[this->m_deserLoc + 2]) << 40) |
446 1000016 (static_cast<U64>(buffAddr[this->m_deserLoc + 1]) << 48) |
447 1000016 (static_cast<U64>(buffAddr[this->m_deserLoc + 0]) << 56);
448 1000016 break;
449 6 case Endianness::LITTLE:
450 // LSB first
451 6 val = (static_cast<U64>(buffAddr[this->m_deserLoc + 0]) << 0) |
452 6 (static_cast<U64>(buffAddr[this->m_deserLoc + 1]) << 8) |
453 6 (static_cast<U64>(buffAddr[this->m_deserLoc + 2]) << 16) |
454 6 (static_cast<U64>(buffAddr[this->m_deserLoc + 3]) << 24) |
455 6 (static_cast<U64>(buffAddr[this->m_deserLoc + 4]) << 32) |
456 6 (static_cast<U64>(buffAddr[this->m_deserLoc + 5]) << 40) |
457 6 (static_cast<U64>(buffAddr[this->m_deserLoc + 6]) << 48) |
458 6 (static_cast<U64>(buffAddr[this->m_deserLoc + 7]) << 56);
459 6 break;
460 ✗ default:
461 ✗ FW_ASSERT(false);
462 ✗ break;
463 }
464 1000022 this->m_deserLoc += static_cast<Serializable::SizeType>(sizeof(val));
465 1000022 return FW_SERIALIZE_OK;
466 }
467
468 6 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(I64& val, Endianness mode) {
469 6 U64 unsignVal;
470
1/1
✓ Branch 7 taken 6 times.
6 SerializeStatus res = deserializeTo(unsignVal, mode);
471
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (res == SerializeStatus::FW_SERIALIZE_OK) {
472 6 val = static_cast<I64>(unsignVal);
473 }
474 6 return res;
475 }
476 #endif
477
478 1000004 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(F64& val, Endianness mode) {
479 // deserialize as 64-bit int to handle endianness
480 1000004 U64 tempVal;
481
1/1
✓ Branch 7 taken 1000004 times.
1000004 SerializeStatus stat = this->deserializeTo(tempVal, mode);
482
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1000004 times.
1000004 if (stat != FW_SERIALIZE_OK) {
483 ✗ return stat;
484 }
485 // copy to argument
486 1000004 (void)memcpy(&val, &tempVal, sizeof(val));
487
488 1000004 return FW_SERIALIZE_OK;
489 }
490
491 6 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(bool& val, Endianness mode) {
492 6 U8 byteVal = 0;
493
1/1
✓ Branch 7 taken 6 times.
6 const SerializeStatus stat = this->deserializeTo(byteVal, mode);
494
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 if (stat != FW_SERIALIZE_OK) {
495 ✗ return stat;
496 }
497
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2 times.
6 if (FW_SERIALIZE_TRUE_VALUE == byteVal) {
498 4 val = true;
499
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
2 } else if (FW_SERIALIZE_FALSE_VALUE == byteVal) {
500 1 val = false;
501 } else {
502 // leave the malformed byte unconsumed
503 1 this->m_deserLoc -= static_cast<Serializable::SizeType>(sizeof(byteVal));
504 1 return FW_DESERIALIZE_FORMAT_ERROR;
505 }
506 5 return FW_SERIALIZE_OK;
507 }
508
509 4 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(void*& val, Endianness mode) {
510 // Deserialize as pointer cast, then convert to void*
511 4 PlatformPointerCastType pointerCastVal = 0;
512
1/1
✓ Branch 7 taken 4 times.
4 const SerializeStatus stat = this->deserializeTo(pointerCastVal, mode);
513
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 if (stat == FW_SERIALIZE_OK) {
514 4 val = reinterpret_cast<void*>(pointerCastVal);
515 }
516 4 return stat;
517 }
518
519 4 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(F32& val, Endianness mode) {
520 // deserialize as 32-bit int to handle endianness
521 4 U32 tempVal = 0;
522
1/1
✓ Branch 7 taken 4 times.
4 SerializeStatus stat = this->deserializeTo(tempVal, mode);
523
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 if (stat != FW_SERIALIZE_OK) {
524 ✗ return stat;
525 }
526 4 (void)memcpy(&val, &tempVal, sizeof(val));
527
528 4 return FW_SERIALIZE_OK;
529 }
530
531 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(U8* buff,
532 Serializable::SizeType& length,
533 Endianness endianMode) {
534 ✗ FwSizeType length_in_out = static_cast<FwSizeType>(length);
535 ✗ SerializeStatus status = this->deserializeTo(buff, length_in_out, Serialization::INCLUDE_LENGTH, endianMode);
536 ✗ length = static_cast<Serializable::SizeType>(length_in_out);
537 ✗ return status;
538 }
539
540 2 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(U8* buff,
541 Serializable::SizeType& length,
542 Serialization::t lengthMode,
543 Endianness endianMode) {
544 2 U8* buffAddr = this->m_buffAddr;
545 2 FW_ASSERT(buffAddr != nullptr);
546
547
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (lengthMode == Serialization::INCLUDE_LENGTH) {
548 2 FwSizeStoreType storedLength = 0;
549
550
1/1
✓ Branch 7 taken 2 times.
2 SerializeStatus stat = this->deserializeTo(storedLength, endianMode);
551
552
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (stat != FW_SERIALIZE_OK) {
553 ✗ return stat;
554 }
555
556 // make sure it fits
557
4/7
✓ Branch 7 taken 2 times.
✓ Branch 9 taken 2 times.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 2 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 2 times.
2 if ((storedLength > this->getDeserializeSizeLeft()) || (storedLength > length)) {
558 ✗ return FW_DESERIALIZE_SIZE_MISMATCH;
559 }
560
561
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (storedLength > 0) {
562 2 FW_ASSERT(buff != nullptr);
563 }
564
2/4
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
2 (void)memcpy(buff, &buffAddr[this->m_deserLoc], static_cast<size_t>(storedLength));
565
566 2 length = static_cast<FwSizeType>(storedLength);
567
568 } else {
569 // make sure enough is left
570 ✗ if (length > this->getDeserializeSizeLeft()) {
571 ✗ return FW_DESERIALIZE_SIZE_MISMATCH;
572 }
573
574 ✗ if (length > 0) {
575 ✗ FW_ASSERT(buff != nullptr);
576 }
577 ✗ (void)memcpy(buff, &buffAddr[this->m_deserLoc], static_cast<size_t>(length));
578 }
579
580 2 this->m_deserLoc += static_cast<Serializable::SizeType>(length);
581 2 return FW_SERIALIZE_OK;
582 }
583
584 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(Serializable& val, Endianness mode) {
585 ✗ return val.deserializeFrom(*this, mode);
586 }
587
588 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(LinearBufferBase& val, Endianness mode) {
589 ✗ U8* valBuffAddr = val.getBuffAddr();
590 ✗ FW_ASSERT(valBuffAddr != nullptr);
591 ✗ SerializeStatus stat = FW_SERIALIZE_OK;
592
593 ✗ FwSizeStoreType storedLength = 0;
594
595 ✗ stat = this->deserializeTo(storedLength, mode);
596
597 ✗ if (stat != FW_SERIALIZE_OK) {
598 ✗ return stat;
599 }
600
601 // make sure destination has enough room
602
603 ✗ if ((storedLength > val.getCapacity()) || (storedLength > this->getDeserializeSizeLeft())) {
604 ✗ return FW_DESERIALIZE_SIZE_MISMATCH;
605 }
606
607 ✗ U8* thisBuffAddr = this->m_buffAddr;
608 ✗ FW_ASSERT(thisBuffAddr != nullptr);
609 ✗ (void)memcpy(valBuffAddr, &thisBuffAddr[this->m_deserLoc], static_cast<size_t>(storedLength));
610
611 ✗ stat = val.setBuffLen(storedLength);
612
613 ✗ if (stat != FW_SERIALIZE_OK) {
614 ✗ return stat;
615 }
616
617 ✗ this->m_deserLoc += storedLength;
618
619 ✗ return FW_SERIALIZE_OK;
620 }
621
622 2 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeSize(FwSizeType& size, Endianness mode) {
623 2 FwSizeStoreType storedSize = 0;
624
1/1
✓ Branch 7 taken 2 times.
2 Fw::SerializeStatus status = this->deserializeTo(storedSize, mode);
625
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (status == FW_SERIALIZE_OK) {
626 2 size = static_cast<FwSizeType>(storedSize);
627 }
628 2 return status;
629 }
630
631 1000047 void LinearBufferBase::resetSer() {
632 1000047 this->m_deserLoc = 0;
633 1000047 this->m_serLoc = 0;
634 1000047 }
635
636 12 void LinearBufferBase::resetDeser() {
637 12 this->m_deserLoc = 0;
638 12 }
639
640 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeSkip(FwSizeType numBytesToSkip) {
641 ✗ Fw::SerializeStatus status = FW_SERIALIZE_OK;
642 // compute new ser loc
643 ✗ const FwSizeType newSerLoc = this->m_serLoc + numBytesToSkip;
644 // check for room
645 ✗ if (newSerLoc <= this->m_capacity) {
646 // update ser loc
647 ✗ this->m_serLoc = static_cast<Serializable::SizeType>(newSerLoc);
648 } else {
649 ✗ status = FW_SERIALIZE_NO_ROOM_LEFT;
650 }
651 ✗ return status;
652 }
653
654 5 FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeSkip(FwSizeType numBytesToSkip) {
655 // check for room
656 5 const Serializable::SizeType size = this->m_serLoc;
657
2/2
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 4 times.
5 if (size == this->m_deserLoc) {
658 1 return FW_DESERIALIZE_BUFFER_EMPTY;
659
2/2
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 3 times.
4 } else if (size - this->m_deserLoc < numBytesToSkip) {
660 1 return FW_DESERIALIZE_SIZE_MISMATCH;
661 }
662 // update location in buffer to skip the value
663 3 this->m_deserLoc += static_cast<Serializable::SizeType>(numBytesToSkip);
664 3 return FW_SERIALIZE_OK;
665 }
666
667 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::moveSerToOffset(FwSizeType offset) {
668 // Reset serialization
669 ✗ this->resetSer();
670 // Advance to offset
671 ✗ return this->serializeSkip(offset);
672 }
673 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::moveDeserToOffset(FwSizeType offset) {
674 // Reset deserialization
675 ✗ this->resetDeser();
676 // Advance to offset
677 ✗ return this->deserializeSkip(offset);
678 }
679
680 16 Serializable::SizeType LinearBufferBase::getSize() const {
681 16 return this->m_serLoc;
682 }
683
684 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::setBuff(const U8* src, Serializable::SizeType length) {
685 ✗ if (this->m_capacity < length) {
686 ✗ return FW_SERIALIZE_NO_ROOM_LEFT;
687 } else {
688 ✗ FW_ASSERT(src);
689 ✗ U8* buffAddr = this->m_buffAddr;
690 ✗ FW_ASSERT(buffAddr != nullptr);
691 ✗ (void)memcpy(buffAddr, src, static_cast<size_t>(length));
692 ✗ this->m_serLoc = length;
693 ✗ this->m_deserLoc = 0;
694 ✗ return FW_SERIALIZE_OK;
695 }
696 }
697
698 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::setBuffLen(Serializable::SizeType length) {
699 ✗ if (this->m_capacity < length) {
700 ✗ return FW_SERIALIZE_NO_ROOM_LEFT;
701 } else {
702 ✗ this->m_serLoc = length;
703 ✗ this->m_deserLoc = 0;
704 ✗ return FW_SERIALIZE_OK;
705 }
706 }
707
708 10 Serializable::SizeType LinearBufferBase::getDeserializeSizeLeft() const {
709 10 FW_ASSERT(this->m_serLoc >= this->m_deserLoc, static_cast<FwAssertArgType>(this->m_serLoc),
710 static_cast<FwAssertArgType>(this->m_deserLoc));
711 10 return this->m_serLoc - this->m_deserLoc;
712 }
713
714 2 Serializable::SizeType LinearBufferBase::getSerializeSizeLeft() const {
715 2 FW_ASSERT(this->m_capacity >= this->m_serLoc, static_cast<FwAssertArgType>(this->m_capacity),
716 static_cast<FwAssertArgType>(this->m_serLoc));
717 2 return this->m_capacity - this->m_serLoc;
718 }
719
720 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::copyRaw(SerialBufferBase& dest,
721 Serializable::SizeType size) {
722 // make sure there is sufficient size in destination
723 ✗ if (dest.getCapacity() < size) {
724 ✗ return FW_SERIALIZE_NO_ROOM_LEFT;
725 }
726 // make sure there is sufficient buffer in source
727 ✗ if (this->getDeserializeSizeLeft() < size) {
728 ✗ return FW_DESERIALIZE_SIZE_MISMATCH;
729 }
730
731 // otherwise, set destination buffer to data from deserialization pointer plus size
732 ✗ U8* buffAddr = this->m_buffAddr;
733
734 ✗ FW_ASSERT(buffAddr);
735 ✗ SerializeStatus stat = dest.setBuff(&buffAddr[this->m_deserLoc], size);
736 ✗ if (stat == FW_SERIALIZE_OK) {
737 ✗ this->m_deserLoc += size;
738 }
739 ✗ return stat;
740 }
741
742 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::copyRawOffset(SerialBufferBase& dest,
743 Serializable::SizeType size) {
744 // make sure there is sufficient size in destination
745 ✗ const Serializable::SizeType destCapacity = dest.getCapacity();
746 ✗ const Serializable::SizeType destSize = dest.getSize();
747 ✗ if (destCapacity < size + destSize) {
748 ✗ return FW_SERIALIZE_NO_ROOM_LEFT;
749 }
750 // make sure there is sufficient buffer in source
751 ✗ if (this->getDeserializeSizeLeft() < size) {
752 ✗ return FW_DESERIALIZE_SIZE_MISMATCH;
753 }
754
755 // otherwise, serialize bytes to destination without writing length
756 ✗ U8* buffAddr = this->m_buffAddr;
757 ✗ SerializeStatus stat = dest.serializeFrom(&buffAddr[this->m_deserLoc], size, Serialization::OMIT_LENGTH);
758 ✗ if (stat == FW_SERIALIZE_OK) {
759 ✗ this->m_deserLoc += size;
760 }
761 ✗ return stat;
762 }
763
764 // return address of buffer not yet deserialized. This is used
765 // to copy the remainder of a buffer.
766 ✗ const U8* LinearBufferBase::getBuffAddrLeft() const {
767 ✗ const U8* buffAddr = this->m_buffAddr;
768 ✗ FW_ASSERT(buffAddr != nullptr);
769 ✗ return &buffAddr[this->m_deserLoc];
770 }
771
772 //!< gets address of end of serialization. Used to manually place data at the end
773 ✗ U8* LinearBufferBase::getBuffAddrSer() {
774 ✗ U8* buffAddr = this->m_buffAddr;
775 ✗ FW_ASSERT(buffAddr != nullptr);
776 ✗ return &buffAddr[this->m_serLoc];
777 }
778
779 #ifdef BUILD_UT
780 1 bool LinearBufferBase::operator==(const LinearBufferBase& other) const {
781
1/2
✗ Branch 11 not taken.
✓ Branch 12 taken 1 times.
1 if (this->m_serLoc != other.getSize()) {
782 ✗ return false;
783 }
784
785 1 const U8* us = this->m_buffAddr;
786 1 const U8* them = other.getBuffAddr();
787
788 1 FW_ASSERT(us);
789 1 FW_ASSERT(them);
790
791
2/2
✓ Branch 4 taken 51 times.
✓ Branch 5 taken 1 times.
52 for (Serializable::SizeType byte = 0; byte < this->m_serLoc; byte++) {
792
1/2
✗ Branch 4 not taken.
✓ Branch 5 taken 51 times.
51 if (us[byte] != them[byte]) {
793 ✗ return false;
794 }
795 }
796
797 1 return true;
798 }
799
800 ✗ std::ostream& operator<<(std::ostream& os, const LinearBufferBase& buff) {
801 ✗ const U8* us = buff.getBuffAddr();
802
803 ✗ FW_ASSERT(us);
804
805 ✗ for (Serializable::SizeType byte = 0; byte < buff.getSize(); byte++) {
806 ✗ os << "[" << std::setw(2) << std::hex << std::setfill('0') << us[byte] << "]" << std::dec;
807 }
808
809 ✗ return os;
810 }
811 #endif
812
813 6 ExternalSerializeBuffer::ExternalSerializeBuffer(U8* buffPtr, Serializable::SizeType size)
814 6 : LinearBufferBase(nullptr, 0) {
815
1/1
✓ Branch 4 taken 6 times.
6 this->setExtBuffer(buffPtr, size);
816 6 }
817
818 ✗ ExternalSerializeBuffer::ExternalSerializeBuffer() : LinearBufferBase(nullptr, 0) {
819 ✗ this->clear();
820 ✗ }
821
822 9 void ExternalSerializeBuffer::setExtBuffer(U8* buffPtr, Serializable::SizeType size) {
823 // Allow setting buffer with null pointer and zero size (for initialization/reset)
824 // but reject null pointer with non-zero size
825 9 FW_ASSERT((buffPtr != nullptr) || (size == 0), static_cast<FwAssertArgType>(size));
826 9 this->clear();
827 9 this->setBuffAddrInternal(buffPtr);
828 9 this->setCapacityInternal(size);
829 9 }
830
831 10 void ExternalSerializeBuffer::clear() {
832 10 this->resetSer();
833 10 this->resetDeser();
834 10 this->setBuffAddrInternal(nullptr);
835 10 this->setCapacityInternal(0);
836 10 }
837
838 // ----------------------------------------------------------------------
839 // Deprecated method implementations for backward compatibility
840 // ----------------------------------------------------------------------
841
842 ✗ Serializable::SizeType LinearBufferBase::getBuffLength() const {
843 ✗ return this->m_serLoc;
844 }
845
846 ✗ Serializable::SizeType LinearBufferBase::getBuffLeft() {
847 ✗ return this->getDeserializeSizeLeft();
848 }
849
850 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serialize(U8 val) {
851 ✗ return this->serializeFrom(val);
852 }
853 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serialize(I8 val) {
854 ✗ return this->serializeFrom(val);
855 }
856 #if FW_HAS_16_BIT == 1
857 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serialize(U16 val) {
858 ✗ return this->serializeFrom(val);
859 }
860 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serialize(I16 val) {
861 ✗ return this->serializeFrom(val);
862 }
863 #endif
864 #if FW_HAS_32_BIT == 1
865 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serialize(U32 val) {
866 ✗ return this->serializeFrom(val);
867 }
868 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serialize(I32 val) {
869 ✗ return this->serializeFrom(val);
870 }
871 #endif
872 #if FW_HAS_64_BIT == 1
873 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serialize(U64 val) {
874 ✗ return this->serializeFrom(val);
875 }
876 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serialize(I64 val) {
877 ✗ return this->serializeFrom(val);
878 }
879 #endif
880 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serialize(F32 val) {
881 ✗ return this->serializeFrom(val);
882 }
883 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serialize(F64 val) {
884 ✗ return this->serializeFrom(val);
885 }
886 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serialize(bool val) {
887 ✗ return this->serializeFrom(val);
888 }
889 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serialize(const void* val) {
890 ✗ return this->serializeFrom(val);
891 }
892
893 // Deprecated method for backward compatibility
894 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serialize(const U8* buff,
895 FwSizeType length,
896 bool noLength) {
897 ✗ const Serialization::t mode = noLength ? Serialization::OMIT_LENGTH : Serialization::INCLUDE_LENGTH;
898 ✗ return this->serializeFrom(buff, length, mode);
899 }
900
901 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serialize(const U8* buff, FwSizeType length) {
902 ✗ return this->serializeFrom(buff, length);
903 }
904 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serialize(const U8* buff,
905 FwSizeType length,
906 Serialization::t mode) {
907 ✗ return this->serializeFrom(buff, length, mode);
908 }
909 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serialize(const Serializable& val) {
910 ✗ return this->serializeFrom(val);
911 }
912 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serialize(const LinearBufferBase& val) {
913 ✗ return this->serializeFrom(val);
914 }
915
916 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserialize(U8& val) {
917 ✗ return this->deserializeTo(val);
918 }
919 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserialize(I8& val) {
920 ✗ return this->deserializeTo(val);
921 }
922 #if FW_HAS_16_BIT == 1
923 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserialize(U16& val) {
924 ✗ return this->deserializeTo(val);
925 }
926 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserialize(I16& val) {
927 ✗ return this->deserializeTo(val);
928 }
929 #endif
930 #if FW_HAS_32_BIT == 1
931 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserialize(U32& val) {
932 ✗ return this->deserializeTo(val);
933 }
934 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserialize(I32& val) {
935 ✗ return this->deserializeTo(val);
936 }
937 #endif
938 #if FW_HAS_64_BIT == 1
939 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserialize(U64& val) {
940 ✗ return this->deserializeTo(val);
941 }
942 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserialize(I64& val) {
943 ✗ return this->deserializeTo(val);
944 }
945 #endif
946 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserialize(F32& val) {
947 ✗ return this->deserializeTo(val);
948 }
949 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserialize(F64& val) {
950 ✗ return this->deserializeTo(val);
951 }
952 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserialize(bool& val) {
953 ✗ return this->deserializeTo(val);
954 }
955 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserialize(void*& val) {
956 ✗ return this->deserializeTo(val);
957 }
958
959 // Deprecated method for backward compatibility
960 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserialize(U8* buff,
961 FwSizeType& length,
962 bool noLength) {
963 ✗ const Serialization::t mode = noLength ? Serialization::OMIT_LENGTH : Serialization::INCLUDE_LENGTH;
964 ✗ return this->deserializeTo(buff, length, mode);
965 }
966
967 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserialize(U8* buff, FwSizeType& length) {
968 ✗ return this->deserializeTo(buff, length, Serialization::INCLUDE_LENGTH);
969 }
970
971 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserialize(U8* buff,
972 FwSizeType& length,
973 Serialization::t mode) {
974 ✗ return this->deserializeTo(buff, length, mode);
975 }
976
977 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserialize(Serializable& val) {
978 ✗ return this->deserializeTo(val);
979 }
980 ✗ FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserialize(LinearBufferBase& val) {
981 ✗ return this->deserializeTo(val);
982 }
983
984 ✗ Serializable::SizeType ExternalSerializeBuffer::getBuffCapacity() const {
985 ✗ return this->getCapacity();
986 }
987
988 } // namespace Fw
989