found solution for circ dependency
had to put store_address_t in own file though
This commit is contained in:
parent
d2d1ef9a85
commit
d4abfacd27
@ -1,4 +1,5 @@
|
|||||||
#include <framework/storagemanager/StorageAccessor.h>
|
#include <framework/storagemanager/StorageAccessor.h>
|
||||||
|
#include <framework/storagemanager/StorageManagerIF.h>
|
||||||
|
|
||||||
ConstStorageAccessor::ConstStorageAccessor(store_address_t storeId):
|
ConstStorageAccessor::ConstStorageAccessor(store_address_t storeId):
|
||||||
storeId(storeId) {}
|
storeId(storeId) {}
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
#define FRAMEWORK_STORAGEMANAGER_STORAGEACCESSOR_H_
|
#define FRAMEWORK_STORAGEMANAGER_STORAGEACCESSOR_H_
|
||||||
|
|
||||||
#include <framework/ipc/MutexHelper.h>
|
#include <framework/ipc/MutexHelper.h>
|
||||||
#include <framework/storagemanager/StorageManagerIF.h>
|
#include <framework/storagemanager/storeAddress.h>
|
||||||
|
|
||||||
|
class StorageManagerIF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Helper classes to facilitate safe access to storages which is also
|
* @brief Helper classes to facilitate safe access to storages which is also
|
||||||
|
@ -3,64 +3,14 @@
|
|||||||
|
|
||||||
#include <framework/events/Event.h>
|
#include <framework/events/Event.h>
|
||||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
||||||
#include <cstddef>
|
#include <framework/storagemanager/StorageAccessor.h>
|
||||||
|
#include <framework/storagemanager/storeAddress.h>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <cstddef>
|
||||||
class StorageAccessor;
|
|
||||||
class ConstStorageAccessor;
|
|
||||||
|
|
||||||
using AccessorPair = std::pair<ReturnValue_t, StorageAccessor>;
|
using AccessorPair = std::pair<ReturnValue_t, StorageAccessor>;
|
||||||
using ConstAccessorPair = std::pair<ReturnValue_t, ConstStorageAccessor>;
|
using ConstAccessorPair = std::pair<ReturnValue_t, ConstStorageAccessor>;
|
||||||
|
|
||||||
/**
|
|
||||||
* This union defines the type that identifies where a data packet is
|
|
||||||
* stored in the store. It comprises of a raw part to read it as raw value and
|
|
||||||
* a structured part to use it in pool-like stores.
|
|
||||||
*/
|
|
||||||
union store_address_t {
|
|
||||||
/**
|
|
||||||
* Default Constructor, initializing to INVALID_ADDRESS
|
|
||||||
*/
|
|
||||||
store_address_t():raw(0xFFFFFFFF){}
|
|
||||||
/**
|
|
||||||
* Constructor to create an address object using the raw address
|
|
||||||
*
|
|
||||||
* @param rawAddress
|
|
||||||
*/
|
|
||||||
store_address_t(uint32_t rawAddress):raw(rawAddress){}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor to create an address object using pool
|
|
||||||
* and packet indices
|
|
||||||
*
|
|
||||||
* @param poolIndex
|
|
||||||
* @param packetIndex
|
|
||||||
*/
|
|
||||||
store_address_t(uint16_t poolIndex, uint16_t packetIndex):
|
|
||||||
pool_index(poolIndex),packet_index(packetIndex){}
|
|
||||||
/**
|
|
||||||
* A structure with two elements to access the store address pool-like.
|
|
||||||
*/
|
|
||||||
struct {
|
|
||||||
/**
|
|
||||||
* The index in which pool the packet lies.
|
|
||||||
*/
|
|
||||||
uint16_t pool_index;
|
|
||||||
/**
|
|
||||||
* The position in the chosen pool.
|
|
||||||
*/
|
|
||||||
uint16_t packet_index;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* Alternative access to the raw value.
|
|
||||||
*/
|
|
||||||
uint32_t raw;
|
|
||||||
|
|
||||||
bool operator==(const store_address_t& other) const {
|
|
||||||
return raw == other.raw;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This class provides an interface for intermediate data storage.
|
* @brief This class provides an interface for intermediate data storage.
|
||||||
* @details The Storage manager classes shall be used to store larger chunks of
|
* @details The Storage manager classes shall be used to store larger chunks of
|
||||||
|
54
storagemanager/storeAddress.h
Normal file
54
storagemanager/storeAddress.h
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#ifndef FRAMEWORK_STORAGEMANAGER_STOREADDRESS_H_
|
||||||
|
#define FRAMEWORK_STORAGEMANAGER_STOREADDRESS_H_
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This union defines the type that identifies where a data packet is
|
||||||
|
* stored in the store. It comprises of a raw part to read it as raw value and
|
||||||
|
* a structured part to use it in pool-like stores.
|
||||||
|
*/
|
||||||
|
union store_address_t {
|
||||||
|
/**
|
||||||
|
* Default Constructor, initializing to INVALID_ADDRESS
|
||||||
|
*/
|
||||||
|
store_address_t():raw(0xFFFFFFFF){}
|
||||||
|
/**
|
||||||
|
* Constructor to create an address object using the raw address
|
||||||
|
*
|
||||||
|
* @param rawAddress
|
||||||
|
*/
|
||||||
|
store_address_t(uint32_t rawAddress):raw(rawAddress){}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor to create an address object using pool
|
||||||
|
* and packet indices
|
||||||
|
*
|
||||||
|
* @param poolIndex
|
||||||
|
* @param packetIndex
|
||||||
|
*/
|
||||||
|
store_address_t(uint16_t poolIndex, uint16_t packetIndex):
|
||||||
|
pool_index(poolIndex),packet_index(packetIndex){}
|
||||||
|
/**
|
||||||
|
* A structure with two elements to access the store address pool-like.
|
||||||
|
*/
|
||||||
|
struct {
|
||||||
|
/**
|
||||||
|
* The index in which pool the packet lies.
|
||||||
|
*/
|
||||||
|
uint16_t pool_index;
|
||||||
|
/**
|
||||||
|
* The position in the chosen pool.
|
||||||
|
*/
|
||||||
|
uint16_t packet_index;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Alternative access to the raw value.
|
||||||
|
*/
|
||||||
|
uint32_t raw;
|
||||||
|
|
||||||
|
bool operator==(const store_address_t& other) const {
|
||||||
|
return raw == other.raw;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* FRAMEWORK_STORAGEMANAGER_STOREADDRESS_H_ */
|
Loading…
Reference in New Issue
Block a user