Changeset 120 for XMLIO_V2/dev/dev_rv/src/XMLIO/container.hpp
- Timestamp:
- 09/08/10 15:02:31 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XMLIO_V2/dev/dev_rv/src/XMLIO/container.hpp
r114 r120 1 1 #ifndef __XMLIO_CONTAINER__ 2 2 #define __XMLIO_CONTAINER__ 3 4 // Classes utilisées issues de Poco5 using Poco::HashMap;6 using Poco::Hash;7 3 8 4 // Classes utilisées issues de la STL … … 12 8 using std::ostream; 13 9 14 // Classes XMLIOSERVER15 using XMLIOSERVER::XMLIOUndefinedValueException;16 17 10 namespace XMLIOSERVER 18 11 { 19 template<class Key, class Mapped, class HashFunc = Hash<Key> >12 template<class Key, class Mapped, class HashFunc = Poco::Hash<Key> > 20 13 class ExHashMap 21 : private HashMap<Key, Mapped*,Hash<Key> >14 : private Poco::HashMap<Key, Mapped*, Poco::Hash<Key> > 22 15 { 23 16 public : 24 25 ExHashMap() : HashMap<Key, Mapped*, Hash<Key> >(), _elemList()26 {/* Ne rien faire de plus */}27 17 28 18 Mapped* operator[] (const Key& kval) throw (XMLIOUndefinedValueException) 29 19 { 30 20 if(!hasMappedValue(kval)) 31 throw XMLIO UndefinedValueException("Appel de la méthode ExHashMap::operator["+kval+"] invalide.");21 throw XMLIOSERVER::XMLIOUndefinedValueException("Appel de la méthode ExHashMap::operator["+kval+"] invalide."); 32 22 return (find(kval)->second); 33 23 } … … 44 34 45 35 protected : 36 37 ExHashMap() : Poco::HashMap<Key, Mapped*, Poco::Hash<Key> >(), _elemList() 38 {/* Ne rien faire de plus */} 46 39 47 40 bool addValue(const Key& kval, Mapped* element) … … 77 70 template<class Mapped> 78 71 class StrHashMap 79 : public ExHashMap<string, Mapped, Hash<string> >72 : public ExHashMap<string, Mapped, Poco::Hash<string> > 80 73 { 81 74 public : 82 75 83 StrHashMap() : ExHashMap<string, Mapped, Hash<string> >()76 StrHashMap() : ExHashMap<string, Mapped, Poco::Hash<string> >() 84 77 {/* Ne rien faire de plus */} 85 78 86 79 bool addObject(Mapped* element) 87 { if(element->hasId()) return(addValue(element->getId(), element)); 80 { if(element->hasId()) return(addValue(element->getId(), element)); return(addValue(element)); } 88 81 89 82 bool removeObject(const string& kval) 90 83 { 91 if(!ExHashMap<string, Mapped, Hash<string> >::hasMappedValue(kval)) return (false);92 ExHashMap<string, Mapped, Hash<string> >::removeValue(kval); return (true);84 if(!ExHashMap<string, Mapped, Poco::Hash<string> >::hasMappedValue(kval)) return (false); 85 ExHashMap<string, Mapped, Poco::Hash<string> >::removeValue(kval); return (true); 93 86 } 94 87
Note: See TracChangeset
for help on using the changeset viewer.