LCOV - code coverage report
Current view: top level - eq/server - compoundActivateVisitor.h (source / functions) Hit Total Coverage
Test: lcov2.info Lines: 12 12 100.0 %
Date: 2014-06-18 Functions: 3 4 75.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2009-2013, 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 EQSERVER_COMPOUNDACTIVATEVISITOR_H
      20             : #define EQSERVER_COMPOUNDACTIVATEVISITOR_H
      21             : 
      22             : #include "compoundVisitor.h" // base class
      23             : 
      24             : namespace eq
      25             : {
      26             : namespace server
      27             : {
      28             : /** The compound visitor (de-)activating channels of a compound tree. */
      29             : class CompoundActivateVisitor : public CompoundVisitor
      30             : {
      31             : public:
      32          16 :     CompoundActivateVisitor( const bool activate, const Eye eye )
      33          16 :         : _activate( activate ), _eye( eye ) {}
      34          16 :     virtual ~CompoundActivateVisitor() {}
      35             : 
      36             :     /** Visit all compounds. */
      37          90 :     virtual VisitorResult visit( Compound* compound )
      38             :     {
      39          90 :         Channel* channel = compound->getChannel();
      40          90 :         if( channel && compound->testInheritEye( _eye ))
      41             :         {
      42          44 :             if( _activate )
      43             :             {
      44          22 :                 channel->activate();
      45             : 
      46             :                 // Fix https://github.com/Eyescale/Equalizer/issues/147
      47          22 :                 compound->updateInheritTasks();
      48          22 :                 channel->addTasks( compound->getInheritTasks( ));
      49             :             }
      50             :             else
      51          22 :                 channel->deactivate();
      52             :         }
      53          90 :         return TRAVERSE_CONTINUE;
      54             :     }
      55             : 
      56             : private:
      57             :     const bool _activate;
      58             :     const Eye _eye;
      59             : };
      60             : 
      61             : }
      62             : }
      63             : #endif // EQSERVER_COMPOUNDACTIVATEVISITOR_H

Generated by: LCOV version 1.10