WIP: somethings wrong.. #19

Closed
muellerr wants to merge 808 commits from source/master into master
6 changed files with 51 additions and 13 deletions
Showing only changes of commit d99ed47150 - Show all commits

View File

@ -6,7 +6,9 @@
#include <utility>
/**
* \ingroup container
* @brief Implementation of a fixed map using an array list
* @details Initialize with desired fixed size
* @ingroup container
*/
template<typename key_t, typename T>
class FixedMap: public SerializeIF {
@ -56,6 +58,13 @@ public:
return &ArrayList<std::pair<key_t, T>, uint32_t>::Iterator::value->second;
}
key_t first() {
return ArrayList<std::pair<key_t, T>, uint32_t>::Iterator::value->first;
}
T second() {
return ArrayList<std::pair<key_t, T>, uint32_t>::Iterator::value->second;
}
};
Iterator begin() const {
@ -87,7 +96,7 @@ public:
}
ReturnValue_t insert(std::pair<key_t, T> pair) {
return insert(pair.fist, pair.second);
return insert(pair.first, pair.second);
}
ReturnValue_t exists(key_t key) const {

View File

@ -31,7 +31,7 @@ private:
*/
Type type;
/**
* \brief This value contains the size of the data pool entry in bytes.
* \brief This value contains the size of the data pool entry type in bytes.
*/
uint8_t typeSize;
/**
@ -48,15 +48,7 @@ private:
ReadWriteMode_t readWriteMode;
static const uint8_t RAW_MAX_SIZE = sizeof(double);
protected:
/**
* \brief This is a call to read the value from the global data pool.
* \details When executed, this operation tries to fetch the pool entry with matching
* data pool id from the global data pool and copies the value and the valid
* information to its local attributes. In case of a failure (wrong type or
* pool id not found), the variable is set to zero and invalid.
* The operation does NOT provide any mutual exclusive protection by itself.
*/
ReturnValue_t read();
/**
* \brief The commit call writes back the variable's value to the data pool.
* \details It checks type and size, as well as if the variable is writable. If so,
@ -66,6 +58,7 @@ protected:
*/
ReturnValue_t commit();
public:
static const uint8_t INTERFACE_ID = CLASS_ID::POOL_RAW_ACCESS_CLASS;
static const ReturnValue_t INCORRECT_SIZE = MAKE_RETURN_CODE(0x01);
static const ReturnValue_t DATA_POOL_ACCESS_FAILED = MAKE_RETURN_CODE(0x02);
@ -78,6 +71,15 @@ public:
* discarded and not written back to the data pool.
*/
~PoolRawAccess();
/**
* \brief This is a call to read the value from the global data pool.
* \details When executed, this operation tries to fetch the pool entry with matching
* data pool id from the global data pool and copies the value and the valid
* information to its local attributes. In case of a failure (wrong type or
* pool id not found), the variable is set to zero and invalid.
* The operation does NOT provide any mutual exclusive protection by itself.
*/
ReturnValue_t read();
/**
* \brief This operation returns a pointer to the entry fetched.
* \details Return pointer to the buffer containing the raw data

View File

@ -46,7 +46,6 @@ public:
* @param startAtIndex
* @return
*/
// shouldnt startAtIndex be uint8?
virtual ReturnValue_t getParameter(uint8_t domainId, uint16_t parameterId,
ParameterWrapper *parameterWrapper,
const ParameterWrapper *newValues, uint16_t startAtIndex) = 0;

View File

@ -27,6 +27,7 @@ public:
static ReturnValue_t serialize(const ArrayList<T, count_t>* list, uint8_t** buffer, uint32_t* size,
const uint32_t max_size, bool bigEndian) {
// Serialize length field first
ReturnValue_t result = SerializeAdapter<count_t>::serialize(&list->size,
buffer, size, max_size, bigEndian);
count_t i = 0;

View File

@ -24,10 +24,12 @@ public:
template<typename... Args>
SerialFixedArrayListAdapter(Args... args) : FixedArrayList<T, MAX_SIZE, count_t>(std::forward<Args>(args)...) {
}
ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
const uint32_t max_size, bool bigEndian) const {
return SerialArrayListAdapter<T, count_t>::serialize(this, buffer, size, max_size, bigEndian);
}
uint32_t getSerializedSize() const {
return SerialArrayListAdapter<T, count_t>::getSerializedSize(this);
}

View File

@ -159,6 +159,15 @@ public:
* @brief In the LocalPool's destructor all allocated memory is freed.
*/
virtual ~LocalPool(void);
/**
* Add data to local data pool, performs range check
* @param storageId [out] Store ID in which the data will be stored
* @param data
* @param size
* @param ignoreFault
* @return @c RETURN_OK if write was successful
*/
ReturnValue_t addData(store_address_t* storageId, const uint8_t * data,
uint32_t size, bool ignoreFault = false);
@ -171,8 +180,24 @@ public:
*/
ReturnValue_t getFreeElement(store_address_t* storageId,
const uint32_t size, uint8_t** p_data, bool ignoreFault = false);
/**
* Retrieve data from local pool
* @param packet_id
* @param packet_ptr
* @param size [out] Size of retrieved data
* @return @c RETURN_OK if data retrieval was successfull
*/
ReturnValue_t getData(store_address_t packet_id, const uint8_t** packet_ptr,
uint32_t* size);
/**
* Modify data by supplying a previously obtaind packet pointer
* @param packet_id Store ID of data to modify
* @param packet_ptr
* @param size [out] size of changed data
* @return
*/
ReturnValue_t modifyData(store_address_t packet_id, uint8_t** packet_ptr,
uint32_t* size);
virtual ReturnValue_t deleteData(store_address_t);