Alex Bikfalvi
SimStream Documentation
StreamBootPush.cpp
00001 #include "Headers.h" 00002 #include "StreamBootPush.h" 00003 00004 void CStreamBootPush::Register(CAddress host, CAddress source) 00005 { 00006 this->hosts.insert(pair<CAddress, CStreamBootEntry>(host, CStreamBootEntry(source))); 00007 } 00008 00009 void CStreamBootPush::Deregister(CAddress host) 00010 { 00011 this->hosts.erase(host); 00012 } 00013 00014 bool CStreamBootPush::IsDependent(CAddress host, CAddress parent) 00015 { 00016 // For all ancestors from the parent to the root 00017 for(CAddress ancestor = parent; ancestor != this->root;) 00018 { 00019 // If the host is an ancestor of the parent, return true 00020 if(ancestor == host) return true; 00021 00022 // Else, get the entry of the ancestor 00023 List::iterator entry = this->hosts.find(ancestor); 00024 00025 // If there is not entry for the ancestor (the ancestor is orphan), return true 00026 if(this->hosts.end() == entry) return true; 00027 00028 // Else, move the the source of the ancestor 00029 ancestor = entry->second.Source(); 00030 } 00031 return false; 00032 }
Last updated: February 8, 2011