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: 00041 #ifdef TEMPLATE_SPECIALIZATION_SUPPORTED 00044 template<class T> 00045 void defineEnterFunction(void (*ptrF)(T *)); 00046 00049 template<class T> 00050 void defineWalkOnFunction(bool (*ptrF)(T *, SFNode)); 00051 00054 template<class T> 00055 void defineLeaveFunction(void (*ptrF)(T *)); 00056 #endif 00057 00060 void define(const std::pair<StringType, EnterFunction *> &entry); 00061 00064 void define(const std::pair<StringType, WalkOnFunction *> &entry); 00065 00068 void define(const std::pair<StringType, LeaveFunction *> &entry); 00069 00070 private: 00071 EnterDict _enterDict; 00072 WalkOnDict _walkonDict; 00073 LeaveDict _leaveDict; 00074 }; 00075 00076 } 00077 00078 #include "X3DComponentVisitor.inl" 00079 00080 #endif