template<typename K, typename V>
class maxon::MapInterface< K, V >
MapInterface is an interface which provides the usual map functions as virtual methods. Each standard map of the MAXON API can be represented as such an interface, so this allows to write non-template functions which nevertheless are able to deal with any kind of map.
If the function won't modify both the structure and values of the map, you should use a const
MapInterface with const
values:
void Func(const MapInterface<Int, const String>& map);
HashMap<Int, String> myMap;
Func(myMap);
ArrayMap<Int, String> myMap2;
Func(myMap2);
The access to the set happens via virtual methods, so there is an inevitable performance penalty, but this will be negligible for most use cases.
For a map which shall be modified, use WritableMapInterface as type of the function parameter instead.
- Template Parameters
-
K | Type of keys of the map. |
V | Type of values of the map. |
|
MAXON_METHOD Int | GetCount () const |
|
MAXON_FUNCTION Bool | IsEmpty () const |
|
MAXON_FUNCTION Bool | IsPopulated () const |
|
MAXON_METHOD ResultRef< V > | InsertKey (const K &key, Bool &created=BoolLValue()) |
|
MAXON_METHOD ResultRef< V > | InsertKey (K &&key, Bool &created=BoolLValue()) |
|
template<typename VALUE > |
MAXON_FUNCTION ResultRef< V > | Insert (const K &key, VALUE &&value, Bool &created=BoolLValue()) |
|
template<typename VALUE > |
MAXON_FUNCTION ResultRef< V > | Insert (K &&key, VALUE &&value, Bool &created=BoolLValue()) |
|
MAXON_METHOD V * | FindValue (const K &key) |
|
const MAXON_METHOD V * | FindValue (const K &key) const |
|
MAXON_METHOD Result< Bool > | Erase (const K &key) |
|
MAXON_METHOD Iterator | Erase (const Iterator &iterator) |
|
MAXON_METHOD void | Reset () |
|
MAXON_METHOD void | Flush () |
|
MAXON_METHOD Result< void > | CopyFrom (const MapInterface &other) |
|
MAXON_METHOD Result< MapInterface * > | Clone (Bool cloneElements=true) const |
|
const MAXON_METHOD DataType & | GetKeyDataType () const |
|
const MAXON_METHOD DataType & | GetValueDataType () const |
|
MAXON_METHOD String | ToString (const FormatStatement *formatStatement) const |
|
MAXON_METHOD Int | GetMemorySize () const |
|
| MAXON_ADD_TO_CONST_REFERENCE_CLASS (UInt GetHashCode() const { CriticalStop("Not implemented.");return 0;};) |
|
template<typename KT , typename VT > |
MAXON_FUNCTION Bool | HasType () const |
|
template<typename KT , typename VT > |
MAXON_FUNCTION void | AssertType () const |
|
template<typename KT , typename VT > |
MapInterface< KT, VT > & | AssertCast () |
|
template<typename KT , typename VT > |
const MapInterface< KT, VT > & | AssertCast () const |
|
| operator const MapInterface< K, const V > & () const |
|
| operator const MapInterface< Generic, typename std::conditional< std::is_same< const V, const Generic >::value, const DummyReturnType, const Generic >::type > & () const |
|
| operator MapInterface< Generic, typename std::conditional< std::is_same< V, Generic >::value, volatile DummyReturnType, Generic >::type > & () |
|
| operator const NonConstMap< K, V > & () |
|
| operator const NonConstMap< Generic, typename std::conditional< std::is_same< V, Generic >::value, DummyReturnType, Generic >::type > & () |
|
ConstIterator | Begin () const |
|
Iterator | Begin () |
|
ConstIterator | End () const |
|
Iterator | End () |
|
MAXON_ATTRIBUTE_FORCE_INLINE | MapBase0 (ARGS &&... args) |
|
MAXON_ATTRIBUTE_FORCE_INLINE Bool | Contains (typename ByValueParam< K >::type key) const |
|
MAXON_ATTRIBUTE_FORCE_INLINE SFINAEHelper< Bool, typename PAIR::KeyType >::type | Contains (const PAIR &pair) const |
|
ResultRef< V > | Append (const K &key) |
|
SFINAEHelper< ResultRef< V >, typename PAIR::KeyType >::type | Append (const PAIR &pair) |
|
Result< void > | Add (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY) |
|
Result< void > | AppendAll (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY) |
|
Result< void > | AppendAllInverse (COLLECTION2 &&other) |
|
Bool | ContainsAllImpl (COLLECTION2 &&other, OverloadRank0) const |
|
Result< void > | SubtractImpl (COLLECTION2 &&other, OverloadRank0) |
|
Bool | IsEqualImpl (const COLLECTION2 &other, COMPARE &&cmp, OverloadRank0) const |
|
UInt | GetHashCode () const |
|
MAXON_ATTRIBUTE_FORCE_INLINE | BaseCollection (ARGS &&... args) |
|
MAXON_ATTRIBUTE_FORCE_INLINE std::enable_if< maxon::IsCollection< COLLECTION2 >::value, Bool >::type | operator== (const COLLECTION2 &other) const |
|
MAXON_ATTRIBUTE_FORCE_INLINE std::enable_if< maxon::IsCollection< COLLECTION2 >::value, Bool >::type | operator!= (const COLLECTION2 &other) const |
|
MAXON_ATTRIBUTE_FORCE_INLINE std::enable_if< maxon::IsCollection< COLLECTION2 >::value &&!std::is_same< typename std::decay< COMPARE >::type, EQUALITY >::value, Bool >::type | IsEqual (const COLLECTION2 &other, COMPARE &&cmp=COMPARE()) const |
|
MAXON_ATTRIBUTE_FORCE_INLINE Result< void > | AppendAll (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY) |
|
MAXON_ATTRIBUTE_FORCE_INLINE Result< void > | CopyFrom (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::FIT_TO_SIZE) |
|
MAXON_ATTRIBUTE_FORCE_INLINE Result< void > | Subtract (COLLECTION2 &&other) |
|
MAXON_ATTRIBUTE_FORCE_INLINE Result< void > | Intersect (const COLLECTION2 &other) |
|
Bool | Intersects (const COLLECTION2 &other) const |
|
MAXON_ATTRIBUTE_FORCE_INLINE Result< void > | CopyFromImpl (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags, OverloadRank0) |
|
Result< void > | AppendAllImpl (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags, Bool overwrite, OverloadRank0) |
|
Result< void > | IntersectImpl (COLLECTION2 &&other, OverloadRank0) |
|
MAXON_ATTRIBUTE_FORCE_INLINE Bool | IsEmpty () const |
|
MAXON_ATTRIBUTE_FORCE_INLINE Bool | IsPopulated () const |
|
String | ToString (const FormatStatement *formatStatement) const |
|
MAXON_ATTRIBUTE_FORCE_INLINE Bool | ContainsAll (COLLECTION2 &&other) const |
|
Bool | ContainsAllImpl (COLLECTION2 &&other, OverloadRank0) const |
|