Visitor.h

Go to the documentation of this file.
00001 #ifndef X3DTK_VISITOR_H
00002 #define X3DTK_VISITOR_H
00003 
00004 #include "X3DAbstractNode.h"
00005 #include "VisitingFunctions.h"
00006 #include "EnterFunction.h"
00007 #include "WalkOnFunction.h"
00008 #include "LeaveFunction.h"
00009 #include "X3DActor.h"
00010 
00011 #include <list>
00012 
00013 namespace X3DTK {
00014 
00015 class SFType;
00016 class X3DComponentVisitor;
00017 
00024 class Visitor : public X3DActor
00025 {
00026   friend class SFType; 
00027 public:  
00029   Visitor();
00031   virtual ~Visitor();
00032   
00034   void setComponentVisitor(X3DComponentVisitor *component);
00036   inline void enter(SFNode N) const {_visitingArray[N->getType()->getId()]->enter(N);};
00038   inline bool walkOn(SFNode N, SFNode child = 0) const {return _visitingArray[N->getType()->getId()]->walkOn(N, child);};
00040   inline void leave(SFNode N) const {_visitingArray[N->getType()->getId()]->leave(N);};
00042   void reset();
00043   
00045   friend Visitor *joinVisitors(Visitor *N0, Visitor *N1);
00046   
00047 private:  
00049   virtual void addType(const SFType *type);
00051   EnterFunction *getEnterFunctionOf(const SFType *type) const;
00052   WalkOnFunction *getWalkOnFunctionOf(const SFType *type) const;
00053   LeaveFunction *getLeaveFunctionOf(const SFType *type) const;
00054   
00055   //Dictionary of all the creation functions used.
00056   VisitingArray _visitingArray;
00057   std::list<X3DComponentVisitor *> _componentList;
00058 };
00059 
00060 }
00061 
00062 #endif

Generated on Fri Aug 27 13:16:22 2004 for X3DToolKit by doxygen 1.3.6