2021-01-12 19:58:29 +01:00
|
|
|
#ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLDEFINITIONS_H_
|
|
|
|
#define FSFW_DATAPOOLLOCAL_LOCALPOOLDEFINITIONS_H_
|
2020-10-14 00:50:24 +02:00
|
|
|
|
2021-01-12 19:58:29 +01:00
|
|
|
#include "../datapool/PoolEntryIF.h"
|
2020-10-14 00:50:24 +02:00
|
|
|
#include "../objectmanager/SystemObjectIF.h"
|
|
|
|
#include "../objectmanager/frameworkObjects.h"
|
|
|
|
|
2021-01-12 19:58:29 +01:00
|
|
|
#include <cstdint>
|
|
|
|
#include <map>
|
|
|
|
|
2020-10-14 00:50:24 +02:00
|
|
|
/**
|
|
|
|
* @brief Type definition for local pool entries.
|
|
|
|
*/
|
|
|
|
using lp_id_t = uint32_t;
|
|
|
|
|
2020-11-30 13:45:08 +01:00
|
|
|
namespace localpool {
|
|
|
|
static constexpr uint32_t INVALID_LPID = -1;
|
2021-01-12 19:58:29 +01:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2021-01-12 20:33:53 +01:00
|
|
|
//! This is the core data structure of the local data pools. Users should insert all desired
|
|
|
|
//! pool variables, using the std::map interface.
|
2021-01-12 19:58:29 +01:00
|
|
|
using DataPool = std::map<lp_id_t, PoolEntryIF*>;
|
|
|
|
using DataPoolMapIter = DataPool::iterator;
|
2021-01-12 20:33:53 +01:00
|
|
|
|
2020-11-30 13:45:08 +01:00
|
|
|
}
|
2020-10-14 00:50:24 +02:00
|
|
|
|
2020-11-30 13:45:08 +01:00
|
|
|
/**
|
|
|
|
* Used as a unique identifier for data sets.
|
|
|
|
*/
|
2020-10-14 00:50:24 +02:00
|
|
|
union sid_t {
|
|
|
|
static constexpr uint64_t INVALID_SID = -1;
|
|
|
|
static constexpr uint32_t INVALID_OBJECT_ID = objects::NO_OBJECT;
|
2020-11-30 13:45:08 +01:00
|
|
|
static constexpr uint32_t INVALID_SET_ID = -1;
|
|
|
|
|
|
|
|
|
2020-10-14 00:50:24 +02:00
|
|
|
sid_t(): raw(INVALID_SID) {}
|
|
|
|
|
|
|
|
sid_t(object_id_t objectId, uint32_t setId):
|
|
|
|
objectId(objectId),
|
|
|
|
ownerSetId(setId) {}
|
|
|
|
|
|
|
|
struct {
|
|
|
|
object_id_t objectId ;
|
|
|
|
/**
|
|
|
|
* A generic 32 bit ID to identify unique HK packets for a single
|
|
|
|
* object. For example, the DeviceCommandId_t is used for
|
|
|
|
* DeviceHandlers
|
|
|
|
*/
|
|
|
|
uint32_t ownerSetId;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* Alternative access to the raw value. This is also the size of the type.
|
|
|
|
*/
|
|
|
|
uint64_t raw;
|
|
|
|
|
|
|
|
bool notSet() const {
|
|
|
|
return raw == INVALID_SID;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator==(const sid_t& other) const {
|
|
|
|
return raw == other.raw;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator!=(const sid_t& other) const {
|
|
|
|
return not (raw == other.raw);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-11-30 13:45:08 +01:00
|
|
|
/**
|
|
|
|
* Used as a global unique identifier for local pool variables.
|
|
|
|
*/
|
|
|
|
union gp_id_t {
|
|
|
|
static constexpr uint64_t INVALID_GPID = -1;
|
|
|
|
static constexpr uint32_t INVALID_OBJECT_ID = objects::NO_OBJECT;
|
|
|
|
static constexpr uint32_t INVALID_LPID = localpool::INVALID_LPID;
|
|
|
|
|
|
|
|
gp_id_t(): raw(INVALID_GPID) {}
|
|
|
|
|
2020-11-30 15:30:56 +01:00
|
|
|
gp_id_t(object_id_t objectId, lp_id_t localPoolId):
|
2020-11-30 13:45:08 +01:00
|
|
|
objectId(objectId),
|
|
|
|
localPoolId(localPoolId) {}
|
|
|
|
|
|
|
|
struct {
|
|
|
|
object_id_t objectId;
|
|
|
|
lp_id_t localPoolId;
|
|
|
|
};
|
|
|
|
|
|
|
|
uint64_t raw;
|
|
|
|
|
|
|
|
bool notSet() const {
|
|
|
|
return raw == INVALID_GPID;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator==(const sid_t& other) const {
|
|
|
|
return raw == other.raw;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator!=(const sid_t& other) const {
|
|
|
|
return not (raw == other.raw);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-01-12 19:58:29 +01:00
|
|
|
#endif /* FSFW_DATAPOOLLOCAL_LOCALPOOLDEFINITIONS_H_ */
|