cleaning up
This commit is contained in:
parent
f4a68f23dd
commit
b3f6f01d97
@ -196,7 +196,7 @@ message(
|
||||
)
|
||||
|
||||
# Check whether the user has already installed ETL first
|
||||
find_package(${FSFW_ETL_LIB_NAME} ${FSFW_ETL_LIB_MAJOR_VERSION})
|
||||
find_package(${FSFW_ETL_LIB_NAME} ${FSFW_ETL_LIB_MAJOR_VERSION} QUIET)
|
||||
# Not installed, so use FetchContent to download and provide etl
|
||||
if(NOT ${FSFW_ETL_LIB_NAME}_FOUND)
|
||||
message(
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
|
||||
#include "../storagemanager/StorageManagerIF.h"
|
||||
/**
|
||||
* The Placement Factory is used to create objects at runtime in a specific pool.
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "fsfw/events/EventMessage.h"
|
||||
#include "fsfw/ipc/MutexFactory.h"
|
||||
#include "fsfw/ipc/QueueFactory.h"
|
||||
#include <stdio.h>
|
||||
|
||||
MessageQueueId_t EventManagerIF::eventmanagerQueue = MessageQueueIF::NO_QUEUE;
|
||||
|
||||
@ -21,11 +20,9 @@ EventManager::EventManager(object_id_t setObjectId)
|
||||
mutex = MutexFactory::instance()->createMutex();
|
||||
eventReportQueue = QueueFactory::instance()->createMessageQueue(MAX_EVENTS_PER_CYCLE,
|
||||
EventMessage::EVENT_MESSAGE_SIZE);
|
||||
printf("EM Q: %i\n", eventReportQueue->getId());
|
||||
}
|
||||
|
||||
EventManager::~EventManager() {
|
||||
puts("EM dtor");
|
||||
listenerList.clear();
|
||||
QueueFactory::instance()->deleteMessageQueue(eventReportQueue);
|
||||
MutexFactory::instance()->deleteMutex(mutex);
|
||||
@ -57,7 +54,7 @@ void EventManager::notifyListeners(EventMessage* message) {
|
||||
}
|
||||
unlockMutex();
|
||||
}
|
||||
#include <stdio.h>
|
||||
|
||||
ReturnValue_t EventManager::registerListener(MessageQueueId_t listener,
|
||||
bool forwardAllButSelected) {
|
||||
auto result = listenerList.insert(std::pair<MessageQueueId_t, EventMatchTree>(
|
||||
|
@ -9,9 +9,8 @@ EventMatchTree::EventMatchTree(StorageManagerIF* storageBackend, bool invertedMa
|
||||
: MatchTree<EventMessage*>(end(), 1), factory(storageBackend), invertedMatch(invertedMatch) {
|
||||
}
|
||||
|
||||
EventMatchTree::~EventMatchTree() {
|
||||
clear();
|
||||
}
|
||||
#include <stdio.h>
|
||||
EventMatchTree::~EventMatchTree() {}
|
||||
|
||||
bool EventMatchTree::match(EventMessage* number) {
|
||||
if (invertedMatch) {
|
||||
@ -142,7 +141,6 @@ EventMatchTree::iterator EventMatchTree::findRangeMatcher(iterator start, VALUE_
|
||||
}
|
||||
|
||||
ReturnValue_t EventMatchTree::cleanUpElement(iterator position) {
|
||||
//TODO root node?
|
||||
factory.destroy(position.element->value);
|
||||
// If deletion fails, delete element anyway, nothing we can do.
|
||||
// SHOULDO: Throw event, or write debug output.
|
||||
|
@ -24,7 +24,9 @@ class MatchTree : public SerializeableMatcherIF<T>, public BinaryTree<Serializea
|
||||
MatchTree(iterator root, uint8_t maxDepth = -1)
|
||||
: BinaryTree<SerializeableMatcherIF<T>>(root.element), maxDepth(maxDepth) {}
|
||||
MatchTree() : BinaryTree<SerializeableMatcherIF<T>>(), maxDepth(-1) {}
|
||||
virtual ~MatchTree() {}
|
||||
virtual ~MatchTree() {
|
||||
clear();
|
||||
}
|
||||
virtual bool match(T number) override { return matchesTree(number); }
|
||||
bool matchesTree(T number) {
|
||||
iterator iter = this->begin();
|
||||
|
@ -6,8 +6,6 @@
|
||||
|
||||
HealthTable::HealthTable(object_id_t objectid) : SystemObject(objectid) {
|
||||
mutex = MutexFactory::instance()->createMutex();
|
||||
;
|
||||
|
||||
mapIterator = healthMap.begin();
|
||||
}
|
||||
|
||||
@ -16,7 +14,8 @@ void HealthTable::setMutexTimeout(MutexIF::TimeoutType timeoutType, uint32_t tim
|
||||
this->mutexTimeoutMs = timeoutMs;
|
||||
}
|
||||
|
||||
HealthTable::~HealthTable() { MutexFactory::instance()->deleteMutex(mutex); }
|
||||
HealthTable::~HealthTable() {
|
||||
MutexFactory::instance()->deleteMutex(mutex); }
|
||||
|
||||
ReturnValue_t HealthTable::registerObject(object_id_t object,
|
||||
HasHealthIF::HealthState initilialState) {
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "fsfw/internalerror/InternalErrorReporter.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "fsfw/datapool/PoolReadGuard.h"
|
||||
#include "fsfw/ipc/MutexFactory.h"
|
||||
#include "fsfw/ipc/QueueFactory.h"
|
||||
@ -14,7 +12,6 @@ InternalErrorReporter::InternalErrorReporter(object_id_t setObjectId, uint32_t m
|
||||
internalErrorDataset(this) {
|
||||
commandQueue = QueueFactory::instance()->createMessageQueue(messageQueueDepth);
|
||||
mutex = MutexFactory::instance()->createMutex();
|
||||
printf("IER commandQueue: %p %i\n", commandQueue, commandQueue->getId());
|
||||
}
|
||||
|
||||
InternalErrorReporter::~InternalErrorReporter() {
|
||||
|
@ -23,9 +23,18 @@ void ObjectManager::setObjectFactoryFunction(produce_function_t objFactoryFunc,
|
||||
|
||||
ObjectManager::ObjectManager() = default;
|
||||
|
||||
void ObjectManager::clear() {
|
||||
if (objManagerInstance != nullptr) {
|
||||
delete objManagerInstance;
|
||||
objManagerInstance = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
ObjectManager::~ObjectManager() {
|
||||
for (auto const& iter : objectList) {
|
||||
delete iter.second;
|
||||
auto iter = objectList.begin();
|
||||
while (iter != objectList.end()) {
|
||||
delete iter->second;
|
||||
iter = objectList.begin();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,12 +24,17 @@ class ObjectManager : public ObjectManagerIF {
|
||||
using produce_function_t = void (*)(void* args);
|
||||
|
||||
/**
|
||||
* Returns the single instance of TaskFactory.
|
||||
* Returns the single instance of ObjectManager.
|
||||
* The implementation of #instance is found in its subclasses.
|
||||
* Thus, we choose link-time variability of the instance.
|
||||
*/
|
||||
static ObjectManager* instance();
|
||||
|
||||
/**
|
||||
* Deletes the single instance of ObjectManager
|
||||
*/
|
||||
static void clear();
|
||||
|
||||
void setObjectFactoryFunction(produce_function_t prodFunc, void* args);
|
||||
|
||||
template <typename T>
|
||||
|
@ -23,8 +23,6 @@ MessageQueue::MessageQueue(uint32_t messageDepth, size_t maxMessageSize, MqArgs*
|
||||
// Set the name of the queue. The slash is mandatory!
|
||||
sprintf(name, "/FSFW_MQ%u", queueCounter++);
|
||||
|
||||
printf("openend %s\n", name);
|
||||
|
||||
// Create a nonblocking queue if the name is available (the queue is read
|
||||
// and writable for the owner as well as the group)
|
||||
int oflag = O_NONBLOCK | O_RDWR | O_CREAT | O_EXCL;
|
||||
@ -33,7 +31,6 @@ MessageQueue::MessageQueue(uint32_t messageDepth, size_t maxMessageSize, MqArgs*
|
||||
if (tempId == -1) {
|
||||
handleOpenError(&attributes, messageDepth);
|
||||
} else {
|
||||
printf("openend %s with id %i\n", name, tempId);
|
||||
// Successful mq_open call
|
||||
this->id = tempId;
|
||||
}
|
||||
@ -268,7 +265,6 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
|
||||
}
|
||||
|
||||
ReturnValue_t MessageQueue::handleOpenError(mq_attr* attributes, uint32_t messageDepth) {
|
||||
printf("MQ Error %i\n", errno);
|
||||
switch (errno) {
|
||||
case (EINVAL): {
|
||||
utility::printUnixErrorGeneric(CLASS_NAME, "MessageQueue", "EINVAL");
|
||||
|
@ -15,8 +15,6 @@
|
||||
|
||||
#if FSFW_ADD_DEFAULT_FACTORY_FUNCTIONS == 1
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Produces system objects.
|
||||
* @details
|
||||
@ -63,5 +61,4 @@ void Factory::setStaticFrameworkObjectIds() {
|
||||
DeviceHandlerFailureIsolation::powerConfirmationId = objects::NO_OBJECT;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -31,5 +31,7 @@ int customSetup() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int customTeardown() {delete ObjectManager::instance();
|
||||
return 0; }
|
||||
int customTeardown() {
|
||||
ObjectManager::clear();
|
||||
return 0;
|
||||
}
|
||||
|
@ -7,19 +7,13 @@
|
||||
#include "mocks/DeviceHandlerMock.h"
|
||||
#include "objects/systemObjectList.h"
|
||||
|
||||
extern int customSetup();
|
||||
|
||||
TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") {
|
||||
//customSetup();
|
||||
EventManagerIF* manager = ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER);
|
||||
|
||||
// Will be deleted with DHB destructor
|
||||
auto* cookieIFMock = new CookieIFMock;
|
||||
ComIFMock comIF(objects::COM_IF_MOCK);
|
||||
DeviceFdirMock deviceFdirMock(objects::DEVICE_HANDLER_MOCK, objects::NO_OBJECT);
|
||||
DeviceHandlerMock deviceHandlerMock(objects::DEVICE_HANDLER_MOCK, objects::COM_IF_MOCK,
|
||||
cookieIFMock, &deviceFdirMock);
|
||||
|
||||
ReturnValue_t result = deviceHandlerMock.initialize();
|
||||
REQUIRE(result == returnvalue::OK);
|
||||
DeviceHandlerCommander deviceHandlerCommander(objects::DEVICE_HANDLER_COMMANDER);
|
||||
|
Loading…
Reference in New Issue
Block a user