reverted some naming changes

This commit is contained in:
Robin Müller 2020-04-07 22:16:43 +02:00
parent c88c6c2a45
commit 30ed08005f
3 changed files with 33 additions and 32 deletions

View File

@ -42,7 +42,8 @@ private:
/**
* \brief This is the actual data pool itself.
* \details It is represented by a map
* with the data pool id as index and a pointer to a single PoolEntry as value.
* with the data pool id as index and a pointer to a single
* PoolEntry as value.
*/
std::map<uint32_t, PoolEntryIF*> data_pool;
public:

View File

@ -5,19 +5,19 @@
template<typename count_t>
SerialBufferAdapter<count_t>::SerialBufferAdapter(const void* buffer,
count_t bufferLength, bool serializeLength) :
m_serialize_length(serializeLength),
m_const_buffer(static_cast<const uint8_t *>(buffer)), m_buffer(nullptr),
m_buffer_length(bufferLength) {
serializeLength(serializeLength),
constBuffer(static_cast<const uint8_t *>(buffer)), m_buffer(nullptr),
bufferLength(bufferLength) {
}
template<typename count_t>
SerialBufferAdapter<count_t>::SerialBufferAdapter(void* buffer, count_t bufferLength,
bool serializeLength) :
m_serialize_length(serializeLength), m_buffer_length(bufferLength) {
serializeLength(serializeLength), bufferLength(bufferLength) {
uint8_t * member_buffer = static_cast<uint8_t *>(buffer);
m_buffer = member_buffer;
m_const_buffer = member_buffer;
constBuffer = member_buffer;
}
@ -28,37 +28,37 @@ SerialBufferAdapter<count_t>::~SerialBufferAdapter() {
template<typename count_t>
ReturnValue_t SerialBufferAdapter<count_t>::serialize(uint8_t** buffer, size_t* size,
const size_t max_size, bool bigEndian) const {
uint32_t serializedLength = m_buffer_length;
if (m_serialize_length) {
uint32_t serializedLength = bufferLength;
if (serializeLength) {
serializedLength += AutoSerializeAdapter::getSerializedSize(
&m_buffer_length);
&bufferLength);
}
if (*size + serializedLength > max_size) {
return BUFFER_TOO_SHORT;
} else {
if (m_serialize_length) {
AutoSerializeAdapter::serialize(&m_buffer_length, buffer, size,
if (serializeLength) {
AutoSerializeAdapter::serialize(&bufferLength, buffer, size,
max_size, bigEndian);
}
if (m_const_buffer != nullptr) {
memcpy(*buffer, m_const_buffer, m_buffer_length);
if (constBuffer != nullptr) {
memcpy(*buffer, constBuffer, bufferLength);
} else if (m_buffer != nullptr) {
memcpy(*buffer, m_buffer, m_buffer_length);
memcpy(*buffer, m_buffer, bufferLength);
} else {
return HasReturnvaluesIF::RETURN_FAILED;
}
*size += m_buffer_length;
(*buffer) += m_buffer_length;
*size += bufferLength;
(*buffer) += bufferLength;
return HasReturnvaluesIF::RETURN_OK;
}
}
template<typename count_t>
size_t SerialBufferAdapter<count_t>::getSerializedSize() const {
if (m_serialize_length) {
return m_buffer_length + AutoSerializeAdapter::getSerializedSize(&m_buffer_length);
if (serializeLength) {
return bufferLength + AutoSerializeAdapter::getSerializedSize(&bufferLength);
} else {
return m_buffer_length;
return bufferLength;
}
}
template<typename count_t>
@ -66,15 +66,15 @@ ReturnValue_t SerialBufferAdapter<count_t>::deSerialize(const uint8_t** buffer,
ssize_t* size, bool bigEndian) {
//TODO Ignores Endian flag!
if (buffer != NULL) {
if(m_serialize_length){
if(serializeLength){
// Suggestion (would require removing rest of the block inside this if clause !):
//ReturnValue_t result = AutoSerializeAdapter::deSerialize(&bufferLength,buffer,size,bigEndian);
//if (result != HasReturnvaluesIF::RETURN_OK) {
// return result;
//}
count_t serializedSize = AutoSerializeAdapter::getSerializedSize(
&m_buffer_length);
if((*size - m_buffer_length - serializedSize) >= 0){
&bufferLength);
if((*size - bufferLength - serializedSize) >= 0){
*buffer += serializedSize;
*size -= serializedSize;
}else{
@ -82,10 +82,10 @@ ReturnValue_t SerialBufferAdapter<count_t>::deSerialize(const uint8_t** buffer,
}
}
//No Else If, go on with buffer
if (*size - m_buffer_length >= 0) {
*size -= m_buffer_length;
memcpy(m_buffer, *buffer, m_buffer_length);
(*buffer) += m_buffer_length;
if (*size - bufferLength >= 0) {
*size -= bufferLength;
memcpy(m_buffer, *buffer, bufferLength);
(*buffer) += bufferLength;
return HasReturnvaluesIF::RETURN_OK;
} else {
return STREAM_TOO_SHORT;
@ -106,17 +106,17 @@ uint8_t * SerialBufferAdapter<count_t>::getBuffer() {
template<typename count_t>
const uint8_t * SerialBufferAdapter<count_t>::getConstBuffer() {
if(m_const_buffer == nullptr) {
if(constBuffer == nullptr) {
error << "Wrong access function for stored type ! Use getBuffer()" << std::endl;
return nullptr;
}
return m_const_buffer;
return constBuffer;
}
template<typename count_t>
void SerialBufferAdapter<count_t>::setBuffer(void * buffer, count_t buffer_length) {
m_buffer = static_cast<uint8_t *>(buffer);
m_buffer_length = buffer_length;
bufferLength = buffer_length;
}

View File

@ -52,10 +52,10 @@ public:
const uint8_t * getConstBuffer();
void setBuffer(void* buffer_, count_t bufferLength_);
private:
bool m_serialize_length = false;
const uint8_t *m_const_buffer = nullptr;
bool serializeLength = false;
const uint8_t *constBuffer = nullptr;
uint8_t *m_buffer = nullptr;
count_t m_buffer_length = 0;
count_t bufferLength = 0;
};