LCOV - code coverage report
Current view: top level - eq/server - nodeFailedVisitor.h (source / functions) Hit Total Coverage
Test: Equalizer Lines: 0 21 0.0 %
Date: 2017-12-16 05:07:20 Functions: 0 11 0.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2011, Cedric Stalder<cedric.stalder@gmail.com>
       3             :  *               2011, Stefan Eilemann <eile@eyescale.ch>
       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_NODEFAILEDVISITOR_H
      20             : #define EQSERVER_NODEFAILEDVISITOR_H
      21             : 
      22             : #include "channel.h"       // member
      23             : #include "node.h"          // member
      24             : #include "pipe.h"          // member
      25             : #include "visitorResult.h" // 'base' class
      26             : #include "window.h"        // member
      27             : 
      28             : namespace eq
      29             : {
      30             : namespace server
      31             : {
      32             : /** Set Failed State all node branch. */
      33           0 : class NodeFailedVisitor : public ConfigVisitor
      34             : {
      35             : public:
      36           0 :     virtual ~NodeFailedVisitor() {}
      37           0 :     virtual VisitorResult visitPre(Node* node)
      38             :     {
      39           0 :         _updateState(node);
      40             : 
      41           0 :         co::LocalNodePtr localNode = node->getLocalNode();
      42           0 :         co::NodePtr netNode = node->getNode();
      43           0 :         localNode->disconnect(netNode);
      44           0 :         node->setNode(0);
      45             : 
      46           0 :         return TRAVERSE_CONTINUE;
      47             :     }
      48             : 
      49           0 :     virtual VisitorResult visitPre(Pipe* pipe)
      50             :     {
      51           0 :         _updateState(pipe);
      52           0 :         return TRAVERSE_CONTINUE;
      53             :     }
      54             : 
      55           0 :     virtual VisitorResult visitPre(Window* window)
      56             :     {
      57           0 :         _updateState(window);
      58           0 :         return TRAVERSE_CONTINUE;
      59             :     }
      60             : 
      61           0 :     virtual VisitorResult visit(Channel* channel)
      62             :     {
      63           0 :         _updateState(channel);
      64           0 :         return TRAVERSE_CONTINUE;
      65             :     }
      66             : 
      67             : private:
      68             :     template <class T>
      69           0 :     void _updateState(T* entity)
      70             :     {
      71           0 :         entity->setState(entity->isActive() ? STATE_FAILED : STATE_STOPPED);
      72           0 :     }
      73             : };
      74             : }
      75             : }
      76             : #endif // EQSERVER_NODEFAILEDVISITOR_H

Generated by: LCOV version 1.11