Line data Source code
1 :
2 : /* Copyright (c) 2008-2012, Stefan Eilemann <eile@equalizergraphics.com>
3 : * 2010, Cedric Stalder <cedric.stalder@gmail.com>
4 : *
5 : * This library is free software; you can redistribute it and/or modify it under
6 : * the terms of the GNU Lesser General Public License version 2.1 as published
7 : * by the Free Software Foundation.
8 : *
9 : * This library is distributed in the hope that it will be useful, but WITHOUT
10 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 : * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 : * details.
13 : *
14 : * You should have received a copy of the GNU Lesser General Public License
15 : * along with this library; if not, write to the Free Software Foundation, Inc.,
16 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 : */
18 :
19 : #ifndef EQFABRIC_ELEMENTVISITOR_H
20 : #define EQFABRIC_ELEMENTVISITOR_H
21 :
22 : // visit methods hide visit methods of base visitor 'C'
23 : # pragma clang diagnostic push
24 : # pragma clang diagnostic ignored "-Woverloaded-virtual"
25 :
26 : namespace eq
27 : {
28 : namespace fabric
29 : {
30 : /** A visitor to traverse non-leaf elements and their children in a tree. */
31 : template< class T, class C > class ElementVisitor : public C
32 : {
33 : public:
34 : /** Construct a new visitor. */
35 33852 : ElementVisitor(){}
36 :
37 : /** Destruct the visitor. */
38 33852 : virtual ~ElementVisitor(){}
39 :
40 : /** Visit an element on the down traversal. */
41 61734 : virtual VisitorResult visitPre( T* element )
42 61734 : { return visitPre( static_cast< const T* >( element )); }
43 :
44 : /** Visit an element on the up traversal. */
45 55402 : virtual VisitorResult visitPost( T* element )
46 55402 : { return visitPost( static_cast< const T* >( element )); }
47 :
48 : /** Visit an element on a const down traversal. */
49 60453 : virtual VisitorResult visitPre( const T* )
50 60453 : { return TRAVERSE_CONTINUE; }
51 :
52 : /** Visit an element on a const up traversal. */
53 55409 : virtual VisitorResult visitPost( const T* )
54 55409 : { return TRAVERSE_CONTINUE; }
55 : };
56 : }
57 : }
58 :
59 : # pragma clang diagnostic pop
60 : #endif // EQFABRIC_ELEMENTVISITOR_H
|