Line data Source code
1 :
2 : /* Copyright (c) 2005-2013, Stefan Eilemann <eile@equalizergraphics.com>
3 : * 2010, Cedric Stalder <cedric.stalder@gmail.com>
4 : * 2012, 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 : #include <lunchbox/lock.h>
27 :
28 : namespace eq
29 : {
30 12 : std::string _programName;
31 12 : std::string _workDir;
32 : NodeFactory* Global::_nodeFactory = 0;
33 :
34 : #ifdef EQUALIZER_USE_HWSD
35 12 : std::string Global::_configFile = hwsd::NodeInfo::getLocalSession();
36 : #else
37 : std::string Global::_configFile = "config.eqc";
38 : #endif
39 :
40 : #ifdef AGL
41 : static lunchbox::Lock _carbonLock;
42 : #endif
43 :
44 7 : void Global::setProgramName( const std::string& programName )
45 : {
46 7 : _programName = programName;
47 7 : }
48 :
49 19 : const std::string& Global::getProgramName()
50 : {
51 19 : return _programName;
52 : }
53 :
54 9 : void Global::setWorkDir( const std::string& workDir )
55 : {
56 9 : _workDir = workDir;
57 9 : }
58 :
59 19 : const std::string& Global::getWorkDir()
60 : {
61 19 : return _workDir;
62 : }
63 :
64 2 : void Global::setConfigFile( const std::string& configFile )
65 : {
66 2 : _configFile = configFile;
67 2 : }
68 :
69 26 : const std::string& Global::getConfigFile()
70 : {
71 26 : return _configFile;
72 : }
73 :
74 15 : void Global::enterCarbon()
75 : {
76 : #ifdef AGL
77 : _carbonLock.set();
78 : #endif
79 15 : }
80 :
81 15 : void Global::leaveCarbon()
82 : {
83 : #ifdef AGL
84 : _carbonLock.unset();
85 : #endif
86 15 : }
87 :
88 36 : }
|