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

SHPushPullSH.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 SH_PUSH_PULL_STREAM_HANDLER_H 00025 #define SH_PUSH_PULL_STREAM_HANDLER_H 00026 00027 #include <sys/types.h> 00028 00029 #include "SH.h" 00030 #include "SHEndpoint.h" 00031 #include "SHEndpointSpec.h" 00032 #include "MNPCList.h" 00033 #include "DummyList.h" 00034 #include "var_type.h" 00035 00036 namespace SH 00037 { 00038 00039 class PushPullSH; 00040 class PushPullSinkEndpoint; 00041 class PushPullSourceEndpoint; 00042 00047 /**********************************************************************/ 00048 /* PushPullSinkEndpoint */ 00049 /**********************************************************************/ 00050 00051 class PushPullSinkEndpoint 00052 : public SinkEndpoint 00053 { 00054 public: 00055 PushPullSinkEndpoint( PushPullSH* mySH ); 00056 virtual ~PushPullSinkEndpoint( ); 00057 00058 virtual SH_RC push( DataPtr item ); 00059 00060 PushPullSH* dsh(); 00061 }; 00062 00063 /**********************************************************************/ 00064 /* PushPullSourceEndpoint */ 00065 /**********************************************************************/ 00066 00067 class PushPullSourceEndpoint 00068 : public SourceEndpoint 00069 { 00070 public: 00071 PushPullSourceEndpoint( PushPullSH* mySH ); 00072 virtual ~PushPullSourceEndpoint( ); 00073 00074 virtual SH_RC pull( DataPtr& item, 00075 SourceUnit su = UnitDefault, 00076 size_t amount = 0 ); 00077 00078 PushPullSH* dsh(); 00079 }; 00080 00081 /**********************************************************************/ 00082 /* PushPullSH */ 00083 /**********************************************************************/ 00084 00085 class PushPullSH 00086 : public Base 00087 { 00088 // this stuff is used in case of PlainData 00089 MNPCList<DataPtr> _list; 00090 ProtectedBool _list_stop_indicator; 00091 00092 // this stuff is used in case of DummyData 00093 MNMutex _dummy_mx; 00094 DummyList _dummies; 00095 const char* _debugName; 00096 00097 public: 00098 SH_RC enqueue( DataPtr item ); 00099 SH_RC dequeue( DataPtr& item ); 00100 00101 public: 00102 PushPullSH( SHGraphManager* mgr, 00103 u_int32_t runtimeId, 00104 MNSelector& sel, 00105 const char *debugName="PushPullSH"); 00106 00107 00108 virtual ~PushPullSH(); 00109 00110 private: 00111 00113 PushPullSH( const PushPullSH& ); 00114 00116 PushPullSH& operator=( const PushPullSH& ); 00117 00118 public: 00121 virtual SH_RC initSH(); 00124 virtual SH_RC uninitSH(); 00125 00128 virtual SH_RC startStreaming(); 00131 virtual SH_RC stopStreaming(); 00132 00133 SA_PUSH_PULL_LOW_MARK _low_watermark; 00134 SA_PUSH_PULL_HIGH_MARK _high_watermark; 00135 int32_t _packet_count; 00136 bool _notify_low_watermark; 00137 SA_PUSH_PULL_NONEBLOCKING_POP _noneblockingPop; 00138 SA_PUSH_PULL_INITIAL_FILL _initial_fill_size; 00139 bool _initial_fill; 00140 size_t _empty_q_detected; 00141 SA_RTP_INT_PAYLOAD_TYPE _int_pt; 00142 SA_FILE_NAME _log_name; 00143 00144 // Attributes have been moved to SH.h 00145 00146 /******************************************************************/ 00147 /* functions required for SHStatus */ 00148 /******************************************************************/ 00149 protected: 00150 friend class PushPullSinkEndpoint; 00151 friend class PushPullSourceEndpoint; 00152 00153 virtual void pushReport( ReportPtr report, Direction d ); 00154 00155 SinkEndpoint* _in_ep_a[1]; 00156 SourceEndpoint* _out_ep_a[1]; 00157 PushPullSinkEndpoint _inEP; 00158 PushPullSourceEndpoint _outEP; 00159 00160 public: 00161 virtual SinkEndpoint** getSinkSpecs(); 00162 virtual SourceEndpoint** getSourceSpecs(); 00163 00177 virtual bool isConnected() const; 00178 00179 private: 00192 void private_low_watermark_check( ); 00193 00195 size_t _cnt; 00196 00200 ostream* _log_file; 00201 }; 00202 00204 00205 }; // namespace SH 00206 00207 #endif /* SH_PUSH_PULL_STREAM_HANDLER_H */ 00208

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