LCOV - code coverage report
Current view: top level - eq/server - configDeregistrator.h (source / functions) Hit Total Coverage
Test: lcov2.info Lines: 43 43 100.0 %
Date: 2014-06-18 Functions: 14 15 93.3 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2009, Stefan Eilemann <eile@equalizergraphics.com> 
       3             :  *
       4             :  * This library is free software; you can redistribute it and/or modify it under
       5             :  * the terms of the GNU Lesser General Public License version 2.1 as published
       6             :  * by the Free Software Foundation.
       7             :  *  
       8             :  * This library is distributed in the hope that it will be useful, but WITHOUT
       9             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      10             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      11             :  * details.
      12             :  * 
      13             :  * You should have received a copy of the GNU Lesser General Public License
      14             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      15             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      16             :  */
      17             : 
      18             : #ifndef EQSERVER_CONFIGDEREGISTRATOR_H
      19             : #define EQSERVER_CONFIGDEREGISTRATOR_H
      20             : 
      21             : #include "configVisitor.h" // base class
      22             : 
      23             : namespace eq
      24             : {
      25             : namespace server
      26             : {
      27             :     /** Unmaps all mapped config children. */
      28          10 :     class ConfigDeregistrator : public ConfigVisitor
      29             :     {
      30             :     public:
      31          10 :         virtual ~ConfigDeregistrator(){}
      32             : 
      33          10 :         virtual VisitorResult visitPost( Canvas* canvas )
      34             :             {
      35          10 :                 _deregister( canvas );
      36          10 :                 return TRAVERSE_CONTINUE; 
      37             :             }
      38          10 :         virtual VisitorResult visit( Segment* segment )
      39             :             { 
      40          10 :                 _deregister( segment );
      41          10 :                 return TRAVERSE_CONTINUE; 
      42             :             }
      43             : 
      44          63 :         virtual VisitorResult visitPost( Layout* layout )
      45             :             { 
      46          63 :                 _deregister( layout );
      47          63 :                 return TRAVERSE_CONTINUE; 
      48             :             }
      49          63 :         virtual VisitorResult visit( View* view )
      50             :             { 
      51          63 :                 _deregister( view );
      52          63 :                 return TRAVERSE_CONTINUE; 
      53             :             }
      54             : 
      55          10 :         virtual VisitorResult visit( Observer* observer )
      56             :             { 
      57          10 :                 _deregister( observer );
      58          10 :                 return TRAVERSE_CONTINUE; 
      59             :             }
      60             : 
      61          10 :         virtual VisitorResult visitPost( Config* config )
      62             :             { 
      63          10 :                 _deregister( config );
      64          10 :                 return TRAVERSE_CONTINUE; 
      65             :             }
      66          15 :         virtual VisitorResult visitPost( Node* node )
      67             :             { 
      68          15 :                 _deregister( node );
      69          15 :                 return TRAVERSE_CONTINUE; 
      70             :             }
      71          23 :         virtual VisitorResult visitPost( Pipe* pipe )
      72             :             { 
      73          23 :                 _deregister( pipe );
      74          23 :                 return TRAVERSE_CONTINUE; 
      75             :             }
      76          23 :         virtual VisitorResult visitPost( Window* window )
      77             :             { 
      78          23 :                 _deregister( window );
      79          23 :                 return TRAVERSE_CONTINUE; 
      80             :             }
      81          86 :         virtual VisitorResult visit( Channel* channel )
      82             :             { 
      83          86 :                 _deregister( channel );
      84          86 :                 return TRAVERSE_CONTINUE; 
      85             :             }
      86             : 
      87         435 :         virtual VisitorResult visit( Compound* compound )
      88             :             {
      89         435 :                 compound->deregister();
      90         435 :                 return TRAVERSE_CONTINUE; 
      91             :             }
      92             : 
      93             :     private:
      94         313 :         void _deregister( co::Object* object )
      95             :             {
      96         313 :                 LBASSERT( object->isAttached( ));
      97         313 :                 if( !object->isAttached( ))
      98         313 :                     return;
      99         313 :                 LBASSERT( object->isMaster( ));
     100             : 
     101         313 :                 object->sync();
     102         313 :                 co::LocalNodePtr node = object->getLocalNode();
     103         313 :                 node->releaseObject( object );
     104             :             }
     105             :     };
     106             : }
     107             : 
     108             : }
     109             : #endif // EQSERVER_CONSTCONFIGVISITOR_H

Generated by: LCOV version 1.10