Equalizer 1.0

connectionDescription.h

00001 
00002 /* Copyright (c) 2005-2011, Stefan Eilemann <eile@equalizergraphics.com> 
00003  *
00004  * This library is free software; you can redistribute it and/or modify it under
00005  * the terms of the GNU Lesser General Public License version 2.1 as published
00006  * by the Free Software Foundation.
00007  *  
00008  * This library is distributed in the hope that it will be useful, but WITHOUT
00009  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00010  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00011  * details.
00012  * 
00013  * You should have received a copy of the GNU Lesser General Public License
00014  * along with this library; if not, write to the Free Software Foundation, Inc.,
00015  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00016  */
00017 
00018 #ifndef CO_CONNECTIONDESCRIPTION_H
00019 #define CO_CONNECTIONDESCRIPTION_H
00020 
00021 #include <co/connectionType.h> // member enum
00022 #include <co/api.h>
00023 #include <co/types.h>
00024 
00025 #include <co/base/api.h>
00026 #include <co/base/referenced.h>
00027 
00028 namespace co
00029 {
00035     class ConnectionDescription : public base::Referenced
00036     {
00037     public:
00038         ConnectionDescription() 
00039                 : type( CONNECTIONTYPE_TCPIP )
00040                 , bandwidth( 0 )
00041                 , port( 0 )
00042                 , _filename( "default" )
00043             {}
00044 
00045         ConnectionDescription( const char* data );
00046 
00048         CO_API bool operator == ( const ConnectionDescription& rhs ) const;
00049 
00051         bool operator != ( const ConnectionDescription& rhs ) const
00052             { return !( *this == rhs ); }
00053 
00055         ConnectionType type;
00056 
00058         int32_t bandwidth;
00059 
00061         uint16_t port;
00062 
00064         CO_API std::string toString() const;
00065         CO_API void serialize( std::ostream& os ) const;
00066 
00082         CO_API bool fromString( std::string& data );
00083 
00089         CO_API void setHostname( const std::string& hostname );
00090         CO_API const std::string& getHostname() const;
00091 
00092         CO_API void setInterface( const std::string& interfacename );
00093         CO_API const std::string& getInterface() const;
00094 
00095         CO_API void setFilename( const std::string& filename );
00096         CO_API const std::string& getFilename() const;
00097 
00098         CO_API bool isSameMulticastGroup( ConnectionDescriptionPtr rhs );
00100 
00103         // Note: also update string array init in connectionDescription.cpp
00105         enum SAttribute
00106         {
00107             SATTR_HOSTNAME,
00108             SATTR_FILENAME,
00109             SATTR_FILL1,
00110             SATTR_FILL2,
00111             SATTR_ALL
00112         };
00113 
00115         enum IAttribute
00116         {
00117             IATTR_TYPE,
00118             IATTR_PORT,
00119             IATTR_BANDWIDTH,
00120             IATTR_FILL1,
00121             IATTR_FILL2,
00122             IATTR_ALL
00123         };
00125 
00126         CO_API static const std::string&
00127         getSAttributeString( const SAttribute attr );
00128         CO_API static const std::string&
00129         getIAttributeString( const IAttribute attr );
00130 
00131     protected:
00132         virtual ~ConnectionDescription() {}
00133 
00134     private:
00136         std::string _hostname;
00137 
00139         std::string _interface;
00140 
00142         std::string _filename;
00143     };
00144 
00145     CO_API std::ostream& operator << ( std::ostream&,
00146                                           const ConnectionDescription& );
00147 
00149     CO_API std::string serialize( const ConnectionDescriptions& );
00150 
00159     CO_API bool deserialize( std::string& data,
00160                                 ConnectionDescriptions& descriptions );
00161 }
00162 
00163 #endif // CO_CONNECTION_DESCRIPTION_H
Generated on Sun May 8 2011 19:11:05 for Equalizer 1.0 by  doxygen 1.7.3