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 <lunchbox/log.h>
22 : #include <co/connection.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 18 : static std::string _sAttributeStrings[ ConnectionDescription::SATTR_ALL ] =
33 : {
34 : MAKE_ATTR_STRING( SATTR_HOSTNAME ),
35 : MAKE_ATTR_STRING( SATTR_PIPE_FILENAME ),
36 : MAKE_ATTR_STRING( SATTR_FILL1 ),
37 : MAKE_ATTR_STRING( SATTR_FILL2 )
38 9 : };
39 18 : static std::string _iAttributeStrings[ ConnectionDescription::IATTR_ALL ] =
40 : {
41 : MAKE_ATTR_STRING( IATTR_TYPE ),
42 : MAKE_ATTR_STRING( IATTR_TCPIP_PORT ),
43 : MAKE_ATTR_STRING( IATTR_BANDWIDTH ),
44 : MAKE_ATTR_STRING( IATTR_FILL1 ),
45 : MAKE_ATTR_STRING( IATTR_FILL2 )
46 9 : };
47 : }
48 :
49 514 : ConnectionDescription::ConnectionDescription()
50 : {
51 514 : const Global* global = Global::instance();
52 :
53 514 : setHostname( global->getConnectionSAttribute( SATTR_HOSTNAME ));
54 : type = static_cast< co::ConnectionType >(
55 514 : global->getConnectionIAttribute( IATTR_TYPE ));
56 :
57 514 : bandwidth = global->getConnectionIAttribute( IATTR_BANDWIDTH );
58 :
59 514 : port = global->getConnectionIAttribute( IATTR_PORT );
60 514 : setFilename( global->getConnectionSAttribute( SATTR_FILENAME ));
61 514 : }
62 :
63 1422 : const std::string& ConnectionDescription::getSAttributeString(
64 : const SAttribute attr )
65 : {
66 1422 : return _sAttributeStrings[ attr ];
67 : }
68 :
69 1775 : const std::string& ConnectionDescription::getIAttributeString(
70 : const IAttribute attr )
71 : {
72 1775 : return _iAttributeStrings[ attr ];
73 : }
74 :
75 :
76 : }
77 27 : }
|