diff options
Diffstat (limited to 'src/google/protobuf/map.h')
-rw-r--r-- | src/google/protobuf/map.h | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h index 6463ac2e..a7126c16 100644 --- a/src/google/protobuf/map.h +++ b/src/google/protobuf/map.h @@ -49,6 +49,12 @@ #include <google/protobuf/map_type_handler.h> #include <google/protobuf/stubs/hash.h> +#ifdef SWIG +#error "You cannot SWIG proto headers" +#endif + +#include <google/protobuf/port_def.inc> + namespace google { namespace protobuf { @@ -78,7 +84,7 @@ class DynamicMapField; class GeneratedMessageReflection; } // namespace internal -// This is the class for google::protobuf::Map's internal value_type. Instead of using +// This is the class for Map's internal value_type. Instead of using // std::pair as value_type, we use this class which provides us more control of // its process of construction and destruction. template <typename Key, typename T> @@ -105,11 +111,11 @@ class MapPair { T second; private: - friend class ::google::protobuf::Arena; + friend class Arena; friend class Map<Key, T>; }; -// google::protobuf::Map is an associative container type used to store protobuf map +// Map is an associative container type used to store protobuf map // fields. Each Map instance may or may not use a different hash function, a // different iteration order, and so on. E.g., please don't examine // implementation details to decide if the following would work: @@ -181,7 +187,7 @@ class Map { } // re-implement std::allocator to use arena allocator for memory allocation. - // Used for google::protobuf::Map implementation. Users should not use this class + // Used for Map implementation. Users should not use this class // directly. template <typename U> class MapAllocator { @@ -622,7 +628,7 @@ class Map { } DestroyNode(item); --num_elements_; - if (GOOGLE_PREDICT_FALSE(b == index_of_first_non_null_)) { + if (PROTOBUF_PREDICT_FALSE(b == index_of_first_non_null_)) { while (index_of_first_non_null_ < num_buckets_ && table_[index_of_first_non_null_] == NULL) { ++index_of_first_non_null_; @@ -679,7 +685,7 @@ class Map { if (TableEntryIsEmpty(b)) { result = InsertUniqueInList(b, node); } else if (TableEntryIsNonEmptyList(b)) { - if (GOOGLE_PREDICT_FALSE(TableEntryIsTooLong(b))) { + if (PROTOBUF_PREDICT_FALSE(TableEntryIsTooLong(b))) { TreeConvert(b); result = InsertUniqueInTree(b, node); GOOGLE_DCHECK_EQ(result.bucket_index_, b & ~static_cast<size_type>(1)); @@ -734,13 +740,13 @@ class Map { // We don't care how many elements are in trees. If a lot are, // we may resize even though there are many empty buckets. In // practice, this seems fine. - if (GOOGLE_PREDICT_FALSE(new_size >= hi_cutoff)) { + if (PROTOBUF_PREDICT_FALSE(new_size >= hi_cutoff)) { if (num_buckets_ <= max_size() / 2) { Resize(num_buckets_ * 2); return true; } - } else if (GOOGLE_PREDICT_FALSE(new_size <= lo_cutoff && - num_buckets_ > kMinTableSize)) { + } else if (PROTOBUF_PREDICT_FALSE(new_size <= lo_cutoff && + num_buckets_ > kMinTableSize)) { size_type lg2_of_size_reduction_factor = 1; // It's possible we want to shrink a lot here... size() could even be 0. // So, estimate how much to shrink by making sure we don't shrink so @@ -1047,9 +1053,8 @@ class Map { value_type** value = &(*elements_)[key]; if (*value == NULL) { *value = CreateValueTypeInternal(key); - internal::MapValueInitializer<google::protobuf::is_proto_enum<T>::value, - T>::Initialize((*value)->second, - default_enum_value_); + internal::MapValueInitializer<is_proto_enum<T>::value, T>::Initialize( + (*value)->second, default_enum_value_); } return (*value)->second; } @@ -1203,7 +1208,7 @@ class Map { int default_enum_value_; InnerMap* elements_; - friend class ::google::protobuf::Arena; + friend class Arena; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; template <typename Derived, typename K, typename V, @@ -1214,6 +1219,8 @@ class Map { }; } // namespace protobuf - } // namespace google + +#include <google/protobuf/port_undef.inc> + #endif // GOOGLE_PROTOBUF_MAP_H__ |