Equalizer  1.10.1
Parallel Rendering Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
elementVisitor.h
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 {
31  template< class T, class C > class ElementVisitor : public C
32  {
33  public:
36 
38  virtual ~ElementVisitor(){}
39 
41  virtual VisitorResult visitPre( T* element )
42  { return visitPre( static_cast< const T* >( element )); }
43 
45  virtual VisitorResult visitPost( T* element )
46  { return visitPost( static_cast< const T* >( element )); }
47 
49  virtual VisitorResult visitPre( const T* )
50  { return TRAVERSE_CONTINUE; }
51 
53  virtual VisitorResult visitPost( const T* )
54  { return TRAVERSE_CONTINUE; }
55  };
56 }
57 }
58 
59 # pragma clang diagnostic pop
60 #endif // EQFABRIC_ELEMENTVISITOR_H
virtual VisitorResult visitPre(T *element)
Visit an element on the down traversal.
virtual ~ElementVisitor()
Destruct the visitor.
A visitor to traverse non-leaf elements and their children in a tree.
virtual VisitorResult visitPre(const T *)
Visit an element on a const down traversal.
virtual VisitorResult visitPost(const T *)
Visit an element on a const up traversal.
virtual VisitorResult visitPost(T *element)
Visit an element on the up traversal.
ElementVisitor()
Construct a new visitor.