mirror of
https://github.com/nasa/fprime.git
synced 2025-12-10 17:47:10 -06:00
Instead of adding the name argument to a constructor when FW_OBJECT_NAMES is enabled, always supply a name argument. Add a marco that conditionally sets the name to "" if FW_OBJECT_NAMES is not set. This cleans up a lot of the conditional compilation switches that weren't being tested and would silently break, while still stripping the strings from the binary.
50 lines
1.7 KiB
C++
50 lines
1.7 KiB
C++
/*
|
|
* ActiveComponentBase.hpp
|
|
*
|
|
* Created on: Aug 14, 2012
|
|
* Author: tcanham
|
|
*/
|
|
|
|
/*
|
|
* Description:
|
|
*/
|
|
#ifndef FW_QUEUED_COMPONENT_BASE_HPP
|
|
#define FW_QUEUED_COMPONENT_BASE_HPP
|
|
|
|
#include <Fw/Comp/PassiveComponentBase.hpp>
|
|
#include <Os/Queue.hpp>
|
|
#include <Os/Task.hpp>
|
|
#include <FpConfig.hpp>
|
|
|
|
|
|
namespace Fw {
|
|
class QueuedComponentBase : public PassiveComponentBase {
|
|
public:
|
|
|
|
// Note: Had to make MsgDispatchStatus public for LLVM.
|
|
typedef enum {
|
|
MSG_DISPATCH_OK, //!< Dispatch was normal
|
|
MSG_DISPATCH_EMPTY, //!< No more messages in the queue
|
|
MSG_DISPATCH_ERROR, //!< Errors dispatching messages
|
|
MSG_DISPATCH_EXIT //!< A message was sent requesting an exit of the loop
|
|
} MsgDispatchStatus;
|
|
|
|
PROTECTED:
|
|
QueuedComponentBase(const char* name); //!< Constructor
|
|
virtual ~QueuedComponentBase(); //!< Destructor
|
|
void init(NATIVE_INT_TYPE instance); //!< initialization function
|
|
Os::Queue m_queue; //!< queue object for active component
|
|
Os::Queue::QueueStatus createQueue(NATIVE_INT_TYPE depth, NATIVE_INT_TYPE msgSize);
|
|
virtual MsgDispatchStatus doDispatch(void)=0; //!< method to dispatch a single message in the queue.
|
|
#if FW_OBJECT_TO_STRING == 1
|
|
virtual void toString(char* str, NATIVE_INT_TYPE size); //!< dump string representation of component
|
|
#endif
|
|
NATIVE_INT_TYPE getNumMsgsDropped(void); //!< return number of messages dropped
|
|
void incNumMsgDropped(void); //!< increment the number of messages dropped
|
|
PRIVATE:
|
|
NATIVE_INT_TYPE m_msgsDropped; //!< number of messages dropped from full queue
|
|
};
|
|
|
|
}
|
|
#endif
|