added access to objectlist and a produce function to ObjectManager

This commit is contained in:
Ulrich Mohr 2022-08-19 12:16:40 +02:00
parent dd281f8a67
commit 20eb232bf5
3 changed files with 15 additions and 1 deletions

View File

@ -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) {
@ -140,3 +144,7 @@ void ObjectManager::printList() {
}
#endif
}
const std::map<object_id_t, SystemObjectIF*> * ObjectManager::getObjectList(){
return &objectList;
}

View File

@ -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;

View File

@ -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_ */