diff --git a/datapoollocal/CMakeLists.txt b/datapoollocal/CMakeLists.txt index 925be505..e2db39eb 100644 --- a/datapoollocal/CMakeLists.txt +++ b/datapoollocal/CMakeLists.txt @@ -5,6 +5,6 @@ target_sources(${LIB_FSFW_NAME} LocalPoolDataSetBase.cpp LocalPoolObjectBase.cpp SharedLocalDataSet.cpp - HasLocalDpIFUserAttorney.cpp - HasLocalDpIFManagerAttorney.cpp -) \ No newline at end of file +) + +add_subdirectory(internal) \ No newline at end of file diff --git a/datapoollocal/HasLocalDataPoolIF.h b/datapoollocal/HasLocalDataPoolIF.h index c1afb4a0..569f2b09 100644 --- a/datapoollocal/HasLocalDataPoolIF.h +++ b/datapoollocal/HasLocalDataPoolIF.h @@ -23,16 +23,11 @@ class LocalDataPoolManager; * @details * Any class implementing this interface shall also have a LocalDataPoolManager member class which * contains the actual pool data structure and exposes the public interface for it. - * This is required because the pool entries are templates, which makes specifying an interface - * rather difficult. The local data pool can be accessed by using the LocalPoolVariable, - * LocalPoolVector or LocalDataSet classes. + * The local data pool can be accessed using helper classes by using the + * LocalPoolVariable, LocalPoolVector or LocalDataSet classes. Every local pool variable can + * be uniquely identified by a global pool ID (gp_id_t) and every dataset tied + * to a pool manager can be uniqely identified by a global structure ID (sid_t). * - * Architectural Note: - * This could be circumvented by using a wrapper/accessor function or implementing the templated - * function in this interface.. The first solution sounds better than the second but the - * LocalPoolVariable classes are templates as well, so this just shifts the problem somewhere else. - * Interfaces are nice, but the most pragmatic solution I found was to offer the client the full - * interface of the LocalDataPoolManager. */ class HasLocalDataPoolIF { friend class HasLocalDpIFManagerAttorney; @@ -106,13 +101,21 @@ public: /** * This function can be used by data pool consumers to retrieve a handle - * which allows subscriptions to dataset and variable updates. + * which allows subscriptions to dataset and variable updates in form of messages. + * The consumers can then read the most recent variable value by calling read with + * an own pool variable or set instance or using the deserialized snapshot data. * @return */ virtual ProvidesDataPoolSubscriptionIF* getSubscriptionInterface() = 0; protected: + /** + * Accessor handle required for internal handling. Not intended for users and therefore + * declared protected. Users should instead use pool variables, sets or the subscription + * interface to access pool entries. + * @return + */ virtual AccessPoolManagerIF* getAccessorHandle() = 0; /** diff --git a/datapoollocal/LocalDataPoolManager.cpp b/datapoollocal/LocalDataPoolManager.cpp index 3902a0fe..462ef17f 100644 --- a/datapoollocal/LocalDataPoolManager.cpp +++ b/datapoollocal/LocalDataPoolManager.cpp @@ -2,8 +2,8 @@ #include "LocalDataPoolManager.h" #include "LocalPoolObjectBase.h" #include "LocalPoolDataSetBase.h" -#include "LocalPoolDataSetAttorney.h" -#include "HasLocalDpIFManagerAttorney.h" +#include "internal/LocalPoolDataSetAttorney.h" +#include "internal/HasLocalDpIFManagerAttorney.h" #include "../housekeeping/HousekeepingPacketUpdate.h" #include "../housekeeping/HousekeepingSetPacket.h" diff --git a/datapoollocal/LocalPoolDataSetBase.cpp b/datapoollocal/LocalPoolDataSetBase.cpp index cd0f8931..5343a9c9 100644 --- a/datapoollocal/LocalPoolDataSetBase.cpp +++ b/datapoollocal/LocalPoolDataSetBase.cpp @@ -1,6 +1,6 @@ #include "LocalPoolDataSetBase.h" #include "HasLocalDataPoolIF.h" -#include "HasLocalDpIFUserAttorney.h" +#include "internal/HasLocalDpIFUserAttorney.h" #include "../serviceinterface/ServiceInterface.h" #include "../datapoollocal/LocalDataPoolManager.h" diff --git a/datapoollocal/LocalPoolObjectBase.cpp b/datapoollocal/LocalPoolObjectBase.cpp index 6dc6e356..bd1bfa0f 100644 --- a/datapoollocal/LocalPoolObjectBase.cpp +++ b/datapoollocal/LocalPoolObjectBase.cpp @@ -1,6 +1,6 @@ #include "LocalDataPoolManager.h" #include "LocalPoolObjectBase.h" -#include "HasLocalDpIFUserAttorney.h" +#include "internal/HasLocalDpIFUserAttorney.h" #include "HasLocalDataPoolIF.h" #include "../objectmanager/ObjectManagerIF.h" diff --git a/datapoollocal/LocalPoolVariable.h b/datapoollocal/LocalPoolVariable.h index e66c565c..859c8f08 100644 --- a/datapoollocal/LocalPoolVariable.h +++ b/datapoollocal/LocalPoolVariable.h @@ -1,11 +1,12 @@ #ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLVARIABLE_H_ #define FSFW_DATAPOOLLOCAL_LOCALPOOLVARIABLE_H_ -#include #include "LocalPoolObjectBase.h" #include "HasLocalDataPoolIF.h" #include "LocalDataPoolManager.h" #include "AccessLocalPoolF.h" +#include "internal/LocalDpManagerAttorney.h" + #include "../datapool/PoolVariableIF.h" #include "../datapool/DataSetIF.h" #include "../serviceinterface/ServiceInterface.h" diff --git a/datapoollocal/LocalPoolVector.h b/datapoollocal/LocalPoolVector.h index 3f26b9f5..74255605 100644 --- a/datapoollocal/LocalPoolVector.h +++ b/datapoollocal/LocalPoolVector.h @@ -1,8 +1,9 @@ #ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLVECTOR_H_ #define FSFW_DATAPOOLLOCAL_LOCALPOOLVECTOR_H_ -#include #include "LocalPoolObjectBase.h" +#include "internal/LocalDpManagerAttorney.h" + #include "../datapool/DataSetIF.h" #include "../datapool/PoolEntry.h" #include "../datapool/PoolVariableIF.h" diff --git a/datapoollocal/PoolReadHelper.h b/datapoollocal/PoolReadHelper.h index c89fff98..61e5feaf 100644 --- a/datapoollocal/PoolReadHelper.h +++ b/datapoollocal/PoolReadHelper.h @@ -1,7 +1,8 @@ #ifndef FSFW_DATAPOOLLOCAL_POOLREADHELPER_H_ #define FSFW_DATAPOOLLOCAL_POOLREADHELPER_H_ -#include +#include "LocalPoolDataSetBase.h" +#include "../serviceinterface/ServiceInterface.h" #include /** @@ -19,6 +20,8 @@ public: #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "PoolReadHelper: Read failed!" << std::endl; #endif +#else + sif::printError("PoolReadHelper: Read failed!\n"); #endif } } diff --git a/datapoollocal/SharedLocalDataSet.h b/datapoollocal/SharedLocalDataSet.h index 2e5a76fa..713d435b 100644 --- a/datapoollocal/SharedLocalDataSet.h +++ b/datapoollocal/SharedLocalDataSet.h @@ -6,6 +6,13 @@ #include "../objectmanager/SystemObject.h" #include +/** + * This local dataset variation can be used if the dataset is used concurrently across + * multiple threads. It provides a lock in addition to all other functionalities provided + * by the LocalPoolDataSetBase class. + * + * TODO: override and protect read, commit and some other calls used by pool manager. + */ class SharedLocalDataSet: public SystemObject, public LocalPoolDataSetBase, public SharedDataSetIF { diff --git a/datapoollocal/internal/CMakeLists.txt b/datapoollocal/internal/CMakeLists.txt new file mode 100644 index 00000000..554f3b88 --- /dev/null +++ b/datapoollocal/internal/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(${LIB_FSFW_NAME} + PRIVATE + HasLocalDpIFUserAttorney.cpp + HasLocalDpIFManagerAttorney.cpp +) diff --git a/datapoollocal/HasLocalDpIFManagerAttorney.cpp b/datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp similarity index 82% rename from datapoollocal/HasLocalDpIFManagerAttorney.cpp rename to datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp index a683cf7b..bc07170f 100644 --- a/datapoollocal/HasLocalDpIFManagerAttorney.cpp +++ b/datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp @@ -1,7 +1,7 @@ #include "HasLocalDpIFManagerAttorney.h" -#include "LocalPoolObjectBase.h" -#include "LocalPoolDataSetBase.h" -#include "HasLocalDataPoolIF.h" +#include "../LocalPoolObjectBase.h" +#include "../LocalPoolDataSetBase.h" +#include "../HasLocalDataPoolIF.h" LocalPoolDataSetBase* HasLocalDpIFManagerAttorney::getDataSetHandle(HasLocalDataPoolIF* clientIF, sid_t sid) { diff --git a/datapoollocal/HasLocalDpIFManagerAttorney.h b/datapoollocal/internal/HasLocalDpIFManagerAttorney.h similarity index 94% rename from datapoollocal/HasLocalDpIFManagerAttorney.h rename to datapoollocal/internal/HasLocalDpIFManagerAttorney.h index 44b06592..ef180b37 100644 --- a/datapoollocal/HasLocalDpIFManagerAttorney.h +++ b/datapoollocal/internal/HasLocalDpIFManagerAttorney.h @@ -1,7 +1,7 @@ #ifndef FSFW_DATAPOOLLOCAL_HASLOCALDPIFMANAGERATTORNEY_H_ #define FSFW_DATAPOOLLOCAL_HASLOCALDPIFMANAGERATTORNEY_H_ -#include "localPoolDefinitions.h" +#include "../localPoolDefinitions.h" class HasLocalDataPoolIF; class LocalPoolDataSetBase; diff --git a/datapoollocal/HasLocalDpIFUserAttorney.cpp b/datapoollocal/internal/HasLocalDpIFUserAttorney.cpp similarity index 72% rename from datapoollocal/HasLocalDpIFUserAttorney.cpp rename to datapoollocal/internal/HasLocalDpIFUserAttorney.cpp index bb4d83d1..838204a7 100644 --- a/datapoollocal/HasLocalDpIFUserAttorney.cpp +++ b/datapoollocal/internal/HasLocalDpIFUserAttorney.cpp @@ -1,6 +1,6 @@ #include "HasLocalDpIFUserAttorney.h" -#include "AccessLocalPoolF.h" -#include "HasLocalDataPoolIF.h" +#include "../AccessLocalPoolF.h" +#include "../HasLocalDataPoolIF.h" AccessPoolManagerIF* HasLocalDpIFUserAttorney::getAccessorHandle(HasLocalDataPoolIF *clientIF) { return clientIF->getAccessorHandle(); diff --git a/datapoollocal/HasLocalDpIFUserAttorney.h b/datapoollocal/internal/HasLocalDpIFUserAttorney.h similarity index 100% rename from datapoollocal/HasLocalDpIFUserAttorney.h rename to datapoollocal/internal/HasLocalDpIFUserAttorney.h diff --git a/datapoollocal/LocalDpManagerAttorney.h b/datapoollocal/internal/LocalDpManagerAttorney.h similarity index 100% rename from datapoollocal/LocalDpManagerAttorney.h rename to datapoollocal/internal/LocalDpManagerAttorney.h diff --git a/datapoollocal/LocalPoolDataSetAttorney.h b/datapoollocal/internal/LocalPoolDataSetAttorney.h similarity index 95% rename from datapoollocal/LocalPoolDataSetAttorney.h rename to datapoollocal/internal/LocalPoolDataSetAttorney.h index 36358db4..9804444a 100644 --- a/datapoollocal/LocalPoolDataSetAttorney.h +++ b/datapoollocal/internal/LocalPoolDataSetAttorney.h @@ -1,7 +1,7 @@ #ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLDATASETATTORNEY_H_ #define FSFW_DATAPOOLLOCAL_LOCALPOOLDATASETATTORNEY_H_ -#include +#include "../LocalPoolDataSetBase.h" class LocalPoolDataSetAttorney { private: @@ -36,5 +36,4 @@ private: }; - #endif /* FSFW_DATAPOOLLOCAL_LOCALPOOLDATASETATTORNEY_H_ */ diff --git a/datapoollocal/localPoolDefinitions.h b/datapoollocal/localPoolDefinitions.h index 86073e6f..3ff1feed 100644 --- a/datapoollocal/localPoolDefinitions.h +++ b/datapoollocal/localPoolDefinitions.h @@ -29,7 +29,7 @@ using DataPoolMapIter = DataPool::iterator; } /** - * Used as a unique identifier for data sets. + * Used as a unique identifier for data sets. Consists of 4 byte object ID and 4 byte set ID. */ union sid_t { static constexpr uint64_t INVALID_SID = -1; @@ -71,7 +71,8 @@ union sid_t { }; /** - * Used as a global unique identifier for local pool variables. + * Used as a global unique identifier for local pool variables. Consists of 4 byte object ID + * and 4 byte local pool ID. */ union gp_id_t { static constexpr uint64_t INVALID_GPID = -1;