-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEncodedITSMessageCdrAux.ipp
More file actions
192 lines (148 loc) · 7.27 KB
/
EncodedITSMessageCdrAux.ipp
File metadata and controls
192 lines (148 loc) · 7.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*!
* @file EncodedITSMessageCdrAux.ipp
* This source file contains some declarations of CDR related functions.
*
* This file was generated by the tool fastddsgen.
*/
#ifndef _FAST_DDS_GENERATED_ENCODEDITSMESSAGECDRAUX_IPP_
#define _FAST_DDS_GENERATED_ENCODEDITSMESSAGECDRAUX_IPP_
#include "EncodedITSMessageCdrAux.hpp"
#include <fastcdr/Cdr.h>
#include <fastcdr/CdrSizeCalculator.hpp>
#include <fastcdr/exceptions/BadParamException.h>
using namespace eprosima::fastcdr::exception;
namespace eprosima {
namespace fastcdr {
template<>
eProsima_user_DllExport size_t calculate_serialized_size(
eprosima::fastcdr::CdrSizeCalculator& calculator,
const EncodedITSMessage& data,
size_t& current_alignment)
{
static_cast<void>(data);
eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding();
size_t calculated_size {calculator.begin_calculate_type_serialized_size(
eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ?
eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 :
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR,
current_alignment)};
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0),
data.topic(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1),
data.message(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(2),
data.rssi(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(3),
data.newInfo(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(4),
data.packetSize(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(5),
data.stationID(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(6),
data.receiverID(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(7),
data.receiverType(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(8),
data.timestamp(), current_alignment);
calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(9),
data.test(), current_alignment);
calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment);
return calculated_size;
}
template<>
eProsima_user_DllExport void serialize(
eprosima::fastcdr::Cdr& scdr,
const EncodedITSMessage& data)
{
eprosima::fastcdr::Cdr::state current_state(scdr);
scdr.begin_serialize_type(current_state,
eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ?
eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 :
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR);
scdr
<< eprosima::fastcdr::MemberId(0) << data.topic()
<< eprosima::fastcdr::MemberId(1) << data.message()
<< eprosima::fastcdr::MemberId(2) << data.rssi()
<< eprosima::fastcdr::MemberId(3) << data.newInfo()
<< eprosima::fastcdr::MemberId(4) << data.packetSize()
<< eprosima::fastcdr::MemberId(5) << data.stationID()
<< eprosima::fastcdr::MemberId(6) << data.receiverID()
<< eprosima::fastcdr::MemberId(7) << data.receiverType()
<< eprosima::fastcdr::MemberId(8) << data.timestamp()
<< eprosima::fastcdr::MemberId(9) << data.test()
;
scdr.end_serialize_type(current_state);
}
template<>
eProsima_user_DllExport void deserialize(
eprosima::fastcdr::Cdr& cdr,
EncodedITSMessage& data)
{
cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ?
eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 :
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR,
[&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool
{
bool ret_value = true;
switch (mid.id)
{
case 0:
dcdr >> data.topic();
break;
case 1:
dcdr >> data.message();
break;
case 2:
dcdr >> data.rssi();
break;
case 3:
dcdr >> data.newInfo();
break;
case 4:
dcdr >> data.packetSize();
break;
case 5:
dcdr >> data.stationID();
break;
case 6:
dcdr >> data.receiverID();
break;
case 7:
dcdr >> data.receiverType();
break;
case 8:
dcdr >> data.timestamp();
break;
case 9:
dcdr >> data.test();
break;
default:
ret_value = false;
break;
}
return ret_value;
});
}
void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const EncodedITSMessage& data)
{
static_cast<void>(scdr);
static_cast<void>(data);
}
} // namespace fastcdr
} // namespace eprosima
#endif // _FAST_DDS_GENERATED_ENCODEDITSMESSAGECDRAUX_IPP_