Reverted changed pool raw access commit

This commit is contained in:
Robin Müller 2019-12-10 23:26:48 +01:00
parent 6abb3cc525
commit f7d8f0c161
2 changed files with 15 additions and 25 deletions

View File

@ -15,17 +15,14 @@ PoolRawAccess::PoolRawAccess(uint32_t set_id, uint8_t setArrayEntry,
}
if(registerVectors == true) {
this->read();
if(arraySize > 1) {
for(uint16_t vectorCount = typeSize;vectorCount < arraySize;vectorCount += typeSize)
{
PoolRawAccess * newPoolRawAccess =
new PoolRawAccess(set_id, setArrayEntry + typeSize,
data_set,setReadWriteMode,true);
if(newPoolRawAccess) {};
}
if(arrayEntry < arraySize - 1) {
uint8_t nextArrayEntry = arrayEntry + 1;
PoolRawAccess * newPoolRawAccess =
new PoolRawAccess(set_id, nextArrayEntry,
data_set,setReadWriteMode,true);
if(newPoolRawAccess) {};
}
}
}
PoolRawAccess::~PoolRawAccess() {
@ -46,10 +43,6 @@ ReturnValue_t PoolRawAccess::read() {
uint8_t* ptr =
&((uint8_t*) read_out->getRawData())[arrayPosition];
memcpy(value, ptr, typeSize);
//for(uint8_t arrayCount = 0; arrayCount < arraySize; arrayCount++) {
// memcpy(value + typeSize * arrayCount, ptr + typeSize * arrayCount, typeSize);
//}
return HasReturnvaluesIF::RETURN_OK;
} else {
//Error value type too large.
@ -173,22 +166,14 @@ ReturnValue_t PoolRawAccess::serialize(uint8_t** buffer, uint32_t* size,
for (uint8_t count = 0; count < typeSize; count++) {
(*buffer)[count] = value[typeSize - count - 1];
}
//for(uint8_t arrayCount = 0; arrayCount < arraySize; arrayCount++) {
// for (uint8_t count = 0; count < typeSize; count++) {
// (*buffer)[typeSize * (arrayCount + 1) - count - 1] =
// value[typeSize * arrayCount + count];
// }
//}
#elif BYTE_ORDER_SYSTEM == BIG_ENDIAN
memcpy(*buffer, value, typeSize);
//memcpy(*buffer, value, typeSize * arraySize);
#endif
} else {
memcpy(*buffer, value, typeSize);
//memcpy(*buffer, value, typeSize * arraySize);
}
*size += typeSize;// * arraySize;
(*buffer) += typeSize;// * arraySize;
*size += typeSize;
(*buffer) += typeSize;
return HasReturnvaluesIF::RETURN_OK;
} else {
return SerializeIF::BUFFER_TOO_SHORT;

View File

@ -78,16 +78,21 @@ public:
static const ReturnValue_t INCORRECT_SIZE = MAKE_RETURN_CODE(0x01);
static const ReturnValue_t DATA_POOL_ACCESS_FAILED = MAKE_RETURN_CODE(0x02);
uint8_t value[RAW_MAX_SIZE];
//uint8_t value[RAW_MAX_SIZE*3];
/**
* This constructor is used to access a data pool entry with a
* given ID if the target type is not known. A DataSet object is supplied
* and the data pool entry with the given ID is registered to that data set
* and the data pool entry with the given ID is registered to that data set.
* Please note that a pool raw access buffer only has a buffer
* with a size of double. As such, for vector entries which have
* @param data_pool_id Target data pool entry ID
* @param arrayEntry
* @param data_set Dataset to register data pool entry to
* @param setReadWriteMode
* @param registerVectors If set to true, the constructor checks if
* there are multiple vector entries to registers
* and registers all of them recursively into the data_set
*
*/
PoolRawAccess(uint32_t data_pool_id, uint8_t arrayEntry,
DataSetIF* data_set, ReadWriteMode_t setReadWriteMode =