added default vlaue for init function

This commit is contained in:
Robin Müller 2020-05-06 16:34:43 +02:00
parent e950051b4a
commit b016f2995a
2 changed files with 7 additions and 5 deletions

View File

@ -1,9 +1,9 @@
#include <framework/action/ActionHelper.h> #include <framework/action/ActionHelper.h>
#include <framework/action/HasActionsIF.h> #include <framework/action/HasActionsIF.h>
#include <framework/objectmanager/ObjectManagerIF.h> #include <framework/objectmanager/ObjectManagerIF.h>
ActionHelper::ActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue) : ActionHelper::ActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue) :
owner(setOwner), queueToUse(useThisQueue), ipcStore( owner(setOwner), queueToUse(useThisQueue), ipcStore(nullptr) {
NULL) {
} }
ActionHelper::~ActionHelper() { ActionHelper::~ActionHelper() {
@ -22,10 +22,12 @@ ReturnValue_t ActionHelper::handleActionMessage(CommandMessage* command) {
ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) { ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) {
ipcStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE); ipcStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
if (ipcStore == NULL) { if (ipcStore == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
if(queueToUse_ != nullptr) {
setQueueToUse(queueToUse_); setQueueToUse(queueToUse_);
}
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }

View File

@ -38,7 +38,7 @@ public:
* @param queueToUse_ Pointer to the messageQueue to be used * @param queueToUse_ Pointer to the messageQueue to be used
* @return Returns RETURN_OK if successful * @return Returns RETURN_OK if successful
*/ */
ReturnValue_t initialize(MessageQueueIF* queueToUse_); ReturnValue_t initialize(MessageQueueIF* queueToUse_ = nullptr);
/** /**
* Function to be called from the owner to send a step message. Success or failure will be determined by the result value. * Function to be called from the owner to send a step message. Success or failure will be determined by the result value.
* *