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 
18 #if FW_OBJECT_TO_STRING == 1
19 const char* QueuedComponentBase::getToStringFormatString() {
20  return "QueueComp: %s";
21 }
22 #endif
23 
25  Os::QueueString queueName;
26 #if FW_OBJECT_NAMES == 1
27  queueName = this->m_objName;
28 #else
29  queueName.format("CompQ_%" PRI_FwSizeType, Os::Queue::getNumQueues());
30 #endif
31  return this->m_queue.create(queueName, depth, msgSize);
32 }
33 
35  return this->m_msgsDropped;
36 }
37 
39  this->m_msgsDropped++;
40 }
41 
42 } // namespace Fw
virtual ~QueuedComponentBase()
Destructor.
PlatformSizeType FwSizeType
I32 FwEnumStoreType
QueuedComponentBase(const char *name)
Constructor.
#define PRI_FwSizeType
static FwSizeType getNumQueues()
get number of queues system-wide
Definition: Queue.cpp:131
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
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
Status create(const Fw::StringBase &name, FwSizeType depth, FwSizeType messageSize) override
create queue storage through delegate
Definition: Queue.cpp:22
void incNumMsgDropped()
increment the number of messages dropped