fsfw/unittests/cfdp/handler/OwnedPduPacket.h

31 lines
882 B
C++

#pragma once
#include <optional>
#include <vector>
#include "fsfw/cfdp/definitions.h"
#include "fsfw/cfdp/handler/PduPacketIF.h"
namespace cfdp {
class OwnedPduPacket : public PduPacketIF {
public:
OwnedPduPacket(PduType pduType, std::optional<FileDirective> fileDirective, const uint8_t* rawPdu,
size_t pduLen)
: pduType(pduType), fileDirective(fileDirective), rawPdu(rawPdu, rawPdu + pduLen) {}
[[nodiscard]] cfdp::PduType getPduType() const override { return pduType; };
[[nodiscard]] std::optional<cfdp::FileDirective> getFileDirective() const override {
return fileDirective;
};
[[nodiscard]] const uint8_t* getRawPduData(size_t& pduLen) const override {
pduLen = rawPdu.size();
return rawPdu.data();
}
PduType pduType;
std::optional<FileDirective> fileDirective;
std::vector<uint8_t> rawPdu;
};
} // namespace cfdp