class UntypedMapBase

Defined at line 250 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

Base class for all Map instantiations.

This class holds all the data and provides the basic functionality shared

among all instantiations.

Having an untyped base class helps generic consumers (like the table-driven

parser) by having non-template code that can handle all instantiations.

Protected Members

map_index_t num_elements_
map_index_t num_buckets_
TaggedInternalMetadataResolver resolver_
TypeInfo type_info_
NodeBase ** table_

Public Methods

void ClearTable (Arena * arena, bool reset)

Defined at line 343 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

TypeInfo GetTypeInfoDynamic (TypeKind key_type, TypeKind value_type, const MessageLite * value_prototype_if_message)
size_t SpaceUsedExcludingSelfLong ()

Space used for the table and nodes.

template <typename T>
TypeKind StaticTypeKind ()

LINT.ThenChange(//depot/google3/third_party/protobuf/rust/cpp_kernel/map.rs:map_ffi)

Defined at line 268 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

void UntypedMapBase (InternalMetadataOffset offset, TypeInfo type_info)

Defined at line 311 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

void UntypedMapBase (TypeInfo type_info)

Defined at line 317 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

void UntypedMapBase (const UntypedMapBase & )

Defined at line 320 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

void UntypedMergeFrom (Arena * arena, const UntypedMapBase & other)
void UntypedSwap (Arena * arena, UntypedMapBase & other, Arena * other_arena)
UntypedMapBase & operator= (const UntypedMapBase & )

Defined at line 321 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

template <typename T>
T * GetKey (NodeBase * node)

Defined at line 324 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

void * GetVoidValue (NodeBase * node)

Defined at line 331 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

template <typename T>
T * GetValue (NodeBase * node)

Defined at line 336 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

TypeInfo type_info ()

Defined at line 351 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

void ConstAccess ()

Defined at line 365 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

void MutableAccess ()

Defined at line 366 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

Arena * arena ()

Defined at line 375 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

void InternalSwap (UntypedMapBase * other)

Defined at line 379 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

size_type max_size ()

Defined at line 389 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

size_type size ()

Defined at line 392 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

bool empty ()

Defined at line 393 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

UntypedMapIterator EndIterator ()

We make this a static function to reduce the cost in MapField.

All the end iterators are singletons anyway.

Defined at line 398 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

UntypedMapIterator begin ()

Defined at line 575 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

template <typename F>
auto VisitKey (NodeBase * node, F f)

Calls `f(k)` with the key of the node, where `k` is the appropriate type

according to the stored TypeInfo.

Defined at line 562 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

template <typename F>
auto VisitValue (NodeBase * node, F f)

Calls `f(v)` with the value of the node, where `v` is the appropriate type

according to the stored TypeInfo.

Messages are visited as `MessageLite`, and enums are visited as int32.

Defined at line 569 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

template <typename F>
void VisitAllNodes (F f)

As above, but calls `f(k, v)` for every node in the map.

Defined at line 550 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

Protected Methods

NodeBase * AllocNode (Arena * arena)

Alignment of the nodes is the same as alignment of NodeBase.

Defined at line 457 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

NodeBase * AllocNode (Arena * arena, size_t node_size)

Defined at line 461 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

void DeallocNode (NodeBase * node)

Defined at line 468 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

void DeallocNode (NodeBase * node, size_t node_size)

Defined at line 470 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

void DeleteTable (Arena * arena, NodeBase ** table, map_index_t n)

Defined at line 475 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

NodeBase ** CreateEmptyTable (Arena * arena, map_index_t n)

Defined at line 484 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

template <typename F>
auto VisitKeyType (F f)

Calls `f(type_t)` where `type_t` is an unspecified type that has a `::type`

typedef in it representing the dynamic type of key/value of the node.

Defined at line 507 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

template <typename F>
auto VisitValueType (F f)

Defined at line 527 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

void ClearTableImpl (Arena * arena, bool reset)
void InsertOrReplaceNodes (Arena * arena, NodeBase * list, map_index_t count)

Insert all the nodes in the list. `count` must be the number of nodes in

the list.

Last-one-wins when there are duplicate keys.

void DeleteNode (NodeBase * node)
void DeleteList (NodeBase * list)
bool ShouldInsertAfterHead (void * node)

Returns whether we should insert after the head of the list. For

non-optimized builds, we randomly decide whether to insert right at the

head of the list or just after the head. This helps add a little bit of

non-determinism to the map ordering.

Defined at line 441 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

Enumerations

enum class TypeKind : uint8_t
Name Value Comments
kBool 0

bool

kU32 1

int32_t, uint32_t, enums

kU64 2

int64_t, uint64_t

kFloat 3

float

kDouble 4

double

kString 5

std::string

kMessage 6

Derived from MessageLite

Possible types that a key/value can take.

LINT.IfChange(map_ffi)

Defined at line 256 of file ../../third_party/protobuf/src/src/google/protobuf/map.h

Records

Friends

class RustMapHelper
class UntypedMapIterator
class MapBenchmarkPeer
class MapTestPeer
class TcParser
class MapFieldBase