Line data Source code
1 :
2 : /* Copyright (c) 2006-2013, Stefan Eilemann <eile@equalizergraphics.com>
3 : * 2008-2010, Cedric Stalder <cedric.stalder@gmail.com>
4 : * 2014, 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 EQSERVER_GLOBAL_H
21 : #define EQSERVER_GLOBAL_H
22 :
23 : #include "compound.h" // nested enum
24 : #include "channel.h" // nested enum
25 : #include "config.h" // nested enum
26 : #include "connectionDescription.h" // nested enum
27 : #include "pipe.h" // nested enum
28 : #include "node.h" // nested enum
29 : #include "window.h" // nested enum
30 : #include "view.h" // nested enum
31 :
32 : namespace eq
33 : {
34 : namespace server
35 : {
36 : /**
37 : * The global default attributes.
38 : */
39 678 : class Global
40 : {
41 : public:
42 : EQSERVER_API static Global* instance();
43 :
44 : /** De-allocate the global instance. */
45 : EQSERVER_API static void clear();
46 :
47 : /** @name Connection (Description) Attributes. */
48 : //@{
49 8 : void setConnectionSAttribute( const ConnectionDescription::SAttribute
50 : attr, const std::string& value )
51 8 : { _connectionSAttributes[attr] = value; }
52 2000 : const std::string& getConnectionSAttribute(
53 : const ConnectionDescription::SAttribute attr ) const
54 2000 : { return _connectionSAttributes[attr]; }
55 :
56 4 : void setConnectionIAttribute( const ConnectionDescription::IAttribute
57 : attr, const int32_t value)
58 4 : { _connectionIAttributes[attr] = value; }
59 3000 : int32_t getConnectionIAttribute(
60 : const ConnectionDescription::IAttribute attr ) const
61 3000 : { return _connectionIAttributes[attr]; }
62 : //@}
63 :
64 : /** @name Config Attributes. */
65 : //@{
66 419 : void setConfigFAttribute( const Config::FAttribute attr,
67 : const float value )
68 419 : { _configFAttributes[attr] = value; }
69 1757 : float getConfigFAttribute( const Config::FAttribute attr ) const
70 1757 : { return _configFAttributes[attr]; }
71 :
72 4 : void setConfigIAttribute( const Config::IAttribute attr,
73 : const int32_t value )
74 4 : { _configIAttributes[attr] = value; }
75 2556 : int32_t getConfigIAttribute( const Config::IAttribute attr ) const
76 2556 : { return _configIAttributes[attr]; }
77 : //@}
78 :
79 : /** @name Node Attributes. */
80 : //@{
81 4 : void setNodeSAttribute( const Node::SAttribute attr,
82 : const std::string& value )
83 4 : { _nodeSAttributes[attr] = value; }
84 1294 : const std::string& getNodeSAttribute( const Node::SAttribute attr) const
85 1294 : { return _nodeSAttributes[attr]; }
86 :
87 4 : void setNodeCAttribute( const Node::CAttribute attr, const char value )
88 4 : { _nodeCAttributes[attr] = value; }
89 1294 : char getNodeCAttribute( const Node::CAttribute attr ) const
90 1294 : { return _nodeCAttributes[attr]; }
91 :
92 12 : void setNodeIAttribute( const Node::IAttribute attr,
93 : const int32_t value )
94 12 : { _nodeIAttributes[attr] = value; }
95 3882 : int32_t getNodeIAttribute( const Node::IAttribute attr ) const
96 3882 : { return _nodeIAttributes[attr]; }
97 : //@}
98 :
99 : /** @name Pipe Attributes. */
100 : //@{
101 8 : void setPipeIAttribute( const Pipe::IAttribute attr,
102 : const int32_t value )
103 8 : { _pipeIAttributes[attr] = value; }
104 3440 : int32_t getPipeIAttribute( const Pipe::IAttribute attr ) const
105 3440 : { return _pipeIAttributes[attr]; }
106 : //@}
107 :
108 : /** @name Window Attributes. */
109 : //@{
110 318 : void setWindowIAttribute( const WindowSettings::IAttribute attr,
111 : const int32_t value )
112 318 : { _windowIAttributes[attr] = value; }
113 47082 : int32_t getWindowIAttribute( const WindowSettings::IAttribute attr ) const
114 47082 : { return _windowIAttributes[attr]; }
115 : //@}
116 :
117 : /** @name Channel Attributes. */
118 : //@{
119 6 : void setChannelIAttribute( const Channel::IAttribute attr,
120 : const int32_t value )
121 6 : { _channelIAttributes[attr] = value; }
122 11550 : int32_t getChannelIAttribute( const Channel::IAttribute attr ) const
123 11550 : { return _channelIAttributes[attr]; }
124 :
125 4 : void setChannelSAttribute( const Channel::SAttribute attr,
126 : const std::string& value )
127 4 : { _channelSAttributes[attr] = value; }
128 9900 : const std::string& getChannelSAttribute( const Channel::SAttribute attr) const
129 9900 : { return _channelSAttributes[attr]; }
130 : //@}
131 :
132 : /** @name Compound Attributes. */
133 : //@{
134 20 : void setCompoundIAttribute( const Compound::IAttribute attr,
135 : const int32_t value )
136 20 : { _compoundIAttributes[attr] = value; }
137 71770 : int32_t getCompoundIAttribute( const Compound::IAttribute attr ) const
138 71770 : { return _compoundIAttributes[attr]; }
139 : //@}
140 :
141 : /** @name View Attributes. */
142 : //@{
143 0 : void setViewSAttribute( const View::SAttribute attr,
144 : const std::string& value )
145 0 : { _viewSAttributes[attr] = value; }
146 5054 : const std::string& getViewSAttribute( const View::SAttribute attr) const
147 5054 : { return _viewSAttributes[attr]; }
148 : //@}
149 :
150 : private:
151 : Global();
152 :
153 : std::string _connectionSAttributes[ConnectionDescription::SATTR_ALL];
154 : int32_t _connectionIAttributes[ConnectionDescription::IATTR_ALL];
155 :
156 : float _configFAttributes[Config::FATTR_ALL];
157 : int32_t _configIAttributes[Config::IATTR_ALL];
158 :
159 : std::string _nodeSAttributes[Node::SATTR_ALL];
160 : char _nodeCAttributes[Node::CATTR_ALL];
161 : int32_t _nodeIAttributes[Node::IATTR_ALL];
162 :
163 : int32_t _pipeIAttributes[Pipe::IATTR_ALL];
164 :
165 : int32_t _windowIAttributes[WindowSettings::IATTR_ALL];
166 :
167 : int32_t _channelIAttributes[Channel::IATTR_ALL];
168 : std::string _channelSAttributes[Channel::SATTR_ALL];
169 :
170 : int32_t _compoundIAttributes[Compound::IATTR_ALL];
171 :
172 : std::string _viewSAttributes[View::SATTR_ALL];
173 :
174 : struct Private;
175 : Private* _private; // placeholder for binary-compatible changes
176 :
177 : void _setupDefaults();
178 : void _readEnvironment();
179 :
180 : friend EQSERVER_API std::ostream& operator << ( std::ostream&,
181 : const Global* );
182 : };
183 :
184 : EQSERVER_API std::ostream& operator << ( std::ostream&, const Global* );
185 : }
186 : }
187 : #endif // EQSERVER_GLOBAL_H
|