GCC Code Coverage Report


Directory: Fw/FilePacket/
File: Header.cpp
Date: 2026-09-03 21:14:53
Exec Total Coverage
Lines: 20 23 87.0%
Functions: 4 4 100.0%
Branches: 6 10 60.0%

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 5 void FilePacket::Header ::initialize(const Type type, const U32 sequenceIndex) {
19 5 this->m_type = type;
20 5 this->m_sequenceIndex = sequenceIndex;
21 5 }
22
23 6 U32 FilePacket::Header ::bufferSize() const {
24 6 return sizeof(U8) + sizeof(this->m_sequenceIndex);
25 }
26
27 5 SerializeStatus FilePacket::Header ::fromSerialBuffer(SerialBuffer& serialBuffer) {
28 5 U8 new_type;
29 SerializeStatus status;
30
31
1/1
✓ Branch 5 taken 5 times.
5 status = serialBuffer.deserializeTo(new_type);
32
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 if (status != FW_SERIALIZE_OK) {
33 return status;
34 }
35 5 this->m_type = static_cast<Type>(new_type);
36
37
1/1
✓ Branch 8 taken 5 times.
5 status = serialBuffer.deserializeTo(this->m_sequenceIndex);
38
39 5 return status;
40 }
41
42 5 SerializeStatus FilePacket::Header ::toSerialBuffer(SerialBuffer& serialBuffer) const {
43
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
5 const U8 type_casted = static_cast<U8>(this->m_type);
44 SerializeStatus status;
45
46 5 status = serialBuffer.serializeFrom(type_casted);
47
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 if (status != FW_SERIALIZE_OK) {
48 return status;
49 }
50
51 5 status = serialBuffer.serializeFrom(this->m_sequenceIndex);
52
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 if (status != FW_SERIALIZE_OK) {
53 return status;
54 }
55
56 5 return FW_SERIALIZE_OK;
57 }
58
59 } // namespace Fw
60