メインページ | ネームスペース一覧 | クラス階層 | アルファベット順一覧 | 構成 | ファイル一覧 | ネームスペースメンバ | 構成メンバ | ファイルメンバ

info-factory.hh

説明を見る。
00001 #ifndef INFO_FACTORY_HH_
00002 # define INFO_FACTORY_HH_
00003 
00004 # include <map>
00005 
00006 # include "incoming-packet.hh"
00007 
00008 namespace infos
00009 {
00010   struct GenInfoMaker
00011   {
00012     GenInfoMaker()
00013     {
00014     }
00015     
00016     virtual packets::IncomingPacket *make() = 0;
00017   };
00018 
00019   template <typename T>
00020   struct InfoMaker : public GenInfoMaker
00021   {
00022   public:
00023     InfoMaker() : GenInfoMaker()
00024     {
00025       InfoFactory::get_instance().register_info_maker(T::op, *this);
00026     }
00027 
00028     packets::IncomingPacket *make()
00029     {
00030       return new T();
00031     }
00032   };
00033 
00034   class InfoFactory
00035   {
00036   public:
00037     typedef std::map<int, GenInfoMaker *> InfoMakerMap;
00038 
00039   public:
00040     InfoFactory();
00041 
00042     void register_info_maker(int op, GenInfoMaker &gim);
00043     packets::IncomingPacket *make(int op, int data_size);
00044     static InfoFactory &get_instance();
00045 
00046   protected:
00047     InfoMakerMap _info_maker_map;
00048   };
00049 };
00050 
00051 #endif

Cronous Emulatorに対してWed Aug 17 06:01:22 2005に生成されました。  doxygen 1.4.2-20050421