Merge remote-tracking branch 'sidestream/mohr_introspection' into mohr/introspection
This commit is contained in:
commit
d634bdb775
@ -57,7 +57,9 @@ void ActionHelper::finish(bool success, MessageQueueId_t reportTo, ActionId_t co
|
||||
|
||||
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,
|
||||
store_address_t dataAddress) {
|
||||
|
@ -102,6 +102,12 @@ class ActionHelper {
|
||||
*/
|
||||
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);
|
||||
|
||||
std::map<ActionId_t, Action*> const* getActionMap();
|
||||
|
@ -40,6 +40,11 @@ class Parameter : public ParameterIF {
|
||||
return value;
|
||||
}
|
||||
|
||||
Parameter& operator =(const T& newValue){
|
||||
value = newValue;
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifdef FSFW_INTROSPECTION
|
||||
Types::ParameterType getType() override {
|
||||
return enumHelper<std::is_base_of<EnumIF, T>::value>::template getType<T>();
|
||||
@ -66,7 +71,6 @@ class Parameter : public ParameterIF {
|
||||
|
||||
bool setFloating(double value) override {
|
||||
if (getType() != Types::FLOATING) {
|
||||
puts("fups");
|
||||
return false;
|
||||
}
|
||||
this->value = T(value);
|
||||
@ -75,7 +79,6 @@ class Parameter : public ParameterIF {
|
||||
|
||||
bool setSigned(int64_t value) override {
|
||||
if ((getType() != Types::SIGNED) && (getType() != Types::ENUM)) {
|
||||
puts("sups");
|
||||
return false;
|
||||
}
|
||||
this->value = T(value);
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "Action.h"
|
||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||
|
||||
template <class owner, class action, class ActionEnum>
|
||||
class TemplateAction : public Action {
|
||||
@ -8,10 +9,15 @@ class TemplateAction : public Action {
|
||||
#ifdef FSFW_INTROSPECTION
|
||||
TemplateAction(owner *myOwner, ActionEnum id) : Action(), myOwner(myOwner) {
|
||||
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);
|
||||
}
|
||||
#else
|
||||
TemplateAction(owner *myOwner, ActionEnum id) : Action((uint32_t) id), myOwner(myOwner) {
|
||||
TemplateAction(owner *myOwner, ActionEnum id) : Action((uint32_t)id), myOwner(myOwner) {
|
||||
myOwner->getActionHelper()->registerAction(this);
|
||||
}
|
||||
#endif
|
||||
|
@ -342,7 +342,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
|
||||
*/
|
||||
virtual ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||
const uint8_t *commandData,
|
||||
size_t commandDataLen) = 0;
|
||||
size_t commandDataLen) {exit(0);}
|
||||
|
||||
/* Reply handling */
|
||||
/**
|
||||
|
@ -78,7 +78,7 @@ SystemObjectIF* ObjectManager::getSystemObject(object_id_t id) {
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectManager::initialize() {
|
||||
void ObjectManager::produce() {
|
||||
if (objectFactoryFunction == nullptr) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "ObjectManager::initialize: Passed produceObjects "
|
||||
@ -90,6 +90,10 @@ void ObjectManager::initialize() {
|
||||
return;
|
||||
}
|
||||
objectFactoryFunction(factoryArgs);
|
||||
}
|
||||
|
||||
void ObjectManager::initialize() {
|
||||
produce();
|
||||
ReturnValue_t result = RETURN_FAILED;
|
||||
uint32_t errorCount = 0;
|
||||
for (auto const& it : objectList) {
|
||||
@ -143,3 +147,7 @@ void ObjectManager::printList() {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
const std::map<object_id_t, SystemObjectIF*> * ObjectManager::getObjectList(){
|
||||
return &objectList;
|
||||
}
|
||||
|
@ -42,7 +42,9 @@ class ObjectManager : public ObjectManagerIF {
|
||||
ReturnValue_t insert(object_id_t id, SystemObjectIF* object) override;
|
||||
ReturnValue_t remove(object_id_t id) override;
|
||||
void initialize() override;
|
||||
void produce() override;
|
||||
void printList() override;
|
||||
const std::map<object_id_t, SystemObjectIF*> * getObjectList() override;
|
||||
|
||||
protected:
|
||||
SystemObjectIF* getSystemObject(object_id_t id) override;
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef FSFW_OBJECTMANAGER_OBJECTMANAGERIF_H_
|
||||
#define FSFW_OBJECTMANAGER_OBJECTMANAGERIF_H_
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
#include "../serviceinterface/ServiceInterface.h"
|
||||
#include "SystemObjectIF.h"
|
||||
@ -58,12 +60,14 @@ class ObjectManagerIF : public HasReturnvaluesIF {
|
||||
* @li RETURN_OK in case the object was successfully removed
|
||||
*/
|
||||
virtual ReturnValue_t remove(object_id_t id) = 0;
|
||||
virtual void produce() = 0;
|
||||
virtual void initialize() = 0;
|
||||
/**
|
||||
* @brief This is a debug function, that prints the current content of the
|
||||
* object list.
|
||||
*/
|
||||
virtual void printList() = 0;
|
||||
virtual const std::map<object_id_t, SystemObjectIF*>* getObjectList() = 0;
|
||||
};
|
||||
|
||||
#endif /* OBJECTMANAGERIF_H_ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user