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