Line data Source code
1 :
2 : /* Copyright (c) 2006-2012, Stefan Eilemann <eile@equalizergraphics.com>
3 : *
4 : * This library is free software; you can redistribute it and/or modify it under
5 : * the terms of the GNU Lesser General Public License version 2.1 as published
6 : * by the Free Software Foundation.
7 : *
8 : * This library is distributed in the hope that it will be useful, but WITHOUT
9 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 : * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 : * details.
12 : *
13 : * You should have received a copy of the GNU Lesser General Public License
14 : * along with this library; if not, write to the Free Software Foundation, Inc.,
15 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 : */
17 :
18 : #include "connectionDescription.h"
19 :
20 : #include "global.h"
21 : #include <co/connection.h>
22 : #include <lunchbox/log.h>
23 :
24 : namespace eq
25 : {
26 : namespace server
27 : {
28 : namespace
29 : {
30 : #define MAKE_ATTR_STRING(attr) (std::string("EQ_CONNECTION_") + #attr)
31 :
32 40 : static std::string _sAttributeStrings[ConnectionDescription::SATTR_ALL] = {
33 80 : MAKE_ATTR_STRING(SATTR_HOSTNAME), MAKE_ATTR_STRING(SATTR_PIPE_FILENAME),
34 100 : MAKE_ATTR_STRING(SATTR_FILL1), MAKE_ATTR_STRING(SATTR_FILL2)};
35 40 : static std::string _iAttributeStrings[ConnectionDescription::IATTR_ALL] = {
36 80 : MAKE_ATTR_STRING(IATTR_TYPE), MAKE_ATTR_STRING(IATTR_TCPIP_PORT),
37 80 : MAKE_ATTR_STRING(IATTR_BANDWIDTH), MAKE_ATTR_STRING(IATTR_FILL1),
38 180 : MAKE_ATTR_STRING(IATTR_FILL2)};
39 : }
40 :
41 962 : ConnectionDescription::ConnectionDescription()
42 : {
43 962 : const Global* global = Global::instance();
44 :
45 962 : setHostname(global->getConnectionSAttribute(SATTR_HOSTNAME));
46 962 : type = static_cast<co::ConnectionType>(
47 962 : global->getConnectionIAttribute(IATTR_TYPE));
48 :
49 962 : bandwidth = global->getConnectionIAttribute(IATTR_BANDWIDTH);
50 :
51 962 : port = global->getConnectionIAttribute(IATTR_PORT);
52 962 : setFilename(global->getConnectionSAttribute(SATTR_FILENAME));
53 962 : }
54 :
55 2444 : const std::string& ConnectionDescription::getSAttributeString(
56 : const SAttribute attr)
57 : {
58 2444 : return _sAttributeStrings[attr];
59 : }
60 :
61 3050 : const std::string& ConnectionDescription::getIAttributeString(
62 : const IAttribute attr)
63 : {
64 3050 : return _iAttributeStrings[attr];
65 : }
66 : }
67 60 : }
|