Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __PLCORE_CONTAINER_SIMPLEMAP_H__
00024 #define __PLCORE_CONTAINER_SIMPLEMAP_H__
00025 #pragma once
00026
00027
00028
00029
00030
00031 #include "PLCore/Container/Map.h"
00032 #include "PLCore/Container/FastPool.h"
00033 #include "PLCore/Container/Functions.h"
00034
00035
00036
00037
00038
00039 namespace PLCore {
00040
00041
00042
00043
00044
00045 template <class KeyType, class ValueType, class Comparer> class SimpleMapIterator;
00046 template <class KeyType, class ValueType, class Comparer> class SimpleMapKeyIterator;
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060 template <class KeyType, class ValueType, class Comparer = CompareFunction>
00061 class SimpleMap : public Map<KeyType, ValueType> {
00062
00063
00064
00065
00066
00067 friend class SimpleMapIterator<KeyType, ValueType, Comparer>;
00068 friend class SimpleMapKeyIterator<KeyType, ValueType, Comparer>;
00069
00070
00071
00072
00073
00074 public:
00075
00076
00077
00078
00079 SimpleMap();
00080
00081
00082
00083
00084
00085 virtual ~SimpleMap();
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097 Map<KeyType, ValueType> &operator =(const SimpleMap<KeyType, ValueType, Comparer> &cSource);
00098
00099
00100
00101
00102
00103 private:
00104
00105
00106
00107
00108 class Element : public FastPoolElement<Element> {
00109 public:
00110 KeyType Key;
00111 ValueType Value;
00112 bool operator ==(const Element &cOther) const
00113 {
00114 return false;
00115 }
00116 };
00117
00118
00119
00120
00121
00122 private:
00123 FastPool<Element> m_lstElements;
00124
00125
00126
00127
00128
00129 public:
00130 virtual Iterator<ValueType> GetIterator(uint32 nIndex = 0) const override;
00131 virtual ConstIterator<ValueType> GetConstIterator(uint32 nIndex = 0) const override;
00132 virtual Iterator<ValueType> GetEndIterator() const override;
00133 virtual ConstIterator<ValueType> GetConstEndIterator() const override;
00134
00135
00136
00137
00138
00139 public:
00140 virtual void Clear() override;
00141 virtual bool IsEmpty() const override;
00142 virtual uint32 GetNumOfElements() const override;
00143 virtual bool Add(const KeyType &Key, const ValueType &Value) override;
00144 virtual bool Replace(const KeyType &Key, const ValueType &NewValue) override;
00145 virtual bool Set(const KeyType &Key, const ValueType &Value) override;
00146 virtual bool Remove(const KeyType &Key) override;
00147 virtual uint32 RemoveValue(const ValueType &Value) override;
00148 virtual const ValueType &Get(const KeyType &Key) const override;
00149 virtual ValueType &Get(const KeyType &Key) override;
00150 virtual Iterator<KeyType> GetKeyIterator(uint32 nIndex = 0) const override;
00151 virtual ConstIterator<KeyType> GetConstKeyIterator(uint32 nIndex = 0) const override;
00152 virtual Iterator<KeyType> GetEndKeyIterator() const override;
00153 virtual ConstIterator<KeyType> GetConstEndKeyIterator() const override;
00154
00155
00156
00157
00158
00159 private:
00160 virtual Map<KeyType, ValueType> &operator =(const Map<KeyType, ValueType> &cMap) override;
00161
00162
00163 };
00164
00165
00166
00167
00168
00169 }
00170
00171
00172
00173
00174
00175 #include "PLCore/Container/SimpleMap.inl"
00176
00177
00178 #endif // __PLCORE_CONTAINER_SIMPLEMAP_H__