found solution for circ dependency

had to put store_address_t in own file though
This commit is contained in:
Robin Müller 2020-05-22 01:15:02 +02:00
parent d2d1ef9a85
commit d4abfacd27
4 changed files with 61 additions and 54 deletions

View File

@ -1,4 +1,5 @@
#include <framework/storagemanager/StorageAccessor.h>
#include <framework/storagemanager/StorageManagerIF.h>
ConstStorageAccessor::ConstStorageAccessor(store_address_t storeId):
storeId(storeId) {}

View File

@ -2,7 +2,9 @@
#define FRAMEWORK_STORAGEMANAGER_STORAGEACCESSOR_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

View File

@ -3,64 +3,14 @@
#include <framework/events/Event.h>
#include <framework/returnvalues/HasReturnvaluesIF.h>
#include <cstddef>
#include <framework/storagemanager/StorageAccessor.h>
#include <framework/storagemanager/storeAddress.h>
#include <utility>
class StorageAccessor;
class ConstStorageAccessor;
#include <cstddef>
using AccessorPair = std::pair<ReturnValue_t, StorageAccessor>;
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.
* @details The Storage manager classes shall be used to store larger chunks of

View 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_ */