00001 /*------------------------------------------------------------------------------ 00002 00003 Copyright (c) 2000 Tyrell Corporation. All rights reserved. 00004 00005 Tyrell DarkIce 00006 00007 File : Connector.h 00008 Version : $Revision: 1.6 $ 00009 Author : $Author: darkeye $ 00010 Location : $Source: /cvsroot/darkice/darkice/src/Connector.h,v $ 00011 00012 Copyright notice: 00013 00014 This program is free software; you can redistribute it and/or 00015 modify it under the terms of the GNU General Public License 00016 as published by the Free Software Foundation; either version 2 00017 of the License, or (at your option) any later version. 00018 00019 This program is distributed in the hope that it will be useful, 00020 but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 GNU General Public License for more details. 00023 00024 You should have received a copy of the GNU General Public License 00025 along with this program; if not, write to the Free Software 00026 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00027 00028 ------------------------------------------------------------------------------*/ 00029 #ifndef CONNECTOR_H 00030 #define CONNECTOR_H 00031 00032 #ifndef __cplusplus 00033 #error This is a C++ include file 00034 #endif 00035 00036 00037 /* ============================================================ include files */ 00038 00039 #include "Referable.h" 00040 #include "Ref.h" 00041 #include "Reporter.h" 00042 #include "Source.h" 00043 #include "Sink.h" 00044 00045 00046 /* ================================================================ constants */ 00047 00048 00049 /* =================================================================== macros */ 00050 00051 00052 /* =============================================================== data types */ 00053 00060 class Connector : public virtual Referable, public virtual Reporter 00061 { 00062 private: 00063 00070 void 00071 init ( Source * source ) throw ( Exception ); 00072 00078 void 00079 strip ( void ) throw ( Exception ); 00080 00081 00082 protected: 00083 00087 Ref<Source> source; 00088 00092 Ref<Sink> * sinks; 00093 00097 unsigned int numSinks; 00098 00104 inline 00105 Connector ( void ) throw ( Exception ) 00106 { 00107 throw Exception( __FILE__, __LINE__); 00108 } 00109 00117 virtual bool 00118 detach ( Sink * sink ) throw ( Exception ); 00119 00120 00121 public: 00122 00129 inline 00130 Connector ( Source * source ) throw ( Exception ) 00131 { 00132 init( source); 00133 } 00134 00142 inline 00143 Connector ( Source * source, 00144 Sink * sink ) throw ( Exception ) 00145 { 00146 init( source); 00147 attach( sink); 00148 } 00149 00156 Connector ( const Connector & connector ) throw ( Exception ); 00157 00163 inline virtual 00164 ~Connector( void ) throw ( Exception ) 00165 { 00166 strip(); 00167 } 00168 00176 virtual Connector & 00177 operator= ( const Connector & connector ) throw ( Exception ); 00178 00185 inline virtual unsigned int 00186 getNumSinks ( void ) const throw () 00187 { 00188 return numSinks; 00189 } 00190 00197 virtual void 00198 attach ( Sink * sink ) throw ( Exception ); 00199 00206 virtual bool 00207 open ( void ) throw ( Exception ); 00208 00231 virtual unsigned int 00232 transfer ( unsigned long bytes, 00233 unsigned int bufSize, 00234 unsigned int sec, 00235 unsigned int usec ) throw ( Exception ); 00236 00242 virtual void 00243 close ( void ) throw ( Exception ); 00244 }; 00245 00246 00247 /* ================================================= external data structures */ 00248 00249 00250 /* ====================================================== function prototypes */ 00251 00252 00253 00254 #endif /* CONNECTOR_H */ 00255 00256 00257 /*------------------------------------------------------------------------------ 00258 00259 $Source: /cvsroot/darkice/darkice/src/Connector.h,v $ 00260 00261 $Log: Connector.h,v $ 00262 Revision 1.6 2002/10/19 12:24:55 darkeye 00263 anged internals so that now each encoding/server connection is 00264 a separate thread 00265 00266 Revision 1.5 2001/08/26 20:44:30 darkeye 00267 removed external command-line encoder support 00268 replaced it with a shared-object support for lame with the possibility 00269 of static linkage 00270 00271 Revision 1.4 2000/11/15 18:37:37 darkeye 00272 changed the transferable number of bytes to unsigned long 00273 00274 Revision 1.3 2000/11/15 18:08:43 darkeye 00275 added multiple verbosity-level event reporting and verbosity command 00276 line option 00277 00278 Revision 1.2 2000/11/13 18:46:50 darkeye 00279 added kdoc-style documentation comments 00280 00281 Revision 1.1.1.1 2000/11/05 10:05:49 darkeye 00282 initial version 00283 00284 00285 ------------------------------------------------------------------------------*/ 00286