00001 #ifndef FASTSHOWER_PTRCONVERTER_H 00002 #define FASTSHOWER_PTRCONVERTER_H 00003 00004 00005 #ifndef STD_STRING_H 00006 #define STD_STRING_H 00007 #include <string> 00008 #endif 00009 00010 #ifndef STD_MAP_H 00011 #define STD_MAP_H 00012 #include <map> 00013 #endif 00014 00015 #ifndef STD_PAIR_H 00016 #define STD_PAIR_H 00017 #include <pair.h> 00018 #endif 00019 00020 #include<iostream> 00021 00022 namespace FastShower{ 00023 using std::string; 00024 using std::pair; 00025 using std::map; 00026 00027 template<class IPtr, class InterfacePtr> 00028 class PtrConverter{ 00029 public: 00030 PtrConverter(map<string, IPtr*>& map): m_map(map){}; 00031 00032 void operator()(pair<string, IPtr*>); 00033 00034 private: 00035 map<string, IPtr*>& m_map; 00036 }; 00038 template<class IPtr, class InterfacePtr> 00039 inline 00040 void 00041 PtrConverter<IPtr, InterfacePtr>::operator()(pair<string, IPtr*>p) { 00042 m_map[p.first] = new InterfacePtr(p.second, p.first); 00043 cout<<"PtrConverter : "<<p.first<<endl; 00044 } 00045 } 00046 #endif