Line data Source code
1 :
2 : /* Copyright (c) 2005-2016, Stefan Eilemann <eile@equalizergraphics.com>
3 : * Cedric Stalder <cedric.stalder@gmail.com>
4 : * Daniel Nachbaur <danielnachbaur@gmail.com>
5 : *
6 : * This library is free software; you can redistribute it and/or modify it under
7 : * the terms of the GNU Lesser General Public License version 2.1 as published
8 : * by the Free Software Foundation.
9 : *
10 : * This library is distributed in the hope that it will be useful, but WITHOUT
11 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 : * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 : * details.
14 : *
15 : * You should have received a copy of the GNU Lesser General Public License
16 : * along with this library; if not, write to the Free Software Foundation, Inc.,
17 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 : */
19 :
20 : #ifndef EQ_GLOBAL_H
21 : #define EQ_GLOBAL_H
22 :
23 : #include <eq/api.h>
24 : #include <eq/init.h> // friend
25 : #include <eq/types.h>
26 :
27 : #include <eq/fabric/global.h> // base class
28 : #include <eq/fabric/iAttribute.h> // enum definition
29 :
30 : namespace eq
31 : {
32 : /** Global parameter handling for the Equalizer client library. */
33 : class Global : public fabric::Global
34 : {
35 : public:
36 : /** Set the name of the program. @version 1.5.2 */
37 : EQ_API static void setProgramName(const std::string& programName);
38 :
39 : /** @return the program name. @version 1.5.2 */
40 : EQ_API static const std::string& getProgramName();
41 :
42 : /** Set the working directory of the program. @version 1.5.2 */
43 : EQ_API static void setWorkDir(const std::string& workDir);
44 :
45 : /** @return the working directory of the program. @version 1.5.2 */
46 : EQ_API static const std::string& getWorkDir();
47 :
48 : /** @return the node factory. @version 1.0 */
49 18 : static NodeFactory* getNodeFactory() { return _nodeFactory; }
50 : /**
51 : * Set the config file or hwsd session for the app-local server.
52 : *
53 : * When started without specifying an explicit server connection, Equalizer
54 : * will create an server instance in an application thread using this
55 : * configuration. Strings ending with '.eqc' are considered Equalizer
56 : * configuration files, otherwise the given string is used as an HWSD
57 : * session name for auto-configuration.
58 : *
59 : * @param config the default configuration.
60 : * @version 1.0
61 : */
62 : EQ_API static void setConfig(const std::string& config);
63 :
64 : /** @return the configuration for the app-local server. @version 1.0 */
65 : EQ_API static const std::string& getConfig();
66 :
67 : /**
68 : * Global lock for all non-thread-safe Carbon API calls.
69 : *
70 : * Note: this is a NOP on non-AGL builds. Do not use unless you know the
71 : * side effects, i.e., ask on the eq-dev mailing list.
72 : *
73 : * @version 1.0
74 : */
75 : static void enterCarbon();
76 :
77 : /** Global unlock for non-thread-safe Carbon API calls. @version 1.0 */
78 : static void leaveCarbon();
79 :
80 : private:
81 : EQ_API friend bool _init(const int argc, char** argv, NodeFactory*);
82 : EQ_API friend bool exit();
83 :
84 : static NodeFactory* _nodeFactory;
85 : static std::string _config;
86 : };
87 : }
88 :
89 : #endif // EQ_GLOBAL_H
|