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 :
31 :
32 : namespace eq
33 : {
34 : namespace server
35 : {
36 : /**
37 : * The global default attributes.
38 : */
39 354 : 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 4 : void setConnectionSAttribute( const ConnectionDescription::SAttribute
50 : attr, const std::string& value )
51 4 : { _connectionSAttributes[attr] = value; }
52 1028 : const std::string& getConnectionSAttribute(
53 : const ConnectionDescription::SAttribute attr ) const
54 1028 : { return _connectionSAttributes[attr]; }
55 :
56 2 : void setConnectionIAttribute( const ConnectionDescription::IAttribute
57 : attr, const int32_t value)
58 2 : { _connectionIAttributes[attr] = value; }
59 1542 : int32_t getConnectionIAttribute(
60 : const ConnectionDescription::IAttribute attr ) const
61 1542 : { return _connectionIAttributes[attr]; }
62 : //@}
63 :
64 : /** @name Config Attributes. */
65 : //@{
66 414 : void setConfigFAttribute( const Config::FAttribute attr,
67 : const float value )
68 414 : { _configFAttributes[attr] = value; }
69 1750 : float getConfigFAttribute( const Config::FAttribute attr ) const
70 1750 : { return _configFAttributes[attr]; }
71 :
72 3 : void setConfigIAttribute( const Config::IAttribute attr,
73 : const int32_t value )
74 3 : { _configIAttributes[attr] = value; }
75 1290 : int32_t getConfigIAttribute( const Config::IAttribute attr ) const
76 1290 : { return _configIAttributes[attr]; }
77 : //@}
78 :
79 : /** @name Node Attributes. */
80 : //@{
81 2 : void setNodeSAttribute( const Node::SAttribute attr,
82 : const std::string& value )
83 2 : { _nodeSAttributes[attr] = value; }
84 677 : const std::string& getNodeSAttribute( const Node::SAttribute attr) const
85 677 : { return _nodeSAttributes[attr]; }
86 :
87 2 : void setNodeCAttribute( const Node::CAttribute attr, const char value )
88 2 : { _nodeCAttributes[attr] = value; }
89 677 : char getNodeCAttribute( const Node::CAttribute attr ) const
90 677 : { return _nodeCAttributes[attr]; }
91 :
92 6 : void setNodeIAttribute( const Node::IAttribute attr,
93 : const int32_t value )
94 6 : { _nodeIAttributes[attr] = value; }
95 2031 : int32_t getNodeIAttribute( const Node::IAttribute attr ) const
96 2031 : { return _nodeIAttributes[attr]; }
97 : //@}
98 :
99 : /** @name Pipe Attributes. */
100 : //@{
101 4 : void setPipeIAttribute( const Pipe::IAttribute attr,
102 : const int32_t value )
103 4 : { _pipeIAttributes[attr] = value; }
104 2742 : int32_t getPipeIAttribute( const Pipe::IAttribute attr ) const
105 2742 : { return _pipeIAttributes[attr]; }
106 : //@}
107 :
108 : /** @name Window Attributes. */
109 : //@{
110 157 : void setWindowIAttribute( const WindowSettings::IAttribute attr,
111 : const int32_t value )
112 157 : { _windowIAttributes[attr] = value; }
113 20934 : int32_t getWindowIAttribute( const WindowSettings::IAttribute attr ) const
114 20934 : { return _windowIAttributes[attr]; }
115 : //@}
116 :
117 : /** @name Channel Attributes. */
118 : //@{
119 3 : void setChannelIAttribute( const Channel::IAttribute attr,
120 : const int32_t value )
121 3 : { _channelIAttributes[attr] = value; }
122 5852 : int32_t getChannelIAttribute( const Channel::IAttribute attr ) const
123 5852 : { return _channelIAttributes[attr]; }
124 :
125 2 : void setChannelSAttribute( const Channel::SAttribute attr,
126 : const std::string& value )
127 2 : { _channelSAttributes[attr] = value; }
128 5016 : const std::string& getChannelSAttribute( const Channel::SAttribute attr) const
129 5016 : { return _channelSAttributes[attr]; }
130 : //@}
131 :
132 : /** @name Compound Attributes. */
133 : //@{
134 10 : void setCompoundIAttribute( const Compound::IAttribute attr,
135 : const int32_t value )
136 10 : { _compoundIAttributes[attr] = value; }
137 46205 : int32_t getCompoundIAttribute( const Compound::IAttribute attr ) const
138 46205 : { return _compoundIAttributes[attr]; }
139 : //@}
140 :
141 : private:
142 : Global();
143 :
144 : std::string _connectionSAttributes[ConnectionDescription::SATTR_ALL];
145 : int32_t _connectionIAttributes[ConnectionDescription::IATTR_ALL];
146 :
147 : float _configFAttributes[Config::FATTR_ALL];
148 : int32_t _configIAttributes[Config::IATTR_ALL];
149 :
150 : std::string _nodeSAttributes[Node::SATTR_ALL];
151 : char _nodeCAttributes[Node::CATTR_ALL];
152 : int32_t _nodeIAttributes[Node::IATTR_ALL];
153 :
154 : int32_t _pipeIAttributes[Pipe::IATTR_ALL];
155 :
156 : int32_t _windowIAttributes[WindowSettings::IATTR_ALL];
157 :
158 : int32_t _channelIAttributes[Channel::IATTR_ALL];
159 : std::string _channelSAttributes[Channel::SATTR_ALL];
160 :
161 : int32_t _compoundIAttributes[Compound::IATTR_ALL];
162 :
163 : struct Private;
164 : Private* _private; // placeholder for binary-compatible changes
165 :
166 : void _setupDefaults();
167 : void _readEnvironment();
168 :
169 : friend EQSERVER_API std::ostream& operator << ( std::ostream&,
170 : const Global* );
171 : };
172 :
173 : EQSERVER_API std::ostream& operator << ( std::ostream&, const Global* );
174 : }
175 : }
176 : #endif // EQSERVER_GLOBAL_H
|