Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)

toolbox/hashMap.hh
Go to the documentation of this file.
00001 #ifndef hashMap_hh
00002 #define hashMap_hh
00003 
00004 #if __ICC == 800
00005 #  include <hash_map>
00006 #  define __gnu_cxx std
00007 #else
00008 #  if __GNUC__ > 2
00009 #    ifdef __DEPRECATED
00010 #      undef __DEPRECATED 
00011 #      include <ext/hash_map>
00012 #      define __DEPRECATED 
00013 #    else
00014 #      include <ext/hash_map>
00015 #    endif
00016 #    if  __GNUC__==3 &&__GNUC_MINOR__ < 1
00017 #      define __gnu_cxx std
00018 #    endif
00019 #  else
00020 #    include <hash_map>
00021 #    define __gnu_cxx std
00022 #  endif
00023 #endif
00024 
00025 #include "basics/outputOperator.hh"
00026 #include "basics/outputMatlab.hh"
00027 
00028 namespace concepts {
00029 
00030   template<class F>
00031   class HashMap : public __gnu_cxx::hash_map<uint, F>, public OutputOperator {
00032   public:
00033 
00035     bool exists(uint i) const {
00036       return this->find(i) != this->end();
00037     }
00038   protected:
00039     virtual std::ostream& info(std::ostream& os) const;
00040   };
00041 
00042   template<class F>
00043     std::ostream& HashMap<F>::info(std::ostream& os) const {
00044       os << "HashMap(" << this->size() << ": " << std::endl;
00045       for (typename concepts::HashMap<F>::
00046           const_iterator i = this->begin(); i != this->end(); ++i)
00047         os << "  " << i->first << " - " 
00048           << OutputMatlab<F>(i->second) << std::endl;
00049       return os << ')';
00050     }
00051 
00052 } // namespace concepts
00053 
00054 #endif

Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)