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 4 : class ConfigDeregistrator : public ConfigVisitor
29 : {
30 : public:
31 4 : virtual ~ConfigDeregistrator(){}
32 :
33 4 : virtual VisitorResult visitPost( Canvas* canvas )
34 : {
35 4 : _deregister( canvas );
36 4 : return TRAVERSE_CONTINUE;
37 : }
38 4 : virtual VisitorResult visit( Segment* segment )
39 : {
40 4 : _deregister( segment );
41 4 : return TRAVERSE_CONTINUE;
42 : }
43 :
44 4 : virtual VisitorResult visitPost( Layout* layout )
45 : {
46 4 : _deregister( layout );
47 4 : return TRAVERSE_CONTINUE;
48 : }
49 4 : virtual VisitorResult visit( View* view )
50 : {
51 4 : _deregister( view );
52 4 : return TRAVERSE_CONTINUE;
53 : }
54 :
55 4 : virtual VisitorResult visit( Observer* observer )
56 : {
57 4 : _deregister( observer );
58 4 : return TRAVERSE_CONTINUE;
59 : }
60 :
61 4 : virtual VisitorResult visitPost( Config* config )
62 : {
63 4 : _deregister( config );
64 4 : return TRAVERSE_CONTINUE;
65 : }
66 4 : virtual VisitorResult visitPost( Node* node )
67 : {
68 4 : _deregister( node );
69 4 : return TRAVERSE_CONTINUE;
70 : }
71 4 : virtual VisitorResult visitPost( Pipe* pipe )
72 : {
73 4 : _deregister( pipe );
74 4 : return TRAVERSE_CONTINUE;
75 : }
76 4 : virtual VisitorResult visitPost( Window* window )
77 : {
78 4 : _deregister( window );
79 4 : return TRAVERSE_CONTINUE;
80 : }
81 8 : virtual VisitorResult visit( Channel* channel )
82 : {
83 8 : _deregister( channel );
84 8 : return TRAVERSE_CONTINUE;
85 : }
86 :
87 8 : virtual VisitorResult visit( Compound* compound )
88 : {
89 8 : compound->deregister();
90 8 : return TRAVERSE_CONTINUE;
91 : }
92 :
93 : private:
94 44 : void _deregister( co::Object* object )
95 : {
96 44 : LBASSERT( object->isAttached( ));
97 44 : if( !object->isAttached( ))
98 44 : return;
99 44 : LBASSERT( object->isMaster( ));
100 :
101 44 : object->sync();
102 44 : co::LocalNodePtr node = object->getLocalNode();
103 44 : node->releaseObject( object );
104 : }
105 : };
106 : }
107 :
108 : }
109 : #endif // EQSERVER_CONSTCONFIGVISITOR_H
|