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 00020 class X3DComponentVisitor : public X3DComponent 00021 { 00022 public: 00024 X3DComponentVisitor(); 00026 virtual ~X3DComponentVisitor() = 0; 00027 00029 EnterFunction *getEnterFunctionOf(const SFType *type) const; 00031 WalkOnFunction *getWalkOnFunctionOf(const SFType *type) const; 00033 LeaveFunction *getLeaveFunctionOf(const SFType *type) const; 00034 00035 protected: 00037 template<class T> 00038 void defineEnterFunction(void (*ptrF)(T *)); 00039 00041 template<class T> 00042 void defineWalkOnFunction(bool (*ptrF)(T *, SFAbstractNode)); 00043 00045 template<class T> 00046 void defineLeaveFunction(void (*ptrF)(T *)); 00047 00049 void define(const std::pair<StringType, EnterFunction *> &entry); 00050 00052 void define(const std::pair<StringType, WalkOnFunction *> &entry); 00053 00055 void define(const std::pair<StringType, LeaveFunction *> &entry); 00056 00057 private: 00058 EnterDict _enterDict; 00059 WalkOnDict _walkonDict; 00060 LeaveDict _leaveDict; 00061 }; 00062 00063 } 00064 00065 #include "X3DComponentVisitor.inl" 00066 00067 #endif