GCC Code Coverage Report


Directory: ./
File: Fw/Comp/QueuedComponentBase.cpp
Date: 2026-09-03 22:12:29
Exec Total Coverage
Lines: 15 28 53.6%
Functions: 6 9 66.7%
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 2 taken 27 times.
27 QueuedComponentBase::QueuedComponentBase(const char* name) : PassiveComponentBase(name), m_msgsDropped(0) {}
11
12 54 QueuedComponentBase::~QueuedComponentBase() {}
13
14 27 void QueuedComponentBase::init(FwEnumStoreType instance) {
15 27 PassiveComponentBase::init(instance);
16 27 }
17
18 27 void QueuedComponentBase::deinit() {
19 27 this->m_queue.teardown();
20 27 }
21
22 #if FW_OBJECT_TO_STRING == 1
23 const char* QueuedComponentBase::getToStringFormatString() {
24 return "QueueComp: %s";
25 }
26 #endif
27
28 27 Os::Queue::Queue::Status QueuedComponentBase::createQueue(FwSizeType depth, FwSizeType msgSize) {
29
1/1
✓ Branch 1 taken 27 times.
27 Os::QueueString queueName;
30 #if FW_OBJECT_NAMES == 1
31
1/1
✓ Branch 1 taken 27 times.
27 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 1 taken 27 times.
✓ Branch 4 taken 27 times.
54 return this->m_queue.create(this->getInstance(), queueName, depth, msgSize);
37 27 }
38
39 59 FwSizeType QueuedComponentBase::getNumMsgsDropped() {
40 59 return this->m_msgsDropped;
41 }
42
43 void QueuedComponentBase::incNumMsgDropped() {
44 this->m_msgsDropped++;
45 }
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