1 // Generated by the protocol buffer compiler.  DO NOT EDIT!
2 // source: protos/perfetto/trace/test_event.proto
3 
4 #include "protos/perfetto/trace/test_event.pb.h"
5 
6 #include <algorithm>
7 #include <cstdint>
8 
9 #include <google/protobuf/io/coded_stream.h>
10 #include <google/protobuf/extension_set.h>
11 #include <google/protobuf/wire_format_lite.h>
12 #include <google/protobuf/io/zero_copy_stream_impl_lite.h>
13 // @@protoc_insertion_point(includes)
14 #include <google/protobuf/port_def.inc>
15 
16 PROTOBUF_PRAGMA_INIT_SEG
17 
18 namespace _pb = ::PROTOBUF_NAMESPACE_ID;
19 namespace _pbi = _pb::internal;
20 
21 namespace perfetto {
22 namespace protos {
TestEvent_TestPayload(::_pbi::ConstantInitialized)23 PROTOBUF_CONSTEXPR TestEvent_TestPayload::TestEvent_TestPayload(
24     ::_pbi::ConstantInitialized): _impl_{
25     /*decltype(_impl_._has_bits_)*/{}
26   , /*decltype(_impl_._cached_size_)*/{}
27   , /*decltype(_impl_.str_)*/{}
28   , /*decltype(_impl_.nested_)*/{}
29   , /*decltype(_impl_.repeated_ints_)*/{}
30   , /*decltype(_impl_.debug_annotations_)*/{}
31   , /*decltype(_impl_.single_string_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
32   , /*decltype(_impl_.remaining_nesting_depth_)*/0u
33   , /*decltype(_impl_.single_int_)*/0} {}
34 struct TestEvent_TestPayloadDefaultTypeInternal {
TestEvent_TestPayloadDefaultTypeInternalperfetto::protos::TestEvent_TestPayloadDefaultTypeInternal35   PROTOBUF_CONSTEXPR TestEvent_TestPayloadDefaultTypeInternal()
36       : _instance(::_pbi::ConstantInitialized{}) {}
~TestEvent_TestPayloadDefaultTypeInternalperfetto::protos::TestEvent_TestPayloadDefaultTypeInternal37   ~TestEvent_TestPayloadDefaultTypeInternal() {}
38   union {  // NOLINT(misc-non-private-member-variables-in-classes)
39     TestEvent_TestPayload _instance;
40   };
41 };
42 PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 TestEvent_TestPayloadDefaultTypeInternal _TestEvent_TestPayload_default_instance_;
TestEvent(::_pbi::ConstantInitialized)43 PROTOBUF_CONSTEXPR TestEvent::TestEvent(
44     ::_pbi::ConstantInitialized): _impl_{
45     /*decltype(_impl_._has_bits_)*/{}
46   , /*decltype(_impl_._cached_size_)*/{}
47   , /*decltype(_impl_.str_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
48   , /*decltype(_impl_.payload_)*/nullptr
49   , /*decltype(_impl_.counter_)*/::uint64_t{0u}
50   , /*decltype(_impl_.seq_value_)*/0u
51   , /*decltype(_impl_.is_last_)*/false} {}
52 struct TestEventDefaultTypeInternal {
TestEventDefaultTypeInternalperfetto::protos::TestEventDefaultTypeInternal53   PROTOBUF_CONSTEXPR TestEventDefaultTypeInternal()
54       : _instance(::_pbi::ConstantInitialized{}) {}
~TestEventDefaultTypeInternalperfetto::protos::TestEventDefaultTypeInternal55   ~TestEventDefaultTypeInternal() {}
56   union {  // NOLINT(misc-non-private-member-variables-in-classes)
57     TestEvent _instance;
58   };
59 };
60 PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 TestEventDefaultTypeInternal _TestEvent_default_instance_;
61 }  // namespace protos
62 }  // namespace perfetto
63 namespace perfetto {
64 namespace protos {
65 
66 // ===================================================================
67 
68 class TestEvent_TestPayload::_Internal {
69  public:
70   using HasBits = decltype(std::declval<TestEvent_TestPayload>()._impl_._has_bits_);
set_has_single_string(HasBits * has_bits)71   static void set_has_single_string(HasBits* has_bits) {
72     (*has_bits)[0] |= 1u;
73   }
set_has_single_int(HasBits * has_bits)74   static void set_has_single_int(HasBits* has_bits) {
75     (*has_bits)[0] |= 4u;
76   }
set_has_remaining_nesting_depth(HasBits * has_bits)77   static void set_has_remaining_nesting_depth(HasBits* has_bits) {
78     (*has_bits)[0] |= 2u;
79   }
80 };
81 
clear_debug_annotations()82 void TestEvent_TestPayload::clear_debug_annotations() {
83   _impl_.debug_annotations_.Clear();
84 }
TestEvent_TestPayload(::PROTOBUF_NAMESPACE_ID::Arena * arena,bool is_message_owned)85 TestEvent_TestPayload::TestEvent_TestPayload(::PROTOBUF_NAMESPACE_ID::Arena* arena,
86                          bool is_message_owned)
87   : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
88   SharedCtor(arena, is_message_owned);
89   // @@protoc_insertion_point(arena_constructor:perfetto.protos.TestEvent.TestPayload)
90 }
TestEvent_TestPayload(const TestEvent_TestPayload & from)91 TestEvent_TestPayload::TestEvent_TestPayload(const TestEvent_TestPayload& from)
92   : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
93   TestEvent_TestPayload* const _this = this; (void)_this;
94   new (&_impl_) Impl_{
95       decltype(_impl_._has_bits_){from._impl_._has_bits_}
96     , /*decltype(_impl_._cached_size_)*/{}
97     , decltype(_impl_.str_){from._impl_.str_}
98     , decltype(_impl_.nested_){from._impl_.nested_}
99     , decltype(_impl_.repeated_ints_){from._impl_.repeated_ints_}
100     , decltype(_impl_.debug_annotations_){from._impl_.debug_annotations_}
101     , decltype(_impl_.single_string_){}
102     , decltype(_impl_.remaining_nesting_depth_){}
103     , decltype(_impl_.single_int_){}};
104 
105   _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
106   _impl_.single_string_.InitDefault();
107   #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
108     _impl_.single_string_.Set("", GetArenaForAllocation());
109   #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
110   if (from._internal_has_single_string()) {
111     _this->_impl_.single_string_.Set(from._internal_single_string(),
112       _this->GetArenaForAllocation());
113   }
114   ::memcpy(&_impl_.remaining_nesting_depth_, &from._impl_.remaining_nesting_depth_,
115     static_cast<size_t>(reinterpret_cast<char*>(&_impl_.single_int_) -
116     reinterpret_cast<char*>(&_impl_.remaining_nesting_depth_)) + sizeof(_impl_.single_int_));
117   // @@protoc_insertion_point(copy_constructor:perfetto.protos.TestEvent.TestPayload)
118 }
119 
SharedCtor(::_pb::Arena * arena,bool is_message_owned)120 inline void TestEvent_TestPayload::SharedCtor(
121     ::_pb::Arena* arena, bool is_message_owned) {
122   (void)arena;
123   (void)is_message_owned;
124   new (&_impl_) Impl_{
125       decltype(_impl_._has_bits_){}
126     , /*decltype(_impl_._cached_size_)*/{}
127     , decltype(_impl_.str_){arena}
128     , decltype(_impl_.nested_){arena}
129     , decltype(_impl_.repeated_ints_){arena}
130     , decltype(_impl_.debug_annotations_){arena}
131     , decltype(_impl_.single_string_){}
132     , decltype(_impl_.remaining_nesting_depth_){0u}
133     , decltype(_impl_.single_int_){0}
134   };
135   _impl_.single_string_.InitDefault();
136   #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
137     _impl_.single_string_.Set("", GetArenaForAllocation());
138   #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
139 }
140 
~TestEvent_TestPayload()141 TestEvent_TestPayload::~TestEvent_TestPayload() {
142   // @@protoc_insertion_point(destructor:perfetto.protos.TestEvent.TestPayload)
143   if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
144   (void)arena;
145     return;
146   }
147   SharedDtor();
148 }
149 
SharedDtor()150 inline void TestEvent_TestPayload::SharedDtor() {
151   GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
152   _impl_.str_.~RepeatedPtrField();
153   _impl_.nested_.~RepeatedPtrField();
154   _impl_.repeated_ints_.~RepeatedField();
155   _impl_.debug_annotations_.~RepeatedPtrField();
156   _impl_.single_string_.Destroy();
157 }
158 
SetCachedSize(int size) const159 void TestEvent_TestPayload::SetCachedSize(int size) const {
160   _impl_._cached_size_.Set(size);
161 }
162 
Clear()163 void TestEvent_TestPayload::Clear() {
164 // @@protoc_insertion_point(message_clear_start:perfetto.protos.TestEvent.TestPayload)
165   ::uint32_t cached_has_bits = 0;
166   // Prevent compiler warnings about cached_has_bits being unused
167   (void) cached_has_bits;
168 
169   _impl_.str_.Clear();
170   _impl_.nested_.Clear();
171   _impl_.repeated_ints_.Clear();
172   _impl_.debug_annotations_.Clear();
173   cached_has_bits = _impl_._has_bits_[0];
174   if (cached_has_bits & 0x00000001u) {
175     _impl_.single_string_.ClearNonDefaultToEmpty();
176   }
177   if (cached_has_bits & 0x00000006u) {
178     ::memset(&_impl_.remaining_nesting_depth_, 0, static_cast<size_t>(
179         reinterpret_cast<char*>(&_impl_.single_int_) -
180         reinterpret_cast<char*>(&_impl_.remaining_nesting_depth_)) + sizeof(_impl_.single_int_));
181   }
182   _impl_._has_bits_.Clear();
183   _internal_metadata_.Clear<std::string>();
184 }
185 
_InternalParse(const char * ptr,::_pbi::ParseContext * ctx)186 const char* TestEvent_TestPayload::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
187 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
188   _Internal::HasBits has_bits{};
189   while (!ctx->Done(&ptr)) {
190     ::uint32_t tag;
191     ptr = ::_pbi::ReadTag(ptr, &tag);
192     switch (tag >> 3) {
193       // repeated string str = 1;
194       case 1:
195         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 10)) {
196           ptr -= 1;
197           do {
198             ptr += 1;
199             auto str = _internal_add_str();
200             ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
201             CHK_(ptr);
202             if (!ctx->DataAvailable(ptr)) break;
203           } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr));
204         } else {
205           goto handle_unusual;
206         }
207         continue;
208       // repeated .perfetto.protos.TestEvent.TestPayload nested = 2;
209       case 2:
210         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 18)) {
211           ptr -= 1;
212           do {
213             ptr += 1;
214             ptr = ctx->ParseMessage(_internal_add_nested(), ptr);
215             CHK_(ptr);
216             if (!ctx->DataAvailable(ptr)) break;
217           } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr));
218         } else {
219           goto handle_unusual;
220         }
221         continue;
222       // optional uint32 remaining_nesting_depth = 3;
223       case 3:
224         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 24)) {
225           _Internal::set_has_remaining_nesting_depth(&has_bits);
226           _impl_.remaining_nesting_depth_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
227           CHK_(ptr);
228         } else {
229           goto handle_unusual;
230         }
231         continue;
232       // optional string single_string = 4;
233       case 4:
234         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 34)) {
235           auto str = _internal_mutable_single_string();
236           ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
237           CHK_(ptr);
238         } else {
239           goto handle_unusual;
240         }
241         continue;
242       // optional int32 single_int = 5;
243       case 5:
244         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 40)) {
245           _Internal::set_has_single_int(&has_bits);
246           _impl_.single_int_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
247           CHK_(ptr);
248         } else {
249           goto handle_unusual;
250         }
251         continue;
252       // repeated int32 repeated_ints = 6;
253       case 6:
254         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 48)) {
255           ptr -= 1;
256           do {
257             ptr += 1;
258             _internal_add_repeated_ints(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr));
259             CHK_(ptr);
260             if (!ctx->DataAvailable(ptr)) break;
261           } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<48>(ptr));
262         } else if (static_cast<::uint8_t>(tag) == 50) {
263           ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_repeated_ints(), ptr, ctx);
264           CHK_(ptr);
265         } else {
266           goto handle_unusual;
267         }
268         continue;
269       // repeated .perfetto.protos.DebugAnnotation debug_annotations = 7;
270       case 7:
271         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 58)) {
272           ptr -= 1;
273           do {
274             ptr += 1;
275             ptr = ctx->ParseMessage(_internal_add_debug_annotations(), ptr);
276             CHK_(ptr);
277             if (!ctx->DataAvailable(ptr)) break;
278           } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<58>(ptr));
279         } else {
280           goto handle_unusual;
281         }
282         continue;
283       default:
284         goto handle_unusual;
285     }  // switch
286   handle_unusual:
287     if ((tag == 0) || ((tag & 7) == 4)) {
288       CHK_(ptr);
289       ctx->SetLastTag(tag);
290       goto message_done;
291     }
292     ptr = UnknownFieldParse(
293         tag,
294         _internal_metadata_.mutable_unknown_fields<std::string>(),
295         ptr, ctx);
296     CHK_(ptr != nullptr);
297   }  // while
298 message_done:
299   _impl_._has_bits_.Or(has_bits);
300   return ptr;
301 failure:
302   ptr = nullptr;
303   goto message_done;
304 #undef CHK_
305 }
306 
_InternalSerialize(::uint8_t * target,::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream * stream) const307 ::uint8_t* TestEvent_TestPayload::_InternalSerialize(
308     ::uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
309   // @@protoc_insertion_point(serialize_to_array_start:perfetto.protos.TestEvent.TestPayload)
310   ::uint32_t cached_has_bits = 0;
311   (void) cached_has_bits;
312 
313   // repeated string str = 1;
314   for (int i = 0, n = this->_internal_str_size(); i < n; i++) {
315     const auto& s = this->_internal_str(i);
316     target = stream->WriteString(1, s, target);
317   }
318 
319   // repeated .perfetto.protos.TestEvent.TestPayload nested = 2;
320   for (unsigned i = 0,
321       n = static_cast<unsigned>(this->_internal_nested_size()); i < n; i++) {
322     const auto& repfield = this->_internal_nested(i);
323     target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
324         InternalWriteMessage(2, repfield, repfield.GetCachedSize(), target, stream);
325   }
326 
327   cached_has_bits = _impl_._has_bits_[0];
328   // optional uint32 remaining_nesting_depth = 3;
329   if (cached_has_bits & 0x00000002u) {
330     target = stream->EnsureSpace(target);
331     target = ::_pbi::WireFormatLite::WriteUInt32ToArray(3, this->_internal_remaining_nesting_depth(), target);
332   }
333 
334   // optional string single_string = 4;
335   if (cached_has_bits & 0x00000001u) {
336     target = stream->WriteStringMaybeAliased(
337         4, this->_internal_single_string(), target);
338   }
339 
340   // optional int32 single_int = 5;
341   if (cached_has_bits & 0x00000004u) {
342     target = stream->EnsureSpace(target);
343     target = ::_pbi::WireFormatLite::WriteInt32ToArray(5, this->_internal_single_int(), target);
344   }
345 
346   // repeated int32 repeated_ints = 6;
347   for (int i = 0, n = this->_internal_repeated_ints_size(); i < n; i++) {
348     target = stream->EnsureSpace(target);
349     target = ::_pbi::WireFormatLite::WriteInt32ToArray(6, this->_internal_repeated_ints(i), target);
350   }
351 
352   // repeated .perfetto.protos.DebugAnnotation debug_annotations = 7;
353   for (unsigned i = 0,
354       n = static_cast<unsigned>(this->_internal_debug_annotations_size()); i < n; i++) {
355     const auto& repfield = this->_internal_debug_annotations(i);
356     target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
357         InternalWriteMessage(7, repfield, repfield.GetCachedSize(), target, stream);
358   }
359 
360   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
361     target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
362         static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
363   }
364   // @@protoc_insertion_point(serialize_to_array_end:perfetto.protos.TestEvent.TestPayload)
365   return target;
366 }
367 
ByteSizeLong() const368 size_t TestEvent_TestPayload::ByteSizeLong() const {
369 // @@protoc_insertion_point(message_byte_size_start:perfetto.protos.TestEvent.TestPayload)
370   size_t total_size = 0;
371 
372   ::uint32_t cached_has_bits = 0;
373   // Prevent compiler warnings about cached_has_bits being unused
374   (void) cached_has_bits;
375 
376   // repeated string str = 1;
377   total_size += 1 *
378       ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(_impl_.str_.size());
379   for (int i = 0, n = _impl_.str_.size(); i < n; i++) {
380     total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
381       _impl_.str_.Get(i));
382   }
383 
384   // repeated .perfetto.protos.TestEvent.TestPayload nested = 2;
385   total_size += 1UL * this->_internal_nested_size();
386   for (const auto& msg : this->_impl_.nested_) {
387     total_size +=
388       ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
389   }
390 
391   // repeated int32 repeated_ints = 6;
392   {
393     size_t data_size = ::_pbi::WireFormatLite::
394       Int32Size(this->_impl_.repeated_ints_);
395     total_size += 1 *
396                   ::_pbi::FromIntSize(this->_internal_repeated_ints_size());
397     total_size += data_size;
398   }
399 
400   // repeated .perfetto.protos.DebugAnnotation debug_annotations = 7;
401   total_size += 1UL * this->_internal_debug_annotations_size();
402   for (const auto& msg : this->_impl_.debug_annotations_) {
403     total_size +=
404       ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
405   }
406 
407   cached_has_bits = _impl_._has_bits_[0];
408   if (cached_has_bits & 0x00000007u) {
409     // optional string single_string = 4;
410     if (cached_has_bits & 0x00000001u) {
411       total_size += 1 +
412         ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
413           this->_internal_single_string());
414     }
415 
416     // optional uint32 remaining_nesting_depth = 3;
417     if (cached_has_bits & 0x00000002u) {
418       total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_remaining_nesting_depth());
419     }
420 
421     // optional int32 single_int = 5;
422     if (cached_has_bits & 0x00000004u) {
423       total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_single_int());
424     }
425 
426   }
427   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
428     total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
429   }
430   int cached_size = ::_pbi::ToCachedSize(total_size);
431   SetCachedSize(cached_size);
432   return total_size;
433 }
434 
CheckTypeAndMergeFrom(const::PROTOBUF_NAMESPACE_ID::MessageLite & from)435 void TestEvent_TestPayload::CheckTypeAndMergeFrom(
436     const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
437   MergeFrom(*::_pbi::DownCast<const TestEvent_TestPayload*>(
438       &from));
439 }
440 
MergeFrom(const TestEvent_TestPayload & from)441 void TestEvent_TestPayload::MergeFrom(const TestEvent_TestPayload& from) {
442   TestEvent_TestPayload* const _this = this;
443   // @@protoc_insertion_point(class_specific_merge_from_start:perfetto.protos.TestEvent.TestPayload)
444   GOOGLE_DCHECK_NE(&from, _this);
445   ::uint32_t cached_has_bits = 0;
446   (void) cached_has_bits;
447 
448   _this->_impl_.str_.MergeFrom(from._impl_.str_);
449   _this->_impl_.nested_.MergeFrom(from._impl_.nested_);
450   _this->_impl_.repeated_ints_.MergeFrom(from._impl_.repeated_ints_);
451   _this->_impl_.debug_annotations_.MergeFrom(from._impl_.debug_annotations_);
452   cached_has_bits = from._impl_._has_bits_[0];
453   if (cached_has_bits & 0x00000007u) {
454     if (cached_has_bits & 0x00000001u) {
455       _this->_internal_set_single_string(from._internal_single_string());
456     }
457     if (cached_has_bits & 0x00000002u) {
458       _this->_impl_.remaining_nesting_depth_ = from._impl_.remaining_nesting_depth_;
459     }
460     if (cached_has_bits & 0x00000004u) {
461       _this->_impl_.single_int_ = from._impl_.single_int_;
462     }
463     _this->_impl_._has_bits_[0] |= cached_has_bits;
464   }
465   _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
466 }
467 
CopyFrom(const TestEvent_TestPayload & from)468 void TestEvent_TestPayload::CopyFrom(const TestEvent_TestPayload& from) {
469 // @@protoc_insertion_point(class_specific_copy_from_start:perfetto.protos.TestEvent.TestPayload)
470   if (&from == this) return;
471   Clear();
472   MergeFrom(from);
473 }
474 
IsInitialized() const475 bool TestEvent_TestPayload::IsInitialized() const {
476   return true;
477 }
478 
InternalSwap(TestEvent_TestPayload * other)479 void TestEvent_TestPayload::InternalSwap(TestEvent_TestPayload* other) {
480   using std::swap;
481   auto* lhs_arena = GetArenaForAllocation();
482   auto* rhs_arena = other->GetArenaForAllocation();
483   _internal_metadata_.InternalSwap(&other->_internal_metadata_);
484   swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
485   _impl_.str_.InternalSwap(&other->_impl_.str_);
486   _impl_.nested_.InternalSwap(&other->_impl_.nested_);
487   _impl_.repeated_ints_.InternalSwap(&other->_impl_.repeated_ints_);
488   _impl_.debug_annotations_.InternalSwap(&other->_impl_.debug_annotations_);
489   ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
490       &_impl_.single_string_, lhs_arena,
491       &other->_impl_.single_string_, rhs_arena
492   );
493   ::PROTOBUF_NAMESPACE_ID::internal::memswap<
494       PROTOBUF_FIELD_OFFSET(TestEvent_TestPayload, _impl_.single_int_)
495       + sizeof(TestEvent_TestPayload::_impl_.single_int_)  // NOLINT
496       - PROTOBUF_FIELD_OFFSET(TestEvent_TestPayload, _impl_.remaining_nesting_depth_)>(
497           reinterpret_cast<char*>(&_impl_.remaining_nesting_depth_),
498           reinterpret_cast<char*>(&other->_impl_.remaining_nesting_depth_));
499 }
500 
GetTypeName() const501 std::string TestEvent_TestPayload::GetTypeName() const {
502   return "perfetto.protos.TestEvent.TestPayload";
503 }
504 
505 
506 // ===================================================================
507 
508 class TestEvent::_Internal {
509  public:
510   using HasBits = decltype(std::declval<TestEvent>()._impl_._has_bits_);
set_has_str(HasBits * has_bits)511   static void set_has_str(HasBits* has_bits) {
512     (*has_bits)[0] |= 1u;
513   }
set_has_seq_value(HasBits * has_bits)514   static void set_has_seq_value(HasBits* has_bits) {
515     (*has_bits)[0] |= 8u;
516   }
set_has_counter(HasBits * has_bits)517   static void set_has_counter(HasBits* has_bits) {
518     (*has_bits)[0] |= 4u;
519   }
set_has_is_last(HasBits * has_bits)520   static void set_has_is_last(HasBits* has_bits) {
521     (*has_bits)[0] |= 16u;
522   }
523   static const ::perfetto::protos::TestEvent_TestPayload& payload(const TestEvent* msg);
set_has_payload(HasBits * has_bits)524   static void set_has_payload(HasBits* has_bits) {
525     (*has_bits)[0] |= 2u;
526   }
527 };
528 
529 const ::perfetto::protos::TestEvent_TestPayload&
payload(const TestEvent * msg)530 TestEvent::_Internal::payload(const TestEvent* msg) {
531   return *msg->_impl_.payload_;
532 }
TestEvent(::PROTOBUF_NAMESPACE_ID::Arena * arena,bool is_message_owned)533 TestEvent::TestEvent(::PROTOBUF_NAMESPACE_ID::Arena* arena,
534                          bool is_message_owned)
535   : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
536   SharedCtor(arena, is_message_owned);
537   // @@protoc_insertion_point(arena_constructor:perfetto.protos.TestEvent)
538 }
TestEvent(const TestEvent & from)539 TestEvent::TestEvent(const TestEvent& from)
540   : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
541   TestEvent* const _this = this; (void)_this;
542   new (&_impl_) Impl_{
543       decltype(_impl_._has_bits_){from._impl_._has_bits_}
544     , /*decltype(_impl_._cached_size_)*/{}
545     , decltype(_impl_.str_){}
546     , decltype(_impl_.payload_){nullptr}
547     , decltype(_impl_.counter_){}
548     , decltype(_impl_.seq_value_){}
549     , decltype(_impl_.is_last_){}};
550 
551   _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
552   _impl_.str_.InitDefault();
553   #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
554     _impl_.str_.Set("", GetArenaForAllocation());
555   #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
556   if (from._internal_has_str()) {
557     _this->_impl_.str_.Set(from._internal_str(),
558       _this->GetArenaForAllocation());
559   }
560   if (from._internal_has_payload()) {
561     _this->_impl_.payload_ = new ::perfetto::protos::TestEvent_TestPayload(*from._impl_.payload_);
562   }
563   ::memcpy(&_impl_.counter_, &from._impl_.counter_,
564     static_cast<size_t>(reinterpret_cast<char*>(&_impl_.is_last_) -
565     reinterpret_cast<char*>(&_impl_.counter_)) + sizeof(_impl_.is_last_));
566   // @@protoc_insertion_point(copy_constructor:perfetto.protos.TestEvent)
567 }
568 
SharedCtor(::_pb::Arena * arena,bool is_message_owned)569 inline void TestEvent::SharedCtor(
570     ::_pb::Arena* arena, bool is_message_owned) {
571   (void)arena;
572   (void)is_message_owned;
573   new (&_impl_) Impl_{
574       decltype(_impl_._has_bits_){}
575     , /*decltype(_impl_._cached_size_)*/{}
576     , decltype(_impl_.str_){}
577     , decltype(_impl_.payload_){nullptr}
578     , decltype(_impl_.counter_){::uint64_t{0u}}
579     , decltype(_impl_.seq_value_){0u}
580     , decltype(_impl_.is_last_){false}
581   };
582   _impl_.str_.InitDefault();
583   #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
584     _impl_.str_.Set("", GetArenaForAllocation());
585   #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
586 }
587 
~TestEvent()588 TestEvent::~TestEvent() {
589   // @@protoc_insertion_point(destructor:perfetto.protos.TestEvent)
590   if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
591   (void)arena;
592     return;
593   }
594   SharedDtor();
595 }
596 
SharedDtor()597 inline void TestEvent::SharedDtor() {
598   GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
599   _impl_.str_.Destroy();
600   if (this != internal_default_instance()) delete _impl_.payload_;
601 }
602 
SetCachedSize(int size) const603 void TestEvent::SetCachedSize(int size) const {
604   _impl_._cached_size_.Set(size);
605 }
606 
Clear()607 void TestEvent::Clear() {
608 // @@protoc_insertion_point(message_clear_start:perfetto.protos.TestEvent)
609   ::uint32_t cached_has_bits = 0;
610   // Prevent compiler warnings about cached_has_bits being unused
611   (void) cached_has_bits;
612 
613   cached_has_bits = _impl_._has_bits_[0];
614   if (cached_has_bits & 0x00000003u) {
615     if (cached_has_bits & 0x00000001u) {
616       _impl_.str_.ClearNonDefaultToEmpty();
617     }
618     if (cached_has_bits & 0x00000002u) {
619       GOOGLE_DCHECK(_impl_.payload_ != nullptr);
620       _impl_.payload_->Clear();
621     }
622   }
623   if (cached_has_bits & 0x0000001cu) {
624     ::memset(&_impl_.counter_, 0, static_cast<size_t>(
625         reinterpret_cast<char*>(&_impl_.is_last_) -
626         reinterpret_cast<char*>(&_impl_.counter_)) + sizeof(_impl_.is_last_));
627   }
628   _impl_._has_bits_.Clear();
629   _internal_metadata_.Clear<std::string>();
630 }
631 
_InternalParse(const char * ptr,::_pbi::ParseContext * ctx)632 const char* TestEvent::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
633 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
634   _Internal::HasBits has_bits{};
635   while (!ctx->Done(&ptr)) {
636     ::uint32_t tag;
637     ptr = ::_pbi::ReadTag(ptr, &tag);
638     switch (tag >> 3) {
639       // optional string str = 1;
640       case 1:
641         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 10)) {
642           auto str = _internal_mutable_str();
643           ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
644           CHK_(ptr);
645         } else {
646           goto handle_unusual;
647         }
648         continue;
649       // optional uint32 seq_value = 2;
650       case 2:
651         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 16)) {
652           _Internal::set_has_seq_value(&has_bits);
653           _impl_.seq_value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
654           CHK_(ptr);
655         } else {
656           goto handle_unusual;
657         }
658         continue;
659       // optional uint64 counter = 3;
660       case 3:
661         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 24)) {
662           _Internal::set_has_counter(&has_bits);
663           _impl_.counter_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
664           CHK_(ptr);
665         } else {
666           goto handle_unusual;
667         }
668         continue;
669       // optional bool is_last = 4;
670       case 4:
671         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 32)) {
672           _Internal::set_has_is_last(&has_bits);
673           _impl_.is_last_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
674           CHK_(ptr);
675         } else {
676           goto handle_unusual;
677         }
678         continue;
679       // optional .perfetto.protos.TestEvent.TestPayload payload = 5;
680       case 5:
681         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 42)) {
682           ptr = ctx->ParseMessage(_internal_mutable_payload(), ptr);
683           CHK_(ptr);
684         } else {
685           goto handle_unusual;
686         }
687         continue;
688       default:
689         goto handle_unusual;
690     }  // switch
691   handle_unusual:
692     if ((tag == 0) || ((tag & 7) == 4)) {
693       CHK_(ptr);
694       ctx->SetLastTag(tag);
695       goto message_done;
696     }
697     ptr = UnknownFieldParse(
698         tag,
699         _internal_metadata_.mutable_unknown_fields<std::string>(),
700         ptr, ctx);
701     CHK_(ptr != nullptr);
702   }  // while
703 message_done:
704   _impl_._has_bits_.Or(has_bits);
705   return ptr;
706 failure:
707   ptr = nullptr;
708   goto message_done;
709 #undef CHK_
710 }
711 
_InternalSerialize(::uint8_t * target,::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream * stream) const712 ::uint8_t* TestEvent::_InternalSerialize(
713     ::uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
714   // @@protoc_insertion_point(serialize_to_array_start:perfetto.protos.TestEvent)
715   ::uint32_t cached_has_bits = 0;
716   (void) cached_has_bits;
717 
718   cached_has_bits = _impl_._has_bits_[0];
719   // optional string str = 1;
720   if (cached_has_bits & 0x00000001u) {
721     target = stream->WriteStringMaybeAliased(
722         1, this->_internal_str(), target);
723   }
724 
725   // optional uint32 seq_value = 2;
726   if (cached_has_bits & 0x00000008u) {
727     target = stream->EnsureSpace(target);
728     target = ::_pbi::WireFormatLite::WriteUInt32ToArray(2, this->_internal_seq_value(), target);
729   }
730 
731   // optional uint64 counter = 3;
732   if (cached_has_bits & 0x00000004u) {
733     target = stream->EnsureSpace(target);
734     target = ::_pbi::WireFormatLite::WriteUInt64ToArray(3, this->_internal_counter(), target);
735   }
736 
737   // optional bool is_last = 4;
738   if (cached_has_bits & 0x00000010u) {
739     target = stream->EnsureSpace(target);
740     target = ::_pbi::WireFormatLite::WriteBoolToArray(4, this->_internal_is_last(), target);
741   }
742 
743   // optional .perfetto.protos.TestEvent.TestPayload payload = 5;
744   if (cached_has_bits & 0x00000002u) {
745     target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
746       InternalWriteMessage(5, _Internal::payload(this),
747         _Internal::payload(this).GetCachedSize(), target, stream);
748   }
749 
750   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
751     target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
752         static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
753   }
754   // @@protoc_insertion_point(serialize_to_array_end:perfetto.protos.TestEvent)
755   return target;
756 }
757 
ByteSizeLong() const758 size_t TestEvent::ByteSizeLong() const {
759 // @@protoc_insertion_point(message_byte_size_start:perfetto.protos.TestEvent)
760   size_t total_size = 0;
761 
762   ::uint32_t cached_has_bits = 0;
763   // Prevent compiler warnings about cached_has_bits being unused
764   (void) cached_has_bits;
765 
766   cached_has_bits = _impl_._has_bits_[0];
767   if (cached_has_bits & 0x0000001fu) {
768     // optional string str = 1;
769     if (cached_has_bits & 0x00000001u) {
770       total_size += 1 +
771         ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
772           this->_internal_str());
773     }
774 
775     // optional .perfetto.protos.TestEvent.TestPayload payload = 5;
776     if (cached_has_bits & 0x00000002u) {
777       total_size += 1 +
778         ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
779           *_impl_.payload_);
780     }
781 
782     // optional uint64 counter = 3;
783     if (cached_has_bits & 0x00000004u) {
784       total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_counter());
785     }
786 
787     // optional uint32 seq_value = 2;
788     if (cached_has_bits & 0x00000008u) {
789       total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_seq_value());
790     }
791 
792     // optional bool is_last = 4;
793     if (cached_has_bits & 0x00000010u) {
794       total_size += 1 + 1;
795     }
796 
797   }
798   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
799     total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
800   }
801   int cached_size = ::_pbi::ToCachedSize(total_size);
802   SetCachedSize(cached_size);
803   return total_size;
804 }
805 
CheckTypeAndMergeFrom(const::PROTOBUF_NAMESPACE_ID::MessageLite & from)806 void TestEvent::CheckTypeAndMergeFrom(
807     const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
808   MergeFrom(*::_pbi::DownCast<const TestEvent*>(
809       &from));
810 }
811 
MergeFrom(const TestEvent & from)812 void TestEvent::MergeFrom(const TestEvent& from) {
813   TestEvent* const _this = this;
814   // @@protoc_insertion_point(class_specific_merge_from_start:perfetto.protos.TestEvent)
815   GOOGLE_DCHECK_NE(&from, _this);
816   ::uint32_t cached_has_bits = 0;
817   (void) cached_has_bits;
818 
819   cached_has_bits = from._impl_._has_bits_[0];
820   if (cached_has_bits & 0x0000001fu) {
821     if (cached_has_bits & 0x00000001u) {
822       _this->_internal_set_str(from._internal_str());
823     }
824     if (cached_has_bits & 0x00000002u) {
825       _this->_internal_mutable_payload()->::perfetto::protos::TestEvent_TestPayload::MergeFrom(
826           from._internal_payload());
827     }
828     if (cached_has_bits & 0x00000004u) {
829       _this->_impl_.counter_ = from._impl_.counter_;
830     }
831     if (cached_has_bits & 0x00000008u) {
832       _this->_impl_.seq_value_ = from._impl_.seq_value_;
833     }
834     if (cached_has_bits & 0x00000010u) {
835       _this->_impl_.is_last_ = from._impl_.is_last_;
836     }
837     _this->_impl_._has_bits_[0] |= cached_has_bits;
838   }
839   _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
840 }
841 
CopyFrom(const TestEvent & from)842 void TestEvent::CopyFrom(const TestEvent& from) {
843 // @@protoc_insertion_point(class_specific_copy_from_start:perfetto.protos.TestEvent)
844   if (&from == this) return;
845   Clear();
846   MergeFrom(from);
847 }
848 
IsInitialized() const849 bool TestEvent::IsInitialized() const {
850   return true;
851 }
852 
InternalSwap(TestEvent * other)853 void TestEvent::InternalSwap(TestEvent* other) {
854   using std::swap;
855   auto* lhs_arena = GetArenaForAllocation();
856   auto* rhs_arena = other->GetArenaForAllocation();
857   _internal_metadata_.InternalSwap(&other->_internal_metadata_);
858   swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
859   ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
860       &_impl_.str_, lhs_arena,
861       &other->_impl_.str_, rhs_arena
862   );
863   ::PROTOBUF_NAMESPACE_ID::internal::memswap<
864       PROTOBUF_FIELD_OFFSET(TestEvent, _impl_.is_last_)
865       + sizeof(TestEvent::_impl_.is_last_)  // NOLINT
866       - PROTOBUF_FIELD_OFFSET(TestEvent, _impl_.payload_)>(
867           reinterpret_cast<char*>(&_impl_.payload_),
868           reinterpret_cast<char*>(&other->_impl_.payload_));
869 }
870 
GetTypeName() const871 std::string TestEvent::GetTypeName() const {
872   return "perfetto.protos.TestEvent";
873 }
874 
875 
876 // @@protoc_insertion_point(namespace_scope)
877 }  // namespace protos
878 }  // namespace perfetto
879 PROTOBUF_NAMESPACE_OPEN
880 template<> PROTOBUF_NOINLINE ::perfetto::protos::TestEvent_TestPayload*
CreateMaybeMessage(Arena * arena)881 Arena::CreateMaybeMessage< ::perfetto::protos::TestEvent_TestPayload >(Arena* arena) {
882   return Arena::CreateMessageInternal< ::perfetto::protos::TestEvent_TestPayload >(arena);
883 }
884 template<> PROTOBUF_NOINLINE ::perfetto::protos::TestEvent*
CreateMaybeMessage(Arena * arena)885 Arena::CreateMaybeMessage< ::perfetto::protos::TestEvent >(Arena* arena) {
886   return Arena::CreateMessageInternal< ::perfetto::protos::TestEvent >(arena);
887 }
888 PROTOBUF_NAMESPACE_CLOSE
889 
890 // @@protoc_insertion_point(global_scope)
891 #include <google/protobuf/port_undef.inc>
892