protobuf/src/google/protobuf/map_field.h
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 #ifndef GOOGLE_PROTOBUF_MAP_FIELD_H__
32 #define GOOGLE_PROTOBUF_MAP_FIELD_H__
33 
34 #include <atomic>
35 #include <functional>
36 
37 #include <google/protobuf/arena.h>
38 #include <google/protobuf/descriptor.h>
39 #include <google/protobuf/generated_message_reflection.h>
40 #include <google/protobuf/generated_message_util.h>
41 #include <google/protobuf/map_entry.h>
42 #include <google/protobuf/map_field_lite.h>
43 #include <google/protobuf/map_type_handler.h>
44 #include <google/protobuf/message.h>
45 #include <google/protobuf/stubs/mutex.h>
46 #include <google/protobuf/port.h>
47 #include <google/protobuf/repeated_field.h>
48 #include <google/protobuf/unknown_field_set.h>
49 
50 
51 #include <google/protobuf/port_def.inc>
52 
53 #ifdef SWIG
54 #error "You cannot SWIG proto headers"
55 #endif
56 
57 namespace google {
58 namespace protobuf {
59 class DynamicMessage;
60 class MapIterator;
61 
62 #define TYPE_CHECK(EXPECTEDTYPE, METHOD) \
63  if (type() != EXPECTEDTYPE) { \
64  GOOGLE_LOG(FATAL) << "Protocol Buffer map usage error:\n" \
65  << METHOD << " type does not match\n" \
66  << " Expected : " \
67  << FieldDescriptor::CppTypeName(EXPECTEDTYPE) << "\n" \
68  << " Actual : " << FieldDescriptor::CppTypeName(type()); \
69  }
70 
71 // MapKey is an union type for representing any possible
72 // map key.
73 class PROTOBUF_EXPORT MapKey {
74  public:
75  MapKey() : type_() {}
76  MapKey(const MapKey& other) : type_() { CopyFrom(other); }
77 
78  MapKey& operator=(const MapKey& other) {
79  CopyFrom(other);
80  return *this;
81  }
82 
83  ~MapKey() {
85  val_.string_value_.Destruct();
86  }
87  }
88 
91  GOOGLE_LOG(FATAL) << "Protocol Buffer map usage error:\n"
92  << "MapKey::type MapKey is not initialized. "
93  << "Call set methods to initialize MapKey.";
94  }
95  return type_;
96  }
97 
100  val_.int64_value_ = value;
101  }
104  val_.uint64_value_ = value;
105  }
108  val_.int32_value_ = value;
109  }
112  val_.uint32_value_ = value;
113  }
114  void SetBoolValue(bool value) {
116  val_.bool_value_ = value;
117  }
120  *val_.string_value_.get_mutable() = std::move(val);
121  }
122 
124  TYPE_CHECK(FieldDescriptor::CPPTYPE_INT64, "MapKey::GetInt64Value");
125  return val_.int64_value_;
126  }
128  TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT64, "MapKey::GetUInt64Value");
129  return val_.uint64_value_;
130  }
132  TYPE_CHECK(FieldDescriptor::CPPTYPE_INT32, "MapKey::GetInt32Value");
133  return val_.int32_value_;
134  }
136  TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT32, "MapKey::GetUInt32Value");
137  return val_.uint32_value_;
138  }
139  bool GetBoolValue() const {
140  TYPE_CHECK(FieldDescriptor::CPPTYPE_BOOL, "MapKey::GetBoolValue");
141  return val_.bool_value_;
142  }
143  const std::string& GetStringValue() const {
144  TYPE_CHECK(FieldDescriptor::CPPTYPE_STRING, "MapKey::GetStringValue");
145  return val_.string_value_.get();
146  }
147 
148  bool operator<(const MapKey& other) const {
149  if (type_ != other.type_) {
150  // We could define a total order that handles this case, but
151  // there currently no need. So, for now, fail.
152  GOOGLE_LOG(FATAL) << "Unsupported: type mismatch";
153  }
154  switch (type()) {
159  GOOGLE_LOG(FATAL) << "Unsupported";
160  return false;
162  return val_.string_value_.get() < other.val_.string_value_.get();
164  return val_.int64_value_ < other.val_.int64_value_;
166  return val_.int32_value_ < other.val_.int32_value_;
168  return val_.uint64_value_ < other.val_.uint64_value_;
170  return val_.uint32_value_ < other.val_.uint32_value_;
172  return val_.bool_value_ < other.val_.bool_value_;
173  }
174  return false;
175  }
176 
177  bool operator==(const MapKey& other) const {
178  if (type_ != other.type_) {
179  // To be consistent with operator<, we don't allow this either.
180  GOOGLE_LOG(FATAL) << "Unsupported: type mismatch";
181  }
182  switch (type()) {
187  GOOGLE_LOG(FATAL) << "Unsupported";
188  break;
190  return val_.string_value_.get() == other.val_.string_value_.get();
192  return val_.int64_value_ == other.val_.int64_value_;
194  return val_.int32_value_ == other.val_.int32_value_;
196  return val_.uint64_value_ == other.val_.uint64_value_;
198  return val_.uint32_value_ == other.val_.uint32_value_;
200  return val_.bool_value_ == other.val_.bool_value_;
201  }
202  GOOGLE_LOG(FATAL) << "Can't get here.";
203  return false;
204  }
205 
206  void CopyFrom(const MapKey& other) {
207  SetType(other.type());
208  switch (type_) {
213  GOOGLE_LOG(FATAL) << "Unsupported";
214  break;
216  *val_.string_value_.get_mutable() = other.val_.string_value_.get();
217  break;
219  val_.int64_value_ = other.val_.int64_value_;
220  break;
222  val_.int32_value_ = other.val_.int32_value_;
223  break;
225  val_.uint64_value_ = other.val_.uint64_value_;
226  break;
228  val_.uint32_value_ = other.val_.uint32_value_;
229  break;
231  val_.bool_value_ = other.val_.bool_value_;
232  break;
233  }
234  }
235 
236  private:
237  template <typename K, typename V>
239  friend class ::PROTOBUF_NAMESPACE_ID::MapIterator;
240  friend class internal::DynamicMapField;
241 
242  union KeyValue {
243  KeyValue() {}
249  bool bool_value_;
250  } val_;
251 
253  if (type_ == type) return;
255  val_.string_value_.Destruct();
256  }
257  type_ = type;
259  val_.string_value_.DefaultConstruct();
260  }
261  }
262 
263  // type_ is 0 or a valid FieldDescriptor::CppType.
264  // Use "CppType()" to indicate zero.
266 };
267 
268 } // namespace protobuf
269 } // namespace google
270 namespace std {
271 template <>
272 struct hash<::PROTOBUF_NAMESPACE_ID::MapKey> {
273  size_t operator()(const ::PROTOBUF_NAMESPACE_ID::MapKey& map_key) const {
274  switch (map_key.type()) {
275  case ::PROTOBUF_NAMESPACE_ID::FieldDescriptor::CPPTYPE_DOUBLE:
276  case ::PROTOBUF_NAMESPACE_ID::FieldDescriptor::CPPTYPE_FLOAT:
277  case ::PROTOBUF_NAMESPACE_ID::FieldDescriptor::CPPTYPE_ENUM:
278  case ::PROTOBUF_NAMESPACE_ID::FieldDescriptor::CPPTYPE_MESSAGE:
279  GOOGLE_LOG(FATAL) << "Unsupported";
280  break;
281  case ::PROTOBUF_NAMESPACE_ID::FieldDescriptor::CPPTYPE_STRING:
282  return hash<std::string>()(map_key.GetStringValue());
283  case ::PROTOBUF_NAMESPACE_ID::FieldDescriptor::CPPTYPE_INT64: {
284  auto value = map_key.GetInt64Value();
285  return hash<decltype(value)>()(value);
286  }
287  case ::PROTOBUF_NAMESPACE_ID::FieldDescriptor::CPPTYPE_INT32: {
288  auto value = map_key.GetInt32Value();
289  return hash<decltype(value)>()(map_key.GetInt32Value());
290  }
291  case ::PROTOBUF_NAMESPACE_ID::FieldDescriptor::CPPTYPE_UINT64: {
292  auto value = map_key.GetUInt64Value();
293  return hash<decltype(value)>()(map_key.GetUInt64Value());
294  }
295  case ::PROTOBUF_NAMESPACE_ID::FieldDescriptor::CPPTYPE_UINT32: {
296  auto value = map_key.GetUInt32Value();
297  return hash<decltype(value)>()(map_key.GetUInt32Value());
298  }
299  case ::PROTOBUF_NAMESPACE_ID::FieldDescriptor::CPPTYPE_BOOL: {
300  return hash<bool>()(map_key.GetBoolValue());
301  }
302  }
303  GOOGLE_LOG(FATAL) << "Can't get here.";
304  return 0;
305  }
306  bool operator()(const ::PROTOBUF_NAMESPACE_ID::MapKey& map_key1,
307  const ::PROTOBUF_NAMESPACE_ID::MapKey& map_key2) const {
308  return map_key1 < map_key2;
309  }
310 };
311 } // namespace std
312 
313 namespace google {
314 namespace protobuf {
315 namespace internal {
316 
317 class ContendedMapCleanTest;
318 class GeneratedMessageReflection;
319 class MapFieldAccessor;
320 
321 // This class provides access to map field using reflection, which is the same
322 // as those provided for RepeatedPtrField<Message>. It is used for internal
323 // reflection implementation only. Users should never use this directly.
324 class PROTOBUF_EXPORT MapFieldBase {
325  public:
327  : arena_(nullptr), repeated_field_(nullptr), state_(STATE_MODIFIED_MAP) {}
328 
329  // This constructor is for constant initialized global instances.
330  // It uses a linker initialized mutex, so it is not compatible with regular
331  // runtime instances.
332  // Except in MSVC, where we can't have a constinit mutex.
333  explicit constexpr MapFieldBase(ConstantInitialized)
334  : arena_(nullptr),
335  repeated_field_(nullptr),
337  state_(STATE_MODIFIED_MAP) {}
339  : arena_(arena), repeated_field_(nullptr), state_(STATE_MODIFIED_MAP) {}
340  virtual ~MapFieldBase();
341 
342  // Returns reference to internal repeated field. Data written using
343  // Map's api prior to calling this function is guarantted to be
344  // included in repeated field.
345  const RepeatedPtrFieldBase& GetRepeatedField() const;
346 
347  // Like above. Returns mutable pointer to the internal repeated field.
348  RepeatedPtrFieldBase* MutableRepeatedField();
349 
350  // Pure virtual map APIs for Map Reflection.
351  virtual bool ContainsMapKey(const MapKey& map_key) const = 0;
352  virtual bool InsertOrLookupMapValue(const MapKey& map_key,
353  MapValueRef* val) = 0;
354  virtual bool LookupMapValue(const MapKey& map_key,
355  MapValueConstRef* val) const = 0;
356  bool LookupMapValue(const MapKey&, MapValueRef*) const = delete;
357 
358  // Returns whether changes to the map are reflected in the repeated field.
359  bool IsRepeatedFieldValid() const;
360  // Insures operations after won't get executed before calling this.
361  bool IsMapValid() const;
362  virtual bool DeleteMapValue(const MapKey& map_key) = 0;
363  virtual bool EqualIterator(const MapIterator& a,
364  const MapIterator& b) const = 0;
365  virtual void MapBegin(MapIterator* map_iter) const = 0;
366  virtual void MapEnd(MapIterator* map_iter) const = 0;
367  virtual void MergeFrom(const MapFieldBase& other) = 0;
368  virtual void Swap(MapFieldBase* other);
369  virtual void UnsafeShallowSwap(MapFieldBase* other);
370  // Sync Map with repeated field and returns the size of map.
371  virtual int size() const = 0;
372  virtual void Clear() = 0;
373 
374  // Returns the number of bytes used by the repeated field, excluding
375  // sizeof(*this)
376  size_t SpaceUsedExcludingSelfLong() const;
377 
379  return internal::ToIntSize(SpaceUsedExcludingSelfLong());
380  }
381 
382  protected:
383  // Gets the size of space used by map field.
384  virtual size_t SpaceUsedExcludingSelfNoLock() const;
385 
386  // Synchronizes the content in Map to RepeatedPtrField if there is any change
387  // to Map after last synchronization.
388  void SyncRepeatedFieldWithMap() const;
389  virtual void SyncRepeatedFieldWithMapNoLock() const;
390 
391  // Synchronizes the content in RepeatedPtrField to Map if there is any change
392  // to RepeatedPtrField after last synchronization.
393  void SyncMapWithRepeatedField() const;
394  virtual void SyncMapWithRepeatedFieldNoLock() const {}
395 
396  // Tells MapFieldBase that there is new change to Map.
397  void SetMapDirty();
398 
399  // Tells MapFieldBase that there is new change to RepeatedPtrField.
400  void SetRepeatedDirty();
401 
402  // Provides derived class the access to repeated field.
403  void* MutableRepeatedPtrField() const;
404 
405  void InternalSwap(MapFieldBase* other);
406 
407  // Support thread sanitizer (tsan) by making const / mutable races
408  // more apparent. If one thread calls MutableAccess() while another
409  // thread calls either ConstAccess() or MutableAccess(), on the same
410  // MapFieldBase-derived object, and there is no synchronization going
411  // on between them, tsan will alert.
412 #if defined(__SANITIZE_THREAD__) || defined(THREAD_SANITIZER)
413  void ConstAccess() const { GOOGLE_CHECK_EQ(seq1_, seq2_); }
414  void MutableAccess() {
415  if (seq1_ & 1) {
416  seq2_ = ++seq1_;
417  } else {
418  seq1_ = ++seq2_;
419  }
420  }
421  unsigned int seq1_ = 0, seq2_ = 0;
422 #else
423  void ConstAccess() const {}
424  void MutableAccess() {}
425 #endif
426  enum State {
427  STATE_MODIFIED_MAP = 0, // map has newly added data that has not been
428  // synchronized to repeated field
429  STATE_MODIFIED_REPEATED = 1, // repeated field has newly added data that
430  // has not been synchronized to map
431  CLEAN = 2, // data in map and repeated field are same
432  };
433 
434  Arena* arena_;
435  mutable RepeatedPtrField<Message>* repeated_field_;
436 
437  mutable internal::WrappedMutex
438  mutex_; // The thread to synchronize map and repeated field
439  // needs to get lock first;
440  mutable std::atomic<State> state_;
441 
442  private:
443  friend class ContendedMapCleanTest;
444  friend class GeneratedMessageReflection;
445  friend class MapFieldAccessor;
446  friend class ::PROTOBUF_NAMESPACE_ID::Reflection;
447  friend class ::PROTOBUF_NAMESPACE_ID::DynamicMessage;
448 
449  // Virtual helper methods for MapIterator. MapIterator doesn't have the
450  // type helper for key and value. Call these help methods to deal with
451  // different types. Real helper methods are implemented in
452  // TypeDefinedMapFieldBase.
453  friend class ::PROTOBUF_NAMESPACE_ID::MapIterator;
454  // Allocate map<...>::iterator for MapIterator.
455  virtual void InitializeIterator(MapIterator* map_iter) const = 0;
456 
457  // DeleteIterator() is called by the destructor of MapIterator only.
458  // It deletes map<...>::iterator for MapIterator.
459  virtual void DeleteIterator(MapIterator* map_iter) const = 0;
460 
461  // Copy the map<...>::iterator from other_iterator to
462  // this_iterator.
463  virtual void CopyIterator(MapIterator* this_iterator,
464  const MapIterator& other_iterator) const = 0;
465 
466  // IncreaseIterator() is called by operator++() of MapIterator only.
467  // It implements the ++ operator of MapIterator.
468  virtual void IncreaseIterator(MapIterator* map_iter) const = 0;
469 
470  // Swaps state_ with another MapFieldBase
471  void SwapState(MapFieldBase* other);
472 
474 };
475 
476 // This class provides common Map Reflection implementations for generated
477 // message and dynamic message.
478 template <typename Key, typename T>
479 class TypeDefinedMapFieldBase : public MapFieldBase {
480  public:
482 
483  // This constructor is for constant initialized global instances.
484  // It uses a linker initialized mutex, so it is not compatible with regular
485  // runtime instances.
487  : MapFieldBase(tag) {}
490  void MapBegin(MapIterator* map_iter) const override;
491  void MapEnd(MapIterator* map_iter) const override;
492  bool EqualIterator(const MapIterator& a, const MapIterator& b) const override;
493 
494  virtual const Map<Key, T>& GetMap() const = 0;
495  virtual Map<Key, T>* MutableMap() = 0;
496 
497  protected:
499  const MapIterator* map_iter) const;
500 
501  private:
502  void InitializeIterator(MapIterator* map_iter) const override;
503  void DeleteIterator(MapIterator* map_iter) const override;
504  void CopyIterator(MapIterator* this_iteratorm,
505  const MapIterator& that_iterator) const override;
506  void IncreaseIterator(MapIterator* map_iter) const override;
507 
508  virtual void SetMapIteratorValue(MapIterator* map_iter) const = 0;
510 };
511 
512 // This class provides access to map field using generated api. It is used for
513 // internal generated message implementation only. Users should never use this
514 // directly.
515 template <typename Derived, typename Key, typename T,
516  WireFormatLite::FieldType kKeyFieldType,
517  WireFormatLite::FieldType kValueFieldType>
518 class MapField : public TypeDefinedMapFieldBase<Key, T> {
519  // Provide utilities to parse/serialize key/value. Provide utilities to
520  // manipulate internal stored type.
523 
524  // Define message type for internal repeated field.
525  typedef Derived EntryType;
526 
527  // Define abbreviation for parent MapFieldLite
530 
531  // Enum needs to be handled differently from other types because it has
532  // different exposed type in Map's api and repeated field's api. For
533  // details see the comment in the implementation of
534  // SyncMapWithRepeatedFieldNoLock.
535  static constexpr bool kIsValueEnum = ValueTypeHandler::kIsEnum;
537 
538  public:
539  typedef typename Derived::SuperType EntryTypeTrait;
541 
542  MapField() {}
543 
544  // This constructor is for constant initialized global instances.
545  // It uses a linker initialized mutex, so it is not compatible with regular
546  // runtime instances.
547  explicit constexpr MapField(ConstantInitialized tag)
549  explicit MapField(Arena* arena)
551 
552  // Implement MapFieldBase
553  bool ContainsMapKey(const MapKey& map_key) const override;
554  bool InsertOrLookupMapValue(const MapKey& map_key, MapValueRef* val) override;
555  bool LookupMapValue(const MapKey& map_key,
556  MapValueConstRef* val) const override;
557  bool LookupMapValue(const MapKey&, MapValueRef*) const = delete;
558  bool DeleteMapValue(const MapKey& map_key) override;
559 
560  const Map<Key, T>& GetMap() const override {
562  return impl_.GetMap();
563  }
564 
565  Map<Key, T>* MutableMap() override {
569  return result;
570  }
571 
572  int size() const override;
573  void Clear() override;
574  void MergeFrom(const MapFieldBase& other) override;
575  void Swap(MapFieldBase* other) override;
576  void UnsafeShallowSwap(MapFieldBase* other) override;
577  void InternalSwap(MapField* other);
578 
579  // Used in the implementation of parsing. Caller should take the ownership iff
580  // arena_ is nullptr.
581  EntryType* NewEntry() const { return impl_.NewEntry(); }
582  // Used in the implementation of serializing enum value type. Caller should
583  // take the ownership iff arena_ is nullptr.
584  EntryType* NewEnumEntryWrapper(const Key& key, const T t) const {
585  return impl_.NewEnumEntryWrapper(key, t);
586  }
587  // Used in the implementation of serializing other value types. Caller should
588  // take the ownership iff arena_ is nullptr.
589  EntryType* NewEntryWrapper(const Key& key, const T& t) const {
590  return impl_.NewEntryWrapper(key, t);
591  }
592 
593  const char* _InternalParse(const char* ptr, ParseContext* ctx) {
594  return impl_._InternalParse(ptr, ctx);
595  }
596  template <typename UnknownType>
597  const char* ParseWithEnumValidation(const char* ptr, ParseContext* ctx,
598  bool (*is_valid)(int), uint32_t field_num,
600  return impl_.template ParseWithEnumValidation<UnknownType>(
601  ptr, ctx, is_valid, field_num, metadata);
602  }
603 
604  private:
606 
608  typedef void DestructorSkippable_;
609 
610  // Implements MapFieldBase
611  void SyncRepeatedFieldWithMapNoLock() const override;
612  void SyncMapWithRepeatedFieldNoLock() const override;
613  size_t SpaceUsedExcludingSelfNoLock() const override;
614 
615  void SetMapIteratorValue(MapIterator* map_iter) const override;
616 
618  friend class MapFieldStateTest; // For testing, it needs raw access to impl_
620 };
621 
622 template <typename Derived, typename Key, typename T,
623  WireFormatLite::FieldType key_wire_type,
624  WireFormatLite::FieldType value_wire_type>
627  const auto& t = field.GetMap();
628  for (typename Map<Key, T>::const_iterator it = t.begin(); it != t.end();
629  ++it) {
630  if (!it->second.IsInitialized()) return false;
631  }
632  return true;
633 }
634 
635 template <typename T, typename Key, typename Value,
636  WireFormatLite::FieldType kKeyFieldType,
637  WireFormatLite::FieldType kValueFieldType>
639  MapEntry<T, Key, Value, kKeyFieldType, kValueFieldType>> {
641 };
642 
643 class PROTOBUF_EXPORT DynamicMapField
644  : public TypeDefinedMapFieldBase<MapKey, MapValueRef> {
645  public:
646  explicit DynamicMapField(const Message* default_entry);
647  DynamicMapField(const Message* default_entry, Arena* arena);
648  ~DynamicMapField() override;
649 
650  // Implement MapFieldBase
651  bool ContainsMapKey(const MapKey& map_key) const override;
652  bool InsertOrLookupMapValue(const MapKey& map_key, MapValueRef* val) override;
653  bool LookupMapValue(const MapKey& map_key,
654  MapValueConstRef* val) const override;
655  bool LookupMapValue(const MapKey&, MapValueRef*) const = delete;
656  bool DeleteMapValue(const MapKey& map_key) override;
657  void MergeFrom(const MapFieldBase& other) override;
658  void Swap(MapFieldBase* other) override;
659  void UnsafeShallowSwap(MapFieldBase* other) override { Swap(other); }
660 
661  const Map<MapKey, MapValueRef>& GetMap() const override;
662  Map<MapKey, MapValueRef>* MutableMap() override;
663 
664  int size() const override;
665  void Clear() override;
666 
667  private:
669  const Message* default_entry_;
670 
671  void AllocateMapValue(MapValueRef* map_val);
672 
673  // Implements MapFieldBase
674  void SyncRepeatedFieldWithMapNoLock() const override;
675  void SyncMapWithRepeatedFieldNoLock() const override;
676  size_t SpaceUsedExcludingSelfNoLock() const override;
677  void SetMapIteratorValue(MapIterator* map_iter) const override;
679 };
680 
681 } // namespace internal
682 
683 // MapValueConstRef points to a map value. Users can NOT modify
684 // the map value.
685 class PROTOBUF_EXPORT MapValueConstRef {
686  public:
687  MapValueConstRef() : data_(nullptr), type_() {}
688 
691  "MapValueConstRef::GetInt64Value");
692  return *reinterpret_cast<int64_t*>(data_);
693  }
696  "MapValueConstRef::GetUInt64Value");
697  return *reinterpret_cast<uint64_t*>(data_);
698  }
701  "MapValueConstRef::GetInt32Value");
702  return *reinterpret_cast<int32_t*>(data_);
703  }
706  "MapValueConstRef::GetUInt32Value");
707  return *reinterpret_cast<uint32_t*>(data_);
708  }
709  bool GetBoolValue() const {
710  TYPE_CHECK(FieldDescriptor::CPPTYPE_BOOL, "MapValueConstRef::GetBoolValue");
711  return *reinterpret_cast<bool*>(data_);
712  }
713  int GetEnumValue() const {
714  TYPE_CHECK(FieldDescriptor::CPPTYPE_ENUM, "MapValueConstRef::GetEnumValue");
715  return *reinterpret_cast<int*>(data_);
716  }
717  const std::string& GetStringValue() const {
719  "MapValueConstRef::GetStringValue");
720  return *reinterpret_cast<std::string*>(data_);
721  }
722  float GetFloatValue() const {
724  "MapValueConstRef::GetFloatValue");
725  return *reinterpret_cast<float*>(data_);
726  }
727  double GetDoubleValue() const {
729  "MapValueConstRef::GetDoubleValue");
730  return *reinterpret_cast<double*>(data_);
731  }
732 
733  const Message& GetMessageValue() const {
735  "MapValueConstRef::GetMessageValue");
736  return *reinterpret_cast<Message*>(data_);
737  }
738 
739  protected:
740  // data_ point to a map value. MapValueConstRef does not
741  // own this value.
742  void* data_;
743  // type_ is 0 or a valid FieldDescriptor::CppType.
744  // Use "CppType()" to indicate zero.
746 
748  if (type_ == FieldDescriptor::CppType() || data_ == nullptr) {
750  << "Protocol Buffer map usage error:\n"
751  << "MapValueConstRef::type MapValueConstRef is not initialized.";
752  }
753  return type_;
754  }
755 
756  private:
757  template <typename Derived, typename K, typename V,
759  internal::WireFormatLite::FieldType value_wire_type>
760  friend class internal::MapField;
761  template <typename K, typename V>
763  friend class ::PROTOBUF_NAMESPACE_ID::MapIterator;
764  friend class Reflection;
766 
768  void SetValue(const void* val) { data_ = const_cast<void*>(val); }
769  void CopyFrom(const MapValueConstRef& other) {
770  type_ = other.type_;
771  data_ = other.data_;
772  }
773 };
774 
775 // MapValueRef points to a map value. Users are able to modify
776 // the map value.
777 class PROTOBUF_EXPORT MapValueRef final : public MapValueConstRef {
778  public:
780 
782  TYPE_CHECK(FieldDescriptor::CPPTYPE_INT64, "MapValueRef::SetInt64Value");
783  *reinterpret_cast<int64_t*>(data_) = value;
784  }
786  TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT64, "MapValueRef::SetUInt64Value");
787  *reinterpret_cast<uint64_t*>(data_) = value;
788  }
790  TYPE_CHECK(FieldDescriptor::CPPTYPE_INT32, "MapValueRef::SetInt32Value");
791  *reinterpret_cast<int32_t*>(data_) = value;
792  }
794  TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT32, "MapValueRef::SetUInt32Value");
795  *reinterpret_cast<uint32_t*>(data_) = value;
796  }
797  void SetBoolValue(bool value) {
798  TYPE_CHECK(FieldDescriptor::CPPTYPE_BOOL, "MapValueRef::SetBoolValue");
799  *reinterpret_cast<bool*>(data_) = value;
800  }
801  // TODO(jieluo) - Checks that enum is member.
802  void SetEnumValue(int value) {
803  TYPE_CHECK(FieldDescriptor::CPPTYPE_ENUM, "MapValueRef::SetEnumValue");
804  *reinterpret_cast<int*>(data_) = value;
805  }
807  TYPE_CHECK(FieldDescriptor::CPPTYPE_STRING, "MapValueRef::SetStringValue");
808  *reinterpret_cast<std::string*>(data_) = value;
809  }
810  void SetFloatValue(float value) {
811  TYPE_CHECK(FieldDescriptor::CPPTYPE_FLOAT, "MapValueRef::SetFloatValue");
812  *reinterpret_cast<float*>(data_) = value;
813  }
814  void SetDoubleValue(double value) {
815  TYPE_CHECK(FieldDescriptor::CPPTYPE_DOUBLE, "MapValueRef::SetDoubleValue");
816  *reinterpret_cast<double*>(data_) = value;
817  }
818 
821  "MapValueRef::MutableMessageValue");
822  return reinterpret_cast<Message*>(data_);
823  }
824 
825  private:
826  friend class internal::DynamicMapField;
827 
828  // Only used in DynamicMapField
829  void DeleteData() {
830  switch (type_) {
831 #define HANDLE_TYPE(CPPTYPE, TYPE) \
832  case FieldDescriptor::CPPTYPE_##CPPTYPE: { \
833  delete reinterpret_cast<TYPE*>(data_); \
834  break; \
835  }
836  HANDLE_TYPE(INT32, int32_t);
837  HANDLE_TYPE(INT64, int64_t);
838  HANDLE_TYPE(UINT32, uint32_t);
839  HANDLE_TYPE(UINT64, uint64_t);
840  HANDLE_TYPE(DOUBLE, double);
841  HANDLE_TYPE(FLOAT, float);
842  HANDLE_TYPE(BOOL, bool);
843  HANDLE_TYPE(STRING, std::string);
844  HANDLE_TYPE(ENUM, int32_t);
846 #undef HANDLE_TYPE
847  }
848  }
849 };
850 
851 #undef TYPE_CHECK
852 
853 class PROTOBUF_EXPORT MapIterator {
854  public:
856  const Reflection* reflection = message->GetReflection();
857  map_ = reflection->MutableMapData(message, field);
858  key_.SetType(field->message_type()->FindFieldByName("key")->cpp_type());
859  value_.SetType(field->message_type()->FindFieldByName("value")->cpp_type());
860  map_->InitializeIterator(this);
861  }
862  MapIterator(const MapIterator& other) {
863  map_ = other.map_;
864  map_->InitializeIterator(this);
865  map_->CopyIterator(this, other);
866  }
867  ~MapIterator() { map_->DeleteIterator(this); }
869  map_ = other.map_;
870  map_->CopyIterator(this, other);
871  return *this;
872  }
873  friend bool operator==(const MapIterator& a, const MapIterator& b) {
874  return a.map_->EqualIterator(a, b);
875  }
876  friend bool operator!=(const MapIterator& a, const MapIterator& b) {
877  return !a.map_->EqualIterator(a, b);
878  }
880  map_->IncreaseIterator(this);
881  return *this;
882  }
884  // iter_ is copied from Map<...>::iterator, no need to
885  // copy from its self again. Use the same implementation
886  // with operator++()
887  map_->IncreaseIterator(this);
888  return *this;
889  }
890  const MapKey& GetKey() { return key_; }
891  const MapValueRef& GetValueRef() { return value_; }
893  map_->SetMapDirty();
894  return &value_;
895  }
896 
897  private:
898  template <typename Key, typename T>
900  friend class internal::DynamicMapField;
901  template <typename Derived, typename Key, typename T,
903  internal::WireFormatLite::FieldType kValueFieldType>
904  friend class internal::MapField;
905 
906  // reinterpret_cast from heap-allocated Map<...>::iterator*. MapIterator owns
907  // the iterator. It is allocated by MapField<...>::InitializeIterator() called
908  // in constructor and deleted by MapField<...>::DeleteIterator() called in
909  // destructor.
910  void* iter_;
911  // Point to a MapField to call helper methods implemented in MapField.
912  // MapIterator does not own this object.
914  MapKey key_;
916 };
917 
918 } // namespace protobuf
919 } // namespace google
920 
921 #include <google/protobuf/port_undef.inc>
922 
923 #endif // GOOGLE_PROTOBUF_MAP_FIELD_H__
google::protobuf.internal::MapIf
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_type_handler.h:50
google::protobuf.internal::MapField::InsertOrLookupMapValue
bool InsertOrLookupMapValue(const MapKey &map_key, MapValueRef *val) override
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_inl.h:222
google::protobuf.internal::MapField::DestructorSkippable_
void DestructorSkippable_
Definition: protobuf/src/google/protobuf/map_field.h:608
ptr
char * ptr
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:45
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
google::protobuf::MapKey::operator<
bool operator<(const MapKey &other) const
Definition: protobuf/src/google/protobuf/map_field.h:148
google::protobuf.internal::MapField::MapField
constexpr MapField(ConstantInitialized tag)
Definition: protobuf/src/google/protobuf/map_field.h:547
google::protobuf::MapValueConstRef::GetStringValue
const std::string & GetStringValue() const
Definition: protobuf/src/google/protobuf/map_field.h:717
google::protobuf::RepeatedPtrField
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/command_line_interface.h:62
google::protobuf::MapValueRef::SetBoolValue
void SetBoolValue(bool value)
Definition: protobuf/src/google/protobuf/map_field.h:797
google::protobuf::MapIterator::GetValueRef
const MapValueRef & GetValueRef()
Definition: protobuf/src/google/protobuf/map_field.h:891
Arena
struct Arena Arena
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/arena.h:189
MESSAGE
static const char MESSAGE[]
Definition: test-callback-stack.c:31
absl::swap_internal::Swap
void Swap(T &lhs, T &rhs) noexcept(IsNothrowSwappable< T >::value)
Definition: abseil-cpp/absl/meta/type_traits.h:772
regen-readme.it
it
Definition: regen-readme.py:15
google::protobuf::value
const Descriptor::ReservedRange value
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1954
google::protobuf.internal::MapField::MergeFrom
void MergeFrom(const MapFieldBase &other) override
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_inl.h:252
google::protobuf::Reflection::MutableMapData
internal::MapFieldBase * MutableMapData(Message *message, const FieldDescriptor *field) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/generated_message_reflection.cc:2212
google::protobuf::FieldDescriptor
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:515
google::protobuf.internal::MapFieldLite::MutableMap
Map< Key, T > * MutableMap()
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_lite.h:72
google::protobuf.internal::MapField::_InternalParse
const char * _InternalParse(const char *ptr, ParseContext *ctx)
Definition: protobuf/src/google/protobuf/map_field.h:593
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS
#define GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TypeName)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/macros.h:40
ctx
Definition: benchmark-async.c:30
metadata
Definition: cq_verifier.cc:48
google::protobuf.internal::TypeDefinedMapFieldBase::EqualIterator
bool EqualIterator(const MapIterator &a, const MapIterator &b) const override
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_inl.h:125
google::protobuf::MapKey::type_
FieldDescriptor::CppType type_
Definition: protobuf/src/google/protobuf/map_field.h:265
google::protobuf::FieldDescriptor::CPPTYPE_STRING
@ CPPTYPE_STRING
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:562
google::protobuf.internal::MapFieldLite
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/map.h:73
google::protobuf.internal::TypeDefinedMapFieldBase::MapBegin
void MapBegin(MapIterator *map_iter) const override
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_inl.h:114
google::protobuf::MapValueConstRef::data_
void * data_
Definition: protobuf/src/google/protobuf/map_field.h:742
google::protobuf.internal::MapField::MapFieldLiteType
MapFieldLite< Derived, Key, T, kKeyFieldType, kValueFieldType, default_enum_value > MapFieldLiteType
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:232
google::protobuf.internal.python_message.MergeFrom
MergeFrom
Definition: bloaty/third_party/protobuf/python/google/protobuf/internal/python_message.py:1339
google::protobuf.internal::MapField
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/map.h:78
google::protobuf::MapValueConstRef::SetValue
void SetValue(const void *val)
Definition: protobuf/src/google/protobuf/map_field.h:768
google::protobuf::MapKey::SetInt64Value
void SetInt64Value(int64_t value)
Definition: protobuf/src/google/protobuf/map_field.h:98
google::protobuf::MapIterator::MapIterator
MapIterator(const MapIterator &other)
Definition: protobuf/src/google/protobuf/map_field.h:862
google::protobuf.internal::ConstantInitialized
Definition: protobuf/src/google/protobuf/message_lite.h:88
google::protobuf::MapValueConstRef::type_
FieldDescriptor::CppType type_
Definition: protobuf/src/google/protobuf/map_field.h:745
google::protobuf::python::cmessage::CopyFrom
static PyObject * CopyFrom(CMessage *self, PyObject *arg)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.cc:1862
google::protobuf::MapIterator::operator++
MapIterator operator++(int)
Definition: protobuf/src/google/protobuf/map_field.h:883
Arena
Definition: arena.c:39
GOOGLE_CHECK_EQ
#define GOOGLE_CHECK_EQ(A, B)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/logging.h:156
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
google::protobuf.internal::MapField::size
int size() const override
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_inl.h:169
type_
std::string type_
Definition: client_channel_stress_test.cc:212
google::protobuf::MapIterator::~MapIterator
~MapIterator()
Definition: protobuf/src/google/protobuf/map_field.h:867
google::protobuf::MapKey::~MapKey
~MapKey()
Definition: protobuf/src/google/protobuf/map_field.h:83
google::protobuf.internal::ParseContext
Definition: bloaty/third_party/protobuf/src/google/protobuf/parse_context.h:336
google::protobuf
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:12
google::protobuf::MapValueConstRef::GetEnumValue
int GetEnumValue() const
Definition: protobuf/src/google/protobuf/map_field.h:713
google::protobuf.internal::DynamicMapField::UnsafeShallowSwap
void UnsafeShallowSwap(MapFieldBase *other) override
Definition: protobuf/src/google/protobuf/map_field.h:659
google::protobuf.internal::AllAreInitialized
bool AllAreInitialized(const Type &t)
Definition: bloaty/third_party/protobuf/src/google/protobuf/generated_message_util.h:99
google::protobuf.internal::TypeDefinedMapFieldBase
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/map.h:81
a
int a
Definition: abseil-cpp/absl/container/internal/hash_policy_traits_test.cc:88
google::protobuf.internal::DynamicMapField
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:324
google::protobuf.internal::MapField::CastValueType
MapIf< kIsValueEnum, T, const T & >::type CastValueType
Definition: protobuf/src/google/protobuf/map_field.h:536
google::protobuf.internal::MapField::ContainsMapKey
bool ContainsMapKey(const MapKey &map_key) const override
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_inl.h:211
google::protobuf::Reflection
Definition: bloaty/third_party/protobuf/src/google/protobuf/message.h:397
google::protobuf::MapValueConstRef::GetInt64Value
int64_t GetInt64Value() const
Definition: protobuf/src/google/protobuf/map_field.h:689
google::protobuf::HANDLE_TYPE
HANDLE_TYPE(int32, FieldDescriptor::CPPTYPE_INT32, -1)
google::protobuf::MapKey::SetType
void SetType(FieldDescriptor::CppType type)
Definition: protobuf/src/google/protobuf/map_field.h:252
google::protobuf::MapKey::MapKey
MapKey()
Definition: protobuf/src/google/protobuf/map_field.h:75
message
char * message
Definition: libuv/docs/code/tty-gravity/main.c:12
T
#define T(upbtypeconst, upbtype, ctype, default_value)
google::protobuf.internal::MapField::MutableMap
Map< Key, T > * MutableMap() override
Definition: protobuf/src/google/protobuf/map_field.h:565
google::protobuf.internal::MapField::InternalSwap
void InternalSwap(MapField *other)
Definition: protobuf/src/google/protobuf/map_field_inl.h:296
google::protobuf.internal::MapFieldLite::NewEnumEntryWrapper
EntryType * NewEnumEntryWrapper(const Key &key, const T t) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_lite.h:97
google::protobuf::MapIterator::MutableValueRef
MapValueRef * MutableValueRef()
Definition: protobuf/src/google/protobuf/map_field.h:892
google::protobuf.internal::TypeDefinedMapFieldBase::DeleteIterator
void DeleteIterator(MapIterator *map_iter) const override
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_inl.h:145
BOOL
int BOOL
Definition: undname.c:46
google::protobuf.internal::TypeDefinedMapFieldBase::IncreaseIterator
void IncreaseIterator(MapIterator *map_iter) const override
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_inl.h:131
google::protobuf::MapKey::GetInt32Value
int32_t GetInt32Value() const
Definition: protobuf/src/google/protobuf/map_field.h:131
arena
grpc_core::ScopedArenaPtr arena
Definition: binder_transport_test.cc:237
google::protobuf.internal::MapField::MapField
MapField()
Definition: protobuf/src/google/protobuf/map_field.h:542
google::protobuf.internal::MapFieldBase::MutableAccess
void MutableAccess()
Definition: protobuf/src/google/protobuf/map_field.h:424
google::protobuf::MapKey::KeyValue
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:539
google::protobuf::MapValueConstRef::GetDoubleValue
double GetDoubleValue() const
Definition: protobuf/src/google/protobuf/map_field.h:727
google::protobuf.internal::MapFieldBase::InitializeIterator
virtual void InitializeIterator(MapIterator *map_iter) const =0
google::protobuf.internal::MapFieldBase::MapFieldBase
constexpr MapFieldBase(ConstantInitialized)
Definition: protobuf/src/google/protobuf/map_field.h:333
google::protobuf.internal::MapField::KeyTypeHandler
MapTypeHandler< kKeyFieldType, Key > KeyTypeHandler
Definition: protobuf/src/google/protobuf/map_field.h:521
google::protobuf::MapKey::type
FieldDescriptor::CppType type() const
Definition: protobuf/src/google/protobuf/map_field.h:89
hash
uint64_t hash
Definition: ring_hash.cc:284
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
std::hash<::PROTOBUF_NAMESPACE_ID::MapKey >::operator()
size_t operator()(const ::PROTOBUF_NAMESPACE_ID::MapKey &map_key) const
Definition: protobuf/src/google/protobuf/map_field.h:273
google::protobuf.internal::MapFieldBase::State
State
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:139
google::protobuf::MapKey::KeyValue::int64_value_
int64 int64_value_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:542
google::protobuf::MapKey::GetUInt64Value
uint64_t GetUInt64Value() const
Definition: protobuf/src/google/protobuf/map_field.h:127
google::protobuf.internal::MapField::LookupMapValue
bool LookupMapValue(const MapKey &map_key, MapValueConstRef *val) const override
Definition: protobuf/src/google/protobuf/map_field_inl.h:240
google::protobuf.internal::MapEntryToMapField< MapEntry< T, Key, Value, kKeyFieldType, kValueFieldType > >::MapFieldType
MapField< T, Key, Value, kKeyFieldType, kValueFieldType > MapFieldType
Definition: protobuf/src/google/protobuf/map_field.h:640
google::protobuf.internal::MapField::NewEntryWrapper
EntryType * NewEntryWrapper(const Key &key, const T &t) const
Definition: protobuf/src/google/protobuf/map_field.h:589
google::protobuf.internal::MapFieldLite::_InternalParse
const char * _InternalParse(const char *ptr, ParseContext *ctx)
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_lite.h:106
google::protobuf::MapKey::CopyFrom
void CopyFrom(const MapKey &other)
Definition: protobuf/src/google/protobuf/map_field.h:206
arena_
Arena * arena_
Definition: client_channel.cc:391
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
int64_t
signed __int64 int64_t
Definition: stdint-msvc2008.h:89
google::protobuf::MapKey::KeyValue::bool_value_
bool bool_value_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:546
google::protobuf.internal::MapField::impl_
MapFieldLiteType impl_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:297
tag
static void * tag(intptr_t t)
Definition: bad_client.cc:318
TYPE_CHECK
#define TYPE_CHECK(EXPECTEDTYPE, METHOD)
Definition: protobuf/src/google/protobuf/map_field.h:62
google::protobuf.internal::MapField::SyncRepeatedFieldWithMapNoLock
void SyncRepeatedFieldWithMapNoLock() const override
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_inl.h:279
google::protobuf::MapKey::KeyValue::int64_value_
int64_t int64_value_
Definition: protobuf/src/google/protobuf/map_field.h:245
google::protobuf::python::GetMap
static MapContainer * GetMap(PyObject *obj)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/map_container.cc:307
google::protobuf::MapValueConstRef::GetUInt64Value
uint64_t GetUInt64Value() const
Definition: protobuf/src/google/protobuf/map_field.h:694
google::protobuf.internal::ToIntSize
int ToIntSize(size_t size)
Definition: bloaty/third_party/protobuf/src/google/protobuf/message_lite.h:105
google::protobuf.internal::MapField::SetMapIteratorValue
void SetMapIteratorValue(MapIterator *map_iter) const override
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_inl.h:197
google::protobuf::MapKey::SetStringValue
void SetStringValue(std::string val)
Definition: protobuf/src/google/protobuf/map_field.h:118
google::protobuf::MapValueRef::SetFloatValue
void SetFloatValue(float value)
Definition: protobuf/src/google/protobuf/map_field.h:810
google::protobuf::MapKey::type_
int type_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:561
google::protobuf.internal::MapField::Clear
void Clear() override
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_inl.h:178
google::protobuf.internal::MapFieldLite::NewEntryWrapper
EntryType * NewEntryWrapper(const Key &key, const T &t) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_lite.h:102
google::protobuf::MapIterator::operator=
MapIterator & operator=(const MapIterator &other)
Definition: protobuf/src/google/protobuf/map_field.h:868
google::protobuf::MapIterator::operator!=
friend bool operator!=(const MapIterator &a, const MapIterator &b)
Definition: protobuf/src/google/protobuf/map_field.h:876
google::protobuf::MapKey::GetUInt32Value
uint32_t GetUInt32Value() const
Definition: protobuf/src/google/protobuf/map_field.h:135
uint64_t
unsigned __int64 uint64_t
Definition: stdint-msvc2008.h:90
google::protobuf::MapKey::KeyValue::uint64_value_
uint64 uint64_value_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:544
google::protobuf.internal::MapFieldBase::SetMapDirty
void SetMapDirty()
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.cc:84
google::protobuf::MapValueConstRef::GetInt32Value
int32_t GetInt32Value() const
Definition: protobuf/src/google/protobuf/map_field.h:699
google::protobuf::MapValueRef::SetEnumValue
void SetEnumValue(int value)
Definition: protobuf/src/google/protobuf/map_field.h:802
google::protobuf.internal::MapTypeHandler
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_type_handler.h:144
google::protobuf.internal::TypeDefinedMapFieldBase::SetMapIteratorValue
virtual void SetMapIteratorValue(MapIterator *map_iter) const =0
google::protobuf.internal::TypeDefinedMapFieldBase::InitializeIterator
void InitializeIterator(MapIterator *map_iter) const override
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_inl.h:138
google::protobuf::MapKey::operator=
MapKey & operator=(const MapKey &other)
Definition: protobuf/src/google/protobuf/map_field.h:78
google::protobuf.internal::TypeDefinedMapFieldBase::TypeDefinedMapFieldBase
TypeDefinedMapFieldBase(Arena *arena)
Definition: protobuf/src/google/protobuf/map_field.h:488
google::protobuf.internal::InternalMetadata
Definition: protobuf/src/google/protobuf/metadata_lite.h:62
google::protobuf.internal::TypeDefinedMapFieldBase::TypeDefinedMapFieldBase
constexpr TypeDefinedMapFieldBase(ConstantInitialized tag)
Definition: protobuf/src/google/protobuf/map_field.h:486
google::protobuf.internal::TypeDefinedMapFieldBase::~TypeDefinedMapFieldBase
~TypeDefinedMapFieldBase() override
Definition: protobuf/src/google/protobuf/map_field.h:489
google::protobuf.internal::MapField::MapField
MapField(Arena *arena)
Definition: protobuf/src/google/protobuf/map_field.h:549
google::protobuf::MapIterator::MapIterator
MapIterator(Message *message, const FieldDescriptor *field)
Definition: protobuf/src/google/protobuf/map_field.h:855
google::protobuf.internal::MapField::NewEnumEntryWrapper
EntryType * NewEnumEntryWrapper(const Key &key, const T t) const
Definition: protobuf/src/google/protobuf/map_field.h:584
google::protobuf.internal::MapFieldLite::NewEntry
EntryType * NewEntry() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_lite.h:92
google::protobuf.internal::TypeDefinedMapFieldBase::MutableMap
virtual Map< Key, T > * MutableMap()=0
key_
RlsLb::RequestKey key_
Definition: rls.cc:659
google::protobuf.internal::WireFormatLite::FieldType
FieldType
Definition: bloaty/third_party/protobuf/src/google/protobuf/wire_format_lite.h:111
google::protobuf::MapValueConstRef::GetMessageValue
const Message & GetMessageValue() const
Definition: protobuf/src/google/protobuf/map_field.h:733
google::protobuf::MapKey::KeyValue::int32_value_
int32 int32_value_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:543
google::protobuf::MapKey::MapKey
MapKey(const MapKey &other)
Definition: protobuf/src/google/protobuf/map_field.h:76
google::protobuf::MapKey::KeyValue::uint32_value_
uint32 uint32_value_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:545
google::protobuf::FieldDescriptor::CPPTYPE_UINT64
@ CPPTYPE_UINT64
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:557
google::protobuf::MapKey::operator==
bool operator==(const MapKey &other) const
Definition: protobuf/src/google/protobuf/map_field.h:177
b
uint64_t b
Definition: abseil-cpp/absl/container/internal/layout_test.cc:53
google::protobuf.internal::MapEntryToMapField
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_lite.h:166
google::protobuf.internal::MapFieldBase::ConstAccess
void ConstAccess() const
Definition: protobuf/src/google/protobuf/map_field.h:423
google::protobuf::MapKey::KeyValue::KeyValue
KeyValue()
Definition: protobuf/src/google/protobuf/map_field.h:243
google::protobuf::MapValueConstRef::GetFloatValue
float GetFloatValue() const
Definition: protobuf/src/google/protobuf/map_field.h:722
google::protobuf::MapValueConstRef::SetType
void SetType(FieldDescriptor::CppType type)
Definition: protobuf/src/google/protobuf/map_field.h:767
google::protobuf.internal::MapField::kIsValueEnum
static const bool kIsValueEnum
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:238
google::protobuf.internal::TypeDefinedMapFieldBase::GetMap
virtual const Map< Key, T > & GetMap() const =0
google::protobuf.internal::MapFieldBase::MapFieldBase
MapFieldBase()
Definition: protobuf/src/google/protobuf/map_field.h:326
google::protobuf.internal::MapField::EntryTypeTrait
Derived::SuperType EntryTypeTrait
Definition: protobuf/src/google/protobuf/map_field.h:539
value_
int value_
Definition: orphanable_test.cc:38
google::protobuf::MapValueConstRef::MapValueConstRef
MapValueConstRef()
Definition: protobuf/src/google/protobuf/map_field.h:687
google::protobuf.internal::MapField::DeleteMapValue
bool DeleteMapValue(const MapKey &map_key) override
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_inl.h:243
google::protobuf.internal::MapField::GOOGLE_DISALLOW_EVIL_CONSTRUCTORS
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapField)
value
const char * value
Definition: hpack_parser_table.cc:165
google::protobuf::FieldDescriptor::CPPTYPE_INT64
@ CPPTYPE_INT64
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:555
val_
T * val_
Definition: bloaty/third_party/googletest/googlemock/test/gmock-matchers_test.cc:3528
google::protobuf::MapValueConstRef::GetUInt32Value
uint32_t GetUInt32Value() const
Definition: protobuf/src/google/protobuf/map_field.h:704
google::protobuf.internal::MapFieldBase::MapFieldBase
MapFieldBase(Arena *arena)
Definition: protobuf/src/google/protobuf/map_field.h:338
google::protobuf.internal::MapEntry
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_entry.h:95
FATAL
#define FATAL(msg)
Definition: task.h:88
std::hash<::PROTOBUF_NAMESPACE_ID::MapKey >::operator()
bool operator()(const ::PROTOBUF_NAMESPACE_ID::MapKey &map_key1, const ::PROTOBUF_NAMESPACE_ID::MapKey &map_key2) const
Definition: protobuf/src/google/protobuf/map_field.h:306
google::protobuf::MapKey::KeyValue::int32_value_
int32_t int32_value_
Definition: protobuf/src/google/protobuf/map_field.h:246
google::protobuf::MapValueRef::DeleteData
void DeleteData()
Definition: protobuf/src/google/protobuf/map_field.h:829
google::protobuf.internal::MapField::Swap
void Swap(MapFieldBase *other) override
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_inl.h:264
google::protobuf::Message
Definition: bloaty/third_party/protobuf/src/google/protobuf/message.h:205
field
const FieldDescriptor * field
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/parser_unittest.cc:2692
google::protobuf::MapKey::KeyValue::string_value_
std::string * string_value_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:541
key
const char * key
Definition: hpack_parser_table.cc:164
google::protobuf.internal::TypeDefinedMapFieldBase::CopyIterator
void CopyIterator(MapIterator *this_iteratorm, const MapIterator &that_iterator) const override
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_inl.h:152
google::protobuf::FieldDescriptor::CPPTYPE_UINT32
@ CPPTYPE_UINT32
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:556
google::protobuf.internal::MapField::SpaceUsedExcludingSelfNoLock
size_t SpaceUsedExcludingSelfNoLock() const override
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_inl.h:339
google::protobuf::FieldDescriptor::CPPTYPE_FLOAT
@ CPPTYPE_FLOAT
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:559
google::protobuf::MapKey::val_
union google::protobuf::MapKey::KeyValue val_
google::protobuf.internal::MapField::ParseWithEnumValidation
const char * ParseWithEnumValidation(const char *ptr, ParseContext *ctx, bool(*is_valid)(int), uint32_t field_num, InternalMetadata *metadata)
Definition: protobuf/src/google/protobuf/map_field.h:597
google::protobuf.internal.python_message.Clear
Clear
Definition: bloaty/third_party/protobuf/python/google/protobuf/internal/python_message.py:1430
google::protobuf.internal::MapFieldLite::GetMap
const Map< Key, T > & GetMap() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_lite.h:71
google::protobuf::MapIterator::GetKey
const MapKey & GetKey()
Definition: protobuf/src/google/protobuf/map_field.h:890
google::protobuf.internal::TypeDefinedMapFieldBase::TypeDefinedMapFieldBase
TypeDefinedMapFieldBase()
Definition: protobuf/src/google/protobuf/map_field.h:481
google::protobuf::MapValueRef::MapValueRef
MapValueRef()
Definition: protobuf/src/google/protobuf/map_field.h:779
google::protobuf::FieldDescriptor::CPPTYPE_BOOL
@ CPPTYPE_BOOL
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:560
google::protobuf::MapKey::KeyValue::string_value_
internal::ExplicitlyConstructed< std::string > string_value_
Definition: protobuf/src/google/protobuf/map_field.h:244
google::protobuf.internal::MapField::EntryType
Derived EntryType
Definition: protobuf/src/google/protobuf/map_field.h:525
google::protobuf::FieldDescriptor::CPPTYPE_DOUBLE
@ CPPTYPE_DOUBLE
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:558
testing::Key
internal::KeyMatcher< M > Key(M inner_matcher)
Definition: cares/cares/test/gmock-1.8.0/gmock/gmock.h:9141
google::protobuf::MapKey
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:371
google::protobuf.internal::MapField::NewEntry
EntryType * NewEntry() const
Definition: protobuf/src/google/protobuf/map_field.h:581
google::protobuf::MapKey::SetUInt32Value
void SetUInt32Value(uint32_t value)
Definition: protobuf/src/google/protobuf/map_field.h:110
google::protobuf::MapValueRef::SetUInt64Value
void SetUInt64Value(uint64_t value)
Definition: protobuf/src/google/protobuf/map_field.h:785
std
Definition: grpcpp/impl/codegen/async_unary_call.h:407
google::protobuf::MapKey::KeyValue::uint32_value_
uint32_t uint32_value_
Definition: protobuf/src/google/protobuf/map_field.h:248
google::protobuf::MapIterator::map_
internal::MapFieldBase * map_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:773
google::protobuf::FieldDescriptor::CPPTYPE_ENUM
@ CPPTYPE_ENUM
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:561
google::protobuf::MapKey::GetStringValue
const std::string & GetStringValue() const
Definition: protobuf/src/google/protobuf/map_field.h:143
google::protobuf::MapKey::GetInt64Value
int64_t GetInt64Value() const
Definition: protobuf/src/google/protobuf/map_field.h:123
google::protobuf.internal::MapFieldBase::SyncMapWithRepeatedFieldNoLock
virtual void SyncMapWithRepeatedFieldNoLock() const
Definition: protobuf/src/google/protobuf/map_field.h:394
google::protobuf::MapValueRef::SetDoubleValue
void SetDoubleValue(double value)
Definition: protobuf/src/google/protobuf/map_field.h:814
google::protobuf.internal::MapFieldBase::SyncMapWithRepeatedField
void SyncMapWithRepeatedField() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.cc:137
google::protobuf.internal::MapFieldStateTest
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_test.cc:201
data_
std::string data_
Definition: cord_rep_btree_navigator_test.cc:84
google::protobuf::MapValueRef::SetStringValue
void SetStringValue(const std::string &value)
Definition: protobuf/src/google/protobuf/map_field.h:806
google::protobuf.internal::MapField::MapFieldLiteType
MapFieldLite< Derived, Key, T, kKeyFieldType, kValueFieldType > MapFieldLiteType
Definition: protobuf/src/google/protobuf/map_field.h:529
state_
grpc_connectivity_state state_
Definition: channel_connectivity.cc:213
google::protobuf::MapKey::SetInt32Value
void SetInt32Value(int32_t value)
Definition: protobuf/src/google/protobuf/map_field.h:106
google::protobuf.internal::RepeatedPtrFieldBase
Definition: bloaty/third_party/protobuf/src/google/protobuf/repeated_field.h:451
google::protobuf.internal::MapFieldBase::SpaceUsedExcludingSelf
int SpaceUsedExcludingSelf() const
Definition: protobuf/src/google/protobuf/map_field.h:378
google::protobuf::MapValueRef::SetInt32Value
void SetInt32Value(int32_t value)
Definition: protobuf/src/google/protobuf/map_field.h:789
google::protobuf.internal::TypeDefinedMapFieldBase::InternalGetIterator
Map< Key, T >::const_iterator & InternalGetIterator(const MapIterator *map_iter) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_inl.h:107
google::protobuf.internal::MapField::MapType
Map< Key, T > MapType
Definition: protobuf/src/google/protobuf/map_field.h:540
google::protobuf.internal::MapField::ValueTypeHandler
MapTypeHandler< kValueFieldType, T > ValueTypeHandler
Definition: protobuf/src/google/protobuf/map_field.h:522
google::protobuf::Map
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/arena.h:79
GOOGLE_PROTOBUF_LINKER_INITIALIZED
#define GOOGLE_PROTOBUF_LINKER_INITIALIZED
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/mutex.h:70
internal
Definition: benchmark/test/output_test_helper.cc:20
google::protobuf.internal::MapFieldBase
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:69
google::protobuf::MapIterator::operator++
MapIterator & operator++()
Definition: protobuf/src/google/protobuf/map_field.h:879
google::protobuf.internal::TypeDefinedMapFieldBase::MapEnd
void MapEnd(MapIterator *map_iter) const override
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_inl.h:120
google::protobuf::FieldDescriptor::CPPTYPE_MESSAGE
@ CPPTYPE_MESSAGE
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:563
google::protobuf::MapValueRef::SetUInt32Value
void SetUInt32Value(uint32_t value)
Definition: protobuf/src/google/protobuf/map_field.h:793
mutex_
internal::WrappedMutex mutex_
Definition: bloaty/third_party/protobuf/src/google/protobuf/message.cc:569
google::protobuf.internal::ExplicitlyConstructed< std::string >
google::protobuf::MapIterator::operator==
friend bool operator==(const MapIterator &a, const MapIterator &b)
Definition: protobuf/src/google/protobuf/map_field.h:873
google::protobuf.internal::MapField::InternalArenaConstructable_
void InternalArenaConstructable_
Definition: protobuf/src/google/protobuf/map_field.h:607
asyncio_get_stats.type
type
Definition: asyncio_get_stats.py:37
Value
struct Value Value
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:676
google::protobuf.internal::TypeDefinedMapFieldBase::GOOGLE_DISALLOW_EVIL_CONSTRUCTORS
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TypeDefinedMapFieldBase)
google::protobuf::MapKey::SetUInt64Value
void SetUInt64Value(uint64_t value)
Definition: protobuf/src/google/protobuf/map_field.h:102
google::protobuf.internal::MapFieldAccessor
Definition: bloaty/third_party/protobuf/src/google/protobuf/reflection_internal.h:202
google::protobuf::MapKey::SetBoolValue
void SetBoolValue(bool value)
Definition: protobuf/src/google/protobuf/map_field.h:114
size
voidpf void uLong size
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
google::protobuf::MapKey::GetBoolValue
bool GetBoolValue() const
Definition: protobuf/src/google/protobuf/map_field.h:139
google::protobuf::MapIterator
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:712
google::protobuf::MapKey::KeyValue::uint64_value_
uint64_t uint64_value_
Definition: protobuf/src/google/protobuf/map_field.h:247
int32_t
signed int int32_t
Definition: stdint-msvc2008.h:77
GOOGLE_LOG
#define GOOGLE_LOG(LEVEL)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/logging.h:146
google::protobuf.internal::MapField::GetMap
const Map< Key, T > & GetMap() const override
Definition: protobuf/src/google/protobuf/map_field.h:560
google::protobuf::MapValueConstRef::GetBoolValue
bool GetBoolValue() const
Definition: protobuf/src/google/protobuf/map_field.h:709
google::protobuf::MapValueConstRef::CopyFrom
void CopyFrom(const MapValueConstRef &other)
Definition: protobuf/src/google/protobuf/map_field.h:769
google::protobuf::MapValueRef::SetInt64Value
void SetInt64Value(int64_t value)
Definition: protobuf/src/google/protobuf/map_field.h:781
google::protobuf::FieldDescriptor::CppType
CppType
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:553
google::protobuf.internal::MapField::SyncMapWithRepeatedFieldNoLock
void SyncMapWithRepeatedFieldNoLock() const override
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_inl.h:316
google
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:11
google::protobuf::MapValueConstRef::type
FieldDescriptor::CppType type() const
Definition: protobuf/src/google/protobuf/map_field.h:747
google::protobuf.internal::MapFieldBase::CopyIterator
virtual void CopyIterator(MapIterator *this_iterator, const MapIterator &other_iterator) const =0
google::protobuf.internal::MapField::UnsafeShallowSwap
void UnsafeShallowSwap(MapFieldBase *other) override
Definition: protobuf/src/google/protobuf/map_field_inl.h:289
google::protobuf::MapValueConstRef
Definition: protobuf/src/google/protobuf/map_field.h:685
google::protobuf::MapValueRef::MutableMessageValue
Message * MutableMessageValue()
Definition: protobuf/src/google/protobuf/map_field.h:819
google::protobuf::MapValueRef
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:565
google::protobuf::FieldDescriptor::CPPTYPE_INT32
@ CPPTYPE_INT32
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:554


grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:19