00001 //========================================================================== 00002 // CVISITOR.H - part of 00003 // OMNeT++/OMNEST 00004 // Discrete System Simulation in C++ 00005 // 00006 // Declaration of the following classes: 00007 // cVisitor: enables traversing the object tree 00008 // 00009 //========================================================================== 00010 00011 /*--------------------------------------------------------------* 00012 Copyright (C) 1992-2005 Andras Varga 00013 00014 This file is distributed WITHOUT ANY WARRANTY. See the file 00015 `license' for details on this and other legal matters. 00016 *--------------------------------------------------------------*/ 00017 00018 #ifndef __CVISITOR_H 00019 #define __CVISITOR_H 00020 00021 #include "defs.h" 00022 00023 class cObject; 00024 00025 00056 class SIM_API cVisitor 00057 { 00058 protected: 00062 class EndTraversalException { public: EndTraversalException() {} }; 00063 00064 public: 00068 virtual ~cVisitor() {} 00069 00075 virtual bool process(cObject *obj); 00076 00083 virtual bool processChildrenOf(cObject *obj); 00084 00095 virtual void visit(cObject *obj) = 0; 00096 }; 00097 00098 #endif 00099 00100