cleaned up a bit

This commit is contained in:
Robin Müller 2021-01-12 20:46:34 +01:00
parent 20bf7b6fc4
commit b3e2e93f52
17 changed files with 50 additions and 30 deletions

View File

@ -5,6 +5,6 @@ target_sources(${LIB_FSFW_NAME}
LocalPoolDataSetBase.cpp LocalPoolDataSetBase.cpp
LocalPoolObjectBase.cpp LocalPoolObjectBase.cpp
SharedLocalDataSet.cpp SharedLocalDataSet.cpp
HasLocalDpIFUserAttorney.cpp
HasLocalDpIFManagerAttorney.cpp
) )
add_subdirectory(internal)

View File

@ -23,16 +23,11 @@ class LocalDataPoolManager;
* @details * @details
* Any class implementing this interface shall also have a LocalDataPoolManager member class which * 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. * 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 * The local data pool can be accessed using helper classes by using the
* rather difficult. The local data pool can be accessed by using the LocalPoolVariable, * LocalPoolVariable, LocalPoolVector or LocalDataSet classes. Every local pool variable can
* LocalPoolVector or LocalDataSet classes. * 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 { class HasLocalDataPoolIF {
friend class HasLocalDpIFManagerAttorney; friend class HasLocalDpIFManagerAttorney;
@ -106,13 +101,21 @@ public:
/** /**
* This function can be used by data pool consumers to retrieve a handle * 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 * @return
*/ */
virtual ProvidesDataPoolSubscriptionIF* getSubscriptionInterface() = 0; virtual ProvidesDataPoolSubscriptionIF* getSubscriptionInterface() = 0;
protected: 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; virtual AccessPoolManagerIF* getAccessorHandle() = 0;
/** /**

View File

@ -2,8 +2,8 @@
#include "LocalDataPoolManager.h" #include "LocalDataPoolManager.h"
#include "LocalPoolObjectBase.h" #include "LocalPoolObjectBase.h"
#include "LocalPoolDataSetBase.h" #include "LocalPoolDataSetBase.h"
#include "LocalPoolDataSetAttorney.h" #include "internal/LocalPoolDataSetAttorney.h"
#include "HasLocalDpIFManagerAttorney.h" #include "internal/HasLocalDpIFManagerAttorney.h"
#include "../housekeeping/HousekeepingPacketUpdate.h" #include "../housekeeping/HousekeepingPacketUpdate.h"
#include "../housekeeping/HousekeepingSetPacket.h" #include "../housekeeping/HousekeepingSetPacket.h"

View File

@ -1,6 +1,6 @@
#include "LocalPoolDataSetBase.h" #include "LocalPoolDataSetBase.h"
#include "HasLocalDataPoolIF.h" #include "HasLocalDataPoolIF.h"
#include "HasLocalDpIFUserAttorney.h" #include "internal/HasLocalDpIFUserAttorney.h"
#include "../serviceinterface/ServiceInterface.h" #include "../serviceinterface/ServiceInterface.h"
#include "../datapoollocal/LocalDataPoolManager.h" #include "../datapoollocal/LocalDataPoolManager.h"

View File

@ -1,6 +1,6 @@
#include "LocalDataPoolManager.h" #include "LocalDataPoolManager.h"
#include "LocalPoolObjectBase.h" #include "LocalPoolObjectBase.h"
#include "HasLocalDpIFUserAttorney.h" #include "internal/HasLocalDpIFUserAttorney.h"
#include "HasLocalDataPoolIF.h" #include "HasLocalDataPoolIF.h"
#include "../objectmanager/ObjectManagerIF.h" #include "../objectmanager/ObjectManagerIF.h"

View File

@ -1,11 +1,12 @@
#ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLVARIABLE_H_ #ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLVARIABLE_H_
#define FSFW_DATAPOOLLOCAL_LOCALPOOLVARIABLE_H_ #define FSFW_DATAPOOLLOCAL_LOCALPOOLVARIABLE_H_
#include <fsfw/datapoollocal/LocalDpManagerAttorney.h>
#include "LocalPoolObjectBase.h" #include "LocalPoolObjectBase.h"
#include "HasLocalDataPoolIF.h" #include "HasLocalDataPoolIF.h"
#include "LocalDataPoolManager.h" #include "LocalDataPoolManager.h"
#include "AccessLocalPoolF.h" #include "AccessLocalPoolF.h"
#include "internal/LocalDpManagerAttorney.h"
#include "../datapool/PoolVariableIF.h" #include "../datapool/PoolVariableIF.h"
#include "../datapool/DataSetIF.h" #include "../datapool/DataSetIF.h"
#include "../serviceinterface/ServiceInterface.h" #include "../serviceinterface/ServiceInterface.h"

View File

@ -1,8 +1,9 @@
#ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLVECTOR_H_ #ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLVECTOR_H_
#define FSFW_DATAPOOLLOCAL_LOCALPOOLVECTOR_H_ #define FSFW_DATAPOOLLOCAL_LOCALPOOLVECTOR_H_
#include <fsfw/datapoollocal/LocalDpManagerAttorney.h>
#include "LocalPoolObjectBase.h" #include "LocalPoolObjectBase.h"
#include "internal/LocalDpManagerAttorney.h"
#include "../datapool/DataSetIF.h" #include "../datapool/DataSetIF.h"
#include "../datapool/PoolEntry.h" #include "../datapool/PoolEntry.h"
#include "../datapool/PoolVariableIF.h" #include "../datapool/PoolVariableIF.h"

View File

@ -1,7 +1,8 @@
#ifndef FSFW_DATAPOOLLOCAL_POOLREADHELPER_H_ #ifndef FSFW_DATAPOOLLOCAL_POOLREADHELPER_H_
#define FSFW_DATAPOOLLOCAL_POOLREADHELPER_H_ #define FSFW_DATAPOOLLOCAL_POOLREADHELPER_H_
#include <fsfw/datapoollocal/LocalPoolDataSetBase.h> #include "LocalPoolDataSetBase.h"
#include "../serviceinterface/ServiceInterface.h"
#include <FSFWConfig.h> #include <FSFWConfig.h>
/** /**
@ -19,6 +20,8 @@ public:
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "PoolReadHelper: Read failed!" << std::endl; sif::error << "PoolReadHelper: Read failed!" << std::endl;
#endif #endif
#else
sif::printError("PoolReadHelper: Read failed!\n");
#endif #endif
} }
} }

View File

@ -6,6 +6,13 @@
#include "../objectmanager/SystemObject.h" #include "../objectmanager/SystemObject.h"
#include <vector> #include <vector>
/**
* 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, class SharedLocalDataSet: public SystemObject,
public LocalPoolDataSetBase, public LocalPoolDataSetBase,
public SharedDataSetIF { public SharedDataSetIF {

View File

@ -0,0 +1,5 @@
target_sources(${LIB_FSFW_NAME}
PRIVATE
HasLocalDpIFUserAttorney.cpp
HasLocalDpIFManagerAttorney.cpp
)

View File

@ -1,7 +1,7 @@
#include "HasLocalDpIFManagerAttorney.h" #include "HasLocalDpIFManagerAttorney.h"
#include "LocalPoolObjectBase.h" #include "../LocalPoolObjectBase.h"
#include "LocalPoolDataSetBase.h" #include "../LocalPoolDataSetBase.h"
#include "HasLocalDataPoolIF.h" #include "../HasLocalDataPoolIF.h"
LocalPoolDataSetBase* HasLocalDpIFManagerAttorney::getDataSetHandle(HasLocalDataPoolIF* clientIF, LocalPoolDataSetBase* HasLocalDpIFManagerAttorney::getDataSetHandle(HasLocalDataPoolIF* clientIF,
sid_t sid) { sid_t sid) {

View File

@ -1,7 +1,7 @@
#ifndef FSFW_DATAPOOLLOCAL_HASLOCALDPIFMANAGERATTORNEY_H_ #ifndef FSFW_DATAPOOLLOCAL_HASLOCALDPIFMANAGERATTORNEY_H_
#define FSFW_DATAPOOLLOCAL_HASLOCALDPIFMANAGERATTORNEY_H_ #define FSFW_DATAPOOLLOCAL_HASLOCALDPIFMANAGERATTORNEY_H_
#include "localPoolDefinitions.h" #include "../localPoolDefinitions.h"
class HasLocalDataPoolIF; class HasLocalDataPoolIF;
class LocalPoolDataSetBase; class LocalPoolDataSetBase;

View File

@ -1,6 +1,6 @@
#include "HasLocalDpIFUserAttorney.h" #include "HasLocalDpIFUserAttorney.h"
#include "AccessLocalPoolF.h" #include "../AccessLocalPoolF.h"
#include "HasLocalDataPoolIF.h" #include "../HasLocalDataPoolIF.h"
AccessPoolManagerIF* HasLocalDpIFUserAttorney::getAccessorHandle(HasLocalDataPoolIF *clientIF) { AccessPoolManagerIF* HasLocalDpIFUserAttorney::getAccessorHandle(HasLocalDataPoolIF *clientIF) {
return clientIF->getAccessorHandle(); return clientIF->getAccessorHandle();

View File

@ -1,7 +1,7 @@
#ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLDATASETATTORNEY_H_ #ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLDATASETATTORNEY_H_
#define FSFW_DATAPOOLLOCAL_LOCALPOOLDATASETATTORNEY_H_ #define FSFW_DATAPOOLLOCAL_LOCALPOOLDATASETATTORNEY_H_
#include <fsfw/datapoollocal/LocalPoolDataSetBase.h> #include "../LocalPoolDataSetBase.h"
class LocalPoolDataSetAttorney { class LocalPoolDataSetAttorney {
private: private:
@ -36,5 +36,4 @@ private:
}; };
#endif /* FSFW_DATAPOOLLOCAL_LOCALPOOLDATASETATTORNEY_H_ */ #endif /* FSFW_DATAPOOLLOCAL_LOCALPOOLDATASETATTORNEY_H_ */

View File

@ -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 { union sid_t {
static constexpr uint64_t INVALID_SID = -1; 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 { union gp_id_t {
static constexpr uint64_t INVALID_GPID = -1; static constexpr uint64_t INVALID_GPID = -1;