mohr_serialize_merged_master #123

Closed
muellerr wants to merge 84 commits from mohr_serialize_merged_master into mohr_serialize
3 changed files with 20 additions and 22 deletions
Showing only changes of commit 3ebc257968 - Show all commits

View File

@ -1,14 +1,11 @@
#ifndef FRAMEWORK_STORAGEMANAGER_LOCALPOOL_H_
#define FRAMEWORK_STORAGEMANAGER_LOCALPOOL_H_
/** /**
* @file LocalPool * @file LocalPool
*
* @date 02.02.2012 * @date 02.02.2012
* @author Bastian Baetz * @author Bastian Baetz
*
* @brief This file contains the definition of the LocalPool class. * @brief This file contains the definition of the LocalPool class.
*/ */
#ifndef FRAMEWORK_STORAGEMANAGER_LOCALPOOL_H_
#define FRAMEWORK_STORAGEMANAGER_LOCALPOOL_H_
#include <framework/objectmanager/SystemObject.h> #include <framework/objectmanager/SystemObject.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h> #include <framework/serviceinterface/ServiceInterfaceStream.h>
@ -20,7 +17,7 @@
/** /**
* @brief The LocalPool class provides an intermediate data storage with * @brief The LocalPool class provides an intermediate data storage with
* a fixed pool size policy. * a fixed pool size policy.
* \details The class implements the StorageManagerIF interface. While the * @details The class implements the StorageManagerIF interface. While the
* total number of pools is fixed, the element sizes in one pool and * total number of pools is fixed, the element sizes in one pool and
* the number of pool elements per pool are set on construction. * the number of pool elements per pool are set on construction.
* The full amount of memory is allocated on construction. * The full amount of memory is allocated on construction.
@ -31,7 +28,6 @@
* It is possible to store empty packets in the pool. * It is possible to store empty packets in the pool.
* The local pool is NOT thread-safe. * The local pool is NOT thread-safe.
*/ */
template<uint8_t NUMBER_OF_POOLS = 5> template<uint8_t NUMBER_OF_POOLS = 5>
class LocalPool: public SystemObject, public StorageManagerIF { class LocalPool: public SystemObject, public StorageManagerIF {
public: public:
@ -55,9 +51,10 @@ public:
* number of elements for each pool is determined. * number of elements for each pool is determined.
* The position of these values correspond to those in * The position of these values correspond to those in
* element_sizes. * element_sizes.
* @param registered Register the pool in object manager or not. Default is false (local pool). * @param registered Register the pool in object manager or not.
* @param spillsToHigherPools * Default is false (local pool).
* A variable to determine whether higher n pools are used if the store is full. * @param spillsToHigherPools A variable to determine whether
* higher n pools are used if the store is full.
*/ */
LocalPool(object_id_t setObjectId, LocalPool(object_id_t setObjectId,
const uint16_t element_sizes[NUMBER_OF_POOLS], const uint16_t element_sizes[NUMBER_OF_POOLS],
@ -117,7 +114,7 @@ private:
/** /**
* @brief store represents the actual memory pool. * @brief store represents the actual memory pool.
* @details It is an array of pointers to memory, which was allocated with * @details It is an array of pointers to memory, which was allocated with
* a \c new call on construction. * a @c new call on construction.
*/ */
uint8_t* store[NUMBER_OF_POOLS]; uint8_t* store[NUMBER_OF_POOLS];
/** /**

View File

@ -15,17 +15,17 @@
template <uint8_t NUMBER_OF_POOLS = 5> template <uint8_t NUMBER_OF_POOLS = 5>
class PoolManager : public LocalPool<NUMBER_OF_POOLS> { class PoolManager : public LocalPool<NUMBER_OF_POOLS> {
public: public:
PoolManager( object_id_t setObjectId, const uint16_t element_sizes[NUMBER_OF_POOLS], PoolManager(object_id_t setObjectId,
const uint16_t n_elements[NUMBER_OF_POOLS] ); const uint16_t element_sizes[NUMBER_OF_POOLS],
/** const uint16_t n_elements[NUMBER_OF_POOLS]);
* @brief In the PoolManager's destructor all allocated memory is freed.
*/ //! @brief In the PoolManager's destructor all allocated memory is freed.
virtual ~PoolManager(); virtual ~PoolManager();
//! @brief LocalPool overrides for thread-safety.
ReturnValue_t deleteData(store_address_t) override; ReturnValue_t deleteData(store_address_t) override;
ReturnValue_t deleteData(uint8_t* buffer, size_t size, ReturnValue_t deleteData(uint8_t* buffer, size_t size,
store_address_t* storeId = NULL) override; store_address_t* storeId = NULL) override;
ReturnValue_t modifyData(store_address_t packet_id, uint8_t** packet_ptr, ReturnValue_t modifyData(store_address_t packet_id, uint8_t** packet_ptr,
size_t* size) override; size_t* size) override;
protected: protected:

View File

@ -6,8 +6,9 @@
#include <stddef.h> #include <stddef.h>
/** /**
* This union defines the type that identifies where a data packet is * @brief 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 * stored in the store.
* It consists of a raw part to read it as raw value and
* a structured part to use it in pool-like stores. * a structured part to use it in pool-like stores.
*/ */
union store_address_t { union store_address_t {
@ -15,9 +16,9 @@ union store_address_t {
* Default Constructor, initializing to INVALID_ADDRESS * Default Constructor, initializing to INVALID_ADDRESS
*/ */
store_address_t():raw(0xFFFFFFFF){} store_address_t():raw(0xFFFFFFFF){}
/** /**
* Constructor to create an address object using the raw address * Constructor to create an address object using the raw address
*
* @param rawAddress * @param rawAddress
*/ */
store_address_t(uint32_t rawAddress):raw(rawAddress){} store_address_t(uint32_t rawAddress):raw(rawAddress){}
@ -30,7 +31,8 @@ union store_address_t {
* @param packetIndex * @param packetIndex
*/ */
store_address_t(uint16_t poolIndex, uint16_t packetIndex): store_address_t(uint16_t poolIndex, uint16_t packetIndex):
pool_index(poolIndex),packet_index(packetIndex){} pool_index(poolIndex),packet_index(packetIndex) {}
/** /**
* A structure with two elements to access the store address pool-like. * A structure with two elements to access the store address pool-like.
*/ */
@ -154,7 +156,6 @@ public:
* Use with care! * Use with care!
*/ */
virtual void clearStore() = 0; virtual void clearStore() = 0;
}; };
#endif /* STORAGEMANAGERIF_H_ */ #endif /* STORAGEMANAGERIF_H_ */