00001 #ifndef MAPS_HH_ 00002 # define MAPS_HH_ 00003 00004 # include <map> 00005 00006 # include "objects_fwd.hh" 00007 00008 namespace objects 00009 { 00010 class Maps 00011 { 00012 public: 00013 typedef std::map<int, DefMap *> MapMap; 00014 00015 public: 00016 Maps(); 00017 ~Maps(); 00018 00019 static Maps &get_instance(); 00020 const DefMap *get_map(int id) const; 00021 const MapMap &get_maps() const; 00022 00023 protected: 00024 MapMap _maps; 00025 }; 00026 00027 template<typename MAP_CLASS> 00028 struct MapRegister : public std::unary_function<Maps::MapMap &, void> 00029 { 00030 void operator()(Maps::MapMap &maps) 00031 { 00032 maps.insert(Maps::MapMap::value_type(MAP_CLASS::id, new MAP_CLASS())); 00033 } 00034 }; 00035 }; 00036 00037 #endif