F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
QueuedComponentBase.cpp
Go to the documentation of this file.
3 #include <Fw/Types/Assert.hpp>
4 #include <Os/QueueString.hpp>
5 
6 #include <cstdio>
7 
8 namespace Fw {
9 
10 QueuedComponentBase::QueuedComponentBase(const char* name) : PassiveComponentBase(name), m_msgsDropped(0) {}
11 
13 
16 }
17 
19  this->m_queue.teardown();
20 }
21 
22 #if FW_OBJECT_TO_STRING == 1
23 const char* QueuedComponentBase::getToStringFormatString() {
24  return "QueueComp: %s";
25 }
26 #endif
27 
29  Os::QueueString queueName;
30 #if FW_OBJECT_NAMES == 1
31  queueName = this->m_objName;
32 #else
33  queueName.format("CompQ_%" PRI_FwSizeType, Os::Queue::getNumQueues());
34 #endif
35  return this->m_queue.create(this->getInstance(), queueName, depth, msgSize);
36 }
37 
39  return this->m_msgsDropped;
40 }
41 
43  this->m_msgsDropped++;
44 }
45 
46 } // namespace Fw
virtual ~QueuedComponentBase()
Destructor.
Status create(FwEnumStoreType id, const Fw::ConstStringBase &name, FwSizeType depth, FwSizeType messageSize) override
create queue storage through delegate
Definition: Queue.cpp:22
PlatformSizeType FwSizeType
I32 FwEnumStoreType
QueuedComponentBase(const char *name)
Constructor.
#define PRI_FwSizeType
static FwSizeType getNumQueues()
get number of queues system-wide
Definition: Queue.cpp:139
FwEnumStoreType getInstance() const
Os::Queue m_queue
queue object for active component
void init()
Object initializer.
Definition: ObjBase.cpp:24
FwSizeType getNumMsgsDropped()
return number of messages dropped
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
Status
Generic OK/ERROR status.
Definition: Os.hpp:25
void deinit()
Allows de-initialization on teardown.
void teardown() override
teardown the queue
Definition: Queue.cpp:49
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
void incNumMsgDropped()
increment the number of messages dropped
Implementation of malloc based allocator.