1 #ifndef CORE_SharedPointersVMap_CPP 2 #define CORE_SharedPointersVMap_CPP 6 template<
class K,
class V>
14 template<
class Key,
class Value>
15 template<
class K,
class V>
21 template<
class Key,
class Value>
26 template<
class Key,
class Value>
27 template<
class K,
class V>
34 put((Key)keys[i],boost::dynamic_pointer_cast<Value>(m[keys[i]]));
38 template<
class K,
class V>
51 template<
class Key,
class Value>
53 typename map<Key,boost::shared_ptr<Value> >::const_iterator iter=
mMap.find(k);
54 if (iter==
mMap.end())
return false;
58 template<
class Key,
class Value>
60 typename map<Key,boost::shared_ptr<Value> >::const_iterator iter=
mMap.find(k);
62 return iter->second.get();
65 template<
class Key,
class Value>
67 typename map<Key,boost::shared_ptr<Value> >::iterator iter=
mMap.find(k);
69 return iter->second.get();
72 template<
class Key,
class Value>
77 typename map<Key,boost::shared_ptr<Value> >::const_iterator iter=
mMap.begin();
78 typename map<Key,boost::shared_ptr<Value> >::const_iterator end=
mMap.end();
81 vals.
set(i++,iter->second);
85 template<
class Key,
class Value>
90 typename map<Key,boost::shared_ptr<Value> >::const_iterator iter=
mMap.begin();
91 typename map<Key,boost::shared_ptr<Value> >::const_iterator end=
mMap.end();
94 vals.
set(i++,iter->second);
99 template<
class Key,
class Value>
104 typename map<Key,boost::shared_ptr<Value> >::const_iterator iter=
mMap.begin();
105 typename map<Key,boost::shared_ptr<Value> >::const_iterator end=
mMap.end();
106 typename vector<Value*>::iterator iVals=vals.
begin();
108 *iVals=iter->second.get();
113 template<
class Key,
class Value>
118 typename map<Key,boost::shared_ptr<Value> >::const_iterator iter=
mMap.begin();
119 typename map<Key,boost::shared_ptr<Value> >::const_iterator end=
mMap.end();
120 typename vector<Value>::iterator iVals=vals.begin();
122 *iVals=iter->second.get();
130 template<
class Key,
class Value>
134 typename map<Key,boost::shared_ptr<Value> >::const_iterator iter=
mMap.begin();
135 typename map<Key,boost::shared_ptr<Value> >::const_iterator end=
mMap.end();
136 typename vector<Key>::iterator iKeys=keys.begin();
145 template<
class Key,
class Value>
149 typename map<Key,boost::shared_ptr<Value> >::const_iterator iter=
mMap.begin();
150 typename map<Key,boost::shared_ptr<Value> >::const_iterator end=
mMap.end();
151 typename vector<Key>::iterator iKeys=keys.
begin();
160 template<
class Key,
class Value>
161 template<
class K,
class V>
165 typename vector<K>::iterator iks=ks.begin();
166 while (iks!=ks.end()) {
167 put((Key)*iks,boost::dynamic_pointer_cast<Value>(m[*iks]));
172 template<
class Key,
class Value>
174 typename map<Key,boost::shared_ptr<Value> >::const_iterator
exists=
mMap.find(k);
175 if (exists!=
mMap.end()) {
182 template<
class Key,
class Value>
187 typename vector<Key>::iterator iks=ks.begin();
188 while (iks!=ks.end()) {
189 if (
get(*iks)==v) ret=
remove(*iks);
tBoolean exists(const Key &k) const
exists return true if the key exists in map
Definition: CORE_SharedPointersVMap.hpp:52
void getValues(CORE_Vector< Value *> &vals) const
return an array of values
Definition: CORE_SharedPointersVMap.hpp:100
void copy(const CORE_SharedPointersVMap< K, V > &mapCpy)
copy a map
Definition: CORE_SharedPointersVMap.hpp:28
tBoolean set(const tUIndex &i, boost::shared_ptr< T > obj)
set the pointer at the index i
Definition: CORE_SharedPointersList.hpp:95
this class describes an array
Definition: CORE_Vector.h:19
class CORE_SharedPointersList is a list of shared pointers
Definition: CORE_SharedPointersList.h:11
void clear()
clear the array
Definition: CORE_SharedPointersList.h:221
tBoolean remove(const Key &k)
remove the key
Definition: CORE_SharedPointersVMap.hpp:173
const Value * get(const Key &k) const
get the value at key k
Definition: CORE_SharedPointersVMap.hpp:59
map< Key, boost::shared_ptr< Value > > mMap
Definition: CORE_SharedPointersVMap.h:17
#define tBoolean
Definition: types.h:139
virtual tString toString() const
return the string associated to the string
Definition: CORE_String.h:223
#define null
Definition: types.h:144
This class describes a map: primitive type of Key -> shared pointer of Value.
Definition: CORE_SharedPointersVMap.h:15
void setSize(const tUIndex &n)
set the size of the vector
Definition: CORE_Vector.h:255
virtual ~CORE_SharedPointersVMap()
destroy a map
Definition: CORE_SharedPointersVMap.hpp:22
virtual tString toString() const
return the string representation of the object node
Definition: CORE_SharedPointersVMap.hpp:39
void merge(const CORE_SharedPointersVMap< K, V > &m)
merge the map
Definition: CORE_SharedPointersVMap.hpp:162
#define tUIndex
Definition: types.h:126
void clear()
clear the map
Definition: CORE_SharedPointersVMap.h:258
abstract base class for most classes.
Definition: CORE_Object.h:53
tBoolean removeValue(const Value *k)
remove the value
Definition: CORE_SharedPointersVMap.h:234
#define tString
Definition: types.h:135
virtual tString toString() const
return the string representation of the object node
Definition: CORE_Object.h:326
void getKeys(vector< Key > &ks) const
return a vector of keys
Definition: CORE_SharedPointersVMap.hpp:131
CORE_SharedPointersVMap()
Definition: CORE_SharedPointersVMap.hpp:7
tBoolean put(const Key &k, const boost::shared_ptr< Value > &v)
set the value at the index k
Definition: CORE_SharedPointersVMap.h:192
vector< T >::const_iterator begin() const
get iterator
Definition: CORE_Vector.h:331
void setSize(const tUIndex &n)
set the size of the shared pointers list
Definition: CORE_SharedPointersList.h:87
void clear()
clear the array
Definition: CORE_Vector.h:248