Introduce NodeVisitor::className and libraryName()

This commit is contained in:
Robert Osfield
2008-12-17 12:13:15 +00:00
parent a5c32da4ff
commit 8a6e04b84d
27 changed files with 90 additions and 52 deletions

View File

@@ -42,6 +42,10 @@ class Transform;
class Camera;
class CameraView;
#define META_NodeVisitor(library,name) \
virtual const char* libraryName() const { return #library; }\
virtual const char* className() const { return #name; }
/** Visitor for type safe operations on osg::Nodes.
Based on GOF's Visitor pattern. The NodeVisitor
is useful for developing type safe operations to nodes
@@ -82,6 +86,12 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced
NodeVisitor(VisitorType type,TraversalMode tm=TRAVERSE_NONE);
virtual ~NodeVisitor();
/** return the library name/namespapce of the visitor's. Should be defined by derived classes.*/
virtual const char* libraryName() const { return "osg"; }
/** return the name of the visitor's class type. Should be defined by derived classes.*/
virtual const char* className() const { return "NodeVisitor"; }
/** Method to call to reset visitor. Useful if your visitor accumulates
state during a traversal, and you plan to reuse the visitor.