1 #ifndef CORE_SharedPointersListVMap_CPP 2 #define CORE_SharedPointersListVMap_CPP 6 template<
class K,
class V>
14 template<
class Key,
class Value>
15 template<
class K,
class V>
22 template<
class Key,
class Value>
27 template<
class Key,
class Value>
28 template<
class K,
class V>
34 for (
int i=0;i<n;i++) {
35 boost::shared_ptr<CORE_SharedPointersList<Value> > &listAtK=m[keys[i]];
37 copyList.copy(listAtK);
38 put((Key)keys[i],copyList);
43 template<
class Key,
class Value>
50 for (
int i=0;i<n;i++) {
54 for (
int j=0;j<p;j++) {
62 template<
class Key,
class Value>
64 typename map<Key,boost::shared_ptr<CORE_SharedPointersList<Value> > >::const_iterator iter=
mMap.find(k);
65 if (iter==
mMap.end())
return false;
69 template<
class Key,
class Value>
72 typename map<Key,boost::shared_ptr<CORE_SharedPointersList<Value> > >::iterator iter=
mMap.find(k);
73 if (iter!=
mMap.end()) {
74 boost::shared_ptr<CORE_SharedPointersList<Value> > &listAtK=iter->second;
78 template<
class Key,
class Value>
80 typename map<Key,boost::shared_ptr<CORE_SharedPointersList<Value> > >::iterator iter=
mMap.find(k);
81 if (iter==
mMap.end()) {
86 boost::shared_ptr<CORE_SharedPointersList<Value> > &listAtK=iter->second;
88 if (!listAtK->exists(v)) listAtK->add(v);
89 }
else listAtK->add(v);
94 template<
class Key,
class Value>
96 typename map<Key,boost::shared_ptr<CORE_SharedPointersList<Value> > >::const_iterator iter=
mMap.find(k);
98 return iter->second.get();
101 template<
class Key,
class Value>
103 typename map<Key,boost::shared_ptr<CORE_SharedPointersList<Value> > >::iterator iter=
mMap.find(k);
105 return iter->second.get();
111 template<
class Key,
class Value>
113 int nbKeys=
mMap.size();
115 typename map<Key,boost::shared_ptr<CORE_SharedPointersList<Value> > >::const_iterator iter=
mMap.begin();
116 typename map<Key,boost::shared_ptr<CORE_SharedPointersList<Value> > >::const_iterator end=
mMap.end();
125 template<
class Key,
class Value>
128 typename map<Key,boost::shared_ptr<CORE_SharedPointersList<Value> > >::const_iterator iter=
mMap.begin();
129 typename map<Key,boost::shared_ptr<CORE_SharedPointersList<Value> > >::const_iterator end=
mMap.end();
132 keys.
add(iter->first);
137 template<
class Key,
class Value>
140 typename map<Key,boost::shared_ptr<CORE_SharedPointersList<Value> > >::const_iterator iter=
mMap.begin();
141 typename map<Key,boost::shared_ptr<CORE_SharedPointersList<Value> > >::const_iterator end=
mMap.end();
144 keys.
add(iter->first);
150 template<
class Key,
class Value>
152 typename map<Key,boost::shared_ptr<CORE_SharedPointersList<Value> > >::const_iterator
exists=
mMap.find(k);
153 if (exists!=
mMap.end()) {
160 template<
class Key,
class Value>
166 for (
int i=0;i<n;i++) {
167 if ((*
this)[ks[i]]->
exists(v)) ret=
remove(ks[i]);
172 template<
class Key,
class Value>
178 for (
int i=0;i<n;i++) {
179 if ((*
this)[ks[i]]->
exists(v)) ret=
remove(ks[i]);
184 template<
class Key,
class Value>
190 for (
int i=0;i<n;i++) {
191 if ((*
this)[ks[i]]->
exists(v)) ret=
remove(ks[i]);
tUIndex getSize() const
return the size of the array
Definition: CORE_SharedPointersList.h:258
tBoolean exists(const Key &k) const
exists return true if the key exists in map
Definition: CORE_SharedPointersListVMap.hpp:63
virtual void clear()
clear the array : desallocate the array
Definition: CORE_Array.h:300
map< Key, boost::shared_ptr< CORE_SharedPointersList< Value > > > mMap
Definition: CORE_SharedPointersListVMap.h:20
this class describes an array
Definition: CORE_Vector.h:19
class CORE_SharedPointersList is a list of shared pointers
Definition: CORE_SharedPointersList.h:11
static boost::shared_ptr< CORE_SharedPointersList< T > > New()
New constructor of a shared pointers list.
Definition: CORE_SharedPointersList.h:72
CORE_SharedPointersListVMap()
Definition: CORE_SharedPointersListVMap.hpp:7
void copy(const CORE_SharedPointersListVMap< K, V > &mapCpy)
copy a map
Definition: CORE_SharedPointersListVMap.hpp:29
virtual ~CORE_SharedPointersListVMap()
destroy a map
Definition: CORE_SharedPointersListVMap.hpp:23
#define tBoolean
Definition: types.h:139
This class describes a map: primitive type of Key -> shared pointer of list of Value.
Definition: CORE_SharedPointersListVMap.h:17
tBoolean remove(const Key &k)
remove the key
Definition: CORE_SharedPointersListVMap.hpp:151
virtual tString toString() const
return the string associated to the string
Definition: CORE_String.h:223
void clear()
clear the map
Definition: CORE_SharedPointersListVMap.h:233
tString toString() const
return the string associated to the integer
Definition: CORE_Integer.h:106
#define null
Definition: types.h:144
tBoolean put(const Key &k, boost::shared_ptr< CORE_SharedPointersList< Value > > v)
set the value at the index k
Definition: CORE_SharedPointersListVMap.h:129
this class describes an array
Definition: CORE_Array.h:19
void add(const CORE_Vector< T > &u, const CORE_Vector< T > &v)
init the value to this=u-v
Definition: CORE_Vector.h:439
tBoolean removeValue(const Value *k)
remove the value
Definition: CORE_SharedPointersListVMap.hpp:185
void add(const tReal &alpha, const CORE_Array< Q > &Y, const tReal &beta)
This=alpha.Y+beta.This.
Definition: CORE_Array.h:582
void keys(CORE_Vector< Key > &ks) const
return an array of keys
Definition: CORE_SharedPointersListVMap.h:102
abstract base class for most classes.
Definition: CORE_Object.h:53
#define tString
Definition: types.h:135
virtual tString toString() const
return the string representation of the object node
Definition: CORE_Object.h:326
const CORE_SharedPointersList< Value > * get(const Key &k) const
get the value at key k
Definition: CORE_SharedPointersListVMap.hpp:95
void getKeys(vector< Key > &ks) const
return a vector of keys
Definition: CORE_SharedPointersListVMap.hpp:112
void clear()
clear the array
Definition: CORE_Vector.h:248
virtual tString toString() const
return the string representation of the object node
Definition: CORE_SharedPointersListVMap.hpp:44