Map container of NodeRef->NodeRef in DSL graph. Map implements copy on write semantics, which means map is mutable but copy will happen when array is referenced in more than two places.
More...
#include <container_ext.h>
|
| Map () |
| default constructor More...
|
|
| Map (Map< K, V > &&other) |
| move constructor More...
|
|
| Map (const Map< K, V > &other) |
| copy constructor More...
|
|
Map< K, V > & | operator= (Map< K, V > &&other) |
| copy assign operator More...
|
|
Map< K, V > & | operator= (const Map< K, V > &other) |
| move assign operator More...
|
|
| Map (ObjectPtr< Object > n) |
| constructor from pointer More...
|
|
template<typename IterType > |
| Map (IterType begin, IterType end) |
| constructor from iterator More...
|
|
| Map (std::initializer_list< std::pair< K, V >> init) |
| constructor from initializer list More...
|
|
template<typename Hash , typename Equal > |
| Map (const std::unordered_map< K, V, Hash, Equal > &init) |
| constructor from unordered_map More...
|
|
const V | at (const K &key) const |
| Read element from map. More...
|
|
const V | operator[] (const K &key) const |
| Read element from map. More...
|
|
size_t | size () const |
|
size_t | count (const K &key) const |
|
bool | empty () const |
|
void | Set (const K &key, const V &value) |
| set the Map. More...
|
|
iterator | begin () const |
|
iterator | end () const |
|
iterator | find (const K &key) const |
|
void | erase (const K &key) |
|
MapObj * | CopyOnWrite () |
| copy on write semantics Do nothing if current handle is the unique copy of the array. Otherwise make a new copy of the array to ensure the current handle hold a unique copy. More...
|
|
| ObjectRef ()=default |
| default constructor More...
|
|
| ObjectRef (ObjectPtr< Object > data) |
| Constructor from existing object ptr. More...
|
|
bool | same_as (const ObjectRef &other) const |
| Comparator. More...
|
|
bool | operator== (const ObjectRef &other) const |
| Comparator. More...
|
|
bool | operator!= (const ObjectRef &other) const |
| Comparator. More...
|
|
bool | operator< (const ObjectRef &other) const |
| Comparator. More...
|
|
bool | defined () const |
|
const Object * | get () const |
|
const Object * | operator-> () const |
|
bool | unique () const |
|
template<typename ObjectType > |
const ObjectType * | as () const |
| Try to downcast the internal Object to a raw pointer of a corresponding type. More...
|
|
template<typename K, typename V, typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
class mxnet::runtime::Map< K, V, typename, typename >
Map container of NodeRef->NodeRef in DSL graph. Map implements copy on write semantics, which means map is mutable but copy will happen when array is referenced in more than two places.
operator[] only provide const acces, use Set to mutate the content.
- Template Parameters
-
K | The key NodeRef type. |
V | The value NodeRef type. |
◆ ContainerType
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
◆ key_type
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
◆ mapped_type
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
◆ Map() [1/7]
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
◆ Map() [2/7]
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
move constructor
- Parameters
-
◆ Map() [3/7]
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
copy constructor
- Parameters
-
◆ Map() [4/7]
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
constructor from pointer
- Parameters
-
◆ Map() [5/7]
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
template<typename IterType >
constructor from iterator
- Parameters
-
begin | begin of iterator |
end | end of iterator |
- Template Parameters
-
IterType | The type of iterator |
◆ Map() [6/7]
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
constructor from initializer list
- Parameters
-
◆ Map() [7/7]
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
template<typename Hash , typename Equal >
constructor from unordered_map
- Parameters
-
◆ at()
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
Read element from map.
- Parameters
-
- Returns
- the corresonding element.
◆ begin()
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
◆ CopyOnWrite()
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
copy on write semantics Do nothing if current handle is the unique copy of the array. Otherwise make a new copy of the array to ensure the current handle hold a unique copy.
- Returns
- Handle to the internal node container(which ganrantees to be unique)
◆ count()
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
- Returns
- The number of elements of the key
◆ empty()
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
- Returns
- whether array is empty
◆ end()
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
◆ erase()
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
◆ find()
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
- Returns
- find the key and returns the associated iterator
◆ operator=() [1/2]
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
move assign operator
- Parameters
-
other | The source of assignment |
- Returns
- reference to self.
◆ operator=() [2/2]
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
copy assign operator
- Parameters
-
other | The source of assignment |
- Returns
- reference to self.
◆ operator[]()
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
Read element from map.
- Parameters
-
- Returns
- the corresonding element.
◆ Set()
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
set the Map.
- Parameters
-
key | The index key. |
value | The value to be setted. |
◆ size()
template<typename K , typename V , typename = typename std::enable_if<std::is_base_of<ObjectRef, K>::value>::type, typename = typename std::enable_if<std::is_base_of<ObjectRef, V>::value>::type>
- Returns
- The size of the array
The documentation for this class was generated from the following file: