Alex Bikfalvi
SimStream Documentation
StreamPullSender.cpp
00001 #include "Headers.h" 00002 #include "StreamPullSender.h" 00003 00004 CStreamPullSender::CStreamPullSender(CAddress address, CConnectionReceiver* connection, TSenderList* list) 00005 { 00006 this->address = address; 00007 this->connection = connection; 00008 this->list = list; 00009 this->type = CONNECTING_SENDER; 00010 00011 // If a list is specified, add the sender to the list 00012 if(this->list) 00013 { 00014 assert(this->list->find(this->address) == this->list->end()); 00015 this->list->insert(pair<CAddress, CStreamPullSender*>(this->address, this)); 00016 } 00017 00018 // Add this as tag to the connection 00019 this->connection->Tag(this); 00020 } 00021 00022 CStreamPullSender::~CStreamPullSender() 00023 { 00024 // If a list is specified, remove the sender from the list 00025 if(this->list) 00026 { 00027 assert(this->list->find(this->address) != this->list->end()); 00028 this->list->erase(this->address); 00029 } 00030 00031 // Remove this as tag from the connection 00032 assert(this->connection->Tag() == this); 00033 this->connection->Tag(NULL); 00034 } 00035 00036 void CStreamPullSender::List(TSenderList* list) 00037 { 00038 // If there is an old list, remove the sender from the list 00039 if(this->list) 00040 { 00041 assert(this->list->find(this->address) != this->list->end()); 00042 this->list->erase(this->address); 00043 } 00044 00045 // Change the list 00046 this->list = list; 00047 00048 // If a list is specified, add the sender to the list 00049 if(this->list) 00050 { 00051 assert(this->list->find(this->address) == this->list->end()); 00052 this->list->insert(pair<CAddress, CStreamPullSender*>(this->address, this)); 00053 } 00054 }
Last updated: February 8, 2011