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 "types.h"
23 : #include <eq/server/api.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 4 : Loader() {}
36 4 : virtual ~Loader() {}
37 : /**
38 : * Loads a config file.
39 : *
40 : * The returned config has to be deleted by the caller.
41 : *
42 : * @param filename the name of the config file.
43 : * @return The parsed config, or <code>0</code> upon error.
44 : */
45 : EQSERVER_API ServerPtr loadFile(const std::string& filename);
46 :
47 : /**
48 : * Parse a config file given as a parameter.
49 : *
50 : * @param config the config file.
51 : * @return the parsed server.
52 : */
53 : EQSERVER_API ServerPtr parseServer(const char* config);
54 :
55 : /**
56 : * Add a Compound for each output channel.
57 : *
58 : * This function creates a compound for each output channel which is not
59 : * used as a destination channel yet.
60 : *
61 : * @param server the server.
62 : */
63 : EQSERVER_API static Compounds addOutputCompounds(ServerPtr server);
64 :
65 : /**
66 : * Add segments and layouts for dest channels in non-view configs.
67 : *
68 : * This function creates the appropriate views and segments for
69 : * destination channels, and reassigns the compound channel.
70 : *
71 : * @param server the server.
72 : */
73 : EQSERVER_API static void addDestinationViews(ServerPtr server);
74 :
75 : /**
76 : * Convert config to version 1.1
77 : *
78 : * This function converts a 1.0 to a 1.1 configuration.
79 : * Most notably, the stereo setting is migrated from compounds to
80 : * views and segments (see
81 : * <a
82 : * 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
|