00001 #ifndef X3DTK_X3DCOMPONENTVISITOR_H 00002 #define X3DTK_X3DCOMPONENTVISITOR_H 00003 00004 #include "X3DComponent.h" 00005 #include "GraphTraversal.h" 00006 #include "EnterFunction.h" 00007 #include "WalkOnFunction.h" 00008 #include "LeaveFunction.h" 00009 #include "X3DAbstractNode.h" 00010 #include "SFSceneGraph.h" 00011 #include "Recorder.h" 00012 00013 namespace X3DTK { 00014 00025 class X3DComponentVisitor : public X3DComponent 00026 { 00027 public: 00029 X3DComponentVisitor(); 00031 virtual ~X3DComponentVisitor() = 0; 00032 00034 EnterFunction *getEnterFunctionOf(const SFType *type) const; 00036 WalkOnFunction *getWalkOnFunctionOf(const SFType *type) const; 00038 LeaveFunction *getLeaveFunctionOf(const SFType *type) const; 00039 00040 protected: 00043 template<class T> 00044 void defineEnterFunction(void (*ptrF)(T *)); 00045 00048 template<class T> 00049 void defineWalkOnFunction(bool (*ptrF)(T *, SFNode)); 00050 00053 template<class T> 00054 void defineLeaveFunction(void (*ptrF)(T *)); 00055 00058 void define(const std::pair<StringType, EnterFunction *> &entry); 00059 00062 void define(const std::pair<StringType, WalkOnFunction *> &entry); 00063 00066 void define(const std::pair<StringType, LeaveFunction *> &entry); 00067 00068 private: 00069 EnterDict _enterDict; 00070 WalkOnDict _walkonDict; 00071 LeaveDict _leaveDict; 00072 }; 00073 00074 } 00075 00076 #include "X3DComponentVisitor.inl" 00077 00078 #endif