Alex Bikfalvi
SimStream Documentation
StreamPullSender.h
00001 #pragma once 00002 00003 #include "ConnectionTag.h" 00004 #include "ConnectionReceiver.h" 00005 #include "StreamMessagePullBitmapResponse.h" 00006 00007 class CStreamPullSender : public CConnectionTag 00008 { 00009 public: 00010 typedef map<CAddress, CStreamPullSender*> TSenderList; 00011 00012 enum EType 00013 { 00014 CONNECTING_SENDER = 0, 00015 SENDER = 1 00016 }; 00017 00018 class CBitmapResponse 00019 { 00020 private: 00021 __uint32 first; 00022 __uint8 count; 00023 __uint64 bitmap; 00024 __bitrate bw; 00025 CStreamMessagePullBitmapResponse::EPreference pref; 00026 00027 public: 00028 CBitmapResponse() { this->first = 0; this->count = 0; this->bitmap = 0; this->bw = 0; } 00029 CBitmapResponse(__uint32 first, __uint8 count, __uint64 bitmap, __bitrate bw, CStreamMessagePullBitmapResponse::EPreference pref) 00030 { this->first = first; this->count = count; this->bitmap = bitmap; this->bw = bw; this->pref = pref; } 00031 ~CBitmapResponse() { } 00032 00033 inline __uint32 First() { return this->first; } 00034 inline __uint8 Count() { return this->count; } 00035 inline __uint64 Bitmap() { return this->bitmap; } 00036 inline __bitrate Bw() { return this->bw; } 00037 inline CStreamMessagePullBitmapResponse::EPreference Preference() { return this->pref; } 00038 00039 inline void Clear() 00040 { this->first = 0; this->count = 0; this->bitmap = 0; this->bw = 0; } 00041 }; 00042 00043 class CSegmentResponse 00044 { 00045 private: 00046 __uint32 first; 00047 __uint8 count; 00048 __uint64 success; 00049 __uint64 fail; 00050 00051 public: 00052 CSegmentResponse() { this->first = 0; this->count = 0; this->success = 0; this->fail = 0; } 00053 CSegmentResponse(__uint32 first, __uint8 count, __uint64 success, __uint64 fail) { this->first = first; this->count = count; this->success = success; this->fail = fail; } 00054 ~CSegmentResponse() { } 00055 00056 inline __uint32 First() { return this->first; } 00057 inline __uint8 Count() { return this->count; } 00058 inline __uint64 Success() { return this->success; } 00059 inline __uint64 Fail() { return this->fail; } 00060 00061 inline void Clear() { this->first = 0; this->count = 0; this->success = 0; this->fail = fail; } 00062 }; 00063 00064 private: 00065 CAddress address; 00066 CConnectionReceiver* connection; 00067 EType type; 00068 CBitmapResponse bitmapResponse; 00069 CSegmentResponse segmentResponse; 00070 TSenderList* list; 00071 00072 public: 00073 CStreamPullSender(CAddress address, CConnectionReceiver* connection, TSenderList* list); 00074 virtual ~CStreamPullSender(); 00075 00076 inline CAddress Address() { return this->address; } 00077 inline CConnectionReceiver* Connection() { return this->connection; } 00078 inline EType Type() { return this->type; } 00079 inline void Type(EType type) { this->type = type; } 00080 inline CBitmapResponse LastBitmapResponse() { return this->bitmapResponse; } 00081 inline void SetBitmapResponse(CBitmapResponse bitmapResponse) { this->bitmapResponse = bitmapResponse; } 00082 inline CSegmentResponse LastSegmentResponse() { return this->segmentResponse; } 00083 inline void SetSegmentResponse(CSegmentResponse segmentResponse) { this->segmentResponse = segmentResponse; } 00084 00085 void List(TSenderList* list); 00086 inline TSenderList* List() { return this->list; } 00087 };
Last updated: February 8, 2011