GCC Code Coverage Report


Directory: ./
File: Fw/Fpy/StatementArgBuffer.cpp
Date: 2026-09-03 21:13:48
Exec Total Coverage
Lines: 21 35 60.0%
Functions: 5 8 62.5%
Branches: 5 11 45.5%

Line Branch Exec Source
1 #include <Fw/Fpy/StatementArgBuffer.hpp>
2 #include <Fw/Types/Assert.hpp>
3 #include <Fw/Types/StringBase.hpp>
4
5 namespace Fw {
6
7 StatementArgBuffer::StatementArgBuffer(const U8* args, FwSizeType size)
8 : Fw::LinearBufferBase(m_bufferData, sizeof(m_bufferData)) {
9 SerializeStatus stat = LinearBufferBase::setBuff(args, size);
10 FW_ASSERT(FW_SERIALIZE_OK == stat, static_cast<FwAssertArgType>(stat));
11 }
12
13 1841310 StatementArgBuffer::StatementArgBuffer() : Fw::LinearBufferBase(m_bufferData, sizeof(m_bufferData)) {}
14
15 3687032 StatementArgBuffer::~StatementArgBuffer() {}
16
17 // m_bufferData contents are copied via setBuff below
18 // cppcheck-suppress missingMemberCopy
19 2206 StatementArgBuffer::StatementArgBuffer(const StatementArgBuffer& other)
20 2206 : Fw::LinearBufferBase(m_bufferData, sizeof(m_bufferData)) {
21
2/2
✓ Branch 15 taken 2206 times.
✓ Branch 20 taken 2206 times.
2206 SerializeStatus stat = LinearBufferBase::setBuff(other.m_bufferData, other.getSize());
22 2206 FW_ASSERT(FW_SERIALIZE_OK == stat, static_cast<FwAssertArgType>(stat));
23 2206 }
24
25 628893 StatementArgBuffer& StatementArgBuffer::operator=(const StatementArgBuffer& other) {
26
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 628893 times.
628893 if (this == &other) {
27 return *this;
28 }
29
30 628893 SerializeStatus stat = LinearBufferBase::setBuff(other.m_bufferData, other.getSize());
31 628893 FW_ASSERT(FW_SERIALIZE_OK == stat, static_cast<FwAssertArgType>(stat));
32 628893 return *this;
33 }
34
35 Serializable::SizeType StatementArgBuffer::getBuffCapacity() const {
36 return this->getCapacity();
37 }
38
39 2048 bool StatementArgBuffer::operator==(const StatementArgBuffer& other) const {
40
1/2
✗ Branch 22 not taken.
✓ Branch 23 taken 2048 times.
2048 if (this->getSize() != other.getSize()) {
41 return false;
42 }
43
44 2048 const U8* us = this->getBuffAddr();
45 2048 const U8* them = other.getBuffAddr();
46
47 2048 FW_ASSERT(us != nullptr);
48 2048 FW_ASSERT(them != nullptr);
49
50 2048 const Serializable::SizeType size = this->getSize();
51
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2048 times.
2048 for (Serializable::SizeType byte = 0; byte < size; byte++) {
52 if (us[byte] != them[byte]) {
53 return false;
54 }
55 }
56
57 2048 return true;
58 }
59
60 #if FW_SERIALIZABLE_TO_STRING
61 void StatementArgBuffer::toString(Fw::StringBase& text) const {
62 static const char* formatString = "(data = %p, size = %" PRI_FwSizeType ")";
63 (void)text.format(formatString, &this->m_bufferData, this->getSize()); // display string may safely truncate
64 }
65 #endif
66 } // namespace Fw
67