GCC Code Coverage Report


Directory: ./
File: Header.cpp
Date: 2026-09-03 22:13:00
Exec Total Coverage
Lines: 8 22 36.4%
Functions: 2 4 50.0%
Branches: 3 8 37.5%

Line Branch Exec Source
1 // ======================================================================
2 // \title Header.cpp
3 // \author bocchino
4 // \brief cpp file for FilePacket::Header
5 //
6 // \copyright
7 // Copyright 2009-2016, by the California Institute of Technology.
8 // ALL RIGHTS RESERVED. United States Government Sponsorship
9 // acknowledged.
10 //
11 // ======================================================================
12
13 #include <Fw/FilePacket/FilePacket.hpp>
14 #include <Fw/Types/Assert.hpp>
15
16 namespace Fw {
17
18 void FilePacket::Header ::initialize(const Type type, const U32 sequenceIndex) {
19 this->m_type = type;
20 this->m_sequenceIndex = sequenceIndex;
21 }
22
23 2 U32 FilePacket::Header ::bufferSize() const {
24 2 return sizeof(U8) + sizeof(this->m_sequenceIndex);
25 }
26
27 6 SerializeStatus FilePacket::Header ::fromSerialBuffer(SerialBuffer& serialBuffer) {
28 U8 new_type;
29 SerializeStatus status;
30
31
1/1
✓ Branch 1 taken 6 times.
6 status = serialBuffer.deserializeTo(new_type);
32
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 if (status != FW_SERIALIZE_OK) {
33 return status;
34 }
35 6 this->m_type = static_cast<Type>(new_type);
36
37
1/1
✓ Branch 1 taken 6 times.
6 status = serialBuffer.deserializeTo(this->m_sequenceIndex);
38
39 6 return status;
40 }
41
42 SerializeStatus FilePacket::Header ::toSerialBuffer(SerialBuffer& serialBuffer) const {
43 const U8 type_casted = static_cast<U8>(this->m_type);
44 SerializeStatus status;
45
46 status = serialBuffer.serializeFrom(type_casted);
47 if (status != FW_SERIALIZE_OK) {
48 return status;
49 }
50
51 status = serialBuffer.serializeFrom(this->m_sequenceIndex);
52 if (status != FW_SERIALIZE_OK) {
53 return status;
54 }
55
56 return FW_SERIALIZE_OK;
57 }
58
59 } // namespace Fw
60