class TcGfxVisitor Abstract base class for visitors and controllers
Abstract base class for visitors and controllers. Description: This abstract base class provides an interface for all actions that must distinguish the type of TcGfxComponent in order to carry out their behavior. It also allows clients to extend the behavior of the TcGfxComponent hierarchy.Collaborators: ConcreteVisitors inherit from this class and then implement each of these interface methods. A client who holds a TcGfxComponent instance calls accept(visitor v) and passes a visitor instance as argument. See visitGfxComponent() for further detail.
Comments: To specify default behavior, a concrete
visitor would place it into this method:
ConcreteVisitor::visitGfxComponent(TcGfxComponent
c) {...} Then when implementing any of the class specific
visitors the default behavior could be extended. eg.
ConcreteVisitor::visitPfGfxObject(TcGfxObject *o) {
visitGfxComponent(o);
<...>
< extended implementation code>
} In addition this is a catchall for extensions to the
TcGfx hierarchy. See visitGfxObject for an example.
Comments:
Like visitGfxComponent, this is a catchall for
extensions to the TcGfxComponent hierarchy. For example consider a new class called MyClassObject
which inherits from TcGfxObject.
MyClassObject::accept(visitor v) {
Because the visitor interface is not able to include
new classes without recoding we call default behavior
v->visitGfxComponent(this)
v->visitTcGfxObject(this);
}
New visitors could implement visitTcGfxObject
as follows: void myNewVisitor::visitGfxObject(TcGfxObject *o) {
visitGfxComponent(o); MyClassObject *obj = dynamic_cast<MyClassObject *> (o);
if (obj) {
<MyClassObject specific visitor code goes here>
}
else {
<TcGfxObject generic visitor code goes here>
}
}
virtual ~TcGfxVisitor()
virtual void visitGfxComponent(TcGfxComponent *c)
virtual void visitGfxObject(TcGfxObject *o)
virtual void visitGfxGroup(TcGfxGroup *g)
virtual void visitGfxPfObject(TdGfxPfObject *o)
virtual void visitGfxPfGroup(TdGfxPfGroup *g)
virtual void visitGfxGLObject(TcGfxGLObject *o)
virtual void visitGfxGLGroup(TdGfxGLGroup *g)
alphabetic index hierarchy of classes
this page has been generated automatically by doc++
(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de