LCOV - code coverage report
Current view: top level - eq/server - configDeregistrator.h (source / functions) Hit Total Coverage
Test: Equalizer Lines: 42 43 97.7 %
Date: 2017-12-16 05:07:20 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           2 : class ConfigDeregistrator : public ConfigVisitor
      29             : {
      30             : public:
      31           2 :     virtual ~ConfigDeregistrator() {}
      32           2 :     virtual VisitorResult visitPost(Canvas* canvas)
      33             :     {
      34           2 :         _deregister(canvas);
      35           2 :         return TRAVERSE_CONTINUE;
      36             :     }
      37           2 :     virtual VisitorResult visit(Segment* segment)
      38             :     {
      39           2 :         _deregister(segment);
      40           2 :         return TRAVERSE_CONTINUE;
      41             :     }
      42             : 
      43          14 :     virtual VisitorResult visitPost(Layout* layout)
      44             :     {
      45          14 :         _deregister(layout);
      46          14 :         return TRAVERSE_CONTINUE;
      47             :     }
      48          14 :     virtual VisitorResult visit(View* view)
      49             :     {
      50          14 :         _deregister(view);
      51          14 :         return TRAVERSE_CONTINUE;
      52             :     }
      53             : 
      54           2 :     virtual VisitorResult visit(Observer* observer)
      55             :     {
      56           2 :         _deregister(observer);
      57           2 :         return TRAVERSE_CONTINUE;
      58             :     }
      59             : 
      60           2 :     virtual VisitorResult visitPost(Config* config)
      61             :     {
      62           2 :         _deregister(config);
      63           2 :         return TRAVERSE_CONTINUE;
      64             :     }
      65           2 :     virtual VisitorResult visitPost(Node* node)
      66             :     {
      67           2 :         _deregister(node);
      68           2 :         return TRAVERSE_CONTINUE;
      69             :     }
      70           4 :     virtual VisitorResult visitPost(Pipe* pipe)
      71             :     {
      72           4 :         _deregister(pipe);
      73           4 :         return TRAVERSE_CONTINUE;
      74             :     }
      75           4 :     virtual VisitorResult visitPost(Window* window)
      76             :     {
      77           4 :         _deregister(window);
      78           4 :         return TRAVERSE_CONTINUE;
      79             :     }
      80          18 :     virtual VisitorResult visit(Channel* channel)
      81             :     {
      82          18 :         _deregister(channel);
      83          18 :         return TRAVERSE_CONTINUE;
      84             :     }
      85             : 
      86         132 :     virtual VisitorResult visit(Compound* compound)
      87             :     {
      88         132 :         compound->deregister();
      89         132 :         return TRAVERSE_CONTINUE;
      90             :     }
      91             : 
      92             : private:
      93          64 :     void _deregister(co::Object* object)
      94             :     {
      95          64 :         LBASSERT(object->isAttached());
      96          64 :         if (!object->isAttached())
      97           0 :             return;
      98          64 :         LBASSERT(object->isMaster());
      99             : 
     100          64 :         object->sync();
     101         128 :         co::LocalNodePtr node = object->getLocalNode();
     102          64 :         node->releaseObject(object);
     103             :     }
     104             : };
     105             : }
     106             : }
     107             : #endif // EQSERVER_CONSTCONFIGVISITOR_H

Generated by: LCOV version 1.11