9 template<
class Key,
class Value>
15 template<
class Key,
class Value>
22 put(keys[i],m.
get(keys[i]));
27 template<
class Key,
class Value>
32 template<
class Key,
class Value>
33 template<
class K2,
class V2>
35 if (
this==©Map)
return;
40 for (
int i=0;i<n;i++) {
41 Key newKey=(Key) keys[i];
42 const Value *newValue=(
const Value *) copyMap.
get(keys[i]);
43 put(newKey,*newValue);
46 template<
class Key,
class Value>
48 typename map<Key,Value>::const_iterator iter=mMap.find(k);
49 if (iter==mMap.end())
return false;
53 template<
class Key,
class Value>
55 typename map<Key,Value>::const_iterator iter=mMap.find(k);
56 if (iter==mMap.end())
return null;
57 return &(iter->second);
59 template<
class Key,
class Value>
61 typename map<Key,Value>::iterator iter=mMap.find(k);
62 if (iter==mMap.end())
return null;
63 return &(iter->second);
66 template<
class Key,
class Value>
71 typename map<Key,Value>::const_iterator iter=mMap.begin();
72 typename map<Key,Value>::const_iterator end=mMap.end();
75 vals.
set(i++,iter->second);
79 template<
class Key,
class Value>
84 typename map<Key,Value>::const_iterator iter=mMap.begin();
85 typename map<Key,Value>::const_iterator end=mMap.end();
88 vals.
set(i++,iter->second);
92 template<
class Key,
class Value>
97 typename map<Key,Value>::const_iterator iter=mMap.begin();
98 typename map<Key,Value>::const_iterator end=mMap.end();
101 vals[i++]=iter->second;
108 template<
class Key,
class Value>
110 int nbKeys=mMap.size();
112 typename map<Key,Value>::const_iterator iter=mMap.begin();
113 typename map<Key,Value>::const_iterator end=mMap.end();
122 template<
class Key,
class Value>
125 typename map<Key,Value>::const_iterator iter=mMap.begin();
126 typename map<Key,Value>::const_iterator end=mMap.end();
128 keys.
add(iter->first);
132 template<
class Key,
class Value>
135 typename map<Key,Value>::const_iterator iter=mMap.begin();
136 typename map<Key,Value>::const_iterator end=mMap.end();
138 keys.
add(iter->first);
142 template<
class Key,
class Value>
146 int nbKeys=ks.size();
147 for (
int i=0;i<nbKeys;i++) {
148 put(ks[i],m.
get(ks[i]));
152 template<
class Key,
class Value>
154 typename map<Key,Value>::const_iterator exists=mMap.find(k);
155 if (exists!=mMap.end()) {
162 template<
class Key,
class Value>
168 for (
int i=0;i<n;i++) {
169 if (
get(ks[i])==v) ret=
remove(ks[i]);
tBoolean exists(const Key &k) const
exists return true if the key exists in map
Definition: CORE_Map.hpp:47
virtual void clear()
clear the array
Definition: CORE_Array.h:489
tBoolean remove(const Key &k)
remove the key
Definition: CORE_Map.hpp:153
void merge(const CORE_Map< Key, Value > &m)
merge the map
Definition: CORE_Map.hpp:143
this class describes an array
Definition: CORE_Vector.h:18
void set(const int &i, const T &obj)
set the object at the index i
Definition: CORE_Array.h:339
void keys(CORE_Vector< Key > &ks) const
return an array of keys
Definition: CORE_Map.h:153
tBoolean removeValue(const Value &k)
remove the value
Definition: CORE_Map.hpp:163
#define tBoolean
Definition: types.h:35
void add(const CORE_Vector< T > &v)
init the value to v
Definition: CORE_Vector.h:206
#define null
Definition: types.h:13
const Value * get(const Key &k) const
get the value at key k
Definition: CORE_Map.hpp:54
void add(const T &obj)
add an element at the end re-allocate the array if capacity too small
Definition: CORE_Array.hpp:157
void setSize(const int &n)
set the size of the array
Definition: CORE_Array.hpp:141
void put(const Key &k, const Value &v)
set the value at the index k
Definition: CORE_Map.h:178
this class describes a map
Definition: CORE_Map.h:18
this class describes an array
Definition: CORE_Array.h:18
virtual ~CORE_Map()
destroy a map
Definition: CORE_Map.hpp:28
abstract base class for most classes.
Definition: CORE_Object.h:30
tBoolean set(int i, const T &obj)
set the pointer at the index i
Definition: CORE_Vector.hpp:178
void setSize(const int &n)
set the size of the array
Definition: CORE_Vector.h:162
void copy(const CORE_Map< K2, V2 > &mapCpy)
copy a map
Definition: CORE_Map.hpp:34
CORE_Map()
build a map
Definition: CORE_Map.hpp:10
void clear()
clear the array
Definition: CORE_Vector.h:350
void getValues(CORE_Vector< Value > &vals) const
return an array of values
Definition: CORE_Map.hpp:67
#define tInteger
Definition: types.h:32
void getKeys(vector< Key > &ks) const
return a vector of keys
Definition: CORE_Map.hpp:109