generated_message_util.cc
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 // Author: kenton@google.com (Kenton Varda)
32 // Based on original Protocol Buffers design by
33 // Sanjay Ghemawat, Jeff Dean, and others.
34 
36 
37 #include <limits>
38 
39 #ifndef GOOGLE_PROTOBUF_SUPPORT_WINDOWS_XP
40 // We're only using this as a standard way for getting the thread id.
41 // We're not using any thread functionality.
42 #include <thread> // NOLINT
43 #endif // #ifndef GOOGLE_PROTOBUF_SUPPORT_WINDOWS_XP
44 
45 #include <vector>
46 
57 
58 #include <google/protobuf/port_def.inc>
59 
60 
61 namespace google {
62 namespace protobuf {
63 namespace internal {
64 
65 void DestroyMessage(const void* message) {
66  static_cast<const MessageLite*>(message)->~MessageLite();
67 }
68 void DestroyString(const void* s) {
69  static_cast<const std::string*>(s)->~string();
70 }
71 
73 
74 
75 static bool InitProtobufDefaultsImpl() {
76  fixed_address_empty_string.DefaultConstruct();
78  return true;
79 }
80 
82  static bool is_inited = InitProtobufDefaultsImpl();
83  (void)is_inited;
84 }
85 
87  const void* start = &str;
88  const void* end = &str + 1;
89  if (start <= str.data() && str.data() < end) {
90  // The string's data is stored inside the string object itself.
91  return 0;
92  } else {
93  return str.capacity();
94  }
95 }
96 
97 template <typename T>
98 const T& Get(const void* ptr) {
99  return *static_cast<const T*>(ptr);
100 }
101 
102 // PrimitiveTypeHelper is a wrapper around the interface of WireFormatLite.
103 // WireFormatLite has a very inconvenient interface with respect to template
104 // meta-programming. This class wraps the different named functions into
105 // a single Serialize / SerializeToArray interface.
106 template <int type>
108 
109 template <>
111  typedef bool Type;
112  static void Serialize(const void* ptr, io::CodedOutputStream* output) {
113  WireFormatLite::WriteBoolNoTag(Get<bool>(ptr), output);
114  }
115  static uint8* SerializeToArray(const void* ptr, uint8* buffer) {
116  return WireFormatLite::WriteBoolNoTagToArray(Get<Type>(ptr), buffer);
117  }
118 };
119 
120 template <>
121 struct PrimitiveTypeHelper<WireFormatLite::TYPE_INT32> {
122  typedef int32 Type;
123  static void Serialize(const void* ptr, io::CodedOutputStream* output) {
124  WireFormatLite::WriteInt32NoTag(Get<int32>(ptr), output);
125  }
126  static uint8* SerializeToArray(const void* ptr, uint8* buffer) {
127  return WireFormatLite::WriteInt32NoTagToArray(Get<Type>(ptr), buffer);
128  }
129 };
130 
131 template <>
132 struct PrimitiveTypeHelper<WireFormatLite::TYPE_SINT32> {
133  typedef int32 Type;
134  static void Serialize(const void* ptr, io::CodedOutputStream* output) {
135  WireFormatLite::WriteSInt32NoTag(Get<int32>(ptr), output);
136  }
137  static uint8* SerializeToArray(const void* ptr, uint8* buffer) {
138  return WireFormatLite::WriteSInt32NoTagToArray(Get<Type>(ptr), buffer);
139  }
140 };
141 
142 template <>
143 struct PrimitiveTypeHelper<WireFormatLite::TYPE_UINT32> {
144  typedef uint32 Type;
145  static void Serialize(const void* ptr, io::CodedOutputStream* output) {
146  WireFormatLite::WriteUInt32NoTag(Get<uint32>(ptr), output);
147  }
148  static uint8* SerializeToArray(const void* ptr, uint8* buffer) {
149  return WireFormatLite::WriteUInt32NoTagToArray(Get<Type>(ptr), buffer);
150  }
151 };
152 template <>
153 struct PrimitiveTypeHelper<WireFormatLite::TYPE_INT64> {
154  typedef int64 Type;
155  static void Serialize(const void* ptr, io::CodedOutputStream* output) {
156  WireFormatLite::WriteInt64NoTag(Get<int64>(ptr), output);
157  }
158  static uint8* SerializeToArray(const void* ptr, uint8* buffer) {
159  return WireFormatLite::WriteInt64NoTagToArray(Get<Type>(ptr), buffer);
160  }
161 };
162 
163 template <>
164 struct PrimitiveTypeHelper<WireFormatLite::TYPE_SINT64> {
165  typedef int64 Type;
166  static void Serialize(const void* ptr, io::CodedOutputStream* output) {
167  WireFormatLite::WriteSInt64NoTag(Get<int64>(ptr), output);
168  }
169  static uint8* SerializeToArray(const void* ptr, uint8* buffer) {
170  return WireFormatLite::WriteSInt64NoTagToArray(Get<Type>(ptr), buffer);
171  }
172 };
173 template <>
174 struct PrimitiveTypeHelper<WireFormatLite::TYPE_UINT64> {
175  typedef uint64 Type;
176  static void Serialize(const void* ptr, io::CodedOutputStream* output) {
177  WireFormatLite::WriteUInt64NoTag(Get<uint64>(ptr), output);
178  }
179  static uint8* SerializeToArray(const void* ptr, uint8* buffer) {
180  return WireFormatLite::WriteUInt64NoTagToArray(Get<Type>(ptr), buffer);
181  }
182 };
183 
184 template <>
185 struct PrimitiveTypeHelper<WireFormatLite::TYPE_FIXED32> {
186  typedef uint32 Type;
187  static void Serialize(const void* ptr, io::CodedOutputStream* output) {
188  WireFormatLite::WriteFixed32NoTag(Get<uint32>(ptr), output);
189  }
190  static uint8* SerializeToArray(const void* ptr, uint8* buffer) {
191  return WireFormatLite::WriteFixed32NoTagToArray(Get<Type>(ptr), buffer);
192  }
193 };
194 
195 template <>
196 struct PrimitiveTypeHelper<WireFormatLite::TYPE_FIXED64> {
197  typedef uint64 Type;
198  static void Serialize(const void* ptr, io::CodedOutputStream* output) {
199  WireFormatLite::WriteFixed64NoTag(Get<uint64>(ptr), output);
200  }
201  static uint8* SerializeToArray(const void* ptr, uint8* buffer) {
202  return WireFormatLite::WriteFixed64NoTagToArray(Get<Type>(ptr), buffer);
203  }
204 };
205 
206 template <>
208  : PrimitiveTypeHelper<WireFormatLite::TYPE_INT32> {};
209 
210 template <>
211 struct PrimitiveTypeHelper<WireFormatLite::TYPE_SFIXED32>
212  : PrimitiveTypeHelper<WireFormatLite::TYPE_FIXED32> {
213  typedef int32 Type;
214 };
215 template <>
216 struct PrimitiveTypeHelper<WireFormatLite::TYPE_SFIXED64>
217  : PrimitiveTypeHelper<WireFormatLite::TYPE_FIXED64> {
218  typedef int64 Type;
219 };
220 template <>
222  : PrimitiveTypeHelper<WireFormatLite::TYPE_FIXED32> {
223  typedef float Type;
224 };
225 template <>
227  : PrimitiveTypeHelper<WireFormatLite::TYPE_FIXED64> {
228  typedef double Type;
229 };
230 
231 template <>
232 struct PrimitiveTypeHelper<WireFormatLite::TYPE_STRING> {
233  typedef std::string Type;
234  static void Serialize(const void* ptr, io::CodedOutputStream* output) {
235  const Type& value = *static_cast<const Type*>(ptr);
236  output->WriteVarint32(value.size());
237  output->WriteRawMaybeAliased(value.data(), value.size());
238  }
239  static uint8* SerializeToArray(const void* ptr, uint8* buffer) {
240  const Type& value = *static_cast<const Type*>(ptr);
242  }
243 };
244 
245 template <>
247  : PrimitiveTypeHelper<WireFormatLite::TYPE_STRING> {};
248 
249 
250 template <>
251 struct PrimitiveTypeHelper<FieldMetadata::kInlinedType>
252  : PrimitiveTypeHelper<WireFormatLite::TYPE_STRING> {};
253 
254 // We want to serialize to both CodedOutputStream and directly into byte arrays
255 // without duplicating the code. In fact we might want extra output channels in
256 // the future.
257 template <typename O, int type>
259 
260 template <int type, typename O>
261 void SerializeTo(const void* ptr, O* output) {
263 }
264 
265 template <typename O>
266 void WriteTagTo(uint32 tag, O* output) {
267  SerializeTo<WireFormatLite::TYPE_UINT32>(&tag, output);
268 }
269 
270 template <typename O>
272  SerializeTo<WireFormatLite::TYPE_UINT32>(&length, output);
273 }
274 
275 // Specialization for coded output stream
276 template <int type>
277 struct OutputHelper<io::CodedOutputStream, type> {
278  static void Serialize(const void* ptr, io::CodedOutputStream* output) {
280  }
281 };
282 
283 // Specialization for writing into a plain array
284 struct ArrayOutput {
287 };
288 
289 template <int type>
291  static void Serialize(const void* ptr, ArrayOutput* output) {
293  }
294 };
295 
299 }
300 
302  if (output->is_deterministic) {
303  io::ArrayOutputStream array_stream(output->ptr, INT_MAX);
304  io::CodedOutputStream o(&array_stream);
306  msg->SerializeWithCachedSizes(&o);
307  output->ptr += o.ByteCount();
308  } else {
310  }
311 }
312 
313 // Helper to branch to fast path if possible
315  const FieldMetadata* field_table, int num_fields,
316  int32 cached_size,
318  const uint8* base = reinterpret_cast<const uint8*>(&msg);
319  if (!output->IsSerializationDeterministic()) {
320  // Try the fast path
321  uint8* ptr = output->GetDirectBufferForNBytesAndAdvance(cached_size);
322  if (ptr) {
323  // We use virtual dispatch to enable dedicated generated code for the
324  // fast path.
326  return;
327  }
328  }
329  SerializeInternal(base, field_table, num_fields, output);
330 }
331 
332 // Helper to branch to fast path if possible
334  const FieldMetadata* field_table, int num_fields,
335  int32 cached_size, ArrayOutput* output) {
336  const uint8* base = reinterpret_cast<const uint8*>(&msg);
337  output->ptr = SerializeInternalToArray(base, field_table, num_fields,
338  output->is_deterministic, output->ptr);
339 }
340 
341 // Serializing messages is special as it's not a primitive type and needs an
342 // explicit overload for each output type.
343 template <typename O>
344 void SerializeMessageTo(const MessageLite* msg, const void* table_ptr,
345  O* output) {
346  const SerializationTable* table =
347  static_cast<const SerializationTable*>(table_ptr);
348  if (!table) {
349  // Proto1
352  return;
353  }
354  const FieldMetadata* field_table = table->field_table;
355  const uint8* base = reinterpret_cast<const uint8*>(msg);
356  int cached_size = *reinterpret_cast<const int32*>(base + field_table->offset);
357  WriteLengthTo(cached_size, output);
358  int num_fields = table->num_fields - 1;
359  SerializeMessageDispatch(*msg, field_table + 1, num_fields, cached_size,
360  output);
361 }
362 
363 // Almost the same as above only it doesn't output the length field.
364 template <typename O>
365 void SerializeGroupTo(const MessageLite* msg, const void* table_ptr,
366  O* output) {
367  const SerializationTable* table =
368  static_cast<const SerializationTable*>(table_ptr);
369  if (!table) {
370  // Proto1
372  return;
373  }
374  const FieldMetadata* field_table = table->field_table;
375  const uint8* base = reinterpret_cast<const uint8*>(msg);
376  int cached_size = *reinterpret_cast<const int32*>(base + field_table->offset);
377  int num_fields = table->num_fields - 1;
378  SerializeMessageDispatch(*msg, field_table + 1, num_fields, cached_size,
379  output);
380 }
381 
382 template <int type>
384  template <typename O>
385  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
386  WriteTagTo(md.tag, output);
387  SerializeTo<type>(field, output);
388  }
389 };
390 
391 template <>
392 struct SingularFieldHelper<WireFormatLite::TYPE_STRING> {
393  template <typename O>
394  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
395  WriteTagTo(md.tag, output);
396  SerializeTo<WireFormatLite::TYPE_STRING>(&Get<ArenaStringPtr>(field).Get(),
397  output);
398  }
399 };
400 
401 template <>
403  : SingularFieldHelper<WireFormatLite::TYPE_STRING> {};
404 
405 template <>
406 struct SingularFieldHelper<WireFormatLite::TYPE_GROUP> {
407  template <typename O>
408  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
409  WriteTagTo(md.tag, output);
410  SerializeGroupTo(Get<const MessageLite*>(field),
411  static_cast<const SerializationTable*>(md.ptr), output);
412  WriteTagTo(md.tag + 1, output);
413  }
414 };
415 
416 template <>
417 struct SingularFieldHelper<WireFormatLite::TYPE_MESSAGE> {
418  template <typename O>
419  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
420  WriteTagTo(md.tag, output);
421  SerializeMessageTo(Get<const MessageLite*>(field),
422  static_cast<const SerializationTable*>(md.ptr), output);
423  }
424 };
425 
426 template <>
427 struct SingularFieldHelper<FieldMetadata::kInlinedType> {
428  template <typename O>
429  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
430  WriteTagTo(md.tag, output);
431  SerializeTo<FieldMetadata::kInlinedType>(&Get<std::string>(field), output);
432  }
433 };
434 
435 template <int type>
437  template <typename O>
438  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
439  typedef typename PrimitiveTypeHelper<type>::Type T;
440  const RepeatedField<T>& array = Get<RepeatedField<T> >(field);
441  for (int i = 0; i < array.size(); i++) {
442  WriteTagTo(md.tag, output);
443  SerializeTo<type>(&array[i], output);
444  }
445  }
446 };
447 
448 // We need to use a helper class to get access to the private members
450  public:
451  static int Size(const RepeatedPtrFieldBase& x) { return x.size(); }
452  static void const* Get(const RepeatedPtrFieldBase& x, int idx) {
453  return x.raw_data()[idx];
454  }
455 };
456 
457 template <>
458 struct RepeatedFieldHelper<WireFormatLite::TYPE_STRING> {
459  template <typename O>
460  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
462  Get<internal::RepeatedPtrFieldBase>(field);
463  for (int i = 0; i < AccessorHelper::Size(array); i++) {
464  WriteTagTo(md.tag, output);
465  SerializeTo<WireFormatLite::TYPE_STRING>(AccessorHelper::Get(array, i),
466  output);
467  }
468  }
469 };
470 
471 template <>
473  : RepeatedFieldHelper<WireFormatLite::TYPE_STRING> {};
474 
475 template <>
476 struct RepeatedFieldHelper<WireFormatLite::TYPE_GROUP> {
477  template <typename O>
478  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
480  Get<internal::RepeatedPtrFieldBase>(field);
481  for (int i = 0; i < AccessorHelper::Size(array); i++) {
482  WriteTagTo(md.tag, output);
484  static_cast<const MessageLite*>(AccessorHelper::Get(array, i)),
485  static_cast<const SerializationTable*>(md.ptr), output);
486  WriteTagTo(md.tag + 1, output);
487  }
488  }
489 };
490 
491 template <>
492 struct RepeatedFieldHelper<WireFormatLite::TYPE_MESSAGE> {
493  template <typename O>
494  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
496  Get<internal::RepeatedPtrFieldBase>(field);
497  for (int i = 0; i < AccessorHelper::Size(array); i++) {
498  WriteTagTo(md.tag, output);
500  static_cast<const MessageLite*>(AccessorHelper::Get(array, i)),
501  md.ptr, output);
502  }
503  }
504 };
505 
506 
507 template <>
508 struct RepeatedFieldHelper<FieldMetadata::kInlinedType>
509  : RepeatedFieldHelper<WireFormatLite::TYPE_STRING> {};
510 
511 template <int type>
513  template <typename O>
514  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
515  typedef typename PrimitiveTypeHelper<type>::Type T;
516  const RepeatedField<T>& array = Get<RepeatedField<T> >(field);
517  if (array.empty()) return;
518  WriteTagTo(md.tag, output);
519  int cached_size =
520  Get<int>(static_cast<const uint8*>(field) + sizeof(RepeatedField<T>));
521  WriteLengthTo(cached_size, output);
522  for (int i = 0; i < array.size(); i++) {
523  SerializeTo<type>(&array[i], output);
524  }
525  }
526 };
527 
528 template <>
529 struct PackedFieldHelper<WireFormatLite::TYPE_STRING> {
530  template <typename O>
531  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
532  GOOGLE_LOG(FATAL) << "Not implemented field number " << md.tag << " with type "
533  << md.type;
534  }
535 };
536 
537 template <>
539  : PackedFieldHelper<WireFormatLite::TYPE_STRING> {};
540 template <>
542  : PackedFieldHelper<WireFormatLite::TYPE_STRING> {};
543 template <>
544 struct PackedFieldHelper<WireFormatLite::TYPE_MESSAGE>
545  : PackedFieldHelper<WireFormatLite::TYPE_STRING> {};
546 template <>
547 struct PackedFieldHelper<FieldMetadata::kInlinedType>
548  : PackedFieldHelper<WireFormatLite::TYPE_STRING> {};
549 
550 template <int type>
552  template <typename O>
553  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
555  }
556 };
557 
558 
559 template <>
560 struct OneOfFieldHelper<FieldMetadata::kInlinedType> {
561  template <typename O>
562  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
564  Get<const std::string*>(field), md, output);
565  }
566 };
567 
569  GOOGLE_LOG(FATAL) << "Not implemented field number " << field;
570 }
571 
572 // When switching to c++11 we should make these constexpr functions
573 #define SERIALIZE_TABLE_OP(type, type_class) \
574  ((type - 1) + static_cast<int>(type_class) * FieldMetadata::kNumTypes)
575 
577  FieldMetadata::FieldTypeClass type_class) {
578  return SERIALIZE_TABLE_OP(type, type_class);
579 }
580 
581 template <int type>
582 bool IsNull(const void* ptr) {
583  return *static_cast<const typename PrimitiveTypeHelper<type>::Type*>(ptr) ==
584  0;
585 }
586 
587 template <>
588 bool IsNull<WireFormatLite::TYPE_STRING>(const void* ptr) {
589  return static_cast<const ArenaStringPtr*>(ptr)->Get().size() == 0;
590 }
591 
592 template <>
593 bool IsNull<WireFormatLite::TYPE_BYTES>(const void* ptr) {
594  return static_cast<const ArenaStringPtr*>(ptr)->Get().size() == 0;
595 }
596 
597 template <>
598 bool IsNull<WireFormatLite::TYPE_GROUP>(const void* ptr) {
599  return Get<const MessageLite*>(ptr) == NULL;
600 }
601 
602 template <>
603 bool IsNull<WireFormatLite::TYPE_MESSAGE>(const void* ptr) {
604  return Get<const MessageLite*>(ptr) == NULL;
605 }
606 
607 
608 template <>
609 bool IsNull<FieldMetadata::kInlinedType>(const void* ptr) {
610  return static_cast<const std::string*>(ptr)->empty();
611 }
612 
613 #define SERIALIZERS_FOR_TYPE(type) \
614  case SERIALIZE_TABLE_OP(type, FieldMetadata::kPresence): \
615  if (!IsPresent(base, field_metadata.has_offset)) continue; \
616  SingularFieldHelper<type>::Serialize(ptr, field_metadata, output); \
617  break; \
618  case SERIALIZE_TABLE_OP(type, FieldMetadata::kNoPresence): \
619  if (IsNull<type>(ptr)) continue; \
620  SingularFieldHelper<type>::Serialize(ptr, field_metadata, output); \
621  break; \
622  case SERIALIZE_TABLE_OP(type, FieldMetadata::kRepeated): \
623  RepeatedFieldHelper<type>::Serialize(ptr, field_metadata, output); \
624  break; \
625  case SERIALIZE_TABLE_OP(type, FieldMetadata::kPacked): \
626  PackedFieldHelper<type>::Serialize(ptr, field_metadata, output); \
627  break; \
628  case SERIALIZE_TABLE_OP(type, FieldMetadata::kOneOf): \
629  if (!IsOneofPresent(base, field_metadata.has_offset, field_metadata.tag)) \
630  continue; \
631  OneOfFieldHelper<type>::Serialize(ptr, field_metadata, output); \
632  break
633 
635  const FieldMetadata* field_metadata_table,
636  int32 num_fields, io::CodedOutputStream* output) {
637  SpecialSerializer func = nullptr;
638  for (int i = 0; i < num_fields; i++) {
639  const FieldMetadata& field_metadata = field_metadata_table[i];
640  const uint8* ptr = base + field_metadata.offset;
641  switch (field_metadata.type) {
661 
662  // Special cases
664  func = reinterpret_cast<SpecialSerializer>(
665  const_cast<void*>(field_metadata.ptr));
666  func(base, field_metadata.offset, field_metadata.tag,
667  field_metadata.has_offset, output);
668  break;
669  default:
670  // __builtin_unreachable()
671  SerializeNotImplemented(field_metadata.type);
672  }
673  }
674 }
675 
677  const FieldMetadata* field_metadata_table,
678  int32 num_fields, bool is_deterministic,
679  uint8* buffer) {
680  ArrayOutput array_output = {buffer, is_deterministic};
681  ArrayOutput* output = &array_output;
682  SpecialSerializer func = nullptr;
683  for (int i = 0; i < num_fields; i++) {
684  const FieldMetadata& field_metadata = field_metadata_table[i];
685  const uint8* ptr = base + field_metadata.offset;
686  switch (field_metadata.type) {
706  // Special cases
708  io::ArrayOutputStream array_stream(array_output.ptr, INT_MAX);
709  io::CodedOutputStream output(&array_stream);
710  output.SetSerializationDeterministic(is_deterministic);
711  func = reinterpret_cast<SpecialSerializer>(
712  const_cast<void*>(field_metadata.ptr));
713  func(base, field_metadata.offset, field_metadata.tag,
714  field_metadata.has_offset, &output);
715  array_output.ptr += output.ByteCount();
716  } break;
717  default:
718  // __builtin_unreachable()
719  SerializeNotImplemented(field_metadata.type);
720  }
721  }
722  return array_output.ptr;
723 }
724 #undef SERIALIZERS_FOR_TYPE
725 
727  uint32 has_offset, io::CodedOutputStream* output) {
728  reinterpret_cast<const ExtensionSet*>(ptr + offset)
729  ->SerializeWithCachedSizes(tag, has_offset, output);
730 }
731 
733  uint32 has_offset,
735  output->WriteString(
736  reinterpret_cast<const InternalMetadataWithArenaLite*>(ptr + offset)
737  ->unknown_fields());
738 }
739 
741  if (message) {
742  MessageLite* ret = message->New();
744  return ret;
745  } else {
746  return NULL;
747  }
748 }
749 
751  std::unique_ptr<MessageLite> tmp(m1->New());
752  tmp->CheckTypeAndMergeFrom(*m1);
753  m1->Clear();
754  m1->CheckTypeAndMergeFrom(*m2);
755  m2->Clear();
756  m2->CheckTypeAndMergeFrom(*tmp);
757 }
758 
759 // Returns a message owned by this Arena. This may require Own()ing or
760 // duplicating the message.
761 MessageLite* GetOwnedMessageInternal(Arena* message_arena,
762  MessageLite* submessage,
763  Arena* submessage_arena) {
764  GOOGLE_DCHECK(submessage->GetArena() == submessage_arena);
765  GOOGLE_DCHECK(message_arena != submessage_arena);
766  if (message_arena != NULL && submessage_arena == NULL) {
767  message_arena->Own(submessage);
768  return submessage;
769  } else {
770  MessageLite* ret = submessage->New(message_arena);
771  ret->CheckTypeAndMergeFrom(*submessage);
772  return ret;
773  }
774 }
775 
776 namespace {
777 
778 void InitSCC_DFS(SCCInfoBase* scc) {
779  if (scc->visit_status.load(std::memory_order_relaxed) !=
781  return;
782  scc->visit_status.store(SCCInfoBase::kRunning, std::memory_order_relaxed);
783  // Each base is followed by an array of pointers to deps
784  auto deps = reinterpret_cast<SCCInfoBase* const*>(scc + 1);
785  for (int i = 0; i < scc->num_deps; i++) {
786  if (deps[i]) InitSCC_DFS(deps[i]);
787  }
788  scc->init_func();
789  // Mark done (note we use memory order release here), other threads could
790  // now see this as initialized and thus the initialization must have happened
791  // before.
792  scc->visit_status.store(SCCInfoBase::kInitialized, std::memory_order_release);
793 }
794 
795 } // namespace
796 
798  static WrappedMutex mu{GOOGLE_PROTOBUF_LINKER_INITIALIZED};
799  // Either the default in case no initialization is running or the id of the
800  // thread that is currently initializing.
801 #ifndef GOOGLE_PROTOBUF_SUPPORT_WINDOWS_XP
802  static std::atomic<std::thread::id> runner;
803  auto me = std::this_thread::get_id();
804 #else
805  // This is a lightweight replacement for std::thread::id. std::thread does not
806  // work on Windows XP SP2 with the latest VC++ libraries, because it utilizes
807  // the Concurrency Runtime that is only supported on Windows XP SP3 and above.
808  static std::atomic_llong runner(-1);
809  auto me = ::GetCurrentThreadId();
810 #endif // #ifndef GOOGLE_PROTOBUF_SUPPORT_WINDOWS_XP
811 
812  // This will only happen because the constructor will call InitSCC while
813  // constructing the default instance.
814  if (runner.load(std::memory_order_relaxed) == me) {
815  // Because we're in the process of constructing the default instance.
816  // We can be assured that we're already exploring this SCC.
817  GOOGLE_CHECK_EQ(scc->visit_status.load(std::memory_order_relaxed),
819  return;
820  }
822  mu.Lock();
823  runner.store(me, std::memory_order_relaxed);
824  InitSCC_DFS(scc);
825 
826 #ifndef GOOGLE_PROTOBUF_SUPPORT_WINDOWS_XP
827  runner.store(std::thread::id{}, std::memory_order_relaxed);
828 #else
829  runner.store(-1, std::memory_order_relaxed);
830 #endif // #ifndef GOOGLE_PROTOBUF_SUPPORT_WINDOWS_XP
831 
832  mu.Unlock();
833 }
834 
835 } // namespace internal
836 } // namespace protobuf
837 } // namespace google
google::protobuf.internal::AccessorHelper::Size
static int Size(const RepeatedPtrFieldBase &x)
Definition: generated_message_util.cc:451
table
upb_strtable table
Definition: php/ext/google/protobuf/protobuf.h:1065
SERIALIZERS_FOR_TYPE
#define SERIALIZERS_FOR_TYPE(type)
Definition: generated_message_util.cc:613
GOOGLE_CHECK_EQ
#define GOOGLE_CHECK_EQ(A, B)
Definition: logging.h:156
google::protobuf.internal::IsNull
bool IsNull(const void *ptr)
Definition: generated_message_util.cc:582
google::protobuf.internal::ExtensionSet
Definition: extension_set.h:179
google::protobuf.internal::WireFormatLite::WriteUInt64NoTag
static PROTOBUF_ALWAYS_INLINE void WriteUInt64NoTag(uint64 value, io::CodedOutputStream *output)
Definition: wire_format_lite.h:1289
google::protobuf.internal::WireFormatLite::WriteSInt32NoTag
static PROTOBUF_ALWAYS_INLINE void WriteSInt32NoTag(int32 value, io::CodedOutputStream *output)
Definition: wire_format_lite.h:1293
google::protobuf.internal::InternalMetadataWithArenaLite
Definition: metadata_lite.h:175
arenastring.h
benchmarks.python.py_benchmark.const
const
Definition: py_benchmark.py:14
google::protobuf.internal::SerializeInternalToArray
uint8 * SerializeInternalToArray(const uint8 *base, const FieldMetadata *table, int32 num_fields, bool is_deterministic, uint8 *buffer)
Definition: generated_message_util.cc:676
google::protobuf.internal::WireFormatLite::TYPE_BOOL
@ TYPE_BOOL
Definition: wire_format_lite.h:119
wire_format_lite.h
google::protobuf.internal::FieldMetadata::FieldTypeClass
FieldTypeClass
Definition: generated_message_table_driven.h:96
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_INT32 >::Type
int32 Type
Definition: generated_message_util.cc:122
google::protobuf.internal::InitSCCImpl
void InitSCCImpl(SCCInfoBase *scc)
Definition: generated_message_util.cc:797
google::protobuf.internal::WireFormatLite::TYPE_DOUBLE
@ TYPE_DOUBLE
Definition: wire_format_lite.h:112
end
GLuint GLuint end
Definition: glcorearb.h:2858
google::protobuf.internal::SpecialSerializer
void(* SpecialSerializer)(const uint8 *base, uint32 offset, uint32 tag, uint32 has_offset, io::CodedOutputStream *output)
Definition: generated_message_util.h:132
NULL
NULL
Definition: test_security_zap.cpp:405
google::protobuf.internal::OutputHelper< io::CodedOutputStream, type >::Serialize
static void Serialize(const void *ptr, io::CodedOutputStream *output)
Definition: generated_message_util.cc:278
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_FIXED32 >::SerializeToArray
static uint8 * SerializeToArray(const void *ptr, uint8 *buffer)
Definition: generated_message_util.cc:190
google::protobuf::int64
int64_t int64
Definition: protobuf/src/google/protobuf/stubs/port.h:151
google::protobuf.internal::RepeatedFieldHelper< WireFormatLite::TYPE_STRING >::Serialize
static void Serialize(const void *field, const FieldMetadata &md, O *output)
Definition: generated_message_util.cc:460
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_SINT64 >::Serialize
static void Serialize(const void *ptr, io::CodedOutputStream *output)
Definition: generated_message_util.cc:166
google::protobuf.internal::WireFormatLite::TYPE_INT32
@ TYPE_INT32
Definition: wire_format_lite.h:116
google::protobuf.internal::InitProtobufDefaultsImpl
static bool InitProtobufDefaultsImpl()
Definition: generated_message_util.cc:75
google::protobuf::MessageLite::GetCachedSize
virtual int GetCachedSize() const =0
google::protobuf.internal::FieldMetadata::kInlinedType
@ kInlinedType
Definition: generated_message_table_driven.h:109
google::protobuf.internal::WireFormatLite::WriteUInt64NoTagToArray
static PROTOBUF_ALWAYS_INLINE uint8 * WriteUInt64NoTagToArray(uint64 value, uint8 *target)
Definition: wire_format_lite.h:1375
google::protobuf.internal::Get
const T & Get(const void *ptr)
Definition: generated_message_util.cc:98
google::protobuf::MessageLite::Clear
virtual void Clear()=0
google::protobuf::MessageLite::GetArena
virtual Arena * GetArena() const
Definition: message_lite.h:206
length
GLenum GLuint GLenum GLsizei length
Definition: glcorearb.h:2695
extension_set.h
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_UINT64 >::Serialize
static void Serialize(const void *ptr, io::CodedOutputStream *output)
Definition: generated_message_util.cc:176
base
Definition: logging.cc:2162
google::protobuf.internal::OutputHelper< ArrayOutput, type >::Serialize
static void Serialize(const void *ptr, ArrayOutput *output)
Definition: generated_message_util.cc:291
google::protobuf::uint8
uint8_t uint8
Definition: protobuf/src/google/protobuf/stubs/port.h:153
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_STRING >::SerializeToArray
static uint8 * SerializeToArray(const void *ptr, uint8 *buffer)
Definition: generated_message_util.cc:239
FATAL
const int FATAL
Definition: log_severity.h:60
google::protobuf.internal::PackedFieldHelper
Definition: generated_message_util.cc:512
google::protobuf.internal::SerializeTo
void SerializeTo(const void *ptr, O *output)
Definition: generated_message_util.cc:261
GOOGLE_DCHECK
#define GOOGLE_DCHECK
Definition: logging.h:194
s
XmlRpcServer s
google::protobuf.internal::FieldMetadata::has_offset
uint32 has_offset
Definition: generated_message_table_driven.h:89
google::protobuf.internal::WireFormatLite::TYPE_GROUP
@ TYPE_GROUP
Definition: wire_format_lite.h:121
google::protobuf.internal::WireFormatLite::WriteInt32NoTagToArray
static PROTOBUF_ALWAYS_INLINE uint8 * WriteInt32NoTagToArray(int32 value, uint8 *target)
Definition: wire_format_lite.h:1362
google::protobuf.internal::WireFormatLite::WriteSInt32NoTagToArray
static PROTOBUF_ALWAYS_INLINE uint8 * WriteSInt32NoTagToArray(int32 value, uint8 *target)
Definition: wire_format_lite.h:1379
google::protobuf.internal::PackedFieldHelper< WireFormatLite::TYPE_STRING >::Serialize
static void Serialize(const void *field, const FieldMetadata &md, O *output)
Definition: generated_message_util.cc:531
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_UINT32 >::Type
uint32 Type
Definition: generated_message_util.cc:144
google::protobuf::uint32
uint32_t uint32
Definition: protobuf/src/google/protobuf/stubs/port.h:155
google::protobuf.internal::SCCInfoBase
Definition: generated_message_util.h:181
google::protobuf.internal::OutputHelper
Definition: generated_message_util.cc:258
google::protobuf.internal::ExtensionSerializer
void ExtensionSerializer(const uint8 *ptr, uint32 offset, uint32 tag, uint32 has_offset, io::CodedOutputStream *output)
Definition: generated_message_util.cc:726
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_INT64 >::Serialize
static void Serialize(const void *ptr, io::CodedOutputStream *output)
Definition: generated_message_util.cc:155
string
GLsizei const GLchar *const * string
Definition: glcorearb.h:3083
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_INT32 >::SerializeToArray
static uint8 * SerializeToArray(const void *ptr, uint8 *buffer)
Definition: generated_message_util.cc:126
google::protobuf::io::CodedOutputStream::SetSerializationDeterministic
void SetSerializationDeterministic(bool value)
Definition: coded_stream.h:855
google::protobuf::RepeatedField< T >
google::protobuf.internal::GenericSwap
void GenericSwap(MessageLite *m1, MessageLite *m2)
Definition: generated_message_util.cc:750
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_SINT64 >::Type
int64 Type
Definition: generated_message_util.cc:165
google::protobuf.internal::WireFormatLite::TYPE_UINT64
@ TYPE_UINT64
Definition: wire_format_lite.h:115
google::protobuf.internal::WireFormatLite::WriteBoolNoTag
static PROTOBUF_ALWAYS_INLINE void WriteBoolNoTag(bool value, io::CodedOutputStream *output)
Definition: wire_format_lite.h:1325
google::protobuf.internal::SerializeInternal
PROTOBUF_EXPORT void SerializeInternal(const uint8 *base, const FieldMetadata *table, int32 num_fields, io::CodedOutputStream *output)
Definition: generated_message_util.cc:634
GOOGLE_PROTOBUF_LINKER_INITIALIZED
#define GOOGLE_PROTOBUF_LINKER_INITIALIZED
Definition: protobuf/src/google/protobuf/stubs/mutex.h:70
google::protobuf::MessageLite
Definition: message_lite.h:183
google::protobuf.internal::OneOfFieldHelper::Serialize
static void Serialize(const void *field, const FieldMetadata &md, O *output)
Definition: generated_message_util.cc:553
x
GLint GLenum GLint x
Definition: glcorearb.h:2834
T
#define T(upbtypeconst, upbtype, ctype, default_value)
google::protobuf.internal::FieldMetadata::offset
uint32 offset
Definition: generated_message_table_driven.h:84
google::protobuf.internal::WriteLengthTo
void WriteLengthTo(uint32 length, O *output)
Definition: generated_message_util.cc:271
google::protobuf.internal::InitProtobufDefaults
void InitProtobufDefaults()
Definition: generated_message_util.cc:81
idx
static uint32_t idx(tarjan *t, const upb_refcounted *r)
Definition: ruby/ext/google/protobuf_c/upb.c:5925
google::protobuf.internal::SerializeGroupTo
void SerializeGroupTo(const MessageLite *msg, const void *table_ptr, O *output)
Definition: generated_message_util.cc:365
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_BOOL >::SerializeToArray
static uint8 * SerializeToArray(const void *ptr, uint8 *buffer)
Definition: generated_message_util.cc:115
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_SINT32 >::Serialize
static void Serialize(const void *ptr, io::CodedOutputStream *output)
Definition: generated_message_util.cc:134
google::protobuf.internal::DestroyString
void DestroyString(const void *s)
Definition: generated_message_util.cc:68
google::protobuf::MessageLite::SerializeWithCachedSizes
virtual void SerializeWithCachedSizes(io::CodedOutputStream *output) const
Definition: message_lite.cc:513
google::protobuf::io::CodedOutputStream::ByteCount
int ByteCount() const
Definition: coded_stream.h:1291
google::protobuf::int32
int32_t int32
Definition: protobuf/src/google/protobuf/stubs/port.h:150
google::protobuf.internal::WireFormatLite::TYPE_FIXED64
@ TYPE_FIXED64
Definition: wire_format_lite.h:117
metadata_lite.h
google::protobuf.internal::ArrayOutput
Definition: generated_message_util.cc:284
google::protobuf.internal::ArrayOutput::is_deterministic
bool is_deterministic
Definition: generated_message_util.cc:286
google::protobuf.internal::WireFormatLite::TYPE_SINT64
@ TYPE_SINT64
Definition: wire_format_lite.h:129
Type
Definition: type.pb.h:182
coded_stream.h
google::protobuf.internal::SerializeMessageDispatch
void SerializeMessageDispatch(const MessageLite &msg, const FieldMetadata *field_table, int num_fields, int32 cached_size, io::CodedOutputStream *output)
Definition: generated_message_util.cc:314
google::protobuf.internal::WireFormatLite::TYPE_SFIXED32
@ TYPE_SFIXED32
Definition: wire_format_lite.h:126
google::protobuf.internal::WireFormatLite::WriteInt64NoTagToArray
static PROTOBUF_ALWAYS_INLINE uint8 * WriteInt64NoTagToArray(int64 value, uint8 *target)
Definition: wire_format_lite.h:1366
offset
GLintptr offset
Definition: glcorearb.h:2944
google::protobuf.internal::WireFormatLite::TYPE_FIXED32
@ TYPE_FIXED32
Definition: wire_format_lite.h:118
buffer
GLuint buffer
Definition: glcorearb.h:2939
google::protobuf.internal::WireFormatLite::WriteSInt64NoTag
static PROTOBUF_ALWAYS_INLINE void WriteSInt64NoTag(int64 value, io::CodedOutputStream *output)
Definition: wire_format_lite.h:1297
id
GLenum GLuint id
Definition: glcorearb.h:2695
start
GLuint start
Definition: glcorearb.h:2858
google::protobuf.internal::PrimitiveTypeHelper
Definition: generated_message_util.cc:107
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_FIXED64 >::Serialize
static void Serialize(const void *ptr, io::CodedOutputStream *output)
Definition: generated_message_util.cc:198
update_failure_list.str
str
Definition: update_failure_list.py:41
google::protobuf.internal::WireFormatLite::WriteInt64NoTag
static PROTOBUF_ALWAYS_INLINE void WriteInt64NoTag(int64 value, io::CodedOutputStream *output)
Definition: wire_format_lite.h:1281
google::protobuf.internal::StringSpaceUsedExcludingSelfLong
size_t StringSpaceUsedExcludingSelfLong(const std::string &str)
Definition: generated_message_util.cc:86
google::protobuf.internal::FieldMetadata::tag
uint32 tag
Definition: generated_message_table_driven.h:85
google::protobuf.internal::WireFormatLite::TYPE_MESSAGE
@ TYPE_MESSAGE
Definition: wire_format_lite.h:122
google::protobuf::io::ArrayOutputStream
Definition: zero_copy_stream_impl_lite.h:99
GOOGLE_LOG
#define GOOGLE_LOG(LEVEL)
Definition: logging.h:146
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_STRING >::Serialize
static void Serialize(const void *ptr, io::CodedOutputStream *output)
Definition: generated_message_util.cc:234
google::protobuf.internal::SCCInfoBase::kInitialized
@ kInitialized
Definition: generated_message_util.h:185
google::protobuf.internal::FieldMetadata::type
uint32 type
Definition: generated_message_table_driven.h:90
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_FIXED32 >::Type
uint32 Type
Definition: generated_message_util.cc:186
google::protobuf::uint64
uint64_t uint64
Definition: protobuf/src/google/protobuf/stubs/port.h:156
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_SINT32 >::Type
int32 Type
Definition: generated_message_util.cc:133
google::protobuf.internal::ArrayOutput::ptr
uint8 * ptr
Definition: generated_message_util.cc:285
repeated_field.h
google::protobuf.internal::SingularFieldHelper< FieldMetadata::kInlinedType >::Serialize
static void Serialize(const void *field, const FieldMetadata &md, O *output)
Definition: generated_message_util.cc:429
google::protobuf.internal::FieldMetadata::ptr
const void * ptr
Definition: generated_message_table_driven.h:91
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_STRING >::Type
std::string Type
Definition: generated_message_util.cc:233
google::protobuf.internal::GetOwnedMessageInternal
MessageLite * GetOwnedMessageInternal(Arena *message_arena, MessageLite *submessage, Arena *submessage_arena)
Definition: generated_message_util.cc:761
buffer
Definition: buffer_processor.h:43
generated_message_table_driven.h
google::protobuf.internal::OnShutdownDestroyString
void OnShutdownDestroyString(const std::string *ptr)
Definition: generated_message_util.h:230
google::protobuf.internal::RepeatedFieldHelper
Definition: generated_message_util.cc:436
google::protobuf.internal::WireFormatLite::WriteFixed64NoTagToArray
static PROTOBUF_ALWAYS_INLINE uint8 * WriteFixed64NoTagToArray(uint64 value, uint8 *target)
Definition: wire_format_lite.h:1393
field
const FieldDescriptor * field
Definition: parser_unittest.cc:2694
google::protobuf.internal::WireFormatLite::TYPE_SFIXED64
@ TYPE_SFIXED64
Definition: wire_format_lite.h:127
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_UINT64 >::SerializeToArray
static uint8 * SerializeToArray(const void *ptr, uint8 *buffer)
Definition: generated_message_util.cc:179
google::protobuf.internal::WireFormatLite::TYPE_BYTES
@ TYPE_BYTES
Definition: wire_format_lite.h:123
google::protobuf.internal::DuplicateIfNonNullInternal
MessageLite * DuplicateIfNonNullInternal(MessageLite *message)
Definition: generated_message_util.cc:740
google::protobuf.internal::SingularFieldHelper::Serialize
static void Serialize(const void *field, const FieldMetadata &md, O *output)
Definition: generated_message_util.cc:385
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_FIXED32 >::Serialize
static void Serialize(const void *ptr, io::CodedOutputStream *output)
Definition: generated_message_util.cc:187
void
typedef void(APIENTRY *GLDEBUGPROCARB)(GLenum source
google::protobuf::io::CodedOutputStream
Definition: coded_stream.h:693
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_SINT32 >::SerializeToArray
static uint8 * SerializeToArray(const void *ptr, uint8 *buffer)
Definition: generated_message_util.cc:137
google::protobuf.internal::WireFormatLite::WriteInt32NoTag
static PROTOBUF_ALWAYS_INLINE void WriteInt32NoTag(int32 value, io::CodedOutputStream *output)
Definition: wire_format_lite.h:1277
i
int i
Definition: gmock-matchers_test.cc:764
google::protobuf.internal::SingularFieldHelper< WireFormatLite::TYPE_STRING >::Serialize
static void Serialize(const void *field, const FieldMetadata &md, O *output)
Definition: generated_message_util.cc:394
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_BOOL >::Type
bool Type
Definition: generated_message_util.cc:111
google::protobuf.internal::SCCInfoBase::visit_status
std::atomic< int > visit_status
Definition: generated_message_util.h:197
google::protobuf.internal::WireFormatLite::TYPE_STRING
@ TYPE_STRING
Definition: wire_format_lite.h:120
type
GLenum type
Definition: glcorearb.h:2695
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_UINT32 >::Serialize
static void Serialize(const void *ptr, io::CodedOutputStream *output)
Definition: generated_message_util.cc:145
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_UINT32 >::SerializeToArray
static uint8 * SerializeToArray(const void *ptr, uint8 *buffer)
Definition: generated_message_util.cc:148
google::protobuf.internal::FieldMetadata::kSpecial
@ kSpecial
Definition: generated_message_table_driven.h:111
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_SFIXED64 >::Type
int64 Type
Definition: generated_message_util.cc:218
google::protobuf.internal::SerializeMessageTo
void SerializeMessageTo(const MessageLite *msg, const void *table_ptr, O *output)
Definition: generated_message_util.cc:344
google::protobuf.internal::WireFormatLite::WriteFixed64NoTag
static PROTOBUF_ALWAYS_INLINE void WriteFixed64NoTag(uint64 value, io::CodedOutputStream *output)
Definition: wire_format_lite.h:1305
google::protobuf.internal::PackedFieldHelper::Serialize
static void Serialize(const void *field, const FieldMetadata &md, O *output)
Definition: generated_message_util.cc:514
google::protobuf.internal::DestroyMessage
void DestroyMessage(const void *message)
Definition: generated_message_util.cc:65
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_FIXED64 >::Type
uint64 Type
Definition: generated_message_util.cc:197
google::protobuf.internal::SerializationTable
Definition: generated_message_table_driven.h:234
google::protobuf.internal::SingularFieldHelper< WireFormatLite::TYPE_MESSAGE >::Serialize
static void Serialize(const void *field, const FieldMetadata &md, O *output)
Definition: generated_message_util.cc:419
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_FIXED64 >::SerializeToArray
static uint8 * SerializeToArray(const void *ptr, uint8 *buffer)
Definition: generated_message_util.cc:201
google::protobuf.internal::SingularFieldHelper
Definition: generated_message_util.cc:383
google::protobuf.internal::WireFormatLite::WriteBoolNoTagToArray
static PROTOBUF_ALWAYS_INLINE uint8 * WriteBoolNoTagToArray(bool value, uint8 *target)
Definition: wire_format_lite.h:1417
google::protobuf.internal::fixed_address_empty_string
ExplicitlyConstructed< std::string > fixed_address_empty_string
Definition: generated_message_util.cc:72
google::protobuf.internal::WriteTagTo
void WriteTagTo(uint32 tag, O *output)
Definition: generated_message_util.cc:266
func
GLenum func
Definition: glcorearb.h:3052
message_lite.h
google::protobuf::MessageLite::InternalSerializeWithCachedSizesToArray
virtual uint8 * InternalSerializeWithCachedSizesToArray(uint8 *target) const
Definition: message_lite.cc:528
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_INT64 >::Type
int64 Type
Definition: generated_message_util.cc:154
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_UINT64 >::Type
uint64 Type
Definition: generated_message_util.cc:175
google::protobuf.internal::RepeatedFieldHelper< WireFormatLite::TYPE_GROUP >::Serialize
static void Serialize(const void *field, const FieldMetadata &md, O *output)
Definition: generated_message_util.cc:478
google::protobuf.internal::AccessorHelper::Get
static void const * Get(const RepeatedPtrFieldBase &x, int idx)
Definition: generated_message_util.cc:452
google::protobuf.internal::SerializeNotImplemented
void SerializeNotImplemented(int field)
Definition: generated_message_util.cc:568
google::protobuf::io::CodedOutputStream::WriteStringWithSizeToArray
static uint8 * WriteStringWithSizeToArray(const std::string &str, uint8 *target)
Definition: coded_stream.cc:787
google::protobuf.internal::RepeatedFieldHelper< WireFormatLite::TYPE_MESSAGE >::Serialize
static void Serialize(const void *field, const FieldMetadata &md, O *output)
Definition: generated_message_util.cc:494
generated_message_util.h
google::protobuf.internal::RepeatedPtrFieldBase
Definition: repeated_field.h:459
mutex.h
google::protobuf.internal::WireFormatLite::TYPE_INT64
@ TYPE_INT64
Definition: wire_format_lite.h:114
google::protobuf.internal::OneOfFieldHelper< FieldMetadata::kInlinedType >::Serialize
static void Serialize(const void *field, const FieldMetadata &md, O *output)
Definition: generated_message_util.cc:562
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_INT32 >::Serialize
static void Serialize(const void *ptr, io::CodedOutputStream *output)
Definition: generated_message_util.cc:123
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_FLOAT >::Type
float Type
Definition: generated_message_util.cc:223
coded_stream_inl.h
google::protobuf.internal::WireFormatLite::WriteFixed32NoTag
static PROTOBUF_ALWAYS_INLINE void WriteFixed32NoTag(uint32 value, io::CodedOutputStream *output)
Definition: wire_format_lite.h:1301
google::protobuf.internal::RepeatedFieldHelper::Serialize
static void Serialize(const void *field, const FieldMetadata &md, O *output)
Definition: generated_message_util.cc:438
internal
Definition: any.pb.h:40
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_SINT64 >::SerializeToArray
static uint8 * SerializeToArray(const void *ptr, uint8 *buffer)
Definition: generated_message_util.cc:169
google::protobuf.internal::WireFormatLite::TYPE_SINT32
@ TYPE_SINT32
Definition: wire_format_lite.h:128
google::protobuf.internal::ExplicitlyConstructed
Definition: message_lite.h:123
google::protobuf.internal::FieldMetadata
Definition: generated_message_table_driven.h:83
google::protobuf.internal::WireFormatLite::WriteSInt64NoTagToArray
static PROTOBUF_ALWAYS_INLINE uint8 * WriteSInt64NoTagToArray(int64 value, uint8 *target)
Definition: wire_format_lite.h:1384
value
GLsizei const GLfloat * value
Definition: glcorearb.h:3093
google::protobuf.internal::FieldMetadata::CalculateType
static int CalculateType(int fundamental_type, FieldTypeClass type_class)
Definition: generated_message_util.cc:576
output
const upb_json_parsermethod const upb_symtab upb_sink * output
Definition: ruby/ext/google/protobuf_c/upb.h:10503
google::protobuf.internal::WireFormatLite::TYPE_UINT32
@ TYPE_UINT32
Definition: wire_format_lite.h:124
google::protobuf.internal::WireFormatLite
Definition: wire_format_lite.h:84
google::protobuf::MessageLite::CheckTypeAndMergeFrom
virtual void CheckTypeAndMergeFrom(const MessageLite &other)=0
google::protobuf.internal::SerializeMessageNoTable
void SerializeMessageNoTable(const MessageLite *msg, io::CodedOutputStream *output)
Definition: generated_message_util.cc:296
google::protobuf.internal::WireFormatLite::TYPE_FLOAT
@ TYPE_FLOAT
Definition: wire_format_lite.h:113
google::protobuf.internal::WireFormatLite::WriteFixed32NoTagToArray
static PROTOBUF_ALWAYS_INLINE uint8 * WriteFixed32NoTagToArray(uint32 value, uint8 *target)
Definition: wire_format_lite.h:1389
google::protobuf.internal::UnknownFieldSerializerLite
void UnknownFieldSerializerLite(const uint8 *ptr, uint32 offset, uint32 tag, uint32 has_offset, io::CodedOutputStream *output)
Definition: generated_message_util.cc:732
google::protobuf.internal::WireFormatLite::WriteUInt32NoTag
static PROTOBUF_ALWAYS_INLINE void WriteUInt32NoTag(uint32 value, io::CodedOutputStream *output)
Definition: wire_format_lite.h:1285
google::protobuf.internal::WireFormatLite::WriteUInt32NoTagToArray
static PROTOBUF_ALWAYS_INLINE uint8 * WriteUInt32NoTagToArray(uint32 value, uint8 *target)
Definition: wire_format_lite.h:1371
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_DOUBLE >::Type
double Type
Definition: generated_message_util.cc:228
google::protobuf.internal::OneOfFieldHelper
Definition: generated_message_util.cc:551
google
Definition: data_proto2_to_proto3_util.h:11
google::protobuf.internal::ArenaStringPtr
Definition: arenastring.h:68
message
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glcorearb.h:2695
SERIALIZE_TABLE_OP
#define SERIALIZE_TABLE_OP(type, type_class)
Definition: generated_message_util.cc:573
google::protobuf.internal::WireFormatLite::TYPE_ENUM
@ TYPE_ENUM
Definition: wire_format_lite.h:125
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_INT64 >::SerializeToArray
static uint8 * SerializeToArray(const void *ptr, uint8 *buffer)
Definition: generated_message_util.cc:158
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_SFIXED32 >::Type
int32 Type
Definition: generated_message_util.cc:213
google::protobuf.internal::SingularFieldHelper< WireFormatLite::TYPE_GROUP >::Serialize
static void Serialize(const void *field, const FieldMetadata &md, O *output)
Definition: generated_message_util.cc:408
google::protobuf::MessageLite::New
virtual MessageLite * New() const =0
google::protobuf.internal::AccessorHelper
Definition: generated_message_util.cc:449
google::protobuf.internal::SCCInfoBase::kUninitialized
@ kUninitialized
Definition: generated_message_util.h:187
array
PHP_PROTO_OBJECT_FREE_END PHP_PROTO_OBJECT_DTOR_END intern array
Definition: array.c:111
google::protobuf.internal::PrimitiveTypeHelper< WireFormatLite::TYPE_BOOL >::Serialize
static void Serialize(const void *ptr, io::CodedOutputStream *output)
Definition: generated_message_util.cc:112
google::protobuf.internal::SCCInfoBase::kRunning
@ kRunning
Definition: generated_message_util.h:186


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:51