Adding error message to a coding error
This commit is contained in:
parent
20eb232bf5
commit
e34664d265
@ -57,7 +57,9 @@ void ActionHelper::finish(bool success, MessageQueueId_t reportTo, ActionId_t co
|
|||||||
|
|
||||||
void ActionHelper::setQueueToUse(MessageQueueIF* queue) { queueToUse = queue; }
|
void ActionHelper::setQueueToUse(MessageQueueIF* queue) { queueToUse = queue; }
|
||||||
|
|
||||||
#include <stdio.h>
|
MessageQueueIF const * ActionHelper::getQueue() const {
|
||||||
|
return queueToUse;
|
||||||
|
}
|
||||||
|
|
||||||
void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId,
|
void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId,
|
||||||
store_address_t dataAddress) {
|
store_address_t dataAddress) {
|
||||||
|
@ -100,6 +100,12 @@ class ActionHelper {
|
|||||||
*/
|
*/
|
||||||
void setQueueToUse(MessageQueueIF* queue);
|
void setQueueToUse(MessageQueueIF* queue);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Needed so templateAction can check if actionHelper was
|
||||||
|
* contructed already to aid in debuggig a nasty coding error.
|
||||||
|
*/
|
||||||
|
MessageQueueIF const * getQueue() const;
|
||||||
|
|
||||||
void registerAction(Action* action);
|
void registerAction(Action* action);
|
||||||
|
|
||||||
std::map<ActionId_t, Action*> const* getActionMap();
|
std::map<ActionId_t, Action*> const* getActionMap();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Action.h"
|
#include "Action.h"
|
||||||
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
template <class owner, class action, class ActionEnum>
|
template <class owner, class action, class ActionEnum>
|
||||||
class TemplateAction : public Action {
|
class TemplateAction : public Action {
|
||||||
@ -8,6 +9,11 @@ class TemplateAction : public Action {
|
|||||||
#ifdef FSFW_INTROSPECTION
|
#ifdef FSFW_INTROSPECTION
|
||||||
TemplateAction(owner *myOwner, ActionEnum id) : Action(), myOwner(myOwner) {
|
TemplateAction(owner *myOwner, ActionEnum id) : Action(), myOwner(myOwner) {
|
||||||
Action::setEnum(&id);
|
Action::setEnum(&id);
|
||||||
|
if (myOwner->getActionHelper()->getQueue() == nullptr) {
|
||||||
|
sif::error
|
||||||
|
<< "TemplateAction::TemplateAction: Action instances need to be created (ie located) after the actionHelper instance."
|
||||||
|
<< "Program will segfault now..." << std::endl;
|
||||||
|
}
|
||||||
myOwner->getActionHelper()->registerAction(this);
|
myOwner->getActionHelper()->registerAction(this);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user