some adaptions
This commit is contained in:
parent
c3f9d6e6b0
commit
5a3946a267
@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
PoolDataSetBase::PoolDataSetBase(PoolVariableIF** registeredVariablesArray,
|
PoolDataSetBase::PoolDataSetBase(PoolVariableIF** registeredVariablesArray,
|
||||||
const size_t maxFillCount, bool serializeWithValidityBlob)
|
const size_t maxFillCount, bool serializeWithValidityBlob)
|
||||||
: registeredVariables(registeredVariablesArray),
|
: serializeWithValidityBlob(serializeWithValidityBlob),
|
||||||
maxFillCount(maxFillCount),
|
registeredVariables(registeredVariablesArray),
|
||||||
serializeWithValidityBlob(serializeWithValidityBlob) {}
|
maxFillCount(maxFillCount) {}
|
||||||
|
|
||||||
PoolDataSetBase::~PoolDataSetBase() = default;
|
PoolDataSetBase::~PoolDataSetBase() = default;
|
||||||
|
|
||||||
|
@ -139,6 +139,8 @@ class PoolDataSetBase : public PoolDataSetIF, public SerializeIF {
|
|||||||
*/
|
*/
|
||||||
void setChildrenValidity(bool valid);
|
void setChildrenValidity(bool valid);
|
||||||
|
|
||||||
|
bool serializeWithValidityBlob = false;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief The fill_count attribute ensures that the variables
|
* @brief The fill_count attribute ensures that the variables
|
||||||
@ -166,7 +168,6 @@ class PoolDataSetBase : public PoolDataSetIF, public SerializeIF {
|
|||||||
*/
|
*/
|
||||||
PoolVariableIF** registeredVariables = nullptr;
|
PoolVariableIF** registeredVariables = nullptr;
|
||||||
const size_t maxFillCount = 0;
|
const size_t maxFillCount = 0;
|
||||||
bool serializeWithValidityBlob = false;
|
|
||||||
|
|
||||||
void setContainer(PoolVariableIF** variablesContainer);
|
void setContainer(PoolVariableIF** variablesContainer);
|
||||||
PoolVariableIF** getContainer() const;
|
PoolVariableIF** getContainer() const;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
using namespace dp;
|
using namespace dp;
|
||||||
|
|
||||||
SharedSet::SharedSet(dp::SharedPool& sharedPool, uint32_t setId, const size_t maxNumberOfVariables,
|
SharedSet::SharedSet(dp::SharedPool& sharedPool, uint32_t setId, const size_t maxNumberOfVariables,
|
||||||
bool serializeWithValídityBlob)
|
bool serializeWithValidityBlob)
|
||||||
: SharedSetBase(sharedPool, setId, nullptr, maxNumberOfVariables, serializeWithValidityBlob),
|
: SharedSetBase(sharedPool, setId, nullptr, maxNumberOfVariables, serializeWithValidityBlob),
|
||||||
poolVarList(maxNumberOfVariables) {
|
poolVarList(maxNumberOfVariables) {
|
||||||
this->setContainer(poolVarList.data());
|
this->setContainer(poolVarList.data());
|
||||||
|
@ -105,9 +105,6 @@ ReturnValue_t SharedSetBase::deSerialize(const uint8_t **buffer, size_t *size,
|
|||||||
|
|
||||||
ReturnValue_t SharedSetBase::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
ReturnValue_t SharedSetBase::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
||||||
SerializeIF::Endianness streamEndianness) const {
|
SerializeIF::Endianness streamEndianness) const {
|
||||||
if (serializeWithValidityBlob) {
|
|
||||||
return base.doSerializeWithValidityBlob(buffer, size, maxSize, streamEndianness);
|
|
||||||
}
|
|
||||||
return base.serialize(buffer, size, maxSize, streamEndianness);
|
return base.serialize(buffer, size, maxSize, streamEndianness);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,3 +162,8 @@ void SharedSetBase::setContainer(PoolVariableIF **variablesContainer) {
|
|||||||
return base.setContainer(variablesContainer);
|
return base.setContainer(variablesContainer);
|
||||||
}
|
}
|
||||||
PoolVariableIF **SharedSetBase::getContainer() const { return base.getContainer(); }
|
PoolVariableIF **SharedSetBase::getContainer() const { return base.getContainer(); }
|
||||||
|
|
||||||
|
void SharedSetBase::updateValidityBlobSerialization(bool enable) {
|
||||||
|
base.serializeWithValidityBlob = enable;
|
||||||
|
}
|
||||||
|
bool SharedSetBase::getValidityBlobSerialization() const { return base.serializeWithValidityBlob; }
|
||||||
|
@ -159,11 +159,8 @@ class SharedSetBase : public SerializeIF, public PoolDataSetIF {
|
|||||||
*/
|
*/
|
||||||
void setChildrenValidity(bool valid);
|
void setChildrenValidity(bool valid);
|
||||||
|
|
||||||
/**
|
void updateValidityBlobSerialization(bool enable);
|
||||||
* If the valid state of a dataset is always relevant to the whole
|
bool getValidityBlobSerialization() const;
|
||||||
* data set we can use this flag.
|
|
||||||
*/
|
|
||||||
bool serializeWithValidityBlob = false;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PoolDataSetBase base;
|
PoolDataSetBase base;
|
||||||
|
@ -62,6 +62,7 @@ TEST_CASE("Pool Dataset Test", "[datapool]") {
|
|||||||
size_t serLen = 0;
|
size_t serLen = 0;
|
||||||
uint8_t* dataPtr = buf;
|
uint8_t* dataPtr = buf;
|
||||||
dataset.serializeWithValidityBlob = true;
|
dataset.serializeWithValidityBlob = true;
|
||||||
|
CHECK(dataset.getSerializedSize() == 6);
|
||||||
CHECK(dataset.serialize(&dataPtr, &serLen, sizeof(buf), SerializeIF::Endianness::NETWORK) ==
|
CHECK(dataset.serialize(&dataPtr, &serLen, sizeof(buf), SerializeIF::Endianness::NETWORK) ==
|
||||||
returnvalue::OK);
|
returnvalue::OK);
|
||||||
CHECK(buf[5] == 0b11000000);
|
CHECK(buf[5] == 0b11000000);
|
||||||
@ -70,7 +71,7 @@ TEST_CASE("Pool Dataset Test", "[datapool]") {
|
|||||||
SECTION("Larger Pool Dataset Serialization With Validity") {
|
SECTION("Larger Pool Dataset Serialization With Validity") {
|
||||||
uint8_t buf[64]{};
|
uint8_t buf[64]{};
|
||||||
TestDatasetLarger datasetLarge;
|
TestDatasetLarger datasetLarge;
|
||||||
datasetLarge.setAllChildrenValidity(true);
|
datasetLarge.setChildrenValidity(true);
|
||||||
size_t serLen = 0;
|
size_t serLen = 0;
|
||||||
uint8_t* dataPtr = buf;
|
uint8_t* dataPtr = buf;
|
||||||
datasetLarge.serializeWithValidityBlob = true;
|
datasetLarge.serializeWithValidityBlob = true;
|
||||||
|
@ -23,6 +23,7 @@ TEST_CASE("DataSetTest", "[datapool]") {
|
|||||||
SECTION("BasicTest") {
|
SECTION("BasicTest") {
|
||||||
/* Test some basic functions */
|
/* Test some basic functions */
|
||||||
CHECK(localSet.getReportingEnabled() == false);
|
CHECK(localSet.getReportingEnabled() == false);
|
||||||
|
CHECK(localSet.getSerializedSize() == 11);
|
||||||
CHECK(localSet.getLocalPoolIdsSerializedSize() == 3 * sizeof(dp::id_t));
|
CHECK(localSet.getLocalPoolIdsSerializedSize() == 3 * sizeof(dp::id_t));
|
||||||
CHECK(localSet.getStructureId() == lpool::testSid1);
|
CHECK(localSet.getStructureId() == lpool::testSid1);
|
||||||
CHECK(localSet.getCreatorObjectId() == objects::TEST_LOCAL_POOL_OWNER_BASE);
|
CHECK(localSet.getCreatorObjectId() == objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||||
@ -156,7 +157,7 @@ TEST_CASE("DataSetTest", "[datapool]") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SECTION("Serialize with Validity Blob") {
|
SECTION("Serialize with Validity Blob") {
|
||||||
localSet.serializeWithValidityBlob = true;
|
localSet.updateValidityBlobSerialization(true);
|
||||||
CHECK(!localSet.localPoolVarUint8.isValid());
|
CHECK(!localSet.localPoolVarUint8.isValid());
|
||||||
CHECK(!localSet.localPoolUint16Vec.isValid());
|
CHECK(!localSet.localPoolUint16Vec.isValid());
|
||||||
CHECK(!localSet.localPoolVarFloat.isValid());
|
CHECK(!localSet.localPoolVarFloat.isValid());
|
||||||
@ -168,6 +169,7 @@ TEST_CASE("DataSetTest", "[datapool]") {
|
|||||||
// Already reserve additional space for validity buffer, will be needed later
|
// Already reserve additional space for validity buffer, will be needed later
|
||||||
uint8_t buffer[128]{};
|
uint8_t buffer[128]{};
|
||||||
uint8_t* buffPtr = buffer;
|
uint8_t* buffPtr = buffer;
|
||||||
|
CHECK(localSet.getSerializedSize() == 12);
|
||||||
CHECK(localSet.serialize(&buffPtr, &serSize, sizeof(buffer),
|
CHECK(localSet.serialize(&buffPtr, &serSize, sizeof(buffer),
|
||||||
SerializeIF::Endianness::MACHINE) == returnvalue::OK);
|
SerializeIF::Endianness::MACHINE) == returnvalue::OK);
|
||||||
CHECK(serSize == 12);
|
CHECK(serSize == 12);
|
||||||
|
Loading…
Reference in New Issue
Block a user