00001 #ifndef X3DTK_CREATIONFUNCTION_H 00002 #define X3DTK_CREATIONFUNCTION_H 00003 00004 #include "X3DTypes.h" 00005 #include "X3DFunction.h" 00006 #include "X3D_SceneGraphTypes.h" 00007 00008 namespace X3DTK { 00009 namespace X3D { 00010 00011 class X3DComponentCreator; 00012 00019 typedef X3D::SFNode (X3DComponentCreator::* ptrToCreationFunction)() const; 00020 00027 class CreationFunction : public X3DFunction 00028 { 00029 public: 00031 CreationFunction(ptrToCreationFunction f, X3DComponentCreator *component); 00033 ~CreationFunction(); 00034 00036 inline X3D::SFNode create() const {return (component_->*ptr2function_)();}; 00037 00038 inline const X3DComponentCreator *getComponent() const {return component_;}; 00039 00040 private: 00042 const ptrToCreationFunction ptr2function_; 00043 const X3DComponentCreator *component_; 00044 }; 00045 00047 typedef std::map<SFString, CreationFunction *, ltSFString> CreationDict; 00048 00049 } 00050 } 00051 00052 #endif