1 // Generated by the protocol buffer compiler. DO NOT EDIT! 2 // source: google/protobuf/duration.proto 3 4 #define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION 5 #include <google/protobuf/duration.pb.h> 6 7 #include <algorithm> 8 9 #include <google/protobuf/stubs/common.h> 10 #include <google/protobuf/stubs/port.h> 11 #include <google/protobuf/stubs/once.h> 12 #include <google/protobuf/io/coded_stream.h> 13 #include <google/protobuf/wire_format_lite_inl.h> 14 #include <google/protobuf/descriptor.h> 15 #include <google/protobuf/generated_message_reflection.h> 16 #include <google/protobuf/reflection_ops.h> 17 #include <google/protobuf/wire_format.h> 18 // @@protoc_insertion_point(includes) 19 20 namespace google { 21 namespace protobuf { 22 23 namespace { 24 25 const ::google::protobuf::Descriptor* Duration_descriptor_ = NULL; 26 const ::google::protobuf::internal::GeneratedMessageReflection* 27 Duration_reflection_ = NULL; 28 29 } // namespace 30 31 32 void protobuf_AssignDesc_google_2fprotobuf_2fduration_2eproto() { 33 protobuf_AddDesc_google_2fprotobuf_2fduration_2eproto(); 34 const ::google::protobuf::FileDescriptor* file = 35 ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( 36 "google/protobuf/duration.proto"); 37 GOOGLE_CHECK(file != NULL); 38 Duration_descriptor_ = file->message_type(0); 39 static const int Duration_offsets_[2] = { 40 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Duration, seconds_), 41 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Duration, nanos_), 42 }; 43 Duration_reflection_ = 44 ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( 45 Duration_descriptor_, 46 Duration::default_instance_, 47 Duration_offsets_, 48 -1, 49 -1, 50 -1, 51 sizeof(Duration), 52 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Duration, _internal_metadata_), 53 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Duration, _is_default_instance_)); 54 } 55 56 namespace { 57 58 GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); 59 inline void protobuf_AssignDescriptorsOnce() { 60 ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, 61 &protobuf_AssignDesc_google_2fprotobuf_2fduration_2eproto); 62 } 63 64 void protobuf_RegisterTypes(const ::std::string&) { 65 protobuf_AssignDescriptorsOnce(); 66 ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( 67 Duration_descriptor_, &Duration::default_instance()); 68 } 69 70 } // namespace 71 72 void protobuf_ShutdownFile_google_2fprotobuf_2fduration_2eproto() { 73 delete Duration::default_instance_; 74 delete Duration_reflection_; 75 } 76 77 void protobuf_AddDesc_google_2fprotobuf_2fduration_2eproto() { 78 static bool already_here = false; 79 if (already_here) return; 80 already_here = true; 81 GOOGLE_PROTOBUF_VERIFY_VERSION; 82 83 ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( 84 "\n\036google/protobuf/duration.proto\022\017google" 85 ".protobuf\"*\n\010Duration\022\017\n\007seconds\030\001 \001(\003\022\r" 86 "\n\005nanos\030\002 \001(\005B|\n\023com.google.protobufB\rDu" 87 "rationProtoP\001Z*github.com/golang/protobu" 88 "f/ptypes/duration\240\001\001\242\002\003GPB\252\002\036Google.Prot" 89 "obuf.WellKnownTypesb\006proto3", 227); 90 ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( 91 "google/protobuf/duration.proto", &protobuf_RegisterTypes); 92 Duration::default_instance_ = new Duration(); 93 Duration::default_instance_->InitAsDefaultInstance(); 94 ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_google_2fprotobuf_2fduration_2eproto); 95 } 96 97 // Force AddDescriptors() to be called at static initialization time. 98 struct StaticDescriptorInitializer_google_2fprotobuf_2fduration_2eproto { 99 StaticDescriptorInitializer_google_2fprotobuf_2fduration_2eproto() { 100 protobuf_AddDesc_google_2fprotobuf_2fduration_2eproto(); 101 } 102 } static_descriptor_initializer_google_2fprotobuf_2fduration_2eproto_; 103 104 namespace { 105 106 static void MergeFromFail(int line) GOOGLE_ATTRIBUTE_COLD; 107 static void MergeFromFail(int line) { 108 GOOGLE_CHECK(false) << __FILE__ << ":" << line; 109 } 110 111 } // namespace 112 113 114 // =================================================================== 115 116 #if !defined(_MSC_VER) || _MSC_VER >= 1900 117 const int Duration::kSecondsFieldNumber; 118 const int Duration::kNanosFieldNumber; 119 #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 120 121 Duration::Duration() 122 : ::google::protobuf::Message(), _internal_metadata_(NULL) { 123 SharedCtor(); 124 // @@protoc_insertion_point(constructor:google.protobuf.Duration) 125 } 126 127 void Duration::InitAsDefaultInstance() { 128 _is_default_instance_ = true; 129 } 130 131 Duration::Duration(const Duration& from) 132 : ::google::protobuf::Message(), 133 _internal_metadata_(NULL) { 134 SharedCtor(); 135 MergeFrom(from); 136 // @@protoc_insertion_point(copy_constructor:google.protobuf.Duration) 137 } 138 139 void Duration::SharedCtor() { 140 _is_default_instance_ = false; 141 _cached_size_ = 0; 142 seconds_ = GOOGLE_LONGLONG(0); 143 nanos_ = 0; 144 } 145 146 Duration::~Duration() { 147 // @@protoc_insertion_point(destructor:google.protobuf.Duration) 148 SharedDtor(); 149 } 150 151 void Duration::SharedDtor() { 152 if (this != default_instance_) { 153 } 154 } 155 156 void Duration::SetCachedSize(int size) const { 157 GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); 158 _cached_size_ = size; 159 GOOGLE_SAFE_CONCURRENT_WRITES_END(); 160 } 161 const ::google::protobuf::Descriptor* Duration::descriptor() { 162 protobuf_AssignDescriptorsOnce(); 163 return Duration_descriptor_; 164 } 165 166 const Duration& Duration::default_instance() { 167 if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fduration_2eproto(); 168 return *default_instance_; 169 } 170 171 Duration* Duration::default_instance_ = NULL; 172 173 Duration* Duration::New(::google::protobuf::Arena* arena) const { 174 Duration* n = new Duration; 175 if (arena != NULL) { 176 arena->Own(n); 177 } 178 return n; 179 } 180 181 void Duration::Clear() { 182 // @@protoc_insertion_point(message_clear_start:google.protobuf.Duration) 183 #if defined(__clang__) 184 #define ZR_HELPER_(f) \ 185 _Pragma("clang diagnostic push") \ 186 _Pragma("clang diagnostic ignored \"-Winvalid-offsetof\"") \ 187 __builtin_offsetof(Duration, f) \ 188 _Pragma("clang diagnostic pop") 189 #else 190 #define ZR_HELPER_(f) reinterpret_cast<char*>(\ 191 &reinterpret_cast<Duration*>(16)->f) 192 #endif 193 194 #define ZR_(first, last) do {\ 195 ::memset(&first, 0,\ 196 ZR_HELPER_(last) - ZR_HELPER_(first) + sizeof(last));\ 197 } while (0) 198 199 ZR_(seconds_, nanos_); 200 201 #undef ZR_HELPER_ 202 #undef ZR_ 203 204 } 205 206 bool Duration::MergePartialFromCodedStream( 207 ::google::protobuf::io::CodedInputStream* input) { 208 #define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure 209 ::google::protobuf::uint32 tag; 210 // @@protoc_insertion_point(parse_start:google.protobuf.Duration) 211 for (;;) { 212 ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); 213 tag = p.first; 214 if (!p.second) goto handle_unusual; 215 switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { 216 // optional int64 seconds = 1; 217 case 1: { 218 if (tag == 8) { 219 DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< 220 ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( 221 input, &seconds_))); 222 223 } else { 224 goto handle_unusual; 225 } 226 if (input->ExpectTag(16)) goto parse_nanos; 227 break; 228 } 229 230 // optional int32 nanos = 2; 231 case 2: { 232 if (tag == 16) { 233 parse_nanos: 234 DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< 235 ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( 236 input, &nanos_))); 237 238 } else { 239 goto handle_unusual; 240 } 241 if (input->ExpectAtEnd()) goto success; 242 break; 243 } 244 245 default: { 246 handle_unusual: 247 if (tag == 0 || 248 ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == 249 ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { 250 goto success; 251 } 252 DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); 253 break; 254 } 255 } 256 } 257 success: 258 // @@protoc_insertion_point(parse_success:google.protobuf.Duration) 259 return true; 260 failure: 261 // @@protoc_insertion_point(parse_failure:google.protobuf.Duration) 262 return false; 263 #undef DO_ 264 } 265 266 void Duration::SerializeWithCachedSizes( 267 ::google::protobuf::io::CodedOutputStream* output) const { 268 // @@protoc_insertion_point(serialize_start:google.protobuf.Duration) 269 // optional int64 seconds = 1; 270 if (this->seconds() != 0) { 271 ::google::protobuf::internal::WireFormatLite::WriteInt64(1, this->seconds(), output); 272 } 273 274 // optional int32 nanos = 2; 275 if (this->nanos() != 0) { 276 ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->nanos(), output); 277 } 278 279 // @@protoc_insertion_point(serialize_end:google.protobuf.Duration) 280 } 281 282 ::google::protobuf::uint8* Duration::SerializeWithCachedSizesToArray( 283 ::google::protobuf::uint8* target) const { 284 // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Duration) 285 // optional int64 seconds = 1; 286 if (this->seconds() != 0) { 287 target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(1, this->seconds(), target); 288 } 289 290 // optional int32 nanos = 2; 291 if (this->nanos() != 0) { 292 target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->nanos(), target); 293 } 294 295 // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Duration) 296 return target; 297 } 298 299 int Duration::ByteSize() const { 300 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Duration) 301 int total_size = 0; 302 303 // optional int64 seconds = 1; 304 if (this->seconds() != 0) { 305 total_size += 1 + 306 ::google::protobuf::internal::WireFormatLite::Int64Size( 307 this->seconds()); 308 } 309 310 // optional int32 nanos = 2; 311 if (this->nanos() != 0) { 312 total_size += 1 + 313 ::google::protobuf::internal::WireFormatLite::Int32Size( 314 this->nanos()); 315 } 316 317 GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); 318 _cached_size_ = total_size; 319 GOOGLE_SAFE_CONCURRENT_WRITES_END(); 320 return total_size; 321 } 322 323 void Duration::MergeFrom(const ::google::protobuf::Message& from) { 324 // @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.Duration) 325 if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); 326 const Duration* source = 327 ::google::protobuf::internal::DynamicCastToGenerated<const Duration>( 328 &from); 329 if (source == NULL) { 330 // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.Duration) 331 ::google::protobuf::internal::ReflectionOps::Merge(from, this); 332 } else { 333 // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.Duration) 334 MergeFrom(*source); 335 } 336 } 337 338 void Duration::MergeFrom(const Duration& from) { 339 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Duration) 340 if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); 341 if (from.seconds() != 0) { 342 set_seconds(from.seconds()); 343 } 344 if (from.nanos() != 0) { 345 set_nanos(from.nanos()); 346 } 347 } 348 349 void Duration::CopyFrom(const ::google::protobuf::Message& from) { 350 // @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.Duration) 351 if (&from == this) return; 352 Clear(); 353 MergeFrom(from); 354 } 355 356 void Duration::CopyFrom(const Duration& from) { 357 // @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.Duration) 358 if (&from == this) return; 359 Clear(); 360 MergeFrom(from); 361 } 362 363 bool Duration::IsInitialized() const { 364 365 return true; 366 } 367 368 void Duration::Swap(Duration* other) { 369 if (other == this) return; 370 InternalSwap(other); 371 } 372 void Duration::InternalSwap(Duration* other) { 373 std::swap(seconds_, other->seconds_); 374 std::swap(nanos_, other->nanos_); 375 _internal_metadata_.Swap(&other->_internal_metadata_); 376 std::swap(_cached_size_, other->_cached_size_); 377 } 378 379 ::google::protobuf::Metadata Duration::GetMetadata() const { 380 protobuf_AssignDescriptorsOnce(); 381 ::google::protobuf::Metadata metadata; 382 metadata.descriptor = Duration_descriptor_; 383 metadata.reflection = Duration_reflection_; 384 return metadata; 385 } 386 387 #if PROTOBUF_INLINE_NOT_IN_HEADERS 388 // Duration 389 390 // optional int64 seconds = 1; 391 void Duration::clear_seconds() { 392 seconds_ = GOOGLE_LONGLONG(0); 393 } 394 ::google::protobuf::int64 Duration::seconds() const { 395 // @@protoc_insertion_point(field_get:google.protobuf.Duration.seconds) 396 return seconds_; 397 } 398 void Duration::set_seconds(::google::protobuf::int64 value) { 399 400 seconds_ = value; 401 // @@protoc_insertion_point(field_set:google.protobuf.Duration.seconds) 402 } 403 404 // optional int32 nanos = 2; 405 void Duration::clear_nanos() { 406 nanos_ = 0; 407 } 408 ::google::protobuf::int32 Duration::nanos() const { 409 // @@protoc_insertion_point(field_get:google.protobuf.Duration.nanos) 410 return nanos_; 411 } 412 void Duration::set_nanos(::google::protobuf::int32 value) { 413 414 nanos_ = value; 415 // @@protoc_insertion_point(field_set:google.protobuf.Duration.nanos) 416 } 417 418 #endif // PROTOBUF_INLINE_NOT_IN_HEADERS 419 420 // @@protoc_insertion_point(namespace_scope) 421 422 } // namespace protobuf 423 } // namespace google 424 425 // @@protoc_insertion_point(global_scope) 426