WPILibC++
2019.1.1-beta-2-21-gbea0565
|
StringMap - This is an unconventional map that is specialized for handling keys that are "strings", which are basically ranges of bytes. More...
#include <StringMap.h>
Public Types | |
using | MapEntryTy = StringMapEntry< ValueTy > |
using | key_type = const char * |
using | mapped_type = ValueTy |
using | value_type = StringMapEntry< ValueTy > |
using | size_type = size_t |
using | const_iterator = StringMapConstIterator< ValueTy > |
using | iterator = StringMapIterator< ValueTy > |
Public Member Functions | |
StringMap (unsigned InitialSize) | |
StringMap (std::initializer_list< std::pair< StringRef, ValueTy >> List) | |
StringMap (StringMap &&RHS) | |
StringMap (const StringMap &RHS) | |
StringMap & | operator= (StringMap RHS) |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
iterator_range < StringMapKeyIterator < ValueTy > > | keys () const |
iterator | find (StringRef Key) |
const_iterator | find (StringRef Key) const |
ValueTy | lookup (StringRef Key) const |
lookup - Return the entry for the specified key, or a default constructed value if no such entry exists. More... | |
ValueTy & | operator[] (StringRef Key) |
Lookup the ValueTy for the Key , or create a default constructed value if the key is not in the map. More... | |
size_type | count (StringRef Key) const |
count - Return 1 if the element is in the map, 0 otherwise. | |
bool | insert (MapEntryTy *KeyValue) |
insert - Insert the specified key/value pair into the map. More... | |
std::pair< iterator, bool > | insert (std::pair< StringRef, ValueTy > KV) |
insert - Inserts the specified key/value pair into the map if the key isn't already in the map. More... | |
template<typename... ArgsTy> | |
std::pair< iterator, bool > | emplace_second (StringRef Key, ArgsTy &&...Args) |
template<typename... ArgsTy> | |
std::pair< iterator, bool > | try_emplace (StringRef Key, ArgsTy &&...Args) |
Emplace a new element for the specified key into the map if the key isn't already in the map. More... | |
void | clear () |
void | remove (MapEntryTy *KeyValue) |
remove - Remove the specified key/value pair from the map, but do not erase it. More... | |
void | erase (iterator I) |
bool | erase (StringRef Key) |
![]() | |
unsigned | getNumBuckets () const |
unsigned | getNumItems () const |
bool | empty () const |
unsigned | size () const |
void | swap (StringMapImpl &Other) |
Additional Inherited Members | |
![]() | |
static StringMapEntryBase * | getTombstoneVal () |
![]() | |
StringMapImpl (unsigned itemSize) | |
StringMapImpl (StringMapImpl &&RHS) | |
StringMapImpl (unsigned InitSize, unsigned ItemSize) | |
unsigned | RehashTable (unsigned BucketNo=0) |
unsigned | LookupBucketFor (StringRef Key) |
LookupBucketFor - Look up the bucket that the specified string should end up in. More... | |
int | FindKey (StringRef Key) const |
FindKey - Look up the bucket that contains the specified key. More... | |
void | RemoveKey (StringMapEntryBase *V) |
RemoveKey - Remove the specified StringMapEntry from the table, but do not delete it. More... | |
StringMapEntryBase * | RemoveKey (StringRef Key) |
RemoveKey - Remove the StringMapEntry for the specified key from the table, returning it. More... | |
void | init (unsigned Size) |
Allocate the table with the specified number of buckets and otherwise setup the map as empty. More... | |
![]() | |
StringMapEntryBase ** | TheTable = nullptr |
unsigned | NumBuckets = 0 |
unsigned | NumItems = 0 |
unsigned | NumTombstones = 0 |
unsigned | ItemSize |
StringMap - This is an unconventional map that is specialized for handling keys that are "strings", which are basically ranges of bytes.
This does some funky memory allocation and hashing things to make it extremely efficient, storing the string data after the value in the map.
|
inline |
insert - Insert the specified key/value pair into the map.
If the key already exists in the map, return false and ignore the request, otherwise insert it and return true.
|
inline |
insert - Inserts the specified key/value pair into the map if the key isn't already in the map.
The bool component of the returned pair is true if and only if the insertion takes place, and the iterator component of the pair points to the element with key equivalent to the key of the pair.
|
inline |
lookup - Return the entry for the specified key, or a default constructed value if no such entry exists.
|
inline |
Lookup the ValueTy for the Key
, or create a default constructed value if the key is not in the map.
|
inline |
remove - Remove the specified key/value pair from the map, but do not erase it.
This aborts if the key is not in the map.
|
inline |
Emplace a new element for the specified key into the map if the key isn't already in the map.
The bool component of the returned pair is true if and only if the insertion takes place, and the iterator component of the pair points to the element with key equivalent to the key of the pair.