1 #ifndef CORE_SharedPointersListVMap_H 2 #define CORE_SharedPointersListVMap_H 4 #include "boost/shared_ptr.hpp" 5 #include "boost/weak_ptr.hpp" 16 template <
class Key,
class Value>
20 map<Key,boost::shared_ptr<CORE_SharedPointersList<Value> > >
mMap;
33 template <
class K,
class Q>
44 inline const boost::shared_ptr<CORE_SharedPointersList<Value> >
operator[](
const Key& k)
const {
46 return mMap.find(k)->second;
50 inline boost::shared_ptr<CORE_SharedPointersList<Value> >
operator[](
const Key& k) {
52 return mMap.find(k)->second;
78 inline Value*
get(
const Key& k,
const tUIndex& index) {
80 if ((list!=
null) && (list->
getSize()>index))
return list->
get(index);
86 inline const Value*
get(
const Key& k,
const tUIndex& index)
const {
88 if ((list!=
null) && (list->
getSize()>index))
return list->
get(index);
108 void getKeys(vector<Key>& ks)
const;
122 template<
class K,
class V>
160 boost::shared_ptr<Value> p_v;
161 v.getSharedPointer(p_v);
162 return put(k,p_v,ifNotExists);
172 if (v!=
null)
return put(k,*v,ifNotExists);
191 return put(k,v,
true);
228 void clear(
const Key& k);
233 inline void clear() {mMap.clear();};
tUIndex getSize() const
return the size of the array
Definition: CORE_SharedPointersList.h:258
tBoolean put(const Key &k, boost::shared_ptr< Value > &v)
add the value at the index k add only if the value v does not already exist at index k ...
Definition: CORE_SharedPointersListVMap.h:190
tBoolean exists(const Key &k) const
exists return true if the key exists in map
Definition: CORE_SharedPointersListVMap.hpp:63
map< Key, boost::shared_ptr< CORE_SharedPointersList< Value > > > mMap
Definition: CORE_SharedPointersListVMap.h:20
boost::shared_ptr< CORE_SharedPointersList< Value > > operator[](const Key &k)
get object corresponding to key
Definition: CORE_SharedPointersListVMap.h:50
this class describes an array
Definition: CORE_Vector.h:19
class CORE_SharedPointersList is a list of shared pointers
Definition: CORE_SharedPointersList.h:11
tBoolean put(const Key &k, Value *v)
add the value at the index k add only if the value v does not already exist at index k ...
Definition: CORE_SharedPointersListVMap.h:180
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
tBoolean put(const Key &k, Value &v, const tBoolean &ifNotExists)
add the value at the index k.
Definition: CORE_SharedPointersListVMap.h:159
const T * get(const tUIndex &i) const
get the pointer at index i
Definition: CORE_SharedPointersList.h:242
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
const boost::shared_ptr< CORE_SharedPointersList< Value > > operator[](const Key &k) const
get object corresponding to key
Definition: CORE_SharedPointersListVMap.h:44
void clear()
clear the map
Definition: CORE_SharedPointersListVMap.h:233
#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
tBoolean put(const Key &k)
put only the key k with no values
Definition: CORE_SharedPointersListVMap.h:139
tBoolean removeValue(const Value *k)
remove the value
Definition: CORE_SharedPointersListVMap.hpp:185
#define tUIndex
Definition: types.h:126
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
tUIndex getSize() const
return the size of the array
Definition: CORE_SharedPointersListVMap.h:96
#define tString
Definition: types.h:135
tUIndex size() const
return the size of the array
Definition: CORE_SharedPointersListVMap.h:93
tBoolean put(const Key &k, Value &v)
add the value at the index k add only if the value v does not already exist at index k ...
Definition: CORE_SharedPointersListVMap.h:185
void getKeys(vector< Key > &ks) const
return a vector of keys
Definition: CORE_SharedPointersListVMap.hpp:112
tBoolean put(const Key &k, Value *v, const tBoolean &ifNotExists)
add the value at the index k
Definition: CORE_SharedPointersListVMap.h:171
virtual tString toString() const
return the string representation of the object node
Definition: CORE_SharedPointersListVMap.hpp:44
#define ASSERT_IN(a)
Definition: types.h:196