GCC Code Coverage Report


Directory: ./
File: Fw/Comp/QueuedComponentBase.cpp
Date: 2026-09-03 21:13:48
Exec Total Coverage
Lines: 18 28 64.3%
Functions: 7 9 77.8%
Branches: 5 9 55.6%

Line Branch Exec Source
1 #include <Fw/Comp/QueuedComponentBase.hpp>
2 #include <Fw/FPrimeBasicTypes.hpp>
3 #include <Fw/Types/Assert.hpp>
4 #include <Os/QueueString.hpp>
5
6 #include <cstdio>
7
8 namespace Fw {
9
10
1/1
✓ Branch 10 taken 1302 times.
1302 QueuedComponentBase::QueuedComponentBase(const char* name) : PassiveComponentBase(name), m_msgsDropped(0) {}
11
12 2604 QueuedComponentBase::~QueuedComponentBase() {}
13
14 1301 void QueuedComponentBase::init(FwEnumStoreType instance) {
15 1301 PassiveComponentBase::init(instance);
16 1301 }
17
18 1301 void QueuedComponentBase::deinit() {
19 1301 this->m_queue.teardown();
20 1301 }
21
22 #if FW_OBJECT_TO_STRING == 1
23 const char* QueuedComponentBase::getToStringFormatString() {
24 return "QueueComp: %s";
25 }
26 #endif
27
28 1301 Os::Queue::Queue::Status QueuedComponentBase::createQueue(FwSizeType depth, FwSizeType msgSize) {
29
1/1
✓ Branch 2 taken 1301 times.
1301 Os::QueueString queueName;
30 #if FW_OBJECT_NAMES == 1
31
1/1
✓ Branch 5 taken 1301 times.
1301 queueName = this->m_objName;
32 #else
33 // Truncation of a queue name is benign
34 (void)queueName.format("CompQ_%" PRI_FwSizeType, Os::Queue::getNumQueues());
35 #endif
36
2/2
✓ Branch 10 taken 1301 times.
✓ Branch 13 taken 1301 times.
2602 return this->m_queue.create(this->getInstance(), queueName, depth, msgSize);
37 1301 }
38
39 2 FwSizeType QueuedComponentBase::getNumMsgsDropped() {
40 2 return this->m_msgsDropped;
41 }
42
43 60595 void QueuedComponentBase::incNumMsgDropped() {
44 60595 this->m_msgsDropped++;
45 60595 }
46
47 Fw::QueuedComponentBase::MsgDispatchStatus QueuedComponentBase::dispatchAvailableMessages() {
48 MsgDispatchStatus status = MSG_DISPATCH_OK;
49 const FwSizeType num_messages = this->m_queue.getMessagesAvailable();
50 for (FwSizeType i = 0; i < num_messages; i++) {
51 status = this->doDispatch();
52 if (status != MSG_DISPATCH_OK) {
53 break;
54 }
55 }
56 return status;
57 }
58 } // namespace Fw
59