GCC Code Coverage Report


Directory: ./
File: Fw/Fpy/StatementArgBuffer.cpp
Date: 2026-09-03 22:12:29
Exec Total Coverage
Lines: 0 35 0.0%
Functions: 0 8 0.0%
Branches: 0 11 0.0%

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 StatementArgBuffer::StatementArgBuffer() : Fw::LinearBufferBase(m_bufferData, sizeof(m_bufferData)) {}
14
15 StatementArgBuffer::~StatementArgBuffer() {}
16
17 // m_bufferData contents are copied via setBuff below
18 // cppcheck-suppress missingMemberCopy
19 StatementArgBuffer::StatementArgBuffer(const StatementArgBuffer& other)
20 : Fw::LinearBufferBase(m_bufferData, sizeof(m_bufferData)) {
21 SerializeStatus stat = LinearBufferBase::setBuff(other.m_bufferData, other.getSize());
22 FW_ASSERT(FW_SERIALIZE_OK == stat, static_cast<FwAssertArgType>(stat));
23 }
24
25 StatementArgBuffer& StatementArgBuffer::operator=(const StatementArgBuffer& other) {
26 if (this == &other) {
27 return *this;
28 }
29
30 SerializeStatus stat = LinearBufferBase::setBuff(other.m_bufferData, other.getSize());
31 FW_ASSERT(FW_SERIALIZE_OK == stat, static_cast<FwAssertArgType>(stat));
32 return *this;
33 }
34
35 Serializable::SizeType StatementArgBuffer::getBuffCapacity() const {
36 return this->getCapacity();
37 }
38
39 bool StatementArgBuffer::operator==(const StatementArgBuffer& other) const {
40 if (this->getSize() != other.getSize()) {
41 return false;
42 }
43
44 const U8* us = this->getBuffAddr();
45 const U8* them = other.getBuffAddr();
46
47 FW_ASSERT(us != nullptr);
48 FW_ASSERT(them != nullptr);
49
50 const Serializable::SizeType size = this->getSize();
51 for (Serializable::SizeType byte = 0; byte < size; byte++) {
52 if (us[byte] != them[byte]) {
53 return false;
54 }
55 }
56
57 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