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
LocalPoolObjectBase.cpp
SharedLocalDataSet.cpp
HasLocalDpIFUserAttorney.cpp
HasLocalDpIFManagerAttorney.cpp
)
add_subdirectory(internal)

View File

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

View File

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

View File

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

View File

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

View File

@ -1,11 +1,12 @@
#ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLVARIABLE_H_
#define FSFW_DATAPOOLLOCAL_LOCALPOOLVARIABLE_H_
#include <fsfw/datapoollocal/LocalDpManagerAttorney.h>
#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"

View File

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

View File

@ -1,7 +1,8 @@
#ifndef FSFW_DATAPOOLLOCAL_POOLREADHELPER_H_
#define FSFW_DATAPOOLLOCAL_POOLREADHELPER_H_
#include <fsfw/datapoollocal/LocalPoolDataSetBase.h>
#include "LocalPoolDataSetBase.h"
#include "../serviceinterface/ServiceInterface.h"
#include <FSFWConfig.h>
/**
@ -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
}
}

View File

@ -6,6 +6,13 @@
#include "../objectmanager/SystemObject.h"
#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,
public LocalPoolDataSetBase,
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 "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) {

View File

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

View File

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

View File

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