1 // Generated by the protocol buffer compiler.  DO NOT EDIT!
2 // source: protos/perfetto/trace/android/initial_display_state.proto
3 
4 #include "protos/perfetto/trace/android/initial_display_state.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 {
InitialDisplayState(::_pbi::ConstantInitialized)23 PROTOBUF_CONSTEXPR InitialDisplayState::InitialDisplayState(
24     ::_pbi::ConstantInitialized): _impl_{
25     /*decltype(_impl_._has_bits_)*/{}
26   , /*decltype(_impl_._cached_size_)*/{}
27   , /*decltype(_impl_.brightness_)*/0
28   , /*decltype(_impl_.display_state_)*/0} {}
29 struct InitialDisplayStateDefaultTypeInternal {
InitialDisplayStateDefaultTypeInternalperfetto::protos::InitialDisplayStateDefaultTypeInternal30   PROTOBUF_CONSTEXPR InitialDisplayStateDefaultTypeInternal()
31       : _instance(::_pbi::ConstantInitialized{}) {}
~InitialDisplayStateDefaultTypeInternalperfetto::protos::InitialDisplayStateDefaultTypeInternal32   ~InitialDisplayStateDefaultTypeInternal() {}
33   union {  // NOLINT(misc-non-private-member-variables-in-classes)
34     InitialDisplayState _instance;
35   };
36 };
37 PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 InitialDisplayStateDefaultTypeInternal _InitialDisplayState_default_instance_;
38 }  // namespace protos
39 }  // namespace perfetto
40 namespace perfetto {
41 namespace protos {
42 
43 // ===================================================================
44 
45 class InitialDisplayState::_Internal {
46  public:
47   using HasBits = decltype(std::declval<InitialDisplayState>()._impl_._has_bits_);
set_has_display_state(HasBits * has_bits)48   static void set_has_display_state(HasBits* has_bits) {
49     (*has_bits)[0] |= 2u;
50   }
set_has_brightness(HasBits * has_bits)51   static void set_has_brightness(HasBits* has_bits) {
52     (*has_bits)[0] |= 1u;
53   }
54 };
55 
InitialDisplayState(::PROTOBUF_NAMESPACE_ID::Arena * arena,bool is_message_owned)56 InitialDisplayState::InitialDisplayState(::PROTOBUF_NAMESPACE_ID::Arena* arena,
57                          bool is_message_owned)
58   : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
59   SharedCtor(arena, is_message_owned);
60   // @@protoc_insertion_point(arena_constructor:perfetto.protos.InitialDisplayState)
61 }
InitialDisplayState(const InitialDisplayState & from)62 InitialDisplayState::InitialDisplayState(const InitialDisplayState& from)
63   : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
64   InitialDisplayState* const _this = this; (void)_this;
65   new (&_impl_) Impl_{
66       decltype(_impl_._has_bits_){from._impl_._has_bits_}
67     , /*decltype(_impl_._cached_size_)*/{}
68     , decltype(_impl_.brightness_){}
69     , decltype(_impl_.display_state_){}};
70 
71   _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
72   ::memcpy(&_impl_.brightness_, &from._impl_.brightness_,
73     static_cast<size_t>(reinterpret_cast<char*>(&_impl_.display_state_) -
74     reinterpret_cast<char*>(&_impl_.brightness_)) + sizeof(_impl_.display_state_));
75   // @@protoc_insertion_point(copy_constructor:perfetto.protos.InitialDisplayState)
76 }
77 
SharedCtor(::_pb::Arena * arena,bool is_message_owned)78 inline void InitialDisplayState::SharedCtor(
79     ::_pb::Arena* arena, bool is_message_owned) {
80   (void)arena;
81   (void)is_message_owned;
82   new (&_impl_) Impl_{
83       decltype(_impl_._has_bits_){}
84     , /*decltype(_impl_._cached_size_)*/{}
85     , decltype(_impl_.brightness_){0}
86     , decltype(_impl_.display_state_){0}
87   };
88 }
89 
~InitialDisplayState()90 InitialDisplayState::~InitialDisplayState() {
91   // @@protoc_insertion_point(destructor:perfetto.protos.InitialDisplayState)
92   if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
93   (void)arena;
94     return;
95   }
96   SharedDtor();
97 }
98 
SharedDtor()99 inline void InitialDisplayState::SharedDtor() {
100   GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
101 }
102 
SetCachedSize(int size) const103 void InitialDisplayState::SetCachedSize(int size) const {
104   _impl_._cached_size_.Set(size);
105 }
106 
Clear()107 void InitialDisplayState::Clear() {
108 // @@protoc_insertion_point(message_clear_start:perfetto.protos.InitialDisplayState)
109   ::uint32_t cached_has_bits = 0;
110   // Prevent compiler warnings about cached_has_bits being unused
111   (void) cached_has_bits;
112 
113   cached_has_bits = _impl_._has_bits_[0];
114   if (cached_has_bits & 0x00000003u) {
115     ::memset(&_impl_.brightness_, 0, static_cast<size_t>(
116         reinterpret_cast<char*>(&_impl_.display_state_) -
117         reinterpret_cast<char*>(&_impl_.brightness_)) + sizeof(_impl_.display_state_));
118   }
119   _impl_._has_bits_.Clear();
120   _internal_metadata_.Clear<std::string>();
121 }
122 
_InternalParse(const char * ptr,::_pbi::ParseContext * ctx)123 const char* InitialDisplayState::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
124 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
125   _Internal::HasBits has_bits{};
126   while (!ctx->Done(&ptr)) {
127     ::uint32_t tag;
128     ptr = ::_pbi::ReadTag(ptr, &tag);
129     switch (tag >> 3) {
130       // optional int32 display_state = 1;
131       case 1:
132         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 8)) {
133           _Internal::set_has_display_state(&has_bits);
134           _impl_.display_state_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
135           CHK_(ptr);
136         } else {
137           goto handle_unusual;
138         }
139         continue;
140       // optional double brightness = 2;
141       case 2:
142         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 17)) {
143           _Internal::set_has_brightness(&has_bits);
144           _impl_.brightness_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr);
145           ptr += sizeof(double);
146         } else {
147           goto handle_unusual;
148         }
149         continue;
150       default:
151         goto handle_unusual;
152     }  // switch
153   handle_unusual:
154     if ((tag == 0) || ((tag & 7) == 4)) {
155       CHK_(ptr);
156       ctx->SetLastTag(tag);
157       goto message_done;
158     }
159     ptr = UnknownFieldParse(
160         tag,
161         _internal_metadata_.mutable_unknown_fields<std::string>(),
162         ptr, ctx);
163     CHK_(ptr != nullptr);
164   }  // while
165 message_done:
166   _impl_._has_bits_.Or(has_bits);
167   return ptr;
168 failure:
169   ptr = nullptr;
170   goto message_done;
171 #undef CHK_
172 }
173 
_InternalSerialize(::uint8_t * target,::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream * stream) const174 ::uint8_t* InitialDisplayState::_InternalSerialize(
175     ::uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
176   // @@protoc_insertion_point(serialize_to_array_start:perfetto.protos.InitialDisplayState)
177   ::uint32_t cached_has_bits = 0;
178   (void) cached_has_bits;
179 
180   cached_has_bits = _impl_._has_bits_[0];
181   // optional int32 display_state = 1;
182   if (cached_has_bits & 0x00000002u) {
183     target = stream->EnsureSpace(target);
184     target = ::_pbi::WireFormatLite::WriteInt32ToArray(1, this->_internal_display_state(), target);
185   }
186 
187   // optional double brightness = 2;
188   if (cached_has_bits & 0x00000001u) {
189     target = stream->EnsureSpace(target);
190     target = ::_pbi::WireFormatLite::WriteDoubleToArray(2, this->_internal_brightness(), target);
191   }
192 
193   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
194     target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
195         static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
196   }
197   // @@protoc_insertion_point(serialize_to_array_end:perfetto.protos.InitialDisplayState)
198   return target;
199 }
200 
ByteSizeLong() const201 size_t InitialDisplayState::ByteSizeLong() const {
202 // @@protoc_insertion_point(message_byte_size_start:perfetto.protos.InitialDisplayState)
203   size_t total_size = 0;
204 
205   ::uint32_t cached_has_bits = 0;
206   // Prevent compiler warnings about cached_has_bits being unused
207   (void) cached_has_bits;
208 
209   cached_has_bits = _impl_._has_bits_[0];
210   if (cached_has_bits & 0x00000003u) {
211     // optional double brightness = 2;
212     if (cached_has_bits & 0x00000001u) {
213       total_size += 1 + 8;
214     }
215 
216     // optional int32 display_state = 1;
217     if (cached_has_bits & 0x00000002u) {
218       total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_display_state());
219     }
220 
221   }
222   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
223     total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
224   }
225   int cached_size = ::_pbi::ToCachedSize(total_size);
226   SetCachedSize(cached_size);
227   return total_size;
228 }
229 
CheckTypeAndMergeFrom(const::PROTOBUF_NAMESPACE_ID::MessageLite & from)230 void InitialDisplayState::CheckTypeAndMergeFrom(
231     const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
232   MergeFrom(*::_pbi::DownCast<const InitialDisplayState*>(
233       &from));
234 }
235 
MergeFrom(const InitialDisplayState & from)236 void InitialDisplayState::MergeFrom(const InitialDisplayState& from) {
237   InitialDisplayState* const _this = this;
238   // @@protoc_insertion_point(class_specific_merge_from_start:perfetto.protos.InitialDisplayState)
239   GOOGLE_DCHECK_NE(&from, _this);
240   ::uint32_t cached_has_bits = 0;
241   (void) cached_has_bits;
242 
243   cached_has_bits = from._impl_._has_bits_[0];
244   if (cached_has_bits & 0x00000003u) {
245     if (cached_has_bits & 0x00000001u) {
246       _this->_impl_.brightness_ = from._impl_.brightness_;
247     }
248     if (cached_has_bits & 0x00000002u) {
249       _this->_impl_.display_state_ = from._impl_.display_state_;
250     }
251     _this->_impl_._has_bits_[0] |= cached_has_bits;
252   }
253   _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
254 }
255 
CopyFrom(const InitialDisplayState & from)256 void InitialDisplayState::CopyFrom(const InitialDisplayState& from) {
257 // @@protoc_insertion_point(class_specific_copy_from_start:perfetto.protos.InitialDisplayState)
258   if (&from == this) return;
259   Clear();
260   MergeFrom(from);
261 }
262 
IsInitialized() const263 bool InitialDisplayState::IsInitialized() const {
264   return true;
265 }
266 
InternalSwap(InitialDisplayState * other)267 void InitialDisplayState::InternalSwap(InitialDisplayState* other) {
268   using std::swap;
269   _internal_metadata_.InternalSwap(&other->_internal_metadata_);
270   swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
271   ::PROTOBUF_NAMESPACE_ID::internal::memswap<
272       PROTOBUF_FIELD_OFFSET(InitialDisplayState, _impl_.display_state_)
273       + sizeof(InitialDisplayState::_impl_.display_state_)  // NOLINT
274       - PROTOBUF_FIELD_OFFSET(InitialDisplayState, _impl_.brightness_)>(
275           reinterpret_cast<char*>(&_impl_.brightness_),
276           reinterpret_cast<char*>(&other->_impl_.brightness_));
277 }
278 
GetTypeName() const279 std::string InitialDisplayState::GetTypeName() const {
280   return "perfetto.protos.InitialDisplayState";
281 }
282 
283 
284 // @@protoc_insertion_point(namespace_scope)
285 }  // namespace protos
286 }  // namespace perfetto
287 PROTOBUF_NAMESPACE_OPEN
288 template<> PROTOBUF_NOINLINE ::perfetto::protos::InitialDisplayState*
CreateMaybeMessage(Arena * arena)289 Arena::CreateMaybeMessage< ::perfetto::protos::InitialDisplayState >(Arena* arena) {
290   return Arena::CreateMessageInternal< ::perfetto::protos::InitialDisplayState >(arena);
291 }
292 PROTOBUF_NAMESPACE_CLOSE
293 
294 // @@protoc_insertion_point(global_scope)
295 #include <google/protobuf/port_undef.inc>
296