Line data Source code
1 :
2 : /* Copyright (c) 2007-2013, Stefan Eilemann <eile@equalizergraphics.com>
3 : *
4 : * This library is free software; you can redistribute it and/or modify it under
5 : * the terms of the GNU Lesser General Public License version 2.1 as published
6 : * by the Free Software Foundation.
7 : *
8 : * This library is distributed in the hope that it will be useful, but WITHOUT
9 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 : * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 : * details.
12 : *
13 : * You should have received a copy of the GNU Lesser General Public License
14 : * along with this library; if not, write to the Free Software Foundation, Inc.,
15 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 : */
17 :
18 : #ifndef EQSERVER_COMPOUNDVISITOR_H
19 : #define EQSERVER_COMPOUNDVISITOR_H
20 :
21 : #include "visitorResult.h" // enum
22 : #include "types.h"
23 :
24 : namespace eq
25 : {
26 : namespace server
27 : {
28 : /** A visitor to traverse a non-const compound tree. */
29 : class CompoundVisitor
30 : {
31 : public:
32 : /** Constructs a new CompoundVisitor. */
33 6931 : CompoundVisitor(){}
34 :
35 : /** Destruct the CompoundVisitor */
36 6931 : virtual ~CompoundVisitor(){}
37 :
38 : /** Visit a non-leaf compound on the down traversal. */
39 9933 : virtual VisitorResult visitPre( Compound* compound )
40 9933 : { return visit( compound ); }
41 : /** Visit a leaf compound. */
42 4011 : virtual VisitorResult visitLeaf( Compound* compound )
43 4011 : { return visit( compound ); }
44 : /** Visit a non-leaf compound on the up traversal. */
45 6719 : virtual VisitorResult visitPost( Compound* compound )
46 6719 : { return visitPost( static_cast< const Compound* >( compound )); }
47 :
48 : /** Visit every compound on the down traversal. */
49 2705 : virtual VisitorResult visit( Compound* compound )
50 2705 : { return visit( static_cast< const Compound* >( compound )); }
51 :
52 :
53 : /** Visit a non-leaf compound on the down traversal. */
54 0 : virtual VisitorResult visitPre( const Compound* compound )
55 0 : { return visit( compound ); }
56 : /** Visit a leaf compound. */
57 0 : virtual VisitorResult visitLeaf( const Compound* compound )
58 0 : { return visit( compound ); }
59 : /** Visit a non-leaf compound on the up traversal. */
60 6719 : virtual VisitorResult visitPost( const Compound* )
61 6719 : { return TRAVERSE_CONTINUE; }
62 :
63 : /** Visit every compound on the down traversal. */
64 2705 : virtual VisitorResult visit( const Compound* )
65 2705 : { return TRAVERSE_CONTINUE; }
66 : };
67 : }
68 : }
69 : #endif // EQSERVER_COMPOUNDVISITOR_H
|