From 40ae81c4ff264e01911392f650297a32975ecec5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 12 Jan 2021 19:58:29 +0100 Subject: [PATCH] unfortunate api change should improve include robustness --- controller/ExtendedControllerBase.cpp | 2 +- controller/ExtendedControllerBase.h | 2 +- datapoollocal/HasLocalDataPoolIF.h | 18 +++++------------- datapoollocal/HasLocalDpIFUserAttorney.h | 3 ++- datapoollocal/LocalDataPoolManager.cpp | 11 ++++++----- datapoollocal/LocalDataPoolManager.h | 14 ++++++++------ datapoollocal/LocalPoolDataSetBase.h | 2 +- datapoollocal/LocalPoolObjectBase.cpp | 10 ++++++---- datapoollocal/LocalPoolObjectBase.h | 2 +- .../ProvidesDataPoolSubscriptionIF.h | 2 +- ...olDefinitions.h => localPoolDefinitions.h} | 19 +++++++++++++++---- devicehandlers/DeviceHandlerBase.cpp | 2 +- devicehandlers/DeviceHandlerBase.h | 2 +- devicehandlers/DeviceHandlerIF.h | 2 +- housekeeping/HousekeepingMessage.h | 2 +- internalError/InternalErrorReporter.cpp | 2 +- internalError/InternalErrorReporter.h | 2 +- monitoring/MonitorReporter.h | 2 +- monitoring/MonitoringMessageContent.h | 2 +- 19 files changed, 55 insertions(+), 46 deletions(-) rename datapoollocal/{locPoolDefinitions.h => localPoolDefinitions.h} (78%) diff --git a/controller/ExtendedControllerBase.cpp b/controller/ExtendedControllerBase.cpp index 379f189c..74453b25 100644 --- a/controller/ExtendedControllerBase.cpp +++ b/controller/ExtendedControllerBase.cpp @@ -17,7 +17,7 @@ ReturnValue_t ExtendedControllerBase::executeAction(ActionId_t actionId, ReturnValue_t ExtendedControllerBase::initializeLocalDataPool( - LocalDataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { + localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { // needs to be overriden and implemented by child class. return HasReturnvaluesIF::RETURN_OK; } diff --git a/controller/ExtendedControllerBase.h b/controller/ExtendedControllerBase.h index ed1d7193..6076b2fe 100644 --- a/controller/ExtendedControllerBase.h +++ b/controller/ExtendedControllerBase.h @@ -63,7 +63,7 @@ protected: /** HasLocalDatapoolIF overrides */ virtual object_id_t getObjectId() const override; virtual ReturnValue_t initializeLocalDataPool( - LocalDataPool& localDataPoolMap, + localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) override; virtual uint32_t getPeriodicOperationFrequency() const override; virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override; diff --git a/datapoollocal/HasLocalDataPoolIF.h b/datapoollocal/HasLocalDataPoolIF.h index 822a8590..3132277d 100644 --- a/datapoollocal/HasLocalDataPoolIF.h +++ b/datapoollocal/HasLocalDataPoolIF.h @@ -1,10 +1,7 @@ #ifndef FSFW_DATAPOOLLOCAL_HASLOCALDATAPOOLIF_H_ #define FSFW_DATAPOOLLOCAL_HASLOCALDATAPOOLIF_H_ -#include "AccessLocalPoolF.h" -#include "ProvidesDataPoolSubscriptionIF.h" -#include "locPoolDefinitions.h" - +#include #include "../datapool/PoolEntryIF.h" #include "../serviceinterface/ServiceInterface.h" #include "../ipc/MessageQueueSenderIF.h" @@ -12,11 +9,11 @@ #include +class AccessPoolManagerIF; +class ProvidesDataPoolSubscriptionIF; class LocalPoolDataSetBase; class LocalPoolObjectBase; - -using LocalDataPool = std::map; -using LocalDataPoolMapIter = LocalDataPool::iterator; +class LocalDataPoolManager; /** * @brief This interface is implemented by classes which posses a local data pool (not the @@ -42,11 +39,6 @@ class HasLocalDataPoolIF { public: virtual~ HasLocalDataPoolIF() {}; - static constexpr uint8_t INTERFACE_ID = CLASS_ID::LOCAL_POOL_OWNER_IF; - - static constexpr ReturnValue_t POOL_ENTRY_NOT_FOUND = MAKE_RETURN_CODE(0x00); - static constexpr ReturnValue_t POOL_ENTRY_TYPE_CONFLICT = MAKE_RETURN_CODE(0x01); - static constexpr uint32_t INVALID_LPID = localpool::INVALID_LPID; virtual object_id_t getObjectId() const = 0; @@ -59,7 +51,7 @@ public: * The manager instance shall also be passed to this function. * It can be used to subscribe for periodic packets for for updates. */ - virtual ReturnValue_t initializeLocalDataPool(LocalDataPool& localDataPoolMap, + virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) = 0; /** diff --git a/datapoollocal/HasLocalDpIFUserAttorney.h b/datapoollocal/HasLocalDpIFUserAttorney.h index ebac9374..51260dbf 100644 --- a/datapoollocal/HasLocalDpIFUserAttorney.h +++ b/datapoollocal/HasLocalDpIFUserAttorney.h @@ -1,8 +1,9 @@ #ifndef FSFW_DATAPOOLLOCAL_HASLOCALDPIFUSERATTORNEY_H_ #define FSFW_DATAPOOLLOCAL_HASLOCALDPIFUSERATTORNEY_H_ +#include "HasLocalDataPoolIF.h" + class AccessPoolManagerIF; -class HasLocalDataPoolIF; class HasLocalDpIFUserAttorney { private: diff --git a/datapoollocal/LocalDataPoolManager.cpp b/datapoollocal/LocalDataPoolManager.cpp index b54b0601..3902a0fe 100644 --- a/datapoollocal/LocalDataPoolManager.cpp +++ b/datapoollocal/LocalDataPoolManager.cpp @@ -1,8 +1,9 @@ -#include +#include "HasLocalDataPoolIF.h" #include "LocalDataPoolManager.h" #include "LocalPoolObjectBase.h" #include "LocalPoolDataSetBase.h" #include "LocalPoolDataSetAttorney.h" +#include "HasLocalDpIFManagerAttorney.h" #include "../housekeeping/HousekeepingPacketUpdate.h" #include "../housekeeping/HousekeepingSetPacket.h" @@ -601,8 +602,8 @@ ReturnValue_t LocalDataPoolManager::printPoolEntry( auto poolIter = localPoolMap.find(localPoolId); if (poolIter == localPoolMap.end()) { printWarningOrError(sif::OutputTypes::OUT_WARNING, "printPoolEntry", - HasLocalDataPoolIF::POOL_ENTRY_NOT_FOUND); - return HasLocalDataPoolIF::POOL_ENTRY_NOT_FOUND; + localpool::POOL_ENTRY_NOT_FOUND); + return localpool::POOL_ENTRY_NOT_FOUND; } poolIter->second->print(); return HasReturnvaluesIF::RETURN_OK; @@ -870,10 +871,10 @@ void LocalDataPoolManager::printWarningOrError(sif::OutputTypes outputType, else if(error == QUEUE_OR_DESTINATION_INVALID) { errorPrint = "Queue or destination not set"; } - else if(error == HasLocalDataPoolIF::POOL_ENTRY_TYPE_CONFLICT) { + else if(error == localpool::POOL_ENTRY_TYPE_CONFLICT) { errorPrint = "Pool entry type conflict"; } - else if(error == HasLocalDataPoolIF::POOL_ENTRY_NOT_FOUND) { + else if(error == localpool::POOL_ENTRY_NOT_FOUND) { errorPrint = "Pool entry not found"; } else { diff --git a/datapoollocal/LocalDataPoolManager.h b/datapoollocal/LocalDataPoolManager.h index cba79776..580ac8b9 100644 --- a/datapoollocal/LocalDataPoolManager.h +++ b/datapoollocal/LocalDataPoolManager.h @@ -2,7 +2,7 @@ #define FSFW_DATAPOOLLOCAL_LOCALDATAPOOLMANAGER_H_ #include "ProvidesDataPoolSubscriptionIF.h" -#include "HasLocalDataPoolIF.h" +#include "AccessLocalPoolF.h" #include "../serviceinterface/ServiceInterface.h" #include "../housekeeping/HousekeepingPacketDownlink.h" @@ -25,6 +25,8 @@ void setStaticFrameworkObjectIds(); class LocalPoolDataSetBase; class HousekeepingPacketUpdate; +class HasLocalDataPoolIF; +class LocalDataPool; /** * @brief This class is the managing instance for the local data pool. @@ -267,7 +269,7 @@ public: virtual LocalDataPoolManager* getHkManagerHandle() override; private: - LocalDataPool localPoolMap; + localpool::DataPool localPoolMap; //! Every housekeeping data manager has a mutex to protect access //! to it's data pool. MutexIF* mutex = nullptr; @@ -400,15 +402,15 @@ ReturnValue_t LocalDataPoolManager::fetchPoolEntry(lp_id_t localPoolId, auto poolIter = localPoolMap.find(localPoolId); if (poolIter == localPoolMap.end()) { printWarningOrError(sif::OutputTypes::OUT_ERROR, "fetchPoolEntry", - HasLocalDataPoolIF::POOL_ENTRY_NOT_FOUND); - return HasLocalDataPoolIF::POOL_ENTRY_NOT_FOUND; + localpool::POOL_ENTRY_NOT_FOUND); + return localpool::POOL_ENTRY_NOT_FOUND; } *poolEntry = dynamic_cast< PoolEntry* >(poolIter->second); if(*poolEntry == nullptr) { printWarningOrError(sif::OutputTypes::OUT_ERROR, "fetchPoolEntry", - HasLocalDataPoolIF::POOL_ENTRY_TYPE_CONFLICT); - return HasLocalDataPoolIF::POOL_ENTRY_TYPE_CONFLICT; + localpool::POOL_ENTRY_TYPE_CONFLICT); + return localpool::POOL_ENTRY_TYPE_CONFLICT; } return HasReturnvaluesIF::RETURN_OK; } diff --git a/datapoollocal/LocalPoolDataSetBase.h b/datapoollocal/LocalPoolDataSetBase.h index ba4c1b6d..2d170c3f 100644 --- a/datapoollocal/LocalPoolDataSetBase.h +++ b/datapoollocal/LocalPoolDataSetBase.h @@ -1,9 +1,9 @@ #ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLDATASETBASE_H_ #define FSFW_DATAPOOLLOCAL_LOCALPOOLDATASETBASE_H_ +#include #include "MarkChangedIF.h" -#include "../datapoollocal/locPoolDefinitions.h" #include "../datapool/DataSetIF.h" #include "../datapool/PoolDataSetBase.h" diff --git a/datapoollocal/LocalPoolObjectBase.cpp b/datapoollocal/LocalPoolObjectBase.cpp index 2ba9ef79..6dc6e356 100644 --- a/datapoollocal/LocalPoolObjectBase.cpp +++ b/datapoollocal/LocalPoolObjectBase.cpp @@ -1,6 +1,9 @@ #include "LocalDataPoolManager.h" #include "LocalPoolObjectBase.h" #include "HasLocalDpIFUserAttorney.h" +#include "HasLocalDataPoolIF.h" + +#include "../objectmanager/ObjectManagerIF.h" LocalPoolObjectBase::LocalPoolObjectBase(lp_id_t poolId, HasLocalDataPoolIF* hkOwner, DataSetIF* dataSet, pool_rwm_t setReadWriteMode): @@ -35,8 +38,7 @@ LocalPoolObjectBase::LocalPoolObjectBase(object_id_t poolOwner, lp_id_t poolId, << "which is the NO_PARAMETER value!" << std::endl; #endif } - HasLocalDataPoolIF* hkOwner = - objectManager->get(poolOwner); + HasLocalDataPoolIF* hkOwner = objectManager->get(poolOwner); if(hkOwner == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "LocalPoolVariable: The supplied pool owner did not " @@ -98,10 +100,10 @@ void LocalPoolObjectBase::reportReadCommitError(const char* variableType, } const char* errMsg = nullptr; - if(error == HasLocalDataPoolIF::POOL_ENTRY_NOT_FOUND) { + if(error == localpool::POOL_ENTRY_NOT_FOUND) { errMsg = "Pool entry not found"; } - else if(error == HasLocalDataPoolIF::POOL_ENTRY_TYPE_CONFLICT) { + else if(error == localpool::POOL_ENTRY_TYPE_CONFLICT) { errMsg = "Pool entry type conflict"; } else if(error == PoolVariableIF::INVALID_READ_WRITE_MODE) { diff --git a/datapoollocal/LocalPoolObjectBase.h b/datapoollocal/LocalPoolObjectBase.h index 5e6d215c..2dddc246 100644 --- a/datapoollocal/LocalPoolObjectBase.h +++ b/datapoollocal/LocalPoolObjectBase.h @@ -1,8 +1,8 @@ #ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLOBJECTBASE_H_ #define FSFW_DATAPOOLLOCAL_LOCALPOOLOBJECTBASE_H_ +#include #include "MarkChangedIF.h" -#include "../datapoollocal/locPoolDefinitions.h" #include "../objectmanager/SystemObjectIF.h" #include "../datapool/PoolVariableIF.h" #include "../returnvalues/HasReturnvaluesIF.h" diff --git a/datapoollocal/ProvidesDataPoolSubscriptionIF.h b/datapoollocal/ProvidesDataPoolSubscriptionIF.h index 7f0cc754..e6d6257e 100644 --- a/datapoollocal/ProvidesDataPoolSubscriptionIF.h +++ b/datapoollocal/ProvidesDataPoolSubscriptionIF.h @@ -1,7 +1,7 @@ #ifndef FSFW_DATAPOOLLOCAL_PROVIDESDATAPOOLSUBSCRIPTION_H_ #define FSFW_DATAPOOLLOCAL_PROVIDESDATAPOOLSUBSCRIPTION_H_ -#include +#include #include #include diff --git a/datapoollocal/locPoolDefinitions.h b/datapoollocal/localPoolDefinitions.h similarity index 78% rename from datapoollocal/locPoolDefinitions.h rename to datapoollocal/localPoolDefinitions.h index 6e74d349..5f558895 100644 --- a/datapoollocal/locPoolDefinitions.h +++ b/datapoollocal/localPoolDefinitions.h @@ -1,10 +1,13 @@ -#ifndef FSFW_DATAPOOLLOCAL_LOCPOOLDEFINITIONS_H_ -#define FSFW_DATAPOOLLOCAL_LOCPOOLDEFINITIONS_H_ +#ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLDEFINITIONS_H_ +#define FSFW_DATAPOOLLOCAL_LOCALPOOLDEFINITIONS_H_ -#include +#include "../datapool/PoolEntryIF.h" #include "../objectmanager/SystemObjectIF.h" #include "../objectmanager/frameworkObjects.h" +#include +#include + /** * @brief Type definition for local pool entries. */ @@ -12,6 +15,14 @@ using lp_id_t = uint32_t; namespace localpool { static constexpr uint32_t INVALID_LPID = -1; + +static constexpr uint8_t INTERFACE_ID = CLASS_ID::LOCAL_POOL_OWNER_IF; + +static constexpr ReturnValue_t POOL_ENTRY_NOT_FOUND = MAKE_RETURN_CODE(0x00); +static constexpr ReturnValue_t POOL_ENTRY_TYPE_CONFLICT = MAKE_RETURN_CODE(0x01); + +using DataPool = std::map; +using DataPoolMapIter = DataPool::iterator; } /** @@ -90,4 +101,4 @@ union gp_id_t { } }; -#endif /* FSFW_DATAPOOLLOCAL_LOCPOOLDEFINITIONS_H_ */ +#endif /* FSFW_DATAPOOLLOCAL_LOCALPOOLDEFINITIONS_H_ */ diff --git a/devicehandlers/DeviceHandlerBase.cpp b/devicehandlers/DeviceHandlerBase.cpp index abe0f701..acfdd81e 100644 --- a/devicehandlers/DeviceHandlerBase.cpp +++ b/devicehandlers/DeviceHandlerBase.cpp @@ -1421,7 +1421,7 @@ void DeviceHandlerBase::performOperationHook() { } ReturnValue_t DeviceHandlerBase::initializeLocalDataPool( - LocalDataPool &localDataPoolMap, + localpool::DataPool &localDataPoolMap, LocalDataPoolManager& poolManager) { if(thermalSet != nullptr) { localDataPoolMap.emplace(thermalSet->thermalStatePoolId, diff --git a/devicehandlers/DeviceHandlerBase.h b/devicehandlers/DeviceHandlerBase.h index c062603f..6042d249 100644 --- a/devicehandlers/DeviceHandlerBase.h +++ b/devicehandlers/DeviceHandlerBase.h @@ -514,7 +514,7 @@ protected: * @param localDataPoolMap * @return */ - virtual ReturnValue_t initializeLocalDataPool(LocalDataPool& localDataPoolMap, + virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) override; diff --git a/devicehandlers/DeviceHandlerIF.h b/devicehandlers/DeviceHandlerIF.h index 865b38b3..bae68516 100644 --- a/devicehandlers/DeviceHandlerIF.h +++ b/devicehandlers/DeviceHandlerIF.h @@ -1,10 +1,10 @@ #ifndef FSFW_DEVICEHANDLERS_DEVICEHANDLERIF_H_ #define FSFW_DEVICEHANDLERS_DEVICEHANDLERIF_H_ +#include #include "DeviceHandlerMessage.h" #include "../action/HasActionsIF.h" -#include "../datapoollocal/locPoolDefinitions.h" #include "../events/Event.h" #include "../modes/HasModesIF.h" #include "../ipc/MessageQueueSenderIF.h" diff --git a/housekeeping/HousekeepingMessage.h b/housekeeping/HousekeepingMessage.h index 90bbe594..a64ce18b 100644 --- a/housekeeping/HousekeepingMessage.h +++ b/housekeeping/HousekeepingMessage.h @@ -1,7 +1,7 @@ #ifndef FSFW_HOUSEKEEPING_HOUSEKEEPINGMESSAGE_H_ #define FSFW_HOUSEKEEPING_HOUSEKEEPINGMESSAGE_H_ -#include "../datapoollocal/locPoolDefinitions.h" +#include #include "../ipc/CommandMessage.h" #include "../ipc/FwMessageTypes.h" #include "../objectmanager/frameworkObjects.h" diff --git a/internalError/InternalErrorReporter.cpp b/internalError/InternalErrorReporter.cpp index 3a05b350..5656f208 100644 --- a/internalError/InternalErrorReporter.cpp +++ b/internalError/InternalErrorReporter.cpp @@ -153,7 +153,7 @@ MessageQueueId_t InternalErrorReporter::getCommandQueue() const { } ReturnValue_t InternalErrorReporter::initializeLocalDataPool( - LocalDataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { + localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { localDataPoolMap.emplace(errorPoolIds::TM_HITS, new PoolEntry()); localDataPoolMap.emplace(errorPoolIds::QUEUE_HITS, diff --git a/internalError/InternalErrorReporter.h b/internalError/InternalErrorReporter.h index 0cb6be59..ec9134d4 100644 --- a/internalError/InternalErrorReporter.h +++ b/internalError/InternalErrorReporter.h @@ -41,7 +41,7 @@ public: virtual object_id_t getObjectId() const override; virtual MessageQueueId_t getCommandQueue() const override; virtual ReturnValue_t initializeLocalDataPool( - LocalDataPool& localDataPoolMap, + localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) override; virtual dur_millis_t getPeriodicOperationFrequency() const override; virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override; diff --git a/monitoring/MonitorReporter.h b/monitoring/MonitorReporter.h index 9028e7e4..6b3204b3 100644 --- a/monitoring/MonitorReporter.h +++ b/monitoring/MonitorReporter.h @@ -1,11 +1,11 @@ #ifndef FSFW_MONITORING_MONITORREPORTER_H_ #define FSFW_MONITORING_MONITORREPORTER_H_ +#include #include "LimitViolationReporter.h" #include "MonitoringIF.h" #include "MonitoringMessageContent.h" -#include "../datapoollocal/locPoolDefinitions.h" #include "../events/EventManagerIF.h" #include "../parameters/HasParametersIF.h" diff --git a/monitoring/MonitoringMessageContent.h b/monitoring/MonitoringMessageContent.h index 2822743a..e44e8480 100644 --- a/monitoring/MonitoringMessageContent.h +++ b/monitoring/MonitoringMessageContent.h @@ -1,9 +1,9 @@ #ifndef MONITORINGMESSAGECONTENT_H_ #define MONITORINGMESSAGECONTENT_H_ +#include #include "HasMonitorsIF.h" #include "MonitoringIF.h" -#include "../datapoollocal/locPoolDefinitions.h" #include "../objectmanager/ObjectManagerIF.h" #include "../serialize/SerialBufferAdapter.h" #include "../serialize/SerialFixedArrayListAdapter.h"