Pool Raw Access change bugfix

This commit is contained in:
Robin Müller 2020-01-26 22:13:56 +01:00
parent d9fa13b6eb
commit 85048cc9ee
2 changed files with 23 additions and 15 deletions

View File

@ -21,24 +21,13 @@ ReturnValue_t PoolRawAccess::read() {
PoolEntryIF* read_out = ::dataPool.getRawData(dataPoolId);
if (read_out != NULL) {
result = handleReadOut(read_out);
if(result == RETURN_OK) {
return result;
}
} else {
result = READ_ENTRY_NON_EXISTENT;
}
error << "PoolRawAccess: read of DP Variable 0x" << std::hex << dataPoolId
<< std::dec << " failed, ";
if(result == READ_TYPE_TOO_LARGE) {
error << "type too large." << std::endl;
}
else if(result == READ_INDEX_TOO_LARGE) {
error << "index too large." << std::endl;
}
else {
error << "entry does not exist." << std::endl;
}
valid = INVALID;
typeSize = 0;
sizeTillEnd = 0;
memset(value, 0, sizeof(value));
handleReadError(result);
return result;
}
@ -65,6 +54,24 @@ ReturnValue_t PoolRawAccess::handleReadOut(PoolEntryIF* read_out) {
return result;
}
void PoolRawAccess::handleReadError(ReturnValue_t result) {
error << "PoolRawAccess: read of DP Variable 0x" << std::hex << dataPoolId
<< std::dec << " failed, ";
if(result == READ_TYPE_TOO_LARGE) {
error << "type too large." << std::endl;
}
else if(result == READ_INDEX_TOO_LARGE) {
error << "index too large." << std::endl;
}
else if(result == READ_ENTRY_NON_EXISTENT) {
error << "entry does not exist." << std::endl;
}
valid = INVALID;
typeSize = 0;
sizeTillEnd = 0;
memset(value, 0, sizeof(value));
}
ReturnValue_t PoolRawAccess::commit() {
PoolEntryIF* write_back = ::dataPool.getRawData(dataPoolId);
if ((write_back != NULL) && (readWriteMode != VAR_READ)) {

View File

@ -157,6 +157,7 @@ protected:
ReturnValue_t commit();
ReturnValue_t handleReadOut(PoolEntryIF* read_out);
void handleReadError(ReturnValue_t result);
private:
/**
* \brief To access the correct data pool entry on read and commit calls, the data pool id