10 #include <boost/optional.hpp> 14 namespace uhd {
namespace utils {
namespace chdr {
27 template <
typename payload_t>
31 boost::optional<uint64_t> timestamp = boost::none,
32 std::vector<uint64_t> metadata = {});
40 std::vector<uint8_t> payload_data,
41 boost::optional<uint64_t> timestamp = boost::none,
42 std::vector<uint64_t> mdata = {});
60 boost::optional<uint64_t> get_timestamp()
const;
66 void set_timestamp(boost::optional<uint64_t> timestamp);
72 const std::vector<uint64_t>& get_metadata()
const;
78 void set_metadata(std::vector<uint64_t> metadata);
85 std::vector<uint8_t> serialize_to_byte_vector(
94 template <
typename OutputIterator>
95 void serialize(OutputIterator first,
107 template <
typename InputIterator>
117 size_t get_packet_len()
const;
123 const std::vector<uint8_t>& get_payload_bytes()
const;
129 void set_payload_bytes(std::vector<uint8_t> bytes);
136 template <
typename payload_t>
145 template <
typename payload_t>
150 const std::string to_string()
const;
153 template <
typename payload_t>
154 const std::string to_string_with_payload(
158 void serialize_ptr(
endianness_t endianness,
void* start,
void* end)
const;
163 inline void set_header_lengths()
166 _header.set_length(get_packet_len());
170 std::vector<uint8_t> _payload;
171 boost::optional<uint64_t> _timestamp;
172 std::vector<uint64_t> _mdata;
constexpr size_t chdr_w_to_bits(chdr_w_t chdr_w)
Conversion from chdr_w_t to a number of bits.
Definition: rfnoc_types.hpp:22
Definition: build_info.hpp:12
Definition: chdr_packet.hpp:20
endianness_t
Definition: endianness.hpp:30
Definition: endianness.hpp:30
#define UHD_API
Definition: config.h:87
chdr_w_t
Type that indicates the CHDR Width in bits.
Definition: rfnoc_types.hpp:19