/src/sentencepiece/src/builtin_pb/sentencepiece.pb.cc
Line | Count | Source |
1 | | // Generated by the protocol buffer compiler. DO NOT EDIT! |
2 | | // source: sentencepiece.proto |
3 | | |
4 | | #include "sentencepiece.pb.h" |
5 | | |
6 | | #include <algorithm> |
7 | | |
8 | | #include <google/protobuf/io/coded_stream.h> |
9 | | #include <google/protobuf/extension_set.h> |
10 | | #include <google/protobuf/wire_format_lite.h> |
11 | | #include <google/protobuf/io/zero_copy_stream_impl_lite.h> |
12 | | // @@protoc_insertion_point(includes) |
13 | | #include <google/protobuf/port_def.inc> |
14 | | extern PROTOBUF_INTERNAL_EXPORT_sentencepiece_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_SentencePieceText_sentencepiece_2eproto; |
15 | | extern PROTOBUF_INTERNAL_EXPORT_sentencepiece_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_SentencePieceText_SentencePiece_sentencepiece_2eproto; |
16 | | namespace sentencepiece { |
17 | | class SentencePieceText_SentencePieceDefaultTypeInternal { |
18 | | public: |
19 | | ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<SentencePieceText_SentencePiece> _instance; |
20 | | } _SentencePieceText_SentencePiece_default_instance_; |
21 | | class SentencePieceTextDefaultTypeInternal { |
22 | | public: |
23 | | ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<SentencePieceText> _instance; |
24 | | } _SentencePieceText_default_instance_; |
25 | | class NBestSentencePieceTextDefaultTypeInternal { |
26 | | public: |
27 | | ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<NBestSentencePieceText> _instance; |
28 | | } _NBestSentencePieceText_default_instance_; |
29 | | } // namespace sentencepiece |
30 | 0 | static void InitDefaultsscc_info_NBestSentencePieceText_sentencepiece_2eproto() { |
31 | 0 | GOOGLE_PROTOBUF_VERIFY_VERSION; |
32 | |
|
33 | 0 | { |
34 | 0 | void* ptr = &::sentencepiece::_NBestSentencePieceText_default_instance_; |
35 | 0 | new (ptr) ::sentencepiece::NBestSentencePieceText(); |
36 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); |
37 | 0 | } |
38 | 0 | } |
39 | | |
40 | | ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_NBestSentencePieceText_sentencepiece_2eproto = |
41 | | {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_NBestSentencePieceText_sentencepiece_2eproto}, { |
42 | | &scc_info_SentencePieceText_sentencepiece_2eproto.base,}}; |
43 | | |
44 | 1 | static void InitDefaultsscc_info_SentencePieceText_sentencepiece_2eproto() { |
45 | 1 | GOOGLE_PROTOBUF_VERIFY_VERSION; |
46 | | |
47 | 1 | { |
48 | 1 | void* ptr = &::sentencepiece::_SentencePieceText_default_instance_; |
49 | 1 | new (ptr) ::sentencepiece::SentencePieceText(); |
50 | 1 | ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); |
51 | 1 | } |
52 | 1 | } |
53 | | |
54 | | ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_SentencePieceText_sentencepiece_2eproto = |
55 | | {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_SentencePieceText_sentencepiece_2eproto}, { |
56 | | &scc_info_SentencePieceText_SentencePiece_sentencepiece_2eproto.base,}}; |
57 | | |
58 | 1 | static void InitDefaultsscc_info_SentencePieceText_SentencePiece_sentencepiece_2eproto() { |
59 | 1 | GOOGLE_PROTOBUF_VERIFY_VERSION; |
60 | | |
61 | 1 | { |
62 | 1 | void* ptr = &::sentencepiece::_SentencePieceText_SentencePiece_default_instance_; |
63 | 1 | new (ptr) ::sentencepiece::SentencePieceText_SentencePiece(); |
64 | 1 | ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); |
65 | 1 | } |
66 | 1 | } |
67 | | |
68 | | ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_SentencePieceText_SentencePiece_sentencepiece_2eproto = |
69 | | {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_SentencePieceText_SentencePiece_sentencepiece_2eproto}, {}}; |
70 | | |
71 | | namespace sentencepiece { |
72 | | |
73 | | // =================================================================== |
74 | | |
75 | | class SentencePieceText_SentencePiece::_Internal { |
76 | | public: |
77 | | using HasBits = decltype(std::declval<SentencePieceText_SentencePiece>()._has_bits_); |
78 | 0 | static void set_has_piece(HasBits* has_bits) { |
79 | 0 | (*has_bits)[0] |= 1u; |
80 | 0 | } |
81 | 0 | static void set_has_id(HasBits* has_bits) { |
82 | 0 | (*has_bits)[0] |= 4u; |
83 | 0 | } |
84 | 0 | static void set_has_surface(HasBits* has_bits) { |
85 | 0 | (*has_bits)[0] |= 2u; |
86 | 0 | } |
87 | 0 | static void set_has_begin(HasBits* has_bits) { |
88 | 0 | (*has_bits)[0] |= 8u; |
89 | 0 | } |
90 | 0 | static void set_has_end(HasBits* has_bits) { |
91 | 0 | (*has_bits)[0] |= 16u; |
92 | 0 | } |
93 | | }; |
94 | | |
95 | | SentencePieceText_SentencePiece::SentencePieceText_SentencePiece(::PROTOBUF_NAMESPACE_ID::Arena* arena) |
96 | 1 | : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena), |
97 | 1 | _extensions_(arena) { |
98 | 1 | SharedCtor(); |
99 | 1 | RegisterArenaDtor(arena); |
100 | | // @@protoc_insertion_point(arena_constructor:sentencepiece.SentencePieceText.SentencePiece) |
101 | 1 | } |
102 | | SentencePieceText_SentencePiece::SentencePieceText_SentencePiece(const SentencePieceText_SentencePiece& from) |
103 | 0 | : ::PROTOBUF_NAMESPACE_ID::MessageLite(), |
104 | 0 | _has_bits_(from._has_bits_) { |
105 | 0 | _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); |
106 | 0 | _extensions_.MergeFrom(from._extensions_); |
107 | 0 | piece_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
108 | 0 | if (from._internal_has_piece()) { |
109 | 0 | piece_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_piece(), |
110 | 0 | GetArena()); |
111 | 0 | } |
112 | 0 | surface_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
113 | 0 | if (from._internal_has_surface()) { |
114 | 0 | surface_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_surface(), |
115 | 0 | GetArena()); |
116 | 0 | } |
117 | 0 | ::memcpy(&id_, &from.id_, |
118 | 0 | static_cast<size_t>(reinterpret_cast<char*>(&end_) - |
119 | 0 | reinterpret_cast<char*>(&id_)) + sizeof(end_)); |
120 | | // @@protoc_insertion_point(copy_constructor:sentencepiece.SentencePieceText.SentencePiece) |
121 | 0 | } |
122 | | |
123 | 1 | void SentencePieceText_SentencePiece::SharedCtor() { |
124 | 1 | ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_SentencePieceText_SentencePiece_sentencepiece_2eproto.base); |
125 | 1 | piece_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
126 | 1 | surface_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
127 | 1 | ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( |
128 | 1 | reinterpret_cast<char*>(&id_) - reinterpret_cast<char*>(this)), |
129 | 1 | 0, static_cast<size_t>(reinterpret_cast<char*>(&end_) - |
130 | 1 | reinterpret_cast<char*>(&id_)) + sizeof(end_)); |
131 | 1 | } |
132 | | |
133 | 0 | SentencePieceText_SentencePiece::~SentencePieceText_SentencePiece() { |
134 | | // @@protoc_insertion_point(destructor:sentencepiece.SentencePieceText.SentencePiece) |
135 | 0 | SharedDtor(); |
136 | 0 | _internal_metadata_.Delete<std::string>(); |
137 | 0 | } |
138 | | |
139 | 0 | void SentencePieceText_SentencePiece::SharedDtor() { |
140 | 0 | GOOGLE_DCHECK(GetArena() == nullptr); |
141 | 0 | piece_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
142 | 0 | surface_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
143 | 0 | } |
144 | | |
145 | 0 | void SentencePieceText_SentencePiece::ArenaDtor(void* object) { |
146 | 0 | SentencePieceText_SentencePiece* _this = reinterpret_cast< SentencePieceText_SentencePiece* >(object); |
147 | 0 | (void)_this; |
148 | 0 | } |
149 | 1 | void SentencePieceText_SentencePiece::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { |
150 | 1 | } |
151 | 0 | void SentencePieceText_SentencePiece::SetCachedSize(int size) const { |
152 | 0 | _cached_size_.Set(size); |
153 | 0 | } |
154 | 0 | const SentencePieceText_SentencePiece& SentencePieceText_SentencePiece::default_instance() { |
155 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_SentencePieceText_SentencePiece_sentencepiece_2eproto.base); |
156 | 0 | return *internal_default_instance(); |
157 | 0 | } |
158 | | |
159 | | |
160 | 0 | void SentencePieceText_SentencePiece::Clear() { |
161 | | // @@protoc_insertion_point(message_clear_start:sentencepiece.SentencePieceText.SentencePiece) |
162 | 0 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
163 | | // Prevent compiler warnings about cached_has_bits being unused |
164 | 0 | (void) cached_has_bits; |
165 | |
|
166 | 0 | _extensions_.Clear(); |
167 | 0 | cached_has_bits = _has_bits_[0]; |
168 | 0 | if (cached_has_bits & 0x00000003u) { |
169 | 0 | if (cached_has_bits & 0x00000001u) { |
170 | 0 | piece_.ClearNonDefaultToEmpty(); |
171 | 0 | } |
172 | 0 | if (cached_has_bits & 0x00000002u) { |
173 | 0 | surface_.ClearNonDefaultToEmpty(); |
174 | 0 | } |
175 | 0 | } |
176 | 0 | if (cached_has_bits & 0x0000001cu) { |
177 | 0 | ::memset(&id_, 0, static_cast<size_t>( |
178 | 0 | reinterpret_cast<char*>(&end_) - |
179 | 0 | reinterpret_cast<char*>(&id_)) + sizeof(end_)); |
180 | 0 | } |
181 | 0 | _has_bits_.Clear(); |
182 | 0 | _internal_metadata_.Clear<std::string>(); |
183 | 0 | } |
184 | | |
185 | 0 | const char* SentencePieceText_SentencePiece::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { |
186 | 0 | #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure |
187 | 0 | _Internal::HasBits has_bits{}; |
188 | 0 | while (!ctx->Done(&ptr)) { |
189 | 0 | ::PROTOBUF_NAMESPACE_ID::uint32 tag; |
190 | 0 | ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); |
191 | 0 | CHK_(ptr); |
192 | 0 | switch (tag >> 3) { |
193 | | // optional string piece = 1; |
194 | 0 | case 1: |
195 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { |
196 | 0 | auto str = _internal_mutable_piece(); |
197 | 0 | ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); |
198 | 0 | CHK_(ptr); |
199 | 0 | } else goto handle_unusual; |
200 | 0 | continue; |
201 | | // optional uint32 id = 2; |
202 | 0 | case 2: |
203 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { |
204 | 0 | _Internal::set_has_id(&has_bits); |
205 | 0 | id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); |
206 | 0 | CHK_(ptr); |
207 | 0 | } else goto handle_unusual; |
208 | 0 | continue; |
209 | | // optional string surface = 3; |
210 | 0 | case 3: |
211 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { |
212 | 0 | auto str = _internal_mutable_surface(); |
213 | 0 | ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); |
214 | 0 | CHK_(ptr); |
215 | 0 | } else goto handle_unusual; |
216 | 0 | continue; |
217 | | // optional uint32 begin = 4; |
218 | 0 | case 4: |
219 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) { |
220 | 0 | _Internal::set_has_begin(&has_bits); |
221 | 0 | begin_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); |
222 | 0 | CHK_(ptr); |
223 | 0 | } else goto handle_unusual; |
224 | 0 | continue; |
225 | | // optional uint32 end = 5; |
226 | 0 | case 5: |
227 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) { |
228 | 0 | _Internal::set_has_end(&has_bits); |
229 | 0 | end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); |
230 | 0 | CHK_(ptr); |
231 | 0 | } else goto handle_unusual; |
232 | 0 | continue; |
233 | 0 | default: { |
234 | 0 | handle_unusual: |
235 | 0 | if ((tag & 7) == 4 || tag == 0) { |
236 | 0 | ctx->SetLastTag(tag); |
237 | 0 | goto success; |
238 | 0 | } |
239 | 0 | if ((1600u <= tag)) { |
240 | 0 | ptr = _extensions_.ParseField(tag, ptr, |
241 | 0 | internal_default_instance(), &_internal_metadata_, ctx); |
242 | 0 | CHK_(ptr != nullptr); |
243 | 0 | continue; |
244 | 0 | } |
245 | 0 | ptr = UnknownFieldParse(tag, |
246 | 0 | _internal_metadata_.mutable_unknown_fields<std::string>(), |
247 | 0 | ptr, ctx); |
248 | 0 | CHK_(ptr != nullptr); |
249 | 0 | continue; |
250 | 0 | } |
251 | 0 | } // switch |
252 | 0 | } // while |
253 | 0 | success: |
254 | 0 | _has_bits_.Or(has_bits); |
255 | 0 | return ptr; |
256 | 0 | failure: |
257 | 0 | ptr = nullptr; |
258 | 0 | goto success; |
259 | 0 | #undef CHK_ |
260 | 0 | } |
261 | | |
262 | | ::PROTOBUF_NAMESPACE_ID::uint8* SentencePieceText_SentencePiece::_InternalSerialize( |
263 | 0 | ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { |
264 | | // @@protoc_insertion_point(serialize_to_array_start:sentencepiece.SentencePieceText.SentencePiece) |
265 | 0 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
266 | 0 | (void) cached_has_bits; |
267 | |
|
268 | 0 | cached_has_bits = _has_bits_[0]; |
269 | | // optional string piece = 1; |
270 | 0 | if (cached_has_bits & 0x00000001u) { |
271 | 0 | target = stream->WriteStringMaybeAliased( |
272 | 0 | 1, this->_internal_piece(), target); |
273 | 0 | } |
274 | | |
275 | | // optional uint32 id = 2; |
276 | 0 | if (cached_has_bits & 0x00000004u) { |
277 | 0 | target = stream->EnsureSpace(target); |
278 | 0 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(2, this->_internal_id(), target); |
279 | 0 | } |
280 | | |
281 | | // optional string surface = 3; |
282 | 0 | if (cached_has_bits & 0x00000002u) { |
283 | 0 | target = stream->WriteStringMaybeAliased( |
284 | 0 | 3, this->_internal_surface(), target); |
285 | 0 | } |
286 | | |
287 | | // optional uint32 begin = 4; |
288 | 0 | if (cached_has_bits & 0x00000008u) { |
289 | 0 | target = stream->EnsureSpace(target); |
290 | 0 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(4, this->_internal_begin(), target); |
291 | 0 | } |
292 | | |
293 | | // optional uint32 end = 5; |
294 | 0 | if (cached_has_bits & 0x00000010u) { |
295 | 0 | target = stream->EnsureSpace(target); |
296 | 0 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(5, this->_internal_end(), target); |
297 | 0 | } |
298 | | |
299 | | // Extension range [200, 536870912) |
300 | 0 | target = _extensions_._InternalSerialize( |
301 | 0 | 200, 536870912, target, stream); |
302 | |
|
303 | 0 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
304 | 0 | target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), |
305 | 0 | static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); |
306 | 0 | } |
307 | | // @@protoc_insertion_point(serialize_to_array_end:sentencepiece.SentencePieceText.SentencePiece) |
308 | 0 | return target; |
309 | 0 | } |
310 | | |
311 | 0 | size_t SentencePieceText_SentencePiece::ByteSizeLong() const { |
312 | | // @@protoc_insertion_point(message_byte_size_start:sentencepiece.SentencePieceText.SentencePiece) |
313 | 0 | size_t total_size = 0; |
314 | |
|
315 | 0 | total_size += _extensions_.ByteSize(); |
316 | |
|
317 | 0 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
318 | | // Prevent compiler warnings about cached_has_bits being unused |
319 | 0 | (void) cached_has_bits; |
320 | |
|
321 | 0 | cached_has_bits = _has_bits_[0]; |
322 | 0 | if (cached_has_bits & 0x0000001fu) { |
323 | | // optional string piece = 1; |
324 | 0 | if (cached_has_bits & 0x00000001u) { |
325 | 0 | total_size += 1 + |
326 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( |
327 | 0 | this->_internal_piece()); |
328 | 0 | } |
329 | | |
330 | | // optional string surface = 3; |
331 | 0 | if (cached_has_bits & 0x00000002u) { |
332 | 0 | total_size += 1 + |
333 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( |
334 | 0 | this->_internal_surface()); |
335 | 0 | } |
336 | | |
337 | | // optional uint32 id = 2; |
338 | 0 | if (cached_has_bits & 0x00000004u) { |
339 | 0 | total_size += 1 + |
340 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32Size( |
341 | 0 | this->_internal_id()); |
342 | 0 | } |
343 | | |
344 | | // optional uint32 begin = 4; |
345 | 0 | if (cached_has_bits & 0x00000008u) { |
346 | 0 | total_size += 1 + |
347 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32Size( |
348 | 0 | this->_internal_begin()); |
349 | 0 | } |
350 | | |
351 | | // optional uint32 end = 5; |
352 | 0 | if (cached_has_bits & 0x00000010u) { |
353 | 0 | total_size += 1 + |
354 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32Size( |
355 | 0 | this->_internal_end()); |
356 | 0 | } |
357 | |
|
358 | 0 | } |
359 | 0 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
360 | 0 | total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); |
361 | 0 | } |
362 | 0 | int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); |
363 | 0 | SetCachedSize(cached_size); |
364 | 0 | return total_size; |
365 | 0 | } |
366 | | |
367 | | void SentencePieceText_SentencePiece::CheckTypeAndMergeFrom( |
368 | 0 | const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { |
369 | 0 | MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast<const SentencePieceText_SentencePiece*>( |
370 | 0 | &from)); |
371 | 0 | } |
372 | | |
373 | 0 | void SentencePieceText_SentencePiece::MergeFrom(const SentencePieceText_SentencePiece& from) { |
374 | | // @@protoc_insertion_point(class_specific_merge_from_start:sentencepiece.SentencePieceText.SentencePiece) |
375 | 0 | GOOGLE_DCHECK_NE(&from, this); |
376 | 0 | _extensions_.MergeFrom(from._extensions_); |
377 | 0 | _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); |
378 | 0 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
379 | 0 | (void) cached_has_bits; |
380 | |
|
381 | 0 | cached_has_bits = from._has_bits_[0]; |
382 | 0 | if (cached_has_bits & 0x0000001fu) { |
383 | 0 | if (cached_has_bits & 0x00000001u) { |
384 | 0 | _internal_set_piece(from._internal_piece()); |
385 | 0 | } |
386 | 0 | if (cached_has_bits & 0x00000002u) { |
387 | 0 | _internal_set_surface(from._internal_surface()); |
388 | 0 | } |
389 | 0 | if (cached_has_bits & 0x00000004u) { |
390 | 0 | id_ = from.id_; |
391 | 0 | } |
392 | 0 | if (cached_has_bits & 0x00000008u) { |
393 | 0 | begin_ = from.begin_; |
394 | 0 | } |
395 | 0 | if (cached_has_bits & 0x00000010u) { |
396 | 0 | end_ = from.end_; |
397 | 0 | } |
398 | 0 | _has_bits_[0] |= cached_has_bits; |
399 | 0 | } |
400 | 0 | } |
401 | | |
402 | 0 | void SentencePieceText_SentencePiece::CopyFrom(const SentencePieceText_SentencePiece& from) { |
403 | | // @@protoc_insertion_point(class_specific_copy_from_start:sentencepiece.SentencePieceText.SentencePiece) |
404 | 0 | if (&from == this) return; |
405 | 0 | Clear(); |
406 | 0 | MergeFrom(from); |
407 | 0 | } |
408 | | |
409 | 0 | bool SentencePieceText_SentencePiece::IsInitialized() const { |
410 | 0 | if (!_extensions_.IsInitialized()) { |
411 | 0 | return false; |
412 | 0 | } |
413 | | |
414 | 0 | return true; |
415 | 0 | } |
416 | | |
417 | 0 | void SentencePieceText_SentencePiece::InternalSwap(SentencePieceText_SentencePiece* other) { |
418 | 0 | using std::swap; |
419 | 0 | _extensions_.Swap(&other->_extensions_); |
420 | 0 | _internal_metadata_.Swap<std::string>(&other->_internal_metadata_); |
421 | 0 | swap(_has_bits_[0], other->_has_bits_[0]); |
422 | 0 | piece_.Swap(&other->piece_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); |
423 | 0 | surface_.Swap(&other->surface_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); |
424 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::memswap< |
425 | 0 | PROTOBUF_FIELD_OFFSET(SentencePieceText_SentencePiece, end_) |
426 | 0 | + sizeof(SentencePieceText_SentencePiece::end_) |
427 | 0 | - PROTOBUF_FIELD_OFFSET(SentencePieceText_SentencePiece, id_)>( |
428 | 0 | reinterpret_cast<char*>(&id_), |
429 | 0 | reinterpret_cast<char*>(&other->id_)); |
430 | 0 | } |
431 | | |
432 | 0 | std::string SentencePieceText_SentencePiece::GetTypeName() const { |
433 | 0 | return "sentencepiece.SentencePieceText.SentencePiece"; |
434 | 0 | } |
435 | | |
436 | | |
437 | | // =================================================================== |
438 | | |
439 | | class SentencePieceText::_Internal { |
440 | | public: |
441 | | using HasBits = decltype(std::declval<SentencePieceText>()._has_bits_); |
442 | 0 | static void set_has_text(HasBits* has_bits) { |
443 | 0 | (*has_bits)[0] |= 1u; |
444 | 0 | } |
445 | 0 | static void set_has_score(HasBits* has_bits) { |
446 | 0 | (*has_bits)[0] |= 2u; |
447 | 0 | } |
448 | | }; |
449 | | |
450 | | SentencePieceText::SentencePieceText(::PROTOBUF_NAMESPACE_ID::Arena* arena) |
451 | 117 | : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena), |
452 | 117 | _extensions_(arena), |
453 | 117 | pieces_(arena) { |
454 | 117 | SharedCtor(); |
455 | 117 | RegisterArenaDtor(arena); |
456 | | // @@protoc_insertion_point(arena_constructor:sentencepiece.SentencePieceText) |
457 | 117 | } |
458 | | SentencePieceText::SentencePieceText(const SentencePieceText& from) |
459 | 0 | : ::PROTOBUF_NAMESPACE_ID::MessageLite(), |
460 | 0 | _has_bits_(from._has_bits_), |
461 | 0 | pieces_(from.pieces_) { |
462 | 0 | _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); |
463 | 0 | _extensions_.MergeFrom(from._extensions_); |
464 | 0 | text_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
465 | 0 | if (from._internal_has_text()) { |
466 | 0 | text_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_text(), |
467 | 0 | GetArena()); |
468 | 0 | } |
469 | 0 | score_ = from.score_; |
470 | | // @@protoc_insertion_point(copy_constructor:sentencepiece.SentencePieceText) |
471 | 0 | } |
472 | | |
473 | 117 | void SentencePieceText::SharedCtor() { |
474 | 117 | ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_SentencePieceText_sentencepiece_2eproto.base); |
475 | 117 | text_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
476 | 117 | score_ = 0; |
477 | 117 | } |
478 | | |
479 | 116 | SentencePieceText::~SentencePieceText() { |
480 | | // @@protoc_insertion_point(destructor:sentencepiece.SentencePieceText) |
481 | 116 | SharedDtor(); |
482 | 116 | _internal_metadata_.Delete<std::string>(); |
483 | 116 | } |
484 | | |
485 | 116 | void SentencePieceText::SharedDtor() { |
486 | 116 | GOOGLE_DCHECK(GetArena() == nullptr); |
487 | 116 | text_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
488 | 116 | } |
489 | | |
490 | 0 | void SentencePieceText::ArenaDtor(void* object) { |
491 | 0 | SentencePieceText* _this = reinterpret_cast< SentencePieceText* >(object); |
492 | 0 | (void)_this; |
493 | 0 | } |
494 | 117 | void SentencePieceText::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { |
495 | 117 | } |
496 | 116 | void SentencePieceText::SetCachedSize(int size) const { |
497 | 116 | _cached_size_.Set(size); |
498 | 116 | } |
499 | 116 | const SentencePieceText& SentencePieceText::default_instance() { |
500 | 116 | ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_SentencePieceText_sentencepiece_2eproto.base); |
501 | 116 | return *internal_default_instance(); |
502 | 116 | } |
503 | | |
504 | | |
505 | 0 | void SentencePieceText::Clear() { |
506 | | // @@protoc_insertion_point(message_clear_start:sentencepiece.SentencePieceText) |
507 | 0 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
508 | | // Prevent compiler warnings about cached_has_bits being unused |
509 | 0 | (void) cached_has_bits; |
510 | |
|
511 | 0 | _extensions_.Clear(); |
512 | 0 | pieces_.Clear(); |
513 | 0 | cached_has_bits = _has_bits_[0]; |
514 | 0 | if (cached_has_bits & 0x00000001u) { |
515 | 0 | text_.ClearNonDefaultToEmpty(); |
516 | 0 | } |
517 | 0 | score_ = 0; |
518 | 0 | _has_bits_.Clear(); |
519 | 0 | _internal_metadata_.Clear<std::string>(); |
520 | 0 | } |
521 | | |
522 | 0 | const char* SentencePieceText::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { |
523 | 0 | #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure |
524 | 0 | _Internal::HasBits has_bits{}; |
525 | 0 | while (!ctx->Done(&ptr)) { |
526 | 0 | ::PROTOBUF_NAMESPACE_ID::uint32 tag; |
527 | 0 | ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); |
528 | 0 | CHK_(ptr); |
529 | 0 | switch (tag >> 3) { |
530 | | // optional string text = 1; |
531 | 0 | case 1: |
532 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { |
533 | 0 | auto str = _internal_mutable_text(); |
534 | 0 | ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); |
535 | 0 | CHK_(ptr); |
536 | 0 | } else goto handle_unusual; |
537 | 0 | continue; |
538 | | // repeated .sentencepiece.SentencePieceText.SentencePiece pieces = 2; |
539 | 0 | case 2: |
540 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { |
541 | 0 | ptr -= 1; |
542 | 0 | do { |
543 | 0 | ptr += 1; |
544 | 0 | ptr = ctx->ParseMessage(_internal_add_pieces(), ptr); |
545 | 0 | CHK_(ptr); |
546 | 0 | if (!ctx->DataAvailable(ptr)) break; |
547 | 0 | } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr)); |
548 | 0 | } else goto handle_unusual; |
549 | 0 | continue; |
550 | | // optional float score = 3; |
551 | 0 | case 3: |
552 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 29)) { |
553 | 0 | _Internal::set_has_score(&has_bits); |
554 | 0 | score_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr); |
555 | 0 | ptr += sizeof(float); |
556 | 0 | } else goto handle_unusual; |
557 | 0 | continue; |
558 | 0 | default: { |
559 | 0 | handle_unusual: |
560 | 0 | if ((tag & 7) == 4 || tag == 0) { |
561 | 0 | ctx->SetLastTag(tag); |
562 | 0 | goto success; |
563 | 0 | } |
564 | 0 | if ((1600u <= tag)) { |
565 | 0 | ptr = _extensions_.ParseField(tag, ptr, |
566 | 0 | internal_default_instance(), &_internal_metadata_, ctx); |
567 | 0 | CHK_(ptr != nullptr); |
568 | 0 | continue; |
569 | 0 | } |
570 | 0 | ptr = UnknownFieldParse(tag, |
571 | 0 | _internal_metadata_.mutable_unknown_fields<std::string>(), |
572 | 0 | ptr, ctx); |
573 | 0 | CHK_(ptr != nullptr); |
574 | 0 | continue; |
575 | 0 | } |
576 | 0 | } // switch |
577 | 0 | } // while |
578 | 0 | success: |
579 | 0 | _has_bits_.Or(has_bits); |
580 | 0 | return ptr; |
581 | 0 | failure: |
582 | 0 | ptr = nullptr; |
583 | 0 | goto success; |
584 | 0 | #undef CHK_ |
585 | 0 | } |
586 | | |
587 | | ::PROTOBUF_NAMESPACE_ID::uint8* SentencePieceText::_InternalSerialize( |
588 | 116 | ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { |
589 | | // @@protoc_insertion_point(serialize_to_array_start:sentencepiece.SentencePieceText) |
590 | 116 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
591 | 116 | (void) cached_has_bits; |
592 | | |
593 | 116 | cached_has_bits = _has_bits_[0]; |
594 | | // optional string text = 1; |
595 | 116 | if (cached_has_bits & 0x00000001u) { |
596 | 0 | target = stream->WriteStringMaybeAliased( |
597 | 0 | 1, this->_internal_text(), target); |
598 | 0 | } |
599 | | |
600 | | // repeated .sentencepiece.SentencePieceText.SentencePiece pieces = 2; |
601 | 116 | for (unsigned int i = 0, |
602 | 116 | n = static_cast<unsigned int>(this->_internal_pieces_size()); i < n; i++) { |
603 | 0 | target = stream->EnsureSpace(target); |
604 | 0 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: |
605 | 0 | InternalWriteMessage(2, this->_internal_pieces(i), target, stream); |
606 | 0 | } |
607 | | |
608 | | // optional float score = 3; |
609 | 116 | if (cached_has_bits & 0x00000002u) { |
610 | 0 | target = stream->EnsureSpace(target); |
611 | 0 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(3, this->_internal_score(), target); |
612 | 0 | } |
613 | | |
614 | | // Extension range [200, 536870912) |
615 | 116 | target = _extensions_._InternalSerialize( |
616 | 116 | 200, 536870912, target, stream); |
617 | | |
618 | 116 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
619 | 0 | target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), |
620 | 0 | static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); |
621 | 0 | } |
622 | | // @@protoc_insertion_point(serialize_to_array_end:sentencepiece.SentencePieceText) |
623 | 116 | return target; |
624 | 116 | } |
625 | | |
626 | 116 | size_t SentencePieceText::ByteSizeLong() const { |
627 | | // @@protoc_insertion_point(message_byte_size_start:sentencepiece.SentencePieceText) |
628 | 116 | size_t total_size = 0; |
629 | | |
630 | 116 | total_size += _extensions_.ByteSize(); |
631 | | |
632 | 116 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
633 | | // Prevent compiler warnings about cached_has_bits being unused |
634 | 116 | (void) cached_has_bits; |
635 | | |
636 | | // repeated .sentencepiece.SentencePieceText.SentencePiece pieces = 2; |
637 | 116 | total_size += 1UL * this->_internal_pieces_size(); |
638 | 116 | for (const auto& msg : this->pieces_) { |
639 | 0 | total_size += |
640 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); |
641 | 0 | } |
642 | | |
643 | 116 | cached_has_bits = _has_bits_[0]; |
644 | 116 | if (cached_has_bits & 0x00000003u) { |
645 | | // optional string text = 1; |
646 | 0 | if (cached_has_bits & 0x00000001u) { |
647 | 0 | total_size += 1 + |
648 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( |
649 | 0 | this->_internal_text()); |
650 | 0 | } |
651 | | |
652 | | // optional float score = 3; |
653 | 0 | if (cached_has_bits & 0x00000002u) { |
654 | 0 | total_size += 1 + 4; |
655 | 0 | } |
656 | |
|
657 | 0 | } |
658 | 116 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
659 | 0 | total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); |
660 | 0 | } |
661 | 116 | int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); |
662 | 116 | SetCachedSize(cached_size); |
663 | 116 | return total_size; |
664 | 116 | } |
665 | | |
666 | | void SentencePieceText::CheckTypeAndMergeFrom( |
667 | 0 | const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { |
668 | 0 | MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast<const SentencePieceText*>( |
669 | 0 | &from)); |
670 | 0 | } |
671 | | |
672 | 0 | void SentencePieceText::MergeFrom(const SentencePieceText& from) { |
673 | | // @@protoc_insertion_point(class_specific_merge_from_start:sentencepiece.SentencePieceText) |
674 | 0 | GOOGLE_DCHECK_NE(&from, this); |
675 | 0 | _extensions_.MergeFrom(from._extensions_); |
676 | 0 | _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); |
677 | 0 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
678 | 0 | (void) cached_has_bits; |
679 | |
|
680 | 0 | pieces_.MergeFrom(from.pieces_); |
681 | 0 | cached_has_bits = from._has_bits_[0]; |
682 | 0 | if (cached_has_bits & 0x00000003u) { |
683 | 0 | if (cached_has_bits & 0x00000001u) { |
684 | 0 | _internal_set_text(from._internal_text()); |
685 | 0 | } |
686 | 0 | if (cached_has_bits & 0x00000002u) { |
687 | 0 | score_ = from.score_; |
688 | 0 | } |
689 | 0 | _has_bits_[0] |= cached_has_bits; |
690 | 0 | } |
691 | 0 | } |
692 | | |
693 | 0 | void SentencePieceText::CopyFrom(const SentencePieceText& from) { |
694 | | // @@protoc_insertion_point(class_specific_copy_from_start:sentencepiece.SentencePieceText) |
695 | 0 | if (&from == this) return; |
696 | 0 | Clear(); |
697 | 0 | MergeFrom(from); |
698 | 0 | } |
699 | | |
700 | 116 | bool SentencePieceText::IsInitialized() const { |
701 | 116 | if (!_extensions_.IsInitialized()) { |
702 | 0 | return false; |
703 | 0 | } |
704 | | |
705 | 116 | if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(pieces_)) return false; |
706 | 116 | return true; |
707 | 116 | } |
708 | | |
709 | 0 | void SentencePieceText::InternalSwap(SentencePieceText* other) { |
710 | 0 | using std::swap; |
711 | 0 | _extensions_.Swap(&other->_extensions_); |
712 | 0 | _internal_metadata_.Swap<std::string>(&other->_internal_metadata_); |
713 | 0 | swap(_has_bits_[0], other->_has_bits_[0]); |
714 | 0 | pieces_.InternalSwap(&other->pieces_); |
715 | 0 | text_.Swap(&other->text_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); |
716 | 0 | swap(score_, other->score_); |
717 | 0 | } |
718 | | |
719 | 0 | std::string SentencePieceText::GetTypeName() const { |
720 | 0 | return "sentencepiece.SentencePieceText"; |
721 | 0 | } |
722 | | |
723 | | |
724 | | // =================================================================== |
725 | | |
726 | | class NBestSentencePieceText::_Internal { |
727 | | public: |
728 | | }; |
729 | | |
730 | | NBestSentencePieceText::NBestSentencePieceText(::PROTOBUF_NAMESPACE_ID::Arena* arena) |
731 | 0 | : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena), |
732 | 0 | nbests_(arena) { |
733 | 0 | SharedCtor(); |
734 | 0 | RegisterArenaDtor(arena); |
735 | | // @@protoc_insertion_point(arena_constructor:sentencepiece.NBestSentencePieceText) |
736 | 0 | } |
737 | | NBestSentencePieceText::NBestSentencePieceText(const NBestSentencePieceText& from) |
738 | 0 | : ::PROTOBUF_NAMESPACE_ID::MessageLite(), |
739 | 0 | nbests_(from.nbests_) { |
740 | 0 | _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); |
741 | | // @@protoc_insertion_point(copy_constructor:sentencepiece.NBestSentencePieceText) |
742 | 0 | } |
743 | | |
744 | 0 | void NBestSentencePieceText::SharedCtor() { |
745 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_NBestSentencePieceText_sentencepiece_2eproto.base); |
746 | 0 | } |
747 | | |
748 | 0 | NBestSentencePieceText::~NBestSentencePieceText() { |
749 | | // @@protoc_insertion_point(destructor:sentencepiece.NBestSentencePieceText) |
750 | 0 | SharedDtor(); |
751 | 0 | _internal_metadata_.Delete<std::string>(); |
752 | 0 | } |
753 | | |
754 | 0 | void NBestSentencePieceText::SharedDtor() { |
755 | 0 | GOOGLE_DCHECK(GetArena() == nullptr); |
756 | 0 | } |
757 | | |
758 | 0 | void NBestSentencePieceText::ArenaDtor(void* object) { |
759 | 0 | NBestSentencePieceText* _this = reinterpret_cast< NBestSentencePieceText* >(object); |
760 | 0 | (void)_this; |
761 | 0 | } |
762 | 0 | void NBestSentencePieceText::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { |
763 | 0 | } |
764 | 0 | void NBestSentencePieceText::SetCachedSize(int size) const { |
765 | 0 | _cached_size_.Set(size); |
766 | 0 | } |
767 | 0 | const NBestSentencePieceText& NBestSentencePieceText::default_instance() { |
768 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_NBestSentencePieceText_sentencepiece_2eproto.base); |
769 | 0 | return *internal_default_instance(); |
770 | 0 | } |
771 | | |
772 | | |
773 | 0 | void NBestSentencePieceText::Clear() { |
774 | | // @@protoc_insertion_point(message_clear_start:sentencepiece.NBestSentencePieceText) |
775 | 0 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
776 | | // Prevent compiler warnings about cached_has_bits being unused |
777 | 0 | (void) cached_has_bits; |
778 | |
|
779 | 0 | nbests_.Clear(); |
780 | 0 | _internal_metadata_.Clear<std::string>(); |
781 | 0 | } |
782 | | |
783 | 0 | const char* NBestSentencePieceText::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { |
784 | 0 | #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure |
785 | 0 | while (!ctx->Done(&ptr)) { |
786 | 0 | ::PROTOBUF_NAMESPACE_ID::uint32 tag; |
787 | 0 | ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); |
788 | 0 | CHK_(ptr); |
789 | 0 | switch (tag >> 3) { |
790 | | // repeated .sentencepiece.SentencePieceText nbests = 1; |
791 | 0 | case 1: |
792 | 0 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { |
793 | 0 | ptr -= 1; |
794 | 0 | do { |
795 | 0 | ptr += 1; |
796 | 0 | ptr = ctx->ParseMessage(_internal_add_nbests(), ptr); |
797 | 0 | CHK_(ptr); |
798 | 0 | if (!ctx->DataAvailable(ptr)) break; |
799 | 0 | } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr)); |
800 | 0 | } else goto handle_unusual; |
801 | 0 | continue; |
802 | 0 | default: { |
803 | 0 | handle_unusual: |
804 | 0 | if ((tag & 7) == 4 || tag == 0) { |
805 | 0 | ctx->SetLastTag(tag); |
806 | 0 | goto success; |
807 | 0 | } |
808 | 0 | ptr = UnknownFieldParse(tag, |
809 | 0 | _internal_metadata_.mutable_unknown_fields<std::string>(), |
810 | 0 | ptr, ctx); |
811 | 0 | CHK_(ptr != nullptr); |
812 | 0 | continue; |
813 | 0 | } |
814 | 0 | } // switch |
815 | 0 | } // while |
816 | 0 | success: |
817 | 0 | return ptr; |
818 | 0 | failure: |
819 | 0 | ptr = nullptr; |
820 | 0 | goto success; |
821 | 0 | #undef CHK_ |
822 | 0 | } |
823 | | |
824 | | ::PROTOBUF_NAMESPACE_ID::uint8* NBestSentencePieceText::_InternalSerialize( |
825 | 0 | ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { |
826 | | // @@protoc_insertion_point(serialize_to_array_start:sentencepiece.NBestSentencePieceText) |
827 | 0 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
828 | 0 | (void) cached_has_bits; |
829 | | |
830 | | // repeated .sentencepiece.SentencePieceText nbests = 1; |
831 | 0 | for (unsigned int i = 0, |
832 | 0 | n = static_cast<unsigned int>(this->_internal_nbests_size()); i < n; i++) { |
833 | 0 | target = stream->EnsureSpace(target); |
834 | 0 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: |
835 | 0 | InternalWriteMessage(1, this->_internal_nbests(i), target, stream); |
836 | 0 | } |
837 | |
|
838 | 0 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
839 | 0 | target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), |
840 | 0 | static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); |
841 | 0 | } |
842 | | // @@protoc_insertion_point(serialize_to_array_end:sentencepiece.NBestSentencePieceText) |
843 | 0 | return target; |
844 | 0 | } |
845 | | |
846 | 0 | size_t NBestSentencePieceText::ByteSizeLong() const { |
847 | | // @@protoc_insertion_point(message_byte_size_start:sentencepiece.NBestSentencePieceText) |
848 | 0 | size_t total_size = 0; |
849 | |
|
850 | 0 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
851 | | // Prevent compiler warnings about cached_has_bits being unused |
852 | 0 | (void) cached_has_bits; |
853 | | |
854 | | // repeated .sentencepiece.SentencePieceText nbests = 1; |
855 | 0 | total_size += 1UL * this->_internal_nbests_size(); |
856 | 0 | for (const auto& msg : this->nbests_) { |
857 | 0 | total_size += |
858 | 0 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); |
859 | 0 | } |
860 | |
|
861 | 0 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
862 | 0 | total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); |
863 | 0 | } |
864 | 0 | int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); |
865 | 0 | SetCachedSize(cached_size); |
866 | 0 | return total_size; |
867 | 0 | } |
868 | | |
869 | | void NBestSentencePieceText::CheckTypeAndMergeFrom( |
870 | 0 | const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { |
871 | 0 | MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast<const NBestSentencePieceText*>( |
872 | 0 | &from)); |
873 | 0 | } |
874 | | |
875 | 0 | void NBestSentencePieceText::MergeFrom(const NBestSentencePieceText& from) { |
876 | | // @@protoc_insertion_point(class_specific_merge_from_start:sentencepiece.NBestSentencePieceText) |
877 | 0 | GOOGLE_DCHECK_NE(&from, this); |
878 | 0 | _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); |
879 | 0 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
880 | 0 | (void) cached_has_bits; |
881 | |
|
882 | 0 | nbests_.MergeFrom(from.nbests_); |
883 | 0 | } |
884 | | |
885 | 0 | void NBestSentencePieceText::CopyFrom(const NBestSentencePieceText& from) { |
886 | | // @@protoc_insertion_point(class_specific_copy_from_start:sentencepiece.NBestSentencePieceText) |
887 | 0 | if (&from == this) return; |
888 | 0 | Clear(); |
889 | 0 | MergeFrom(from); |
890 | 0 | } |
891 | | |
892 | 0 | bool NBestSentencePieceText::IsInitialized() const { |
893 | 0 | if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(nbests_)) return false; |
894 | 0 | return true; |
895 | 0 | } |
896 | | |
897 | 0 | void NBestSentencePieceText::InternalSwap(NBestSentencePieceText* other) { |
898 | 0 | using std::swap; |
899 | 0 | _internal_metadata_.Swap<std::string>(&other->_internal_metadata_); |
900 | 0 | nbests_.InternalSwap(&other->nbests_); |
901 | 0 | } |
902 | | |
903 | 0 | std::string NBestSentencePieceText::GetTypeName() const { |
904 | 0 | return "sentencepiece.NBestSentencePieceText"; |
905 | 0 | } |
906 | | |
907 | | |
908 | | // @@protoc_insertion_point(namespace_scope) |
909 | | } // namespace sentencepiece |
910 | | PROTOBUF_NAMESPACE_OPEN |
911 | 0 | template<> PROTOBUF_NOINLINE ::sentencepiece::SentencePieceText_SentencePiece* Arena::CreateMaybeMessage< ::sentencepiece::SentencePieceText_SentencePiece >(Arena* arena) { |
912 | 0 | return Arena::CreateMessageInternal< ::sentencepiece::SentencePieceText_SentencePiece >(arena); |
913 | 0 | } |
914 | 0 | template<> PROTOBUF_NOINLINE ::sentencepiece::SentencePieceText* Arena::CreateMaybeMessage< ::sentencepiece::SentencePieceText >(Arena* arena) { |
915 | 0 | return Arena::CreateMessageInternal< ::sentencepiece::SentencePieceText >(arena); |
916 | 0 | } |
917 | 0 | template<> PROTOBUF_NOINLINE ::sentencepiece::NBestSentencePieceText* Arena::CreateMaybeMessage< ::sentencepiece::NBestSentencePieceText >(Arena* arena) { |
918 | 0 | return Arena::CreateMessageInternal< ::sentencepiece::NBestSentencePieceText >(arena); |
919 | 0 | } |
920 | | PROTOBUF_NAMESPACE_CLOSE |
921 | | |
922 | | // @@protoc_insertion_point(global_scope) |
923 | | #include <google/protobuf/port_undef.inc> |