diff --git a/datapool/PoolRawAccess.cpp b/datapool/PoolRawAccess.cpp index 899eedd6..ff8fb956 100644 --- a/datapool/PoolRawAccess.cpp +++ b/datapool/PoolRawAccess.cpp @@ -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)) { diff --git a/datapool/PoolRawAccess.h b/datapool/PoolRawAccess.h index 5fb482f0..52ba8b21 100644 --- a/datapool/PoolRawAccess.h +++ b/datapool/PoolRawAccess.h @@ -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