Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

SHEndpoint.h

Go to the documentation of this file.
00001 /* Copyright (C) 2000 KOM/Darmstadt University of Technology 00002 * 00003 * You are allowed to use all other parts of the code under the following terms: 00004 * 00005 * For non-commercial use, code may be used in unmodified form provided 00006 * that this copyright notice and this permission notice appear in 00007 * supporting documentation. 00008 * 00009 * This software is provided "as is" and without any express or implied 00010 * warranties, including, without limitation, the implied warranty of 00011 * fitness for a particular purpose. 00012 * 00013 * The code may be subjected to the GNU General Public License, Version 2, 00014 * and re-distributed under the terms of this license. 00015 * As a special exception, permission is granted to link this code 00016 * with the Qt library and distribute executables, as long as you 00017 * follow the requirements of the GNU GPL in regard to all of the 00018 * software in the executable aside from Qt. 00019 * 00020 * Commercial use other than under the terms of the GNU General Public 00021 * License is allowed only after express negotiation of conditions 00022 * with the authors. 00023 */ 00024 #ifndef MN_SH_ENDPOINT_H 00025 #define MN_SH_ENDPOINT_H 00026 00027 #include <sys/types.h> 00028 #include "var_type.h" 00029 00030 #include "SHEndpointSpec.h" 00031 #include "SHReturnCodes.h" 00032 #include "SHReport.h" 00033 #include "SHData.h" 00034 00035 namespace SH 00036 { 00037 class SourceEndpoint; 00038 class SinkEndpoint; 00039 00040 /**********************************************************************/ 00041 /* SourceUnit */ 00042 /**********************************************************************/ 00043 00044 enum SourceUnit 00045 { 00046 UnitDefault, 00047 UnitBytes, 00048 UnitPage 00049 }; 00050 00051 ostream& operator<<( ostream& ostr, SourceUnit su ); 00052 00053 /**********************************************************************/ 00054 /* Endpoint */ 00055 00056 00059 class Endpoint 00060 : public SHEndpointSpec 00061 { 00062 friend class Base; 00063 00064 public: 00065 00073 Endpoint( Base* mySH, bool isSink); 00074 00075 virtual ~Endpoint(); 00076 00077 protected: 00082 virtual void push_report_to_peer( ReportPtr report ) = 0; 00083 00084 private: 00088 Endpoint(const Endpoint & orig); 00089 00093 Endpoint& operator=( const Endpoint& orig ); 00094 00095 public: 00096 void init(); 00097 00098 void uninit(); 00099 00108 virtual void pushReport( ReportPtr report ) = 0; 00109 00117 virtual SH_RC connect( Endpoint* ep ); 00118 00122 virtual SH_RC disconnect( ); 00123 00127 bool is_connected() const; 00128 00131 bool is_sink() const; 00132 00133 protected: 00135 // why? 00136 public: 00137 Base* sh(); 00138 00139 virtual SH_RC changePos( u_int64 pos ) = 0; 00140 00141 private: 00142 00149 const bool _isSink; 00150 00160 bool _connected; 00161 00166 Base* _sh; 00167 }; 00168 00169 /**********************************************************************/ 00170 /* SinkEndpoint */ 00171 /**********************************************************************/ 00172 00173 class SinkEndpoint : public Endpoint 00174 { 00175 SourceEndpoint* _connected_source; 00176 00177 public: 00178 SinkEndpoint( Base* mySH ); 00179 00182 virtual SH_RC connect( Endpoint* ep ); 00183 00186 virtual SH_RC disconnect( ); 00187 00188 const SourceEndpoint* getConnectedSourceEndpoint() const; 00200 virtual SH_RC push( DataPtr item ); 00201 00206 SH_RC pull_from_peer( DataPtr& item, 00207 SourceUnit su = UnitDefault, 00208 size_t amount = 0 ); 00209 00212 virtual void pushReport( ReportPtr report ); 00213 00216 virtual void push_report_to_peer( ReportPtr report ); 00217 00218 virtual SH_RC changePos( u_int64 pos ); 00219 00220 }; 00221 00222 /**********************************************************************/ 00223 /* SourceEndpoint */ 00224 /**********************************************************************/ 00225 00226 class SourceEndpoint : public Endpoint 00227 { 00228 SinkEndpoint* _connected_sink; 00229 00230 public: 00231 SourceEndpoint( Base* mySH ); 00232 00234 virtual SH_RC connect( Endpoint* ep ); 00235 00237 virtual SH_RC disconnect( ); 00238 00250 virtual SH_RC pull( DataPtr& item, 00251 SourceUnit su = UnitDefault, 00252 size_t amount = 0 ); 00253 00258 SH_RC push_to_peer( DataPtr item ); 00259 00261 virtual void push_report_to_peer( ReportPtr report ); 00262 00264 virtual void pushReport( ReportPtr report ); 00265 00266 virtual SH_RC changePos( u_int64 pos ); 00267 00268 }; 00269 00270 }; // namespace SH 00271 00272 #endif /* MN_SH_ENDPOINT_H */ 00273

Generated on Sun Mar 6 13:35:50 2005 for Komssys by doxygen 1.3.8