Line data Source code
1 :
2 : /* Copyright (c) 2005-2017, 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 : #include "global.h"
21 :
22 : #include "nodeFactory.h"
23 : #ifdef EQUALIZER_USE_HWSD
24 : #include <hwsd/nodeInfo.h>
25 : #endif
26 :
27 : namespace eq
28 : {
29 10 : std::string _programName;
30 10 : std::string _workDir;
31 : NodeFactory* Global::_nodeFactory = 0;
32 :
33 : #ifdef EQUALIZER_USE_HWSD
34 10 : std::string Global::_config = hwsd::NodeInfo::getLocalSession();
35 : #else
36 : std::string Global::_config = "configs/config.eqc";
37 : #endif
38 :
39 : #ifdef AGL
40 : static std::mutex _carbonLock;
41 : #endif
42 :
43 2 : void Global::setProgramName(const std::string& programName)
44 : {
45 2 : _programName = programName;
46 2 : }
47 :
48 4 : const std::string& Global::getProgramName()
49 : {
50 4 : return _programName;
51 : }
52 :
53 3 : void Global::setWorkDir(const std::string& workDir)
54 : {
55 3 : _workDir = workDir;
56 3 : }
57 :
58 4 : const std::string& Global::getWorkDir()
59 : {
60 4 : return _workDir;
61 : }
62 :
63 0 : void Global::setConfig(const std::string& config)
64 : {
65 0 : _config = config;
66 0 : }
67 :
68 2 : const std::string& Global::getConfig()
69 : {
70 2 : return _config;
71 : }
72 :
73 2 : void Global::enterCarbon()
74 : {
75 : #ifdef AGL
76 : _carbonLock.lock();
77 : #endif
78 2 : }
79 :
80 2 : void Global::leaveCarbon()
81 : {
82 : #ifdef AGL
83 : _carbonLock.unlock();
84 : #endif
85 2 : }
86 30 : }
|