Line data Source code
1 :
2 : /* Copyright (c) 2010-2011, Stefan Eilemann <eile@eyescale.ch>
3 : * 2010, Cedric Stalder <cedric.stalder@gmail.com>
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_CONFIGRESTOREVISITOR_H
20 : #define EQSERVER_CONFIGRESTOREVISITOR_H
21 :
22 : #include "configVisitor.h" // base class
23 :
24 : namespace eq
25 : {
26 : namespace server
27 : {
28 : namespace
29 : {
30 : /** Restore all data which may have been modified by an application. */
31 : class ConfigRestoreVisitor : public ConfigVisitor
32 : {
33 : public:
34 2 : ConfigRestoreVisitor() {}
35 2 : virtual ~ConfigRestoreVisitor() {}
36 2 : virtual VisitorResult visitPre( Compound* compound )
37 : {
38 2 : compound->restore();
39 2 : return TRAVERSE_CONTINUE;
40 : }
41 2 : virtual VisitorResult visitPre( Config* config )
42 : {
43 2 : return _restore( config );
44 : }
45 2 : virtual VisitorResult visit( Observer* observer )
46 : {
47 2 : return _restore( observer );
48 : }
49 2 : virtual VisitorResult visitPre( Canvas* canvas )
50 : {
51 2 : return _restore( canvas );
52 : }
53 2 : virtual VisitorResult visit( Segment* segment )
54 : {
55 2 : return _restore( segment );
56 : }
57 2 : virtual VisitorResult visitPre( Layout* layout )
58 : {
59 2 : return _restore( layout );
60 : }
61 2 : virtual VisitorResult visit( View* view )
62 : {
63 2 : return _restore( view );
64 : }
65 2 : virtual VisitorResult visitPre( Node* node )
66 : {
67 2 : return _restore( node );
68 : }
69 2 : virtual VisitorResult visitPre( Pipe* pipe )
70 : {
71 2 : return _restore( pipe );
72 : }
73 2 : virtual VisitorResult visitPre( Window* window )
74 : {
75 2 : return _restore( window );
76 : }
77 4 : virtual VisitorResult visit( Channel* channel )
78 : {
79 4 : return _restore( channel );
80 : }
81 :
82 : private:
83 22 : VisitorResult _restore( fabric::Object* object )
84 : {
85 22 : object->restore();
86 22 : return TRAVERSE_CONTINUE;
87 : }
88 : };
89 : }
90 : }
91 : }
92 : #endif // EQSERVER_CONSTCONFIGVISITOR_H
|