LCOV - code coverage report
Current view: top level - eq/fabric - elementVisitor.h (source / functions) Hit Total Coverage
Test: Equalizer Lines: 8 8 100.0 %
Date: 2017-12-16 05:07:20 Functions: 72 119 60.5 %

          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>
      32             : class ElementVisitor : public C
      33             : {
      34             : public:
      35             :     /** Construct a new visitor. */
      36       55915 :     ElementVisitor() {}
      37             :     /** Destruct the visitor. */
      38       55915 :     virtual ~ElementVisitor() {}
      39             :     /** Visit an element on the down traversal. */
      40      109516 :     virtual VisitorResult visitPre(T* element)
      41             :     {
      42      109516 :         return visitPre(static_cast<const T*>(element));
      43             :     }
      44             : 
      45             :     /** Visit an element on the up traversal. */
      46       97158 :     virtual VisitorResult visitPost(T* element)
      47             :     {
      48       97158 :         return visitPost(static_cast<const T*>(element));
      49             :     }
      50             : 
      51             :     /** Visit an element on a const down traversal. */
      52      107798 :     virtual VisitorResult visitPre(const T*) { return TRAVERSE_CONTINUE; }
      53             :     /** Visit an element on a const up traversal. */
      54       97158 :     virtual VisitorResult visitPost(const T*) { return TRAVERSE_CONTINUE; }
      55             : };
      56             : }
      57             : }
      58             : 
      59             : #pragma clang diagnostic pop
      60             : #endif // EQFABRIC_ELEMENTVISITOR_H

Generated by: LCOV version 1.11