00001 /*---------------------------------------------------------------------------*\ 00002 * OpenSG * 00003 * * 00004 * * 00005 * Copyright (C) 2000-2002 by the OpenSG Forum * 00006 * * 00007 * www.opensg.org * 00008 * * 00009 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de * 00010 * * 00011 \*---------------------------------------------------------------------------*/ 00012 /*---------------------------------------------------------------------------*\ 00013 * License * 00014 * * 00015 * This library is free software; you can redistribute it and/or modify it * 00016 * under the terms of the GNU Library General Public License as published * 00017 * by the Free Software Foundation, version 2. * 00018 * * 00019 * This library is distributed in the hope that it will be useful, but * 00020 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00022 * Library General Public License for more details. * 00023 * * 00024 * You should have received a copy of the GNU Library General Public * 00025 * License along with this library; if not, write to the Free Software * 00026 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00027 * * 00028 \*---------------------------------------------------------------------------*/ 00029 /*---------------------------------------------------------------------------*\ 00030 * Changes * 00031 * * 00032 * * 00033 * * 00034 * * 00035 * * 00036 * * 00037 \*---------------------------------------------------------------------------*/ 00038 00039 00040 #ifndef _CONNECTION_H_ 00041 #define _CONNECTION_H_ 00042 #ifdef __sgi 00043 #pragma once 00044 #endif 00045 00046 //--------------------------------------------------------------------------- 00047 // Includes 00048 //--------------------------------------------------------------------------- 00049 00050 #include <string> 00051 #include <OSGBase.h> 00052 #include <OSGBaseTypes.h> 00053 #include <OSGBinaryDataHandler.h> 00054 #include <OSGTime.h> 00055 00056 OSG_BEGIN_NAMESPACE 00057 00058 class ConnectionType; 00059 00060 class OSG_BASE_DLLMAPPING Connection : public BinaryDataHandler 00061 { 00062 /*========================== PUBLIC =================================*/ 00063 public: 00064 00065 /*---------------------------------------------------------------------*/ 00069 typedef Int32 Channel; 00070 00072 /*---------------------------------------------------------------------*/ 00076 Connection ( int zeroCopyThreshold ); 00077 virtual ~Connection ( void ); 00078 00080 /*---------------------------------------------------------------------*/ 00084 virtual const ConnectionType *getType (void) = 0; 00085 00087 /*---------------------------------------------------------------------*/ 00091 virtual Channel connectPoint(const std::string &address, 00092 Time timeout=-1) = 0; 00093 virtual Channel acceptPoint ( Time timeout=-1) = 0; 00094 00096 /*---------------------------------------------------------------------*/ 00100 virtual bool wait (Time timeout = -1) throw (ReadError ) = 0; 00101 virtual void signal(void ) throw (WriteError) = 0; 00102 00104 /*---------------------------------------------------------------------*/ 00108 virtual Channel selectChannel(Time timeout=-1) throw (ReadError) = 0; 00109 00111 /*---------------------------------------------------------------------*/ 00115 virtual std::string bind (const std::string &address="") = 0; 00116 00118 /*---------------------------------------------------------------------*/ 00122 virtual void setParams(const std::string ¶ms); 00123 00125 /*---------------------------------------------------------------------*/ 00129 const std::string &getInterface(void ); 00130 void setInterface(const std::string &interf); 00131 00133 /*========================= PROTECTED ===============================*/ 00134 protected: 00135 /*---------------------------------------------------------------------*/ 00139 std::string _interface; 00140 00143 /*========================== PRIVATE ================================*/ 00144 private: 00145 00146 typedef BinaryDataHandler Inherited; 00147 00148 // prohibit default functions (move to 'public' if you need one) 00149 Connection(const Connection &source); 00150 Connection& operator =(const Connection &source); 00151 }; 00152 00153 //--------------------------------------------------------------------------- 00154 // Exported Types 00155 //--------------------------------------------------------------------------- 00156 00157 // class pointer 00158 00159 typedef Connection *ConnectionP; 00160 00161 OSG_END_NAMESPACE 00162 00163 #define OSG_CONNECTION_HEADER_CVSID "@(#)$Id: $" 00164 00165 #endif /* _CONNECTION_H_ */
1.5.5