00001 /* 00002 * ExtensionBlockFactory.h 00003 * 00004 * Created on: 28.05.2010 00005 * Author: morgenro 00006 */ 00007 00008 #ifndef EXTENSIONBLOCKFACTORY_H_ 00009 #define EXTENSIONBLOCKFACTORY_H_ 00010 00011 #include "ibrdtn/data/Bundle.h" 00012 00013 namespace dtn 00014 { 00015 namespace data 00016 { 00017 class ExtensionBlockFactory 00018 { 00019 public: 00020 virtual dtn::data::Block* create() = 0; 00021 00022 protected: 00023 ExtensionBlockFactory(char type) 00024 : _type(type) 00025 { 00026 std::map<char, ExtensionBlockFactory*> &factories = dtn::data::Bundle::getExtensionBlockFactories(); 00027 factories[type] = this; 00028 } 00029 00030 virtual ~ExtensionBlockFactory() 00031 { 00032 std::map<char, ExtensionBlockFactory*> &factories = dtn::data::Bundle::getExtensionBlockFactories(); 00033 factories.erase(_type); 00034 } 00035 00036 private: 00037 char _type; 00038 }; 00039 } 00040 } 00041 00042 #endif /* EXTENSIONBLOCKFACTORY_H_ */
1.7.1