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 int& index) {
80 if ((list!=
null) && (list->
getSize()>index))
return list->
get(index);
86 inline const Value*
get(
const Key& k,
const int& index)
const {
88 if ((list!=
null) && (list->
getSize()>index))
return list->
get(index);
93 inline int size()
const{
return (
int) mMap.size();};
96 inline int getSize()
const{
return (
int) mMap.size();};
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();};
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
virtual tString toString() const
return the string representation of the object node
Definition: CORE_SharedPointersListVMap.hpp:44
boost::shared_ptr< CORE_SharedPointersList< Value > > operator[](const Key &k)
get object corresponding to key
Definition: CORE_SharedPointersListVMap.h:50
int getSize() const
return the size of the array
Definition: CORE_SharedPointersListVMap.h:96
this class describes an array
Definition: CORE_Vector.h:18
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:79
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
tBoolean exists(const Key &k) const
exists return true if the key exists in map
Definition: CORE_SharedPointersListVMap.hpp:63
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:35
This class describes a map: primitive type of Key -> shared pointer of list of Value.
Definition: CORE_SharedPointersListVMap.h:17
void clear()
clear the map
Definition: CORE_SharedPointersListVMap.h:233
#define null
Definition: types.h:13
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:18
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
int getSize() const
return the size of the array
Definition: CORE_SharedPointersList.h:250
void keys(CORE_Vector< Key > &ks) const
return an array of keys
Definition: CORE_SharedPointersListVMap.h:102
const T * get(const int &i) const
get the pointer at index i ASSERT_IN(i>-1); ASSERT_IN(i<((int)mVector.size()));
Definition: CORE_SharedPointersList.h:230
abstract base class for most classes.
Definition: CORE_Object.h:30
#define tString
Definition: types.h:36
int 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
tBoolean put(const Key &k, Value *v, const tBoolean &ifNotExists)
add the value at the index k
Definition: CORE_SharedPointersListVMap.h:171
void getKeys(vector< Key > &ks) const
return a vector of keys
Definition: CORE_SharedPointersListVMap.hpp:112
const boost::shared_ptr< CORE_SharedPointersList< Value > > operator[](const Key &k) const
get object corresponding to key
Definition: CORE_SharedPointersListVMap.h:44
#define ASSERT_IN(a)
Definition: types.h:82