Skip to content

Commit 921cd45

Browse files
committed
Refs #24261: Last update
Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com>
1 parent ea419ca commit 921cd45

17 files changed

Lines changed: 683 additions & 365 deletions

examples/cpp/delivery_mechanisms/DeliveryMechanismsCdrAux.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#include "DeliveryMechanisms.hpp"
2626

27-
constexpr uint32_t DeliveryMechanisms_max_cdr_typesize {40UL};
27+
constexpr uint32_t DeliveryMechanisms_max_cdr_typesize {36UL};
2828
constexpr uint32_t DeliveryMechanisms_max_key_cdr_typesize {0UL};
2929

3030

examples/cpp/delivery_mechanisms/DeliveryMechanismsCdrAux.ipp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ eProsima_user_DllExport size_t calculate_serialized_size(
4545
eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding();
4646
size_t calculated_size {calculator.begin_calculate_type_serialized_size(
4747
eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ?
48-
eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 :
48+
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 :
4949
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR,
5050
current_alignment)};
5151

@@ -70,7 +70,7 @@ eProsima_user_DllExport void serialize(
7070
eprosima::fastcdr::Cdr::state current_state(scdr);
7171
scdr.begin_serialize_type(current_state,
7272
eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ?
73-
eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 :
73+
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 :
7474
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR);
7575

7676
scdr
@@ -91,7 +91,7 @@ eProsima_user_DllExport void deserialize(
9191

9292

9393
cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ?
94-
eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 :
94+
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 :
9595
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR,
9696
[&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool
9797
{

examples/cpp/delivery_mechanisms/DeliveryMechanismsPubSubTypes.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ bool DeliveryMechanismsPubSubType::serialize(
6565
ser.set_encoding_flag(
6666
data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ?
6767
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR :
68-
eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2);
68+
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2);
6969

7070
try
7171
{

examples/cpp/delivery_mechanisms/DeliveryMechanismsPubSubTypes.hpp

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,39 @@
4040
#endif // FASTDDS_GEN_API_VER
4141

4242

43+
#ifndef SWIG
44+
namespace detail {
45+
46+
template<typename Tag, typename Tag::type M>
47+
struct DeliveryMechanisms_rob
48+
{
49+
friend constexpr typename Tag::type get(
50+
Tag)
51+
{
52+
return M;
53+
}
54+
55+
};
56+
57+
struct DeliveryMechanisms_f
58+
{
59+
typedef std::array<char, 32> DeliveryMechanisms::* type;
60+
friend constexpr type get(
61+
DeliveryMechanisms_f);
62+
};
63+
64+
template struct DeliveryMechanisms_rob<DeliveryMechanisms_f, &DeliveryMechanisms::m_message>;
65+
66+
template <typename T, typename Tag>
67+
inline size_t constexpr DeliveryMechanisms_offset_of()
68+
{
69+
return ((::size_t) &reinterpret_cast<char const volatile&>((((T*)0)->*get(Tag()))));
70+
}
71+
72+
} // namespace detail
73+
#endif // ifndef SWIG
74+
75+
4376
/*!
4477
* @brief This class represents the TopicDataType of the type DeliveryMechanisms defined by the user in the IDL file.
4578
* @ingroup DeliveryMechanisms
@@ -98,8 +131,14 @@ class DeliveryMechanismsPubSubType : public eprosima::fastdds::dds::TopicDataTyp
98131
eProsima_user_DllExport inline bool is_plain(
99132
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
100133
{
101-
static_cast<void>(data_representation);
102-
return false;
134+
if (data_representation == eprosima::fastdds::dds::DataRepresentationId_t::XCDR2_DATA_REPRESENTATION)
135+
{
136+
return is_plain_xcdrv2_impl();
137+
}
138+
else
139+
{
140+
return is_plain_xcdrv1_impl();
141+
}
103142
}
104143

105144
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
@@ -108,14 +147,29 @@ class DeliveryMechanismsPubSubType : public eprosima::fastdds::dds::TopicDataTyp
108147
eProsima_user_DllExport inline bool construct_sample(
109148
void* memory) const override
110149
{
111-
static_cast<void>(memory);
112-
return false;
150+
new (memory) DeliveryMechanisms();
151+
return true;
113152
}
114153

115154
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
116155

117156
private:
118157

158+
159+
static constexpr bool is_plain_xcdrv1_impl()
160+
{
161+
return 36ULL ==
162+
(detail::DeliveryMechanisms_offset_of<DeliveryMechanisms, detail::DeliveryMechanisms_f>() +
163+
sizeof(std::array<char, 32>));
164+
}
165+
166+
static constexpr bool is_plain_xcdrv2_impl()
167+
{
168+
return 36ULL ==
169+
(detail::DeliveryMechanisms_offset_of<DeliveryMechanisms, detail::DeliveryMechanisms_f>() +
170+
sizeof(std::array<char, 32>));
171+
}
172+
119173
};
120174

121175

examples/cpp/delivery_mechanisms/DeliveryMechanismsTypeObjectSupport.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void register_DeliveryMechanisms_type_identifier(
4949
"DeliveryMechanisms", type_ids_DeliveryMechanisms);
5050
if (eprosima::fastdds::dds::RETCODE_OK != return_code_DeliveryMechanisms)
5151
{
52-
StructTypeFlag struct_flags_DeliveryMechanisms = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE,
52+
StructTypeFlag struct_flags_DeliveryMechanisms = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::FINAL,
5353
false, false);
5454
QualifiedTypeName type_name_DeliveryMechanisms = "DeliveryMechanisms";
5555
eprosima::fastcdr::optional<AppliedBuiltinTypeAnnotations> type_ann_builtin_DeliveryMechanisms;

0 commit comments

Comments
 (0)