F´ Flight Software - C/C++ Documentation  NASA-v1.5.0
A framework for building embedded system applications to NASA flight quality standards.
QueuedComponentBase.cpp
Go to the documentation of this file.
2 #include <Fw/Types/Assert.hpp>
4 #include <FpConfig.hpp>
5 
6 #include <stdio.h>
7 
8 namespace Fw {
9 
10  QueuedComponentBase::QueuedComponentBase(const char* name) : PassiveComponentBase(name),m_msgsDropped(0) {
11 
12  }
13 
15 
16  }
17 
20  }
21 
22 #if FW_OBJECT_TO_STRING == 1 && FW_OBJECT_NAMES == 1
23  void QueuedComponentBase::toString(char* buffer, NATIVE_INT_TYPE size) {
24  (void)snprintf(buffer, size,"QueueComp: %s", this->m_objName);
25  buffer[size-1] = 0;
26  }
27 #endif
28 
30 
31  Fw::EightyCharString queueName;
32 #if FW_OBJECT_NAMES == 1
33  queueName = this->m_objName;
34 #else
35  char queueNameChar[FW_QUEUE_NAME_MAX_SIZE];
36  (void)snprintf(queueNameChar,sizeof(queueNameChar),"CompQ_%d",Os::Queue::getNumQueues());
37  queueName = queueNameChar;
38 #endif
39  return this->m_queue.create(queueName, depth, msgSize);
40  }
41 
43  return this->m_msgsDropped;
44  }
45 
47  this->m_msgsDropped++;
48  }
49 
50 }
Os::Queue::create
QueueStatus create(const Fw::StringBase &name, NATIVE_INT_TYPE depth, NATIVE_INT_TYPE msgSize)
create a message queue
Definition: QueueCommon.cpp:41
Fw::QueuedComponentBase::~QueuedComponentBase
virtual ~QueuedComponentBase()
Destructor.
Definition: QueuedComponentBase.cpp:14
Fw::QueuedComponentBase::incNumMsgDropped
void incNumMsgDropped(void)
increment the number of messages dropped
Definition: QueuedComponentBase.cpp:46
Os::Queue::QueueStatus
QueueStatus
Definition: Queue.hpp:27
Fw::EightyCharString
Definition: EightyCharString.hpp:10
Fw::QueuedComponentBase::m_queue
Os::Queue m_queue
queue object for active component
Definition: QueuedComponentBase.hpp:36
Assert.hpp
EightyCharString.hpp
Fw::ObjBase::init
void init(void)
Object initializer.
Definition: ObjBase.cpp:26
Fw::QueuedComponentBase::getNumMsgsDropped
NATIVE_INT_TYPE getNumMsgsDropped(void)
return number of messages dropped
Definition: QueuedComponentBase.cpp:42
FpConfig.hpp
ISF configuration file.
Os::Queue::getNumQueues
static NATIVE_INT_TYPE getNumQueues(void)
get the number of queues in the system
Definition: QueueCommon.cpp:57
QueuedComponentBase.hpp
NATIVE_INT_TYPE
int NATIVE_INT_TYPE
native integer type declaration
Definition: BasicTypes.hpp:29
FW_QUEUE_NAME_MAX_SIZE
#define FW_QUEUE_NAME_MAX_SIZE
Max size of message queue name.
Definition: FpConfig.hpp:210
Fw::QueuedComponentBase::createQueue
Os::Queue::QueueStatus createQueue(NATIVE_INT_TYPE depth, NATIVE_INT_TYPE msgSize)
Definition: QueuedComponentBase.cpp:29
Fw
Definition: BufferGetPortAc.cpp:6