Class MapObj#
Defined in File map.h
Inheritance Relationships#
Base Type#
public tvm::ffi::Object
(Class Object)
Derived Types#
public tvm::ffi::DenseMapObj
(Class DenseMapObj)public tvm::ffi::SmallMapObj
(Class SmallMapObj)
Class Documentation#
-
class MapObj : public tvm::ffi::Object#
Shared content of all specializations of hash map.
Subclassed by tvm::ffi::DenseMapObj, tvm::ffi::SmallMapObj
Public Types
Public Functions
-
size_t count(const key_type &key) const#
Count the number of times a key exists in the hash map.
- Parameters:
key – The indexing key
- Returns:
The result, 0 or 1
-
const mapped_type &at(const key_type &key) const#
Index value associated with a key, throw exception if the key does not exist.
- Parameters:
key – The indexing key
- Returns:
The const reference to the value
-
mapped_type &at(const key_type &key)#
Index value associated with a key, throw exception if the key does not exist.
- Parameters:
key – The indexing key
- Returns:
The mutable reference to the value
-
iterator begin() const#
- Returns:
begin iterator
-
iterator end() const#
- Returns:
end iterator
-
iterator find(const key_type &key) const#
Index value associated with a key.
- Parameters:
key – The indexing key
- Returns:
The iterator of the entry associated with the key, end iterator if not exists
-
void erase(const iterator &position)#
Erase the entry associated with the iterator.
- Parameters:
position – The iterator
Public Static Functions
Protected Functions
-
inline bool IsSmallMap() const#
Check if the map is a small map.
- Returns:
True if the map is a small map
Protected Attributes
-
void *data_#
data pointer to the data region of the map.
Note
For immutable inplace small map we do not need data_, but we keep it here for future compact with mutable container.
-
uint64_t size_#
number of entries in the container
-
uint64_t slots_#
number of slots
Protected Static Functions
-
template<typename IterType>
static inline ObjectPtr<Object> CreateFromRange(IterType first, IterType last)# Create the map using contents from the given iterators.
- Parameters:
first – Begin of iterator
last – End of iterator
- Template Parameters:
IterType – The type of iterator
- Returns:
ObjectPtr to the map created
-
static inline void InsertMaybeReHash(KVType &&kv, ObjectPtr<Object> *map)#
InsertMaybeReHash an entry into the given hash map.
- Parameters:
kv – The entry to be inserted
map – The pointer to the map, can be changed if re-hashing happens
-
static inline ObjectPtr<MapObj> CopyFrom(MapObj *from)#
Create an empty container with elements copying from another SmallMapObj.
- Parameters:
from – The source container
- Returns:
The object created
Protected Static Attributes
-
static constexpr uint64_t kSmallTagMask = static_cast<uint64_t>(1) << 63#
Small layout tag mask.
Note
The most significant bit is used to indicate the small map layout.
Friends
- friend class Map
-
size_t count(const key_type &key) const#