1 // Generated by the protocol buffer compiler. DO NOT EDIT!
2 // source: google/protobuf/duration.proto
3
4 #include <google/protobuf/duration.pb.h>
5
6 #include <algorithm>
7
8 #include <google/protobuf/io/coded_stream.h>
9 #include <google/protobuf/extension_set.h>
10 #include <google/protobuf/wire_format_lite.h>
11 #include <google/protobuf/descriptor.h>
12 #include <google/protobuf/generated_message_reflection.h>
13 #include <google/protobuf/reflection_ops.h>
14 #include <google/protobuf/wire_format.h>
15 // @@protoc_insertion_point(includes)
16 #include <google/protobuf/port_def.inc>
17 PROTOBUF_NAMESPACE_OPEN
18 class DurationDefaultTypeInternal {
19 public:
20 ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<Duration> _instance;
21 } _Duration_default_instance_;
22 PROTOBUF_NAMESPACE_CLOSE
InitDefaultsscc_info_Duration_google_2fprotobuf_2fduration_2eproto()23 static void InitDefaultsscc_info_Duration_google_2fprotobuf_2fduration_2eproto() {
24 GOOGLE_PROTOBUF_VERIFY_VERSION;
25
26 {
27 void* ptr = &PROTOBUF_NAMESPACE_ID::_Duration_default_instance_;
28 new (ptr) PROTOBUF_NAMESPACE_ID::Duration();
29 ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
30 }
31 PROTOBUF_NAMESPACE_ID::Duration::InitAsDefaultInstance();
32 }
33
34 PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Duration_google_2fprotobuf_2fduration_2eproto =
35 {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_Duration_google_2fprotobuf_2fduration_2eproto}, {}};
36
37 static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fduration_2eproto[1];
38 static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fduration_2eproto = nullptr;
39 static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fduration_2eproto = nullptr;
40
41 const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fduration_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
42 ~0u, // no _has_bits_
43 PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Duration, _internal_metadata_),
44 ~0u, // no _extensions_
45 ~0u, // no _oneof_case_
46 ~0u, // no _weak_field_map_
47 PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Duration, seconds_),
48 PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Duration, nanos_),
49 };
50 static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
51 { 0, -1, sizeof(PROTOBUF_NAMESPACE_ID::Duration)},
52 };
53
54 static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = {
55 reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_Duration_default_instance_),
56 };
57
58 const char descriptor_table_protodef_google_2fprotobuf_2fduration_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
59 "\n\036google/protobuf/duration.proto\022\017google"
60 ".protobuf\"*\n\010Duration\022\017\n\007seconds\030\001 \001(\003\022\r"
61 "\n\005nanos\030\002 \001(\005B|\n\023com.google.protobufB\rDu"
62 "rationProtoP\001Z*github.com/golang/protobu"
63 "f/ptypes/duration\370\001\001\242\002\003GPB\252\002\036Google.Prot"
64 "obuf.WellKnownTypesb\006proto3"
65 ;
66 static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_google_2fprotobuf_2fduration_2eproto_deps[1] = {
67 };
68 static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_google_2fprotobuf_2fduration_2eproto_sccs[1] = {
69 &scc_info_Duration_google_2fprotobuf_2fduration_2eproto.base,
70 };
71 static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_google_2fprotobuf_2fduration_2eproto_once;
72 const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fduration_2eproto = {
73 false, false, descriptor_table_protodef_google_2fprotobuf_2fduration_2eproto, "google/protobuf/duration.proto", 227,
74 &descriptor_table_google_2fprotobuf_2fduration_2eproto_once, descriptor_table_google_2fprotobuf_2fduration_2eproto_sccs, descriptor_table_google_2fprotobuf_2fduration_2eproto_deps, 1, 0,
75 schemas, file_default_instances, TableStruct_google_2fprotobuf_2fduration_2eproto::offsets,
76 file_level_metadata_google_2fprotobuf_2fduration_2eproto, 1, file_level_enum_descriptors_google_2fprotobuf_2fduration_2eproto, file_level_service_descriptors_google_2fprotobuf_2fduration_2eproto,
77 };
78
79 // Force running AddDescriptors() at dynamic initialization time.
80 static bool dynamic_init_dummy_google_2fprotobuf_2fduration_2eproto = (static_cast<void>(::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_google_2fprotobuf_2fduration_2eproto)), true);
81 PROTOBUF_NAMESPACE_OPEN
82
83 // ===================================================================
84
InitAsDefaultInstance()85 void Duration::InitAsDefaultInstance() {
86 }
87 class Duration::_Internal {
88 public:
89 };
90
Duration(::PROTOBUF_NAMESPACE_ID::Arena * arena)91 Duration::Duration(::PROTOBUF_NAMESPACE_ID::Arena* arena)
92 : ::PROTOBUF_NAMESPACE_ID::Message(arena) {
93 SharedCtor();
94 RegisterArenaDtor(arena);
95 // @@protoc_insertion_point(arena_constructor:google.protobuf.Duration)
96 }
Duration(const Duration & from)97 Duration::Duration(const Duration& from)
98 : ::PROTOBUF_NAMESPACE_ID::Message() {
99 _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
100 ::memcpy(&seconds_, &from.seconds_,
101 static_cast<size_t>(reinterpret_cast<char*>(&nanos_) -
102 reinterpret_cast<char*>(&seconds_)) + sizeof(nanos_));
103 // @@protoc_insertion_point(copy_constructor:google.protobuf.Duration)
104 }
105
SharedCtor()106 void Duration::SharedCtor() {
107 ::memset(&seconds_, 0, static_cast<size_t>(
108 reinterpret_cast<char*>(&nanos_) -
109 reinterpret_cast<char*>(&seconds_)) + sizeof(nanos_));
110 }
111
~Duration()112 Duration::~Duration() {
113 // @@protoc_insertion_point(destructor:google.protobuf.Duration)
114 SharedDtor();
115 _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
116 }
117
SharedDtor()118 void Duration::SharedDtor() {
119 GOOGLE_DCHECK(GetArena() == nullptr);
120 }
121
ArenaDtor(void * object)122 void Duration::ArenaDtor(void* object) {
123 Duration* _this = reinterpret_cast< Duration* >(object);
124 (void)_this;
125 }
RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena *)126 void Duration::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
127 }
SetCachedSize(int size) const128 void Duration::SetCachedSize(int size) const {
129 _cached_size_.Set(size);
130 }
default_instance()131 const Duration& Duration::default_instance() {
132 ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_Duration_google_2fprotobuf_2fduration_2eproto.base);
133 return *internal_default_instance();
134 }
135
136
Clear()137 void Duration::Clear() {
138 // @@protoc_insertion_point(message_clear_start:google.protobuf.Duration)
139 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
140 // Prevent compiler warnings about cached_has_bits being unused
141 (void) cached_has_bits;
142
143 ::memset(&seconds_, 0, static_cast<size_t>(
144 reinterpret_cast<char*>(&nanos_) -
145 reinterpret_cast<char*>(&seconds_)) + sizeof(nanos_));
146 _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
147 }
148
_InternalParse(const char * ptr,::PROTOBUF_NAMESPACE_ID::internal::ParseContext * ctx)149 const char* Duration::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
150 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
151 ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArena(); (void)arena;
152 while (!ctx->Done(&ptr)) {
153 ::PROTOBUF_NAMESPACE_ID::uint32 tag;
154 ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
155 CHK_(ptr);
156 switch (tag >> 3) {
157 // int64 seconds = 1;
158 case 1:
159 if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
160 seconds_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
161 CHK_(ptr);
162 } else goto handle_unusual;
163 continue;
164 // int32 nanos = 2;
165 case 2:
166 if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
167 nanos_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
168 CHK_(ptr);
169 } else goto handle_unusual;
170 continue;
171 default: {
172 handle_unusual:
173 if ((tag & 7) == 4 || tag == 0) {
174 ctx->SetLastTag(tag);
175 goto success;
176 }
177 ptr = UnknownFieldParse(tag,
178 _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
179 ptr, ctx);
180 CHK_(ptr != nullptr);
181 continue;
182 }
183 } // switch
184 } // while
185 success:
186 return ptr;
187 failure:
188 ptr = nullptr;
189 goto success;
190 #undef CHK_
191 }
192
_InternalSerialize(::PROTOBUF_NAMESPACE_ID::uint8 * target,::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream * stream) const193 ::PROTOBUF_NAMESPACE_ID::uint8* Duration::_InternalSerialize(
194 ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
195 // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Duration)
196 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
197 (void) cached_has_bits;
198
199 // int64 seconds = 1;
200 if (this->seconds() != 0) {
201 target = stream->EnsureSpace(target);
202 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_seconds(), target);
203 }
204
205 // int32 nanos = 2;
206 if (this->nanos() != 0) {
207 target = stream->EnsureSpace(target);
208 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_nanos(), target);
209 }
210
211 if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
212 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
213 _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
214 }
215 // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Duration)
216 return target;
217 }
218
ByteSizeLong() const219 size_t Duration::ByteSizeLong() const {
220 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Duration)
221 size_t total_size = 0;
222
223 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
224 // Prevent compiler warnings about cached_has_bits being unused
225 (void) cached_has_bits;
226
227 // int64 seconds = 1;
228 if (this->seconds() != 0) {
229 total_size += 1 +
230 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size(
231 this->_internal_seconds());
232 }
233
234 // int32 nanos = 2;
235 if (this->nanos() != 0) {
236 total_size += 1 +
237 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
238 this->_internal_nanos());
239 }
240
241 if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
242 return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
243 _internal_metadata_, total_size, &_cached_size_);
244 }
245 int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
246 SetCachedSize(cached_size);
247 return total_size;
248 }
249
MergeFrom(const::PROTOBUF_NAMESPACE_ID::Message & from)250 void Duration::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
251 // @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.Duration)
252 GOOGLE_DCHECK_NE(&from, this);
253 const Duration* source =
254 ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<Duration>(
255 &from);
256 if (source == nullptr) {
257 // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.Duration)
258 ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
259 } else {
260 // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.Duration)
261 MergeFrom(*source);
262 }
263 }
264
MergeFrom(const Duration & from)265 void Duration::MergeFrom(const Duration& from) {
266 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Duration)
267 GOOGLE_DCHECK_NE(&from, this);
268 _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
269 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
270 (void) cached_has_bits;
271
272 if (from.seconds() != 0) {
273 _internal_set_seconds(from._internal_seconds());
274 }
275 if (from.nanos() != 0) {
276 _internal_set_nanos(from._internal_nanos());
277 }
278 }
279
CopyFrom(const::PROTOBUF_NAMESPACE_ID::Message & from)280 void Duration::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
281 // @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.Duration)
282 if (&from == this) return;
283 Clear();
284 MergeFrom(from);
285 }
286
CopyFrom(const Duration & from)287 void Duration::CopyFrom(const Duration& from) {
288 // @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.Duration)
289 if (&from == this) return;
290 Clear();
291 MergeFrom(from);
292 }
293
IsInitialized() const294 bool Duration::IsInitialized() const {
295 return true;
296 }
297
InternalSwap(Duration * other)298 void Duration::InternalSwap(Duration* other) {
299 using std::swap;
300 _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
301 ::PROTOBUF_NAMESPACE_ID::internal::memswap<
302 PROTOBUF_FIELD_OFFSET(Duration, nanos_)
303 + sizeof(Duration::nanos_)
304 - PROTOBUF_FIELD_OFFSET(Duration, seconds_)>(
305 reinterpret_cast<char*>(&seconds_),
306 reinterpret_cast<char*>(&other->seconds_));
307 }
308
GetMetadata() const309 ::PROTOBUF_NAMESPACE_ID::Metadata Duration::GetMetadata() const {
310 return GetMetadataStatic();
311 }
312
313
314 // @@protoc_insertion_point(namespace_scope)
315 PROTOBUF_NAMESPACE_CLOSE
316 PROTOBUF_NAMESPACE_OPEN
CreateMaybeMessage(Arena * arena)317 template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Duration* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Duration >(Arena* arena) {
318 return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::Duration >(arena);
319 }
320 PROTOBUF_NAMESPACE_CLOSE
321
322 // @@protoc_insertion_point(global_scope)
323 #include <google/protobuf/port_undef.inc>
324