Line data Source code
1 :
2 : /* Copyright (c) 2006-2011, Stefan Eilemann <eile@equalizergraphics.com>
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_LOADER_H
20 : #define EQSERVER_LOADER_H
21 :
22 : #include "api.h"
23 : #include "types.h"
24 :
25 : #include <iostream>
26 :
27 : namespace eq
28 : {
29 : namespace server
30 : {
31 : /** The config file loader. */
32 : class Loader
33 : {
34 : public:
35 18 : Loader() {}
36 18 : virtual ~Loader() {}
37 :
38 : /**
39 : * Loads a config file.
40 : *
41 : * The returned config has to be deleted by the caller.
42 : *
43 : * @param filename the name of the config file.
44 : * @return The parsed config, or <code>0</code> upon error.
45 : */
46 : EQSERVER_API ServerPtr loadFile( const std::string& filename );
47 :
48 : /**
49 : * Parse a config file given as a parameter.
50 : *
51 : * @param config the config file.
52 : * @return the parsed server.
53 : */
54 : EQSERVER_API ServerPtr parseServer( const char* config );
55 :
56 : /**
57 : * Add a Compound for each output channel.
58 : *
59 : * This function creates a compound for each output channel which is not
60 : * used as a destination channel yet.
61 : *
62 : * @param server the server.
63 : */
64 : EQSERVER_API static Compounds addOutputCompounds( ServerPtr server );
65 :
66 : /**
67 : * Add segments and layouts for dest channels in non-view configs.
68 : *
69 : * This function creates the appropriate views and segments for
70 : * destination channels, and reassigns the compound channel.
71 : *
72 : * @param server the server.
73 : */
74 : EQSERVER_API static void addDestinationViews( ServerPtr server );
75 :
76 : /**
77 : * Convert config to version 1.1
78 : *
79 : * This function converts a 1.0 to a 1.1 configuration.
80 : * Most notably, the stereo setting is migrated from compounds to
81 : * views and segments (see
82 : * <a href="http://www.equalizergraphics.com/documents/design/stereoSwitch.html">Runtime
83 : * stereo switch doc</a>).
84 : *
85 : * @param server the server.
86 : */
87 : EQSERVER_API static void convertTo11( ServerPtr server );
88 :
89 : /**
90 : * Convert config to version 1.2
91 : *
92 : * This function converts a 1.1 to a 1.2 configuration.
93 : * Most notably, the node's host is derived from the connection
94 : * description.
95 : *
96 : * @param server the server.
97 : */
98 : EQSERVER_API static void convertTo12( ServerPtr server );
99 :
100 : /**
101 : * Add one observer for observer-less configurations.
102 : *
103 : * If a configuration has no observers, one is created and assigned to
104 : * all views, which retains the behaviour of legacy configurations.
105 : *
106 : * @param server the server.
107 : */
108 : EQSERVER_API static void addDefaultObserver( ServerPtr server );
109 :
110 : private:
111 : void _parseString( const char* config );
112 : void _parse();
113 : };
114 : }
115 : }
116 : #endif // EQSERVER_LOADER_H
|