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