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 00012 namespace X3DTK { 00013 00019 class X3DComponentVisitor : public X3DComponent 00020 { 00021 public: 00023 X3DComponentVisitor(); 00025 virtual ~X3DComponentVisitor() = 0; 00026 00028 EnterFunction *getEnterFunctionOf(const SFType *type) const; 00030 WalkOnFunction *getWalkOnFunctionOf(const SFType *type) const; 00032 LeaveFunction *getLeaveFunctionOf(const SFType *type) const; 00033 00034 protected: 00036 template<class C, class T> 00037 void defineEnterFunction(void (C::*ptrF)(T *) const); 00038 00040 template<class C, class T> 00041 void defineWalkOnFunction(bool (C::*ptrF)(T *, SFAbstractNode) const); 00042 00044 template<class C, class T> 00045 void defineLeaveFunction(void (C::*ptrF)(T *) const); 00046 00047 private: 00048 EnterDict _enterDict; 00049 WalkOnDict _walkonDict; 00050 LeaveDict _leaveDict; 00051 }; 00052 00053 } 00054 00055 #include "X3DComponentVisitor.inl" 00056 00057 #endif