From d4abfacd27b09c17f898e80c62f969610a5d6367 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Fri, 22 May 2020 01:15:02 +0200 Subject: [PATCH] found solution for circ dependency had to put store_address_t in own file though --- storagemanager/StorageAccessor.cpp | 1 + storagemanager/StorageAccessor.h | 4 ++- storagemanager/StorageManagerIF.h | 56 ++---------------------------- storagemanager/storeAddress.h | 54 ++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 54 deletions(-) create mode 100644 storagemanager/storeAddress.h diff --git a/storagemanager/StorageAccessor.cpp b/storagemanager/StorageAccessor.cpp index cc292d6c..c0c8126b 100644 --- a/storagemanager/StorageAccessor.cpp +++ b/storagemanager/StorageAccessor.cpp @@ -1,4 +1,5 @@ #include +#include ConstStorageAccessor::ConstStorageAccessor(store_address_t storeId): storeId(storeId) {} diff --git a/storagemanager/StorageAccessor.h b/storagemanager/StorageAccessor.h index f6964b93..57c9369c 100644 --- a/storagemanager/StorageAccessor.h +++ b/storagemanager/StorageAccessor.h @@ -2,7 +2,9 @@ #define FRAMEWORK_STORAGEMANAGER_STORAGEACCESSOR_H_ #include -#include +#include + +class StorageManagerIF; /** * @brief Helper classes to facilitate safe access to storages which is also diff --git a/storagemanager/StorageManagerIF.h b/storagemanager/StorageManagerIF.h index 559c4b9a..af5aeb73 100644 --- a/storagemanager/StorageManagerIF.h +++ b/storagemanager/StorageManagerIF.h @@ -3,64 +3,14 @@ #include #include -#include +#include +#include #include - -class StorageAccessor; -class ConstStorageAccessor; +#include using AccessorPair = std::pair; using ConstAccessorPair = std::pair; -/** - * 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 diff --git a/storagemanager/storeAddress.h b/storagemanager/storeAddress.h new file mode 100644 index 00000000..5dd785a3 --- /dev/null +++ b/storagemanager/storeAddress.h @@ -0,0 +1,54 @@ +#ifndef FRAMEWORK_STORAGEMANAGER_STOREADDRESS_H_ +#define FRAMEWORK_STORAGEMANAGER_STOREADDRESS_H_ +#include + +/** + * 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_ */