.idea
automation
cmake
contrib
docs
misc
scripts
src
unittests
action
cfdp
container
datapoollocal
devicehandler
globalfunctions
hal
internalerror
mocks
cfdp
AcceptsTcMock.cpp
AcceptsTcMock.h
AcceptsTmMock.cpp
AcceptsTmMock.h
CMakeLists.txt
CcsdsCheckerMock.cpp
CcsdsCheckerMock.h
CdsShortTimestamperMock.h
ComIFMock.cpp
ComIFMock.h
CookieIFMock.cpp
CookieIFMock.h
DeviceFdirMock.cpp
DeviceFdirMock.h
DeviceHandlerMock.cpp
DeviceHandlerMock.h
EventReportingProxyMock.cpp
EventReportingProxyMock.h
FilesystemMock.cpp
FilesystemMock.h
HkReceiverMock.h
InternalErrorReporterMock.cpp
InternalErrorReporterMock.h
LocalPoolOwnerBase.cpp
LocalPoolOwnerBase.h
MessageQueueMock.cpp
MessageQueueMock.h
PeriodicTaskIFMock.h
PowerSwitcherMock.cpp
PowerSwitcherMock.h
PusDistributorMock.cpp
PusDistributorMock.h
PusServiceBaseMock.cpp
PusServiceBaseMock.h
PusVerificationReporterMock.cpp
PusVerificationReporterMock.h
SimpleSerializable.h
StorageManagerMock.cpp
StorageManagerMock.h
osal
power
pus
serialize
storagemanager
tcdistributor
testcfg
testtemplate
timemanager
tmtcpacket
tmtcservices
util
CMakeLists.txt
CatchDefinitions.cpp
CatchDefinitions.h
CatchFactory.cpp
CatchFactory.h
CatchRunner.cpp
CatchRunner.h
CatchSetup.cpp
lcov_epilog.html
printChar.cpp
printChar.h
testVersion.cpp
.clang-format
.gitignore
.gitmodules
CHANGELOG.md
CMakeLists.txt
FSFWVersion.h.in
LICENSE
NOTICE
README.md
41 lines
1.2 KiB
C++
41 lines
1.2 KiB
C++
#ifndef FSFW_TESTS_SIMPLESERIALIZABLE_H
|
|
#define FSFW_TESTS_SIMPLESERIALIZABLE_H
|
|
|
|
#include "fsfw/osal/Endiness.h"
|
|
#include "fsfw/serialize.h"
|
|
|
|
class SimpleSerializable : public SerializeIF {
|
|
public:
|
|
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
|
Endianness streamEndianness) const override {
|
|
if (*size + getSerializedSize() > maxSize) {
|
|
return SerializeIF::BUFFER_TOO_SHORT;
|
|
}
|
|
**buffer = someU8;
|
|
*buffer += 1;
|
|
*size += 1;
|
|
return SerializeAdapter::serialize(&someU16, buffer, size, maxSize, streamEndianness);
|
|
}
|
|
|
|
[[nodiscard]] size_t getSerializedSize() const override { return 3; }
|
|
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
|
|
Endianness streamEndianness) override {
|
|
if (*size < getSerializedSize()) {
|
|
return SerializeIF::STREAM_TOO_SHORT;
|
|
}
|
|
someU8 = **buffer;
|
|
*size -= 1;
|
|
*buffer += 1;
|
|
return SerializeAdapter::deSerialize(&someU16, buffer, size, streamEndianness);
|
|
}
|
|
|
|
[[nodiscard]] uint8_t getU8() const { return someU8; }
|
|
[[nodiscard]] uint16_t getU16() const { return someU16; }
|
|
|
|
private:
|
|
uint8_t someU8 = 1;
|
|
uint16_t someU16 = 0x0203;
|
|
};
|
|
|
|
#endif // FSFW_TESTS_SIMPLESERIALIZABLE_H
|