00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00031 #ifndef __VGTL_VISITOR_H
00032 #define __VGTL_VISITOR_H
00033
00034 #include <vgtl_helpers.h>
00035
00036 __VGTL_BEGIN_NAMESPACE
00037
00038 #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
00039 #pragma set woff 1209
00040 #endif
00041
00042
00043
00044
00045
00047
00052 template <class _Node, class _Ret, class _Col = const _Ret&>
00053 class preorder_visitor
00054 {
00055 public:
00057 typedef _Ret return_value;
00058 typedef _Col collect_value;
00059
00061 preorder_visitor() {}
00063 virtual ~preorder_visitor() {}
00064
00066
00067 virtual void vinit() { return; }
00068 virtual return_value vvalue() VGTL_PURE_VIRTUAL
00069 virtual void vcollect(collect_value __r) { return; }
00071
00073
00074 virtual bool preorder(const _Node& __n) { return true; }
00075 virtual void collect(const _Node& __n, collect_value __r) { return; }
00076 virtual return_value value() VGTL_PURE_VIRTUAL
00078 };
00079
00081
00086 template <class _Node, class _Ret, class _Col = const _Ret&>
00087 class postorder_visitor
00088 {
00089 public:
00090 typedef _Ret return_value;
00091 typedef _Col collect_value;
00092
00094 postorder_visitor() {}
00096 virtual ~postorder_visitor() {}
00097
00099
00100 virtual void vinit() { return; }
00101 virtual return_value vvalue() VGTL_PURE_VIRTUAL
00102 virtual void vcollect(collect_value __r) { return; }
00104
00106
00107 virtual void init() { return; }
00108 virtual bool postorder(const _Node& __n) { return false; }
00109 virtual void collect(const _Node& __n, collect_value __r) { return; }
00110 virtual return_value value() VGTL_PURE_VIRTUAL
00112 };
00113
00115
00120 template <class _Node, class _Ret, class _Col = const _Ret&>
00121 class prepost_visitor
00122 {
00123 public:
00124 typedef _Ret return_value;
00125 typedef _Col collect_value;
00126
00128 prepost_visitor() {}
00130 virtual ~prepost_visitor() {}
00131
00133
00134 virtual void vinit() { return; }
00135 virtual return_value vvalue() VGTL_PURE_VIRTUAL
00136 virtual void vcollect(collect_value __r) { return; }
00138
00140
00141 virtual bool preorder(const _Node& __n) { return true; }
00142 virtual bool postorder(const _Node& __n) { return false; }
00143 virtual void collect(const _Node& __n, collect_value __r) { return; }
00144 virtual return_value value() VGTL_PURE_VIRTUAL
00146 };
00147
00148 #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
00149 #pragma reset woff 1209
00150 #endif
00151
00152 __VGTL_END_NAMESPACE
00153
00154 #endif
00155
00156
00157
00158