---
source: crates/idl-cpp/tests/snapshot_codegen.rs
expression: cpp
---
// Generated by zerodds idl-cpp. Do not edit.
#pragma once
#include <cstdint>
#include "dds/topic/TopicTraits.hpp"
#include "dds/topic/xcdr2.hpp"
#include "dds/topic/xcdr2_md5.hpp"
namespace Outer {
namespace Inner {
class S {
public:
S() = default;
~S() = default;
private:
int32_t x_;
public:
int32_t& x() { return x_; }
const int32_t& x() const { return x_; }
void x(const int32_t& value) { x_ = value; }
};
} // namespace Inner
} // namespace Outer
// DDS-PSM-Cxx topic_type_support<T> -- auto-generiert (XCDR2 Wire, XTypes 1.3 7.4).
namespace dds {
namespace topic {
template <>
struct topic_type_support<::Outer::Inner::S> {
static const char* type_name() { return "Outer::Inner::S"; }
static constexpr bool is_keyed() { return false; }
static constexpr ::dds::topic::core::policy::DataRepresentationKind extensibility() { return ::dds::topic::core::policy::DataRepresentationKind::APPENDABLE; }
static std::vector<uint8_t> encode(const ::Outer::Inner::S& __v) {
std::vector<uint8_t> __out;
(void)__v;
const auto __dh = ::dds::topic::xcdr2::dheader_begin(__out);
const size_t __origin = __out.size();
(void)__origin;
::dds::topic::xcdr2::write_le_origin<int32_t>(__out, __origin, __v.x());
::dds::topic::xcdr2::dheader_end(__out, __dh);
return __out;
}
static std::vector<uint8_t> encode_be(const ::Outer::Inner::S& __v) {
std::vector<uint8_t> __out;
(void)__v;
const auto __dh = ::dds::topic::xcdr2::dheader_begin(__out);
const size_t __origin = __out.size();
(void)__origin;
::dds::topic::xcdr2::write_be_origin<int32_t>(__out, __origin, __v.x());
::dds::topic::xcdr2::dheader_end(__out, __dh);
return __out;
}
static ::Outer::Inner::S decode(const uint8_t* __buf, size_t __len) {
size_t __pos = 0;
::Outer::Inner::S __v;
(void)__buf; (void)__len; (void)__pos;
const auto __dh = ::dds::topic::xcdr2::dheader_read(__buf, __pos, __len);
const size_t __origin = __pos;
const size_t __end = __origin + __dh;
(void)__end;
__v.x(::dds::topic::xcdr2::read_le_origin<int32_t>(__buf, __pos, __len, __origin));
if (__pos < __end) __pos = __end;
return __v;
}
static std::array<uint8_t, 16> key_hash(const ::Outer::Inner::S& __v) {
(void)__v;
return std::array<uint8_t, 16>{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
}
};
} // namespace topic
} // namespace dds