Equalizer  2.1.0
Parallel Rendering Framework
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>
32 class ElementVisitor : public C
33 {
34 public:
38  virtual ~ElementVisitor() {}
40  virtual VisitorResult visitPre(T* element)
41  {
42  return visitPre(static_cast<const T*>(element));
43  }
44 
46  virtual VisitorResult visitPost(T* element)
47  {
48  return visitPost(static_cast<const T*>(element));
49  }
50 
52  virtual VisitorResult visitPre(const T*) { return TRAVERSE_CONTINUE; }
54  virtual VisitorResult visitPost(const T*) { 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.
The Equalizer client library.
Definition: eq/agl/types.h:23
virtual VisitorResult visitPost(T *element)
Visit an element on the up traversal.
ElementVisitor()
Construct a new visitor.