mirror of
https://github.com/nasa/fprime.git
synced 2025-12-11 04:35:25 -06:00
* Queues use MemAllocator pattern * Derive queue allocation from MallocRegistry * Formatting * Fix UTs * Fix CI * Fix alignment in UT * Formatting and sp * Formatting, bad header * More formatting * Add queue teardown * Deinit components * Fix priority queue test * Fix bug in priority queue allocation * Correct comments * Fix FppTest and Ref UTs * Fix max heap teardown * Fix review comment on max heap * Fix null -> nullptr
47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
#include <Fw/Comp/QueuedComponentBase.hpp>
|
|
#include <Fw/FPrimeBasicTypes.hpp>
|
|
#include <Fw/Types/Assert.hpp>
|
|
#include <Os/QueueString.hpp>
|
|
|
|
#include <cstdio>
|
|
|
|
namespace Fw {
|
|
|
|
QueuedComponentBase::QueuedComponentBase(const char* name) : PassiveComponentBase(name), m_msgsDropped(0) {}
|
|
|
|
QueuedComponentBase::~QueuedComponentBase() {}
|
|
|
|
void QueuedComponentBase::init(FwEnumStoreType instance) {
|
|
PassiveComponentBase::init(instance);
|
|
}
|
|
|
|
void QueuedComponentBase::deinit() {
|
|
this->m_queue.teardown();
|
|
}
|
|
|
|
#if FW_OBJECT_TO_STRING == 1
|
|
const char* QueuedComponentBase::getToStringFormatString() {
|
|
return "QueueComp: %s";
|
|
}
|
|
#endif
|
|
|
|
Os::Queue::Queue::Status QueuedComponentBase::createQueue(FwSizeType depth, FwSizeType msgSize) {
|
|
Os::QueueString queueName;
|
|
#if FW_OBJECT_NAMES == 1
|
|
queueName = this->m_objName;
|
|
#else
|
|
queueName.format("CompQ_%" PRI_FwSizeType, Os::Queue::getNumQueues());
|
|
#endif
|
|
return this->m_queue.create(this->getInstance(), queueName, depth, msgSize);
|
|
}
|
|
|
|
FwSizeType QueuedComponentBase::getNumMsgsDropped() {
|
|
return this->m_msgsDropped;
|
|
}
|
|
|
|
void QueuedComponentBase::incNumMsgDropped() {
|
|
this->m_msgsDropped++;
|
|
}
|
|
|
|
} // namespace Fw
|