00001 00002 00003 00005 00006 00011 00016 00021 // X3DComponentCreator.h // 00023 00024 #ifndef X3DCOMPONENTCREATOR_H 00025 #define X3DCOMPONENTCREATOR_H 00026 00027 #include "X3DComponent.h" 00028 #include "CreationFunction.h" 00029 00030 namespace X3DTK { 00031 00033 00034 class X3DComponentCreator : public X3DComponent 00035 { 00036 public: 00038 X3DComponentCreator(); 00040 virtual ~X3DComponentCreator() = 0; 00041 00043 CreationFunction *getCreationFunctionOf(const SFString &name) const; 00045 inline CreationDict getCreationDict() const {return creationDict_;}; 00046 00048 bool contains(const SFString &name) const; 00049 00050 protected: 00052 template<class T> void defineNewCreationFunction(const SFString &name, X3D::SFNode (T::*ptrF)() const) 00053 { 00054 CreationFunction *CF = new CreationFunction(reinterpret_cast<ptrToCreationFunction>(ptrF), this); 00055 creationDict_.insert(std::pair<SFString, CreationFunction *>(name, CF)); 00056 }; 00057 00058 //private: 00059 CreationDict creationDict_; 00060 }; 00061 00062 } 00063 00064 #endif