00001 00002 // X3DComponentVisitor.h // 00004 00005 #ifndef X3DCOMPONENTVISITOR_H 00006 #define X3DCOMPONENTVISITOR_H 00007 00008 #include "X3DComponent.h" 00009 #include "GraphTraversal.h" 00010 #include "EnterFunction.h" 00011 #include "WalkOnFunction.h" 00012 #include "LeaveFunction.h" 00013 #include "X3DAbstractNode.h" 00014 #include "SFSceneGraph.h" 00015 00016 namespace X3DTK { 00017 00019 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 C, class T> 00038 void defineEnterFunction(void (C::*ptrF)(T *) const); 00039 00041 template<class C, class T> 00042 void defineWalkOnFunction(bool (C::*ptrF)(T *, SFAbstractNode) const); 00043 00045 template<class C, class T> 00046 void defineLeaveFunction(void (C::*ptrF)(T *) const); 00047 00048 private: 00049 EnterDict _enterDict; 00050 WalkOnDict _walkonDict; 00051 LeaveDict _leaveDict; 00052 }; 00053 00054 } 00055 00056 #include "X3DComponentVisitor.inl" 00057 00058 #endif