rename setBuffer to setConstBuffer
This commit is contained in:
@ -21,7 +21,7 @@ cfdp::Lv& cfdp::Lv::operator=(const Lv& other) {
|
||||
if (value == nullptr or otherSize == 0) {
|
||||
this->zeroLen = true;
|
||||
}
|
||||
this->value.setBuffer(value, otherSize);
|
||||
this->value.setConstBuffer(value, otherSize);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ ReturnValue_t cfdp::Lv::deSerialize(const uint8_t** buffer, size_t* size,
|
||||
}
|
||||
zeroLen = false;
|
||||
// Zero-copy implementation
|
||||
value.setBuffer(const_cast<uint8_t*>(*buffer + 1), lengthField);
|
||||
value.setConstBuffer(*buffer + 1, lengthField);
|
||||
*buffer += 1 + lengthField;
|
||||
*size -= 1 + lengthField;
|
||||
return returnvalue::OK;
|
||||
|
@ -75,7 +75,7 @@ ReturnValue_t cfdp::Tlv::deSerialize(const uint8_t **buffer, size_t *size,
|
||||
}
|
||||
zeroLen = false;
|
||||
// Zero-copy implementation
|
||||
value.setBuffer(const_cast<uint8_t *>(*buffer + 1), lengthField);
|
||||
value.setConstBuffer(*buffer + 1, lengthField);
|
||||
*buffer += 1 + lengthField;
|
||||
*size -= 1 + lengthField;
|
||||
return returnvalue::OK;
|
||||
@ -96,7 +96,7 @@ void cfdp::Tlv::setValue(uint8_t *value, size_t len) {
|
||||
if (len > 0) {
|
||||
zeroLen = false;
|
||||
}
|
||||
this->value.setBuffer(value, len);
|
||||
this->value.setConstBuffer(value, len);
|
||||
}
|
||||
|
||||
uint8_t cfdp::Tlv::getLengthField() const { return this->value.getSerializedSize() - 1; }
|
||||
|
@ -571,7 +571,7 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::getMapFilterFr
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
if(fromTimestamp > toTimestamp) {
|
||||
if (fromTimestamp > toTimestamp) {
|
||||
return INVALID_TIME_WINDOW;
|
||||
}
|
||||
itBegin = telecommandMap.begin();
|
||||
@ -580,7 +580,7 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::getMapFilterFr
|
||||
itBegin++;
|
||||
}
|
||||
|
||||
//start looking for end beginning at begin
|
||||
// start looking for end beginning at begin
|
||||
itEnd = itBegin;
|
||||
while (itEnd->first <= toTimestamp && itEnd != telecommandMap.end()) {
|
||||
itEnd++;
|
||||
|
@ -21,7 +21,7 @@ SerialBufferAdapter<count_t>::SerialBufferAdapter(uint8_t* buffer, count_t buffe
|
||||
bufferLength(bufferLength) {}
|
||||
|
||||
template <typename count_t>
|
||||
SerialBufferAdapter<count_t>::~SerialBufferAdapter() {}
|
||||
SerialBufferAdapter<count_t>::~SerialBufferAdapter() = default;
|
||||
|
||||
template <typename count_t>
|
||||
ReturnValue_t SerialBufferAdapter<count_t>::serialize(uint8_t** buffer, size_t* size,
|
||||
@ -119,10 +119,10 @@ const uint8_t* SerialBufferAdapter<count_t>::getConstBuffer() const {
|
||||
}
|
||||
|
||||
template <typename count_t>
|
||||
void SerialBufferAdapter<count_t>::setBuffer(uint8_t* buffer, count_t bufferLength) {
|
||||
this->buffer = buffer;
|
||||
this->constBuffer = buffer;
|
||||
this->bufferLength = bufferLength;
|
||||
void SerialBufferAdapter<count_t>::setConstBuffer(const uint8_t* buf, count_t bufLen) {
|
||||
this->buffer = nullptr;
|
||||
this->bufferLength = bufLen;
|
||||
this->constBuffer = buf;
|
||||
}
|
||||
|
||||
// forward Template declaration for linker
|
||||
|
@ -21,6 +21,7 @@
|
||||
template <typename count_t>
|
||||
class SerialBufferAdapter : public SerializeIF {
|
||||
public:
|
||||
SerialBufferAdapter() = default;
|
||||
/**
|
||||
* Constructor for constant uint8_t buffer. Length field can be serialized optionally.
|
||||
* Type of length can be supplied as template type.
|
||||
@ -40,12 +41,12 @@ class SerialBufferAdapter : public SerializeIF {
|
||||
*/
|
||||
SerialBufferAdapter(uint8_t* buffer, count_t bufferLength, bool serializeLength = false);
|
||||
|
||||
virtual ~SerialBufferAdapter();
|
||||
~SerialBufferAdapter() override;
|
||||
|
||||
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
||||
Endianness streamEndianness) const override;
|
||||
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
||||
Endianness streamEndianness) const override;
|
||||
|
||||
virtual size_t getSerializedSize() const override;
|
||||
[[nodiscard]] size_t getSerializedSize() const override;
|
||||
|
||||
/**
|
||||
* @brief This function deserializes a buffer into the member buffer.
|
||||
@ -59,12 +60,12 @@ class SerialBufferAdapter : public SerializeIF {
|
||||
* @param bigEndian
|
||||
* @return
|
||||
*/
|
||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||
Endianness streamEndianness) override;
|
||||
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||
Endianness streamEndianness) override;
|
||||
|
||||
uint8_t* getBuffer();
|
||||
const uint8_t* getConstBuffer() const;
|
||||
void setBuffer(uint8_t* buffer, count_t bufferLength);
|
||||
[[nodiscard]] const uint8_t* getConstBuffer() const;
|
||||
void setConstBuffer(const uint8_t* buf, count_t bufLen);
|
||||
|
||||
private:
|
||||
bool serializeLength = false;
|
||||
|
@ -17,7 +17,6 @@
|
||||
*/
|
||||
class SpacePacketParser {
|
||||
public:
|
||||
|
||||
struct FoundPacketInfo {
|
||||
size_t startIdx = 0;
|
||||
size_t sizeFound = 0;
|
||||
@ -51,9 +50,7 @@ class SpacePacketParser {
|
||||
ReturnValue_t parseSpacePackets(const uint8_t** buffer, const size_t maxSize,
|
||||
FoundPacketInfo& packetInfo);
|
||||
|
||||
size_t getAmountRead() {
|
||||
return amountRead;
|
||||
}
|
||||
size_t getAmountRead() { return amountRead; }
|
||||
|
||||
void reset() {
|
||||
nextStartIdx = 0;
|
||||
|
Reference in New Issue
Block a user