00001 00002 // CreationFunction.h // 00004 00005 #ifndef CREATIONFUNCTION_H 00006 #define CREATIONFUNCTION_H 00007 00008 #include "X3DTypes.h" 00009 #include "X3DFunction.h" 00010 #include "X3DSceneGraphTypes.h" 00011 00012 namespace X3DTK { 00013 namespace X3D { 00014 00015 class X3DComponentCreator; 00017 typedef X3D::SFNode (X3DComponentCreator::* ptrToCreationFunction)() const; 00018 00020 00021 class CreationFunction : public X3DFunction 00022 { 00023 public: 00025 CreationFunction(ptrToCreationFunction f, X3DComponentCreator *component); 00027 ~CreationFunction(); 00028 00030 inline X3D::SFNode create() const {return (component_->*ptr2function_)();}; 00031 00032 inline const X3DComponentCreator *getComponent() const {return component_;}; 00033 00034 private: 00036 const ptrToCreationFunction ptr2function_; 00037 const X3DComponentCreator *component_; 00038 }; 00039 00041 typedef std::map<SFString, CreationFunction *, ltSFString> CreationDict; 00042 00043 } 00044 } 00045 00046 #endif