| 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 | 83853134 | Serializable::Serializable() {} | |
| 15 | |||
| 16 | 167635152 | 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 | 10689800 | SerialBufferBase::~SerialBufferBase() {} | |
| 39 | |||
| 40 | 5353005 | LinearBufferBase::LinearBufferBase(U8* buffAddr, Serializable::SizeType capacity) | |
| 41 | 5353170 | : m_buffAddr(buffAddr), m_capacity(capacity), m_serLoc(0), m_deserLoc(0) { | |
| 42 | // Ensure buffAddr & capacity are consistent | ||
| 43 | 5350893 | FW_ASSERT((buffAddr == nullptr) == (capacity == 0), static_cast<FwAssertArgType>(capacity)); | |
| 44 | 5350893 | } | |
| 45 | |||
| 46 | 10698054 | 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 | 10917789 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(U8 val, Endianness mode) { | |
| 71 |
2/2✓ Branch 8 taken 2000000 times.
✓ Branch 9 taken 8917789 times.
|
10917789 | if (this->m_serLoc + static_cast<Serializable::SizeType>(sizeof(val)) - 1 >= this->m_capacity) { |
| 72 | 2000000 | return FW_SERIALIZE_NO_ROOM_LEFT; | |
| 73 | } | ||
| 74 | 8917789 | U8* buffAddr = this->m_buffAddr; | |
| 75 | 8917789 | FW_ASSERT(buffAddr != nullptr); | |
| 76 | 8917789 | buffAddr[this->m_serLoc] = val; | |
| 77 | 8917789 | this->m_serLoc += static_cast<Serializable::SizeType>(sizeof(val)); | |
| 78 | 8917789 | this->m_deserLoc = 0; | |
| 79 | |||
| 80 | 8917789 | return FW_SERIALIZE_OK; | |
| 81 | } | ||
| 82 | |||
| 83 | 14 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(I8 val, Endianness mode) { | |
| 84 | 14 | return serializeFrom(static_cast<U8>(val), mode); | |
| 85 | } | ||
| 86 | |||
| 87 | #if FW_HAS_16_BIT == 1 | ||
| 88 | 2287695 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(U16 val, Endianness mode) { | |
| 89 |
2/2✓ Branch 8 taken 1999995 times.
✓ Branch 9 taken 287700 times.
|
2287695 | if (this->m_serLoc + static_cast<Serializable::SizeType>(sizeof(val)) - 1 >= this->m_capacity) { |
| 90 | 1999995 | return FW_SERIALIZE_NO_ROOM_LEFT; | |
| 91 | } | ||
| 92 | 287700 | U8* buffAddr = this->m_buffAddr; | |
| 93 | 287700 | FW_ASSERT(buffAddr != nullptr); | |
| 94 |
2/3✓ Branch 0 taken 287697 times.
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
|
287700 | switch (mode) { |
| 95 | 287697 | case Endianness::BIG: | |
| 96 | // MSB first | ||
| 97 | 287697 | buffAddr[this->m_serLoc + 0] = static_cast<U8>(val >> 8); | |
| 98 | 287697 | buffAddr[this->m_serLoc + 1] = static_cast<U8>(val); | |
| 99 | 287697 | 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 | 287700 | this->m_serLoc += static_cast<Serializable::SizeType>(sizeof(val)); | |
| 110 | 287700 | this->m_deserLoc = 0; | |
| 111 | 287700 | return FW_SERIALIZE_OK; | |
| 112 | } | ||
| 113 | |||
| 114 | 163988 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(I16 val, Endianness mode) { | |
| 115 | 163988 | return serializeFrom(static_cast<U16>(val), mode); | |
| 116 | } | ||
| 117 | #endif | ||
| 118 | #if FW_HAS_32_BIT == 1 | ||
| 119 | 5094352 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(U32 val, Endianness mode) { | |
| 120 |
2/2✓ Branch 8 taken 3999991 times.
✓ Branch 9 taken 1094361 times.
|
5094352 | if (this->m_serLoc + static_cast<Serializable::SizeType>(sizeof(val)) - 1 >= this->m_capacity) { |
| 121 | 3999991 | return FW_SERIALIZE_NO_ROOM_LEFT; | |
| 122 | } | ||
| 123 | 1094361 | U8* buffAddr = this->m_buffAddr; | |
| 124 | 1094361 | FW_ASSERT(buffAddr != nullptr); | |
| 125 |
2/3✓ Branch 0 taken 1094350 times.
✓ Branch 1 taken 11 times.
✗ Branch 2 not taken.
|
1094361 | switch (mode) { |
| 126 | 1094350 | case Endianness::BIG: | |
| 127 | // MSB first | ||
| 128 | 1094350 | buffAddr[this->m_serLoc + 0] = static_cast<U8>(val >> 24); | |
| 129 | 1094350 | buffAddr[this->m_serLoc + 1] = static_cast<U8>(val >> 16); | |
| 130 | 1094350 | buffAddr[this->m_serLoc + 2] = static_cast<U8>(val >> 8); | |
| 131 | 1094350 | buffAddr[this->m_serLoc + 3] = static_cast<U8>(val); | |
| 132 | 1094350 | break; | |
| 133 | 11 | case Endianness::LITTLE: | |
| 134 | // LSB first | ||
| 135 | 11 | buffAddr[this->m_serLoc + 0] = static_cast<U8>(val); | |
| 136 | 11 | buffAddr[this->m_serLoc + 1] = static_cast<U8>(val >> 8); | |
| 137 | 11 | buffAddr[this->m_serLoc + 2] = static_cast<U8>(val >> 16); | |
| 138 | 11 | buffAddr[this->m_serLoc + 3] = static_cast<U8>(val >> 24); | |
| 139 | 11 | break; | |
| 140 | ✗ | default: | |
| 141 | ✗ | FW_ASSERT(false); | |
| 142 | ✗ | break; | |
| 143 | } | ||
| 144 | 1094361 | this->m_serLoc += static_cast<Serializable::SizeType>(sizeof(val)); | |
| 145 | 1094361 | this->m_deserLoc = 0; | |
| 146 | 1094361 | return FW_SERIALIZE_OK; | |
| 147 | } | ||
| 148 | |||
| 149 | 223690 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(I32 val, Endianness mode) { | |
| 150 | 223690 | return serializeFrom(static_cast<U32>(val), mode); | |
| 151 | } | ||
| 152 | #endif | ||
| 153 | |||
| 154 | #if FW_HAS_64_BIT == 1 | ||
| 155 | 3683134 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(U64 val, Endianness mode) { | |
| 156 |
2/2✓ Branch 8 taken 1999996 times.
✓ Branch 9 taken 1683138 times.
|
3683134 | if (this->m_serLoc + static_cast<Serializable::SizeType>(sizeof(val)) - 1 >= this->m_capacity) { |
| 157 | 1999996 | return FW_SERIALIZE_NO_ROOM_LEFT; | |
| 158 | } | ||
| 159 | 1683138 | U8* buffAddr = this->m_buffAddr; | |
| 160 | 1683138 | FW_ASSERT(buffAddr != nullptr); | |
| 161 |
2/3✓ Branch 0 taken 1683132 times.
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
1683138 | switch (mode) { |
| 162 | 1683132 | case Endianness::BIG: | |
| 163 | // MSB first | ||
| 164 | 1683132 | buffAddr[this->m_serLoc + 0] = static_cast<U8>(val >> 56); | |
| 165 | 1683132 | buffAddr[this->m_serLoc + 1] = static_cast<U8>(val >> 48); | |
| 166 | 1683132 | buffAddr[this->m_serLoc + 2] = static_cast<U8>(val >> 40); | |
| 167 | 1683132 | buffAddr[this->m_serLoc + 3] = static_cast<U8>(val >> 32); | |
| 168 | 1683132 | buffAddr[this->m_serLoc + 4] = static_cast<U8>(val >> 24); | |
| 169 | 1683132 | buffAddr[this->m_serLoc + 5] = static_cast<U8>(val >> 16); | |
| 170 | 1683132 | buffAddr[this->m_serLoc + 6] = static_cast<U8>(val >> 8); | |
| 171 | 1683132 | buffAddr[this->m_serLoc + 7] = static_cast<U8>(val); | |
| 172 | 1683132 | 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 | 1683138 | this->m_serLoc += static_cast<Serializable::SizeType>(sizeof(val)); | |
| 189 | 1683138 | this->m_deserLoc = 0; | |
| 190 | 1683138 | return FW_SERIALIZE_OK; | |
| 191 | } | ||
| 192 | |||
| 193 | 151 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(I64 val, Endianness mode) { | |
| 194 | 151 | return serializeFrom(static_cast<U64>(val), mode); | |
| 195 | } | ||
| 196 | #endif | ||
| 197 | |||
| 198 | 1000012 | 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 | 1000012 | U64 u64Val; | |
| 201 | 1000012 | (void)memcpy(&u64Val, &val, sizeof(val)); | |
| 202 |
1/1✓ Branch 7 taken 1000012 times.
|
2000024 | return this->serializeFrom(u64Val, mode); |
| 203 | } | ||
| 204 | |||
| 205 | 2000266 | 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 | 2000266 | U32 u32Val; | |
| 208 | 2000266 | (void)memcpy(&u32Val, &val, sizeof(val)); | |
| 209 |
1/1✓ Branch 7 taken 2000266 times.
|
4000532 | return this->serializeFrom(u32Val, mode); |
| 210 | } | ||
| 211 | |||
| 212 | 10613 | 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 170 times.
✓ Branch 1 taken 10443 times.
|
10613 | const U8 byteVal = val ? static_cast<U8>(FW_SERIALIZE_TRUE_VALUE) : static_cast<U8>(FW_SERIALIZE_FALSE_VALUE); |
| 219 | 10613 | return this->serializeFrom(byteVal, mode); | |
| 220 | } | ||
| 221 | |||
| 222 | 35 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(const void* val, Endianness mode) { | |
| 223 | // pointers are serialized as their integer representation | ||
| 224 | 35 | return this->serializeFrom(reinterpret_cast<PlatformPointerCastType>(val), mode); | |
| 225 | } | ||
| 226 | |||
| 227 | 2013010 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(const U8* buff, | |
| 228 | Serializable::SizeType length, | ||
| 229 | Endianness endianMode) { | ||
| 230 | 2013010 | return this->serializeFrom(buff, static_cast<FwSizeType>(length), Serialization::INCLUDE_LENGTH, endianMode); | |
| 231 | } | ||
| 232 | |||
| 233 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus | ||
| 234 | 2565800 | LinearBufferBase::serializeFrom(const U8* buff, | |
| 235 | FwSizeType length, | ||
| 236 | Serialization::t lengthMode, | ||
| 237 | Endianness endianMode) { // First serialize length | ||
| 238 | SerializeStatus stat; | ||
| 239 |
2/2✓ Branch 0 taken 2052491 times.
✓ Branch 1 taken 513309 times.
|
2565800 | if (lengthMode == Serialization::INCLUDE_LENGTH) { |
| 240 | 2052491 | stat = this->serializeFrom(static_cast<FwSizeStoreType>(length), endianMode); | |
| 241 |
2/2✓ Branch 0 taken 1999994 times.
✓ Branch 1 taken 52497 times.
|
2052491 | 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 |
2/2✓ Branch 8 taken 2 times.
✓ Branch 9 taken 565804 times.
|
565806 | if (length > this->m_capacity - this->m_serLoc) { |
| 249 | 2 | return FW_SERIALIZE_NO_ROOM_LEFT; | |
| 250 | } | ||
| 251 | |||
| 252 |
2/2✓ Branch 0 taken 563984 times.
✓ Branch 1 taken 1820 times.
|
565804 | if (length > 0) { |
| 253 | 563984 | FW_ASSERT(buff != nullptr); | |
| 254 | } | ||
| 255 | 565804 | U8* buffAddr = this->m_buffAddr; | |
| 256 | 565804 | 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 565804 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 565804 times.
|
565804 | (void)memmove(&buffAddr[this->m_serLoc], buff, static_cast<size_t>(length)); |
| 259 | 565804 | this->m_serLoc += static_cast<Serializable::SizeType>(length); | |
| 260 | 565804 | this->m_deserLoc = 0; | |
| 261 | |||
| 262 | 565804 | return FW_SERIALIZE_OK; | |
| 263 | } | ||
| 264 | |||
| 265 | 1172383 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(const Serializable& val, | |
| 266 | Endianness mode) { | ||
| 267 | 1172383 | return val.serializeTo(*this, mode); | |
| 268 | } | ||
| 269 | |||
| 270 | 13646 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeFrom(const LinearBufferBase& val, | |
| 271 | Endianness mode) { | ||
| 272 | 13646 | Serializable::SizeType size = val.getSize(); | |
| 273 | // Note: m_serLoc <= m_capacity is a class invariant, so this subtraction cannot underflow. | ||
| 274 | 13646 | Serializable::SizeType available = this->m_capacity - this->m_serLoc; | |
| 275 |
2/4✓ Branch 0 taken 13646 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 13646 times.
|
13646 | 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 | 13646 | SerializeStatus stat = this->serializeFrom(static_cast<FwSizeStoreType>(size), mode); | |
| 281 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13646 times.
|
13646 | if (stat != FW_SERIALIZE_OK) { |
| 282 | ✗ | return stat; | |
| 283 | } | ||
| 284 | |||
| 285 | 13646 | U8* thisBuffAddr = this->m_buffAddr; | |
| 286 | 13646 | const U8* valBuffAddr = val.getBuffAddr(); | |
| 287 | 13646 | FW_ASSERT(thisBuffAddr != nullptr); | |
| 288 | 13646 | FW_ASSERT(valBuffAddr != nullptr); | |
| 289 | // serialize buffer | ||
| 290 |
2/4✗ Branch 5 not taken.
✓ Branch 6 taken 13646 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 13646 times.
|
13646 | (void)memcpy(&thisBuffAddr[this->m_serLoc], valBuffAddr, static_cast<size_t>(size)); |
| 291 | 13646 | this->m_serLoc += size; | |
| 292 | 13646 | this->m_deserLoc = 0; | |
| 293 | |||
| 294 | 13646 | return FW_SERIALIZE_OK; | |
| 295 | } | ||
| 296 | |||
| 297 | 32646 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeSize(const FwSizeType size, Endianness mode) { | |
| 298 | 32646 | SerializeStatus status = FW_SERIALIZE_OK; | |
| 299 |
3/6✓ Branch 1 taken 32646 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 32646 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 32646 times.
|
32646 | 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 32646 times.
✗ Branch 1 not taken.
|
32646 | if (status == FW_SERIALIZE_OK) { |
| 303 | 32646 | status = this->serializeFrom(static_cast<FwSizeStoreType>(size), mode); | |
| 304 | } | ||
| 305 | 32646 | return status; | |
| 306 | } | ||
| 307 | |||
| 308 | // deserialization routines | ||
| 309 | |||
| 310 | 796636 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(U8& val, Endianness mode) { | |
| 311 | // check for room | ||
| 312 | 796636 | const Serializable::SizeType size = this->m_serLoc; | |
| 313 |
2/2✓ Branch 4 taken 9 times.
✓ Branch 5 taken 796627 times.
|
796636 | if (size == this->m_deserLoc) { |
| 314 | 9 | return FW_DESERIALIZE_BUFFER_EMPTY; | |
| 315 |
1/2✗ Branch 4 not taken.
✓ Branch 5 taken 796627 times.
|
796627 | } 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 | 796627 | U8* buffAddr = this->m_buffAddr; | |
| 320 | 796627 | FW_ASSERT(buffAddr != nullptr); | |
| 321 | 796627 | val = buffAddr[this->m_deserLoc + 0]; | |
| 322 | 796627 | this->m_deserLoc += static_cast<Serializable::SizeType>(sizeof(val)); | |
| 323 | 796627 | return FW_SERIALIZE_OK; | |
| 324 | } | ||
| 325 | |||
| 326 | 13 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(I8& val, Endianness mode) { | |
| 327 | // check for room | ||
| 328 | 13 | const Serializable::SizeType size = this->m_serLoc; | |
| 329 |
1/2✗ Branch 4 not taken.
✓ Branch 5 taken 13 times.
|
13 | if (size == this->m_deserLoc) { |
| 330 | ✗ | return FW_DESERIALIZE_BUFFER_EMPTY; | |
| 331 |
1/2✗ Branch 4 not taken.
✓ Branch 5 taken 13 times.
|
13 | } 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 | 13 | U8* buffAddr = this->m_buffAddr; | |
| 336 | 13 | FW_ASSERT(buffAddr != nullptr); | |
| 337 | 13 | val = static_cast<I8>(buffAddr[this->m_deserLoc + 0]); | |
| 338 | 13 | this->m_deserLoc += static_cast<Serializable::SizeType>(sizeof(val)); | |
| 339 | 13 | return FW_SERIALIZE_OK; | |
| 340 | } | ||
| 341 | |||
| 342 | #if FW_HAS_16_BIT == 1 | ||
| 343 | 317178 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(U16& val, Endianness mode) { | |
| 344 | // check for room | ||
| 345 | 317178 | const Serializable::SizeType size = this->m_serLoc; | |
| 346 |
2/2✓ Branch 4 taken 70847 times.
✓ Branch 5 taken 241180 times.
|
313861 | if (size == this->m_deserLoc) { |
| 347 | 70847 | return FW_DESERIALIZE_BUFFER_EMPTY; | |
| 348 |
2/2✓ Branch 4 taken 3 times.
✓ Branch 5 taken 241177 times.
|
241180 | } else if (size - this->m_deserLoc < static_cast<Serializable::SizeType>(sizeof(val))) { |
| 349 | 3 | return FW_DESERIALIZE_SIZE_MISMATCH; | |
| 350 | } | ||
| 351 | // read from current location | ||
| 352 | 241177 | U8* buffAddr = this->m_buffAddr; | |
| 353 | 241177 | FW_ASSERT(buffAddr != nullptr); | |
| 354 |
2/3✓ Branch 0 taken 241174 times.
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
|
241177 | switch (mode) { |
| 355 | 241174 | case Endianness::BIG: | |
| 356 | // MSB first | ||
| 357 |
2/4✗ Branch 6 not taken.
✓ Branch 7 taken 241174 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 241174 times.
|
241174 | val = static_cast<U16>(((buffAddr[this->m_deserLoc + 1]) << 0) | ((buffAddr[this->m_deserLoc + 0]) << 8)); |
| 358 | 241174 | 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 | 241177 | this->m_deserLoc += static_cast<Serializable::SizeType>(sizeof(val)); | |
| 368 | 241177 | return FW_SERIALIZE_OK; | |
| 369 | } | ||
| 370 | |||
| 371 | 103288 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(I16& val, Endianness mode) { | |
| 372 | 103288 | U16 unsignVal = 0; | |
| 373 |
1/1✓ Branch 7 taken 103288 times.
|
103288 | SerializeStatus res = deserializeTo(unsignVal, mode); |
| 374 |
2/2✓ Branch 0 taken 103287 times.
✓ Branch 1 taken 1 times.
|
103288 | if (res == SerializeStatus::FW_SERIALIZE_OK) { |
| 375 | 103287 | val = static_cast<I16>(unsignVal); | |
| 376 | } | ||
| 377 | 103288 | return res; | |
| 378 | } | ||
| 379 | #endif | ||
| 380 | #if FW_HAS_32_BIT == 1 | ||
| 381 | 1018109 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(U32& val, Endianness mode) { | |
| 382 | // check for room | ||
| 383 | 1018109 | const Serializable::SizeType size = this->m_serLoc; | |
| 384 |
2/2✓ Branch 4 taken 14 times.
✓ Branch 5 taken 1018095 times.
|
1018109 | if (size == this->m_deserLoc) { |
| 385 | 14 | return FW_DESERIALIZE_BUFFER_EMPTY; | |
| 386 |
2/2✓ Branch 4 taken 8 times.
✓ Branch 5 taken 1018087 times.
|
1018095 | } else if (size - this->m_deserLoc < static_cast<Serializable::SizeType>(sizeof(val))) { |
| 387 | 8 | return FW_DESERIALIZE_SIZE_MISMATCH; | |
| 388 | } | ||
| 389 | // read from current location | ||
| 390 | 1018087 | U8* buffAddr = this->m_buffAddr; | |
| 391 | 1018087 | FW_ASSERT(buffAddr != nullptr); | |
| 392 |
2/3✓ Branch 0 taken 1018083 times.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
1018087 | switch (mode) { |
| 393 | 1018083 | case Endianness::BIG: | |
| 394 | // MSB first | ||
| 395 | 1018083 | val = (static_cast<U32>(buffAddr[this->m_deserLoc + 3]) << 0) | | |
| 396 | 1018083 | (static_cast<U32>(buffAddr[this->m_deserLoc + 2]) << 8) | | |
| 397 | 1018083 | (static_cast<U32>(buffAddr[this->m_deserLoc + 1]) << 16) | | |
| 398 | 1018083 | (static_cast<U32>(buffAddr[this->m_deserLoc + 0]) << 24); | |
| 399 | 1018083 | 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 | 1018087 | this->m_deserLoc += static_cast<Serializable::SizeType>(sizeof(val)); | |
| 412 | 1018087 | return FW_SERIALIZE_OK; | |
| 413 | } | ||
| 414 | |||
| 415 | 162791 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(I32& val, Endianness mode) { | |
| 416 | 162791 | U32 unsignVal = 0; | |
| 417 |
1/1✓ Branch 7 taken 162791 times.
|
162791 | SerializeStatus res = deserializeTo(unsignVal, mode); |
| 418 |
1/2✓ Branch 0 taken 162791 times.
✗ Branch 1 not taken.
|
162791 | if (res == SerializeStatus::FW_SERIALIZE_OK) { |
| 419 | 162791 | val = static_cast<I32>(unsignVal); | |
| 420 | } | ||
| 421 | 162791 | return res; | |
| 422 | } | ||
| 423 | #endif | ||
| 424 | |||
| 425 | #if FW_HAS_64_BIT == 1 | ||
| 426 | |||
| 427 | 1688501 | 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 1688501 times.
|
1688501 | if (this->m_serLoc == this->m_deserLoc) { |
| 430 | ✗ | return FW_DESERIALIZE_BUFFER_EMPTY; | |
| 431 |
1/2✗ Branch 8 not taken.
✓ Branch 9 taken 1688501 times.
|
1688501 | } 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 | 1688501 | U8* buffAddr = this->m_buffAddr; | |
| 436 | 1688501 | FW_ASSERT(buffAddr != nullptr); | |
| 437 |
2/3✓ Branch 0 taken 1688495 times.
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
1688501 | switch (mode) { |
| 438 | 1688495 | case Endianness::BIG: | |
| 439 | // MSB first | ||
| 440 | 1688495 | val = (static_cast<U64>(buffAddr[this->m_deserLoc + 7]) << 0) | | |
| 441 | 1688495 | (static_cast<U64>(buffAddr[this->m_deserLoc + 6]) << 8) | | |
| 442 | 1688495 | (static_cast<U64>(buffAddr[this->m_deserLoc + 5]) << 16) | | |
| 443 | 1688495 | (static_cast<U64>(buffAddr[this->m_deserLoc + 4]) << 24) | | |
| 444 | 1688495 | (static_cast<U64>(buffAddr[this->m_deserLoc + 3]) << 32) | | |
| 445 | 1688495 | (static_cast<U64>(buffAddr[this->m_deserLoc + 2]) << 40) | | |
| 446 | 1688495 | (static_cast<U64>(buffAddr[this->m_deserLoc + 1]) << 48) | | |
| 447 | 1688495 | (static_cast<U64>(buffAddr[this->m_deserLoc + 0]) << 56); | |
| 448 | 1688495 | 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 | 1688501 | this->m_deserLoc += static_cast<Serializable::SizeType>(sizeof(val)); | |
| 465 | 1688501 | return FW_SERIALIZE_OK; | |
| 466 | } | ||
| 467 | |||
| 468 | 151 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(I64& val, Endianness mode) { | |
| 469 | 151 | U64 unsignVal; | |
| 470 |
1/1✓ Branch 7 taken 151 times.
|
151 | SerializeStatus res = deserializeTo(unsignVal, mode); |
| 471 |
1/2✓ Branch 0 taken 151 times.
✗ Branch 1 not taken.
|
151 | if (res == SerializeStatus::FW_SERIALIZE_OK) { |
| 472 | 151 | val = static_cast<I64>(unsignVal); | |
| 473 | } | ||
| 474 | 151 | return res; | |
| 475 | } | ||
| 476 | #endif | ||
| 477 | |||
| 478 | 1000011 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(F64& val, Endianness mode) { | |
| 479 | // deserialize as 64-bit int to handle endianness | ||
| 480 | 1000011 | U64 tempVal; | |
| 481 |
1/1✓ Branch 7 taken 1000011 times.
|
1000011 | SerializeStatus stat = this->deserializeTo(tempVal, mode); |
| 482 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1000011 times.
|
1000011 | if (stat != FW_SERIALIZE_OK) { |
| 483 | ✗ | return stat; | |
| 484 | } | ||
| 485 | // copy to argument | ||
| 486 | 1000011 | (void)memcpy(&val, &tempVal, sizeof(val)); | |
| 487 | |||
| 488 | 1000011 | return FW_SERIALIZE_OK; | |
| 489 | } | ||
| 490 | |||
| 491 | 10609 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(bool& val, Endianness mode) { | |
| 492 | 10609 | U8 byteVal = 0; | |
| 493 |
1/1✓ Branch 7 taken 10609 times.
|
10609 | const SerializeStatus stat = this->deserializeTo(byteVal, mode); |
| 494 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10609 times.
|
10609 | if (stat != FW_SERIALIZE_OK) { |
| 495 | ✗ | return stat; | |
| 496 | } | ||
| 497 |
2/2✓ Branch 0 taken 167 times.
✓ Branch 1 taken 10442 times.
|
10609 | if (FW_SERIALIZE_TRUE_VALUE == byteVal) { |
| 498 | 167 | val = true; | |
| 499 |
2/2✓ Branch 0 taken 10441 times.
✓ Branch 1 taken 1 times.
|
10442 | } else if (FW_SERIALIZE_FALSE_VALUE == byteVal) { |
| 500 | 10441 | 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 | 10608 | 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 | 42 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(F32& val, Endianness mode) { | |
| 520 | // deserialize as 32-bit int to handle endianness | ||
| 521 | 42 | U32 tempVal = 0; | |
| 522 |
1/1✓ Branch 7 taken 42 times.
|
42 | SerializeStatus stat = this->deserializeTo(tempVal, mode); |
| 523 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 42 times.
|
42 | if (stat != FW_SERIALIZE_OK) { |
| 524 | ✗ | return stat; | |
| 525 | } | ||
| 526 | 42 | (void)memcpy(&val, &tempVal, sizeof(val)); | |
| 527 | |||
| 528 | 42 | 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 | 154030 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(U8* buff, | |
| 541 | Serializable::SizeType& length, | ||
| 542 | Serialization::t lengthMode, | ||
| 543 | Endianness endianMode) { | ||
| 544 | 154030 | U8* buffAddr = this->m_buffAddr; | |
| 545 | 154030 | FW_ASSERT(buffAddr != nullptr); | |
| 546 | |||
| 547 |
2/2✓ Branch 0 taken 41307 times.
✓ Branch 1 taken 112723 times.
|
154030 | if (lengthMode == Serialization::INCLUDE_LENGTH) { |
| 548 | 41307 | FwSizeStoreType storedLength = 0; | |
| 549 | |||
| 550 |
1/1✓ Branch 7 taken 41307 times.
|
41307 | SerializeStatus stat = this->deserializeTo(storedLength, endianMode); |
| 551 | |||
| 552 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 41307 times.
|
41307 | if (stat != FW_SERIALIZE_OK) { |
| 553 | ✗ | return stat; | |
| 554 | } | ||
| 555 | |||
| 556 | // make sure it fits | ||
| 557 |
6/7✓ Branch 7 taken 41307 times.
✓ Branch 9 taken 41306 times.
✓ Branch 10 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 41306 times.
✓ Branch 14 taken 1 times.
✓ Branch 15 taken 41306 times.
|
41307 | if ((storedLength > this->getDeserializeSizeLeft()) || (storedLength > length)) { |
| 558 | 1 | return FW_DESERIALIZE_SIZE_MISMATCH; | |
| 559 | } | ||
| 560 | |||
| 561 |
2/2✓ Branch 0 taken 40597 times.
✓ Branch 1 taken 709 times.
|
41306 | if (storedLength > 0) { |
| 562 | 40597 | FW_ASSERT(buff != nullptr); | |
| 563 | } | ||
| 564 |
2/4✗ Branch 5 not taken.
✓ Branch 6 taken 41306 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 41306 times.
|
41306 | (void)memcpy(buff, &buffAddr[this->m_deserLoc], static_cast<size_t>(storedLength)); |
| 565 | |||
| 566 | 41306 | length = static_cast<FwSizeType>(storedLength); | |
| 567 | |||
| 568 | } else { | ||
| 569 | // make sure enough is left | ||
| 570 |
2/2✓ Branch 8 taken 1 times.
✓ Branch 9 taken 112722 times.
|
112723 | if (length > this->getDeserializeSizeLeft()) { |
| 571 | 1 | return FW_DESERIALIZE_SIZE_MISMATCH; | |
| 572 | } | ||
| 573 | |||
| 574 |
2/2✓ Branch 1 taken 112717 times.
✓ Branch 2 taken 5 times.
|
112722 | if (length > 0) { |
| 575 | 112717 | FW_ASSERT(buff != nullptr); | |
| 576 | } | ||
| 577 |
2/4✗ Branch 6 not taken.
✓ Branch 7 taken 112722 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 112722 times.
|
112722 | (void)memcpy(buff, &buffAddr[this->m_deserLoc], static_cast<size_t>(length)); |
| 578 | } | ||
| 579 | |||
| 580 | 154028 | this->m_deserLoc += static_cast<Serializable::SizeType>(length); | |
| 581 | 154028 | return FW_SERIALIZE_OK; | |
| 582 | } | ||
| 583 | |||
| 584 | 1232622 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(Serializable& val, Endianness mode) { | |
| 585 | 1232622 | return val.deserializeFrom(*this, mode); | |
| 586 | } | ||
| 587 | |||
| 588 | 11426 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeTo(LinearBufferBase& val, Endianness mode) { | |
| 589 | 11426 | U8* valBuffAddr = val.getBuffAddr(); | |
| 590 | 11426 | FW_ASSERT(valBuffAddr != nullptr); | |
| 591 | 11426 | SerializeStatus stat = FW_SERIALIZE_OK; | |
| 592 | |||
| 593 | 11426 | FwSizeStoreType storedLength = 0; | |
| 594 | |||
| 595 |
1/1✓ Branch 7 taken 11426 times.
|
11426 | stat = this->deserializeTo(storedLength, mode); |
| 596 | |||
| 597 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11426 times.
|
11426 | if (stat != FW_SERIALIZE_OK) { |
| 598 | ✗ | return stat; | |
| 599 | } | ||
| 600 | |||
| 601 | // make sure destination has enough room | ||
| 602 | |||
| 603 |
5/8✓ Branch 7 taken 11426 times.
✓ Branch 9 taken 11426 times.
✗ Branch 10 not taken.
✓ Branch 18 taken 11426 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 11426 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 11426 times.
|
11426 | if ((storedLength > val.getCapacity()) || (storedLength > this->getDeserializeSizeLeft())) { |
| 604 | ✗ | return FW_DESERIALIZE_SIZE_MISMATCH; | |
| 605 | } | ||
| 606 | |||
| 607 | 11426 | U8* thisBuffAddr = this->m_buffAddr; | |
| 608 | 11426 | FW_ASSERT(thisBuffAddr != nullptr); | |
| 609 |
2/4✗ Branch 5 not taken.
✓ Branch 6 taken 11426 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 11426 times.
|
11426 | (void)memcpy(valBuffAddr, &thisBuffAddr[this->m_deserLoc], static_cast<size_t>(storedLength)); |
| 610 | |||
| 611 |
1/1✓ Branch 7 taken 11426 times.
|
11426 | stat = val.setBuffLen(storedLength); |
| 612 | |||
| 613 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11426 times.
|
11426 | if (stat != FW_SERIALIZE_OK) { |
| 614 | ✗ | return stat; | |
| 615 | } | ||
| 616 | |||
| 617 | 11426 | this->m_deserLoc += storedLength; | |
| 618 | |||
| 619 | 11426 | return FW_SERIALIZE_OK; | |
| 620 | } | ||
| 621 | |||
| 622 | 41770 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeSize(FwSizeType& size, Endianness mode) { | |
| 623 | 41770 | FwSizeStoreType storedSize = 0; | |
| 624 |
1/1✓ Branch 7 taken 41770 times.
|
41770 | Fw::SerializeStatus status = this->deserializeTo(storedSize, mode); |
| 625 |
1/2✓ Branch 0 taken 41770 times.
✗ Branch 1 not taken.
|
41770 | if (status == FW_SERIALIZE_OK) { |
| 626 | 41770 | size = static_cast<FwSizeType>(storedSize); | |
| 627 | } | ||
| 628 | 41770 | return status; | |
| 629 | } | ||
| 630 | |||
| 631 | 6106430 | void LinearBufferBase::resetSer() { | |
| 632 | 6106430 | this->m_deserLoc = 0; | |
| 633 | 6106430 | this->m_serLoc = 0; | |
| 634 | 6106429 | } | |
| 635 | |||
| 636 | 5155476 | void LinearBufferBase::resetDeser() { | |
| 637 | 5155476 | this->m_deserLoc = 0; | |
| 638 | 5155476 | } | |
| 639 | |||
| 640 | 2640 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::serializeSkip(FwSizeType numBytesToSkip) { | |
| 641 | 2640 | Fw::SerializeStatus status = FW_SERIALIZE_OK; | |
| 642 | // compute new ser loc | ||
| 643 | 2640 | const FwSizeType newSerLoc = this->m_serLoc + numBytesToSkip; | |
| 644 | // check for room | ||
| 645 |
1/2✓ Branch 4 taken 2640 times.
✗ Branch 5 not taken.
|
2640 | if (newSerLoc <= this->m_capacity) { |
| 646 | // update ser loc | ||
| 647 | 2640 | this->m_serLoc = static_cast<Serializable::SizeType>(newSerLoc); | |
| 648 | } else { | ||
| 649 | ✗ | status = FW_SERIALIZE_NO_ROOM_LEFT; | |
| 650 | } | ||
| 651 | 2640 | return status; | |
| 652 | } | ||
| 653 | |||
| 654 | 1047824 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::deserializeSkip(FwSizeType numBytesToSkip) { | |
| 655 | // check for room | ||
| 656 | 1047824 | const Serializable::SizeType size = this->m_serLoc; | |
| 657 |
2/2✓ Branch 4 taken 1 times.
✓ Branch 5 taken 1047823 times.
|
1047824 | if (size == this->m_deserLoc) { |
| 658 | 1 | return FW_DESERIALIZE_BUFFER_EMPTY; | |
| 659 |
2/2✓ Branch 4 taken 1 times.
✓ Branch 5 taken 1047822 times.
|
1047823 | } 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 | 1047822 | this->m_deserLoc += static_cast<Serializable::SizeType>(numBytesToSkip); | |
| 664 | 1047822 | return FW_SERIALIZE_OK; | |
| 665 | } | ||
| 666 | |||
| 667 | 120 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::moveSerToOffset(FwSizeType offset) { | |
| 668 | // Reset serialization | ||
| 669 | 120 | this->resetSer(); | |
| 670 | // Advance to offset | ||
| 671 | 120 | return this->serializeSkip(offset); | |
| 672 | } | ||
| 673 | 69082 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::moveDeserToOffset(FwSizeType offset) { | |
| 674 | // Reset deserialization | ||
| 675 | 69082 | this->resetDeser(); | |
| 676 | // Advance to offset | ||
| 677 | 69082 | return this->deserializeSkip(offset); | |
| 678 | } | ||
| 679 | |||
| 680 | 3303807 | Serializable::SizeType LinearBufferBase::getSize() const { | |
| 681 | 3303807 | return this->m_serLoc; | |
| 682 | } | ||
| 683 | |||
| 684 | 739263 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::setBuff(const U8* src, Serializable::SizeType length) { | |
| 685 |
1/2✗ Branch 4 not taken.
✓ Branch 5 taken 739263 times.
|
739263 | if (this->m_capacity < length) { |
| 686 | ✗ | return FW_SERIALIZE_NO_ROOM_LEFT; | |
| 687 | } else { | ||
| 688 | 739263 | FW_ASSERT(src); | |
| 689 | 739263 | U8* buffAddr = this->m_buffAddr; | |
| 690 | 739263 | FW_ASSERT(buffAddr != nullptr); | |
| 691 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 739263 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 739263 times.
|
739263 | (void)memcpy(buffAddr, src, static_cast<size_t>(length)); |
| 692 | 739263 | this->m_serLoc = length; | |
| 693 | 739263 | this->m_deserLoc = 0; | |
| 694 | 739263 | return FW_SERIALIZE_OK; | |
| 695 | } | ||
| 696 | } | ||
| 697 | |||
| 698 | 198484 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::setBuffLen(Serializable::SizeType length) { | |
| 699 |
1/2✗ Branch 4 not taken.
✓ Branch 5 taken 198484 times.
|
198484 | if (this->m_capacity < length) { |
| 700 | ✗ | return FW_SERIALIZE_NO_ROOM_LEFT; | |
| 701 | } else { | ||
| 702 | 198484 | this->m_serLoc = length; | |
| 703 | 198484 | this->m_deserLoc = 0; | |
| 704 | 198484 | return FW_SERIALIZE_OK; | |
| 705 | } | ||
| 706 | } | ||
| 707 | |||
| 708 | 3108506 | Serializable::SizeType LinearBufferBase::getDeserializeSizeLeft() const { | |
| 709 | 3108506 | FW_ASSERT(this->m_serLoc >= this->m_deserLoc, static_cast<FwAssertArgType>(this->m_serLoc), | |
| 710 | static_cast<FwAssertArgType>(this->m_deserLoc)); | ||
| 711 | 3108506 | 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 | 7293 | FW_SERIALIZE_FORCE_INLINE_LBB SerializeStatus LinearBufferBase::copyRaw(SerialBufferBase& dest, | |
| 721 | Serializable::SizeType size) { | ||
| 722 | // make sure there is sufficient size in destination | ||
| 723 |
2/2✓ Branch 7 taken 1 times.
✓ Branch 8 taken 7292 times.
|
7293 | if (dest.getCapacity() < size) { |
| 724 | 1 | return FW_SERIALIZE_NO_ROOM_LEFT; | |
| 725 | } | ||
| 726 | // make sure there is sufficient buffer in source | ||
| 727 |
1/2✗ Branch 7 not taken.
✓ Branch 8 taken 7292 times.
|
7292 | 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 | 7292 | U8* buffAddr = this->m_buffAddr; | |
| 733 | |||
| 734 | 7292 | FW_ASSERT(buffAddr); | |
| 735 | 7292 | SerializeStatus stat = dest.setBuff(&buffAddr[this->m_deserLoc], size); | |
| 736 |
1/2✓ Branch 0 taken 7292 times.
✗ Branch 1 not taken.
|
7292 | if (stat == FW_SERIALIZE_OK) { |
| 737 | 7292 | this->m_deserLoc += size; | |
| 738 | } | ||
| 739 | 7292 | 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 | 1009755 | const U8* LinearBufferBase::getBuffAddrLeft() const { | |
| 767 | 1009755 | const U8* buffAddr = this->m_buffAddr; | |
| 768 | 1009755 | FW_ASSERT(buffAddr != nullptr); | |
| 769 | 1009755 | return &buffAddr[this->m_deserLoc]; | |
| 770 | } | ||
| 771 | |||
| 772 | //!< gets address of end of serialization. Used to manually place data at the end | ||
| 773 | 99136 | U8* LinearBufferBase::getBuffAddrSer() { | |
| 774 | 99136 | U8* buffAddr = this->m_buffAddr; | |
| 775 | 99136 | FW_ASSERT(buffAddr != nullptr); | |
| 776 | 99136 | return &buffAddr[this->m_serLoc]; | |
| 777 | } | ||
| 778 | |||
| 779 | #ifdef BUILD_UT | ||
| 780 | 187 | bool LinearBufferBase::operator==(const LinearBufferBase& other) const { | |
| 781 |
1/2✗ Branch 11 not taken.
✓ Branch 12 taken 187 times.
|
187 | if (this->m_serLoc != other.getSize()) { |
| 782 | ✗ | return false; | |
| 783 | } | ||
| 784 | |||
| 785 | 187 | const U8* us = this->m_buffAddr; | |
| 786 | 187 | const U8* them = other.getBuffAddr(); | |
| 787 | |||
| 788 | 187 | FW_ASSERT(us); | |
| 789 | 187 | FW_ASSERT(them); | |
| 790 | |||
| 791 |
2/2✓ Branch 4 taken 5739 times.
✓ Branch 5 taken 187 times.
|
5926 | for (Serializable::SizeType byte = 0; byte < this->m_serLoc; byte++) { |
| 792 |
1/2✗ Branch 4 not taken.
✓ Branch 5 taken 5739 times.
|
5739 | if (us[byte] != them[byte]) { |
| 793 | ✗ | return false; | |
| 794 | } | ||
| 795 | } | ||
| 796 | |||
| 797 | 187 | 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 | 293818 | ExternalSerializeBuffer::ExternalSerializeBuffer(U8* buffPtr, Serializable::SizeType size) | |
| 814 | 293818 | : LinearBufferBase(nullptr, 0) { | |
| 815 |
1/1✓ Branch 4 taken 293818 times.
|
293818 | this->setExtBuffer(buffPtr, size); |
| 816 | 293818 | } | |
| 817 | |||
| 818 | 2200310 | ExternalSerializeBuffer::ExternalSerializeBuffer() : LinearBufferBase(nullptr, 0) { | |
| 819 |
1/1✓ Branch 4 taken 2200310 times.
|
2200310 | this->clear(); |
| 820 | 2200310 | } | |
| 821 | |||
| 822 | 2705043 | 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 | 2705043 | FW_ASSERT((buffPtr != nullptr) || (size == 0), static_cast<FwAssertArgType>(size)); | |
| 826 | 2705043 | this->clear(); | |
| 827 | 2705043 | this->setBuffAddrInternal(buffPtr); | |
| 828 | 2705043 | this->setCapacityInternal(size); | |
| 829 | 2705043 | } | |
| 830 | |||
| 831 | 4905477 | void ExternalSerializeBuffer::clear() { | |
| 832 | 4905477 | this->resetSer(); | |
| 833 | 4905476 | this->resetDeser(); | |
| 834 | 4905477 | this->setBuffAddrInternal(nullptr); | |
| 835 | 4905477 | this->setCapacityInternal(0); | |
| 836 | 4905477 | } | |
| 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 |