Alex Bikfalvi
SimStream Documentation
Peer.cpp
00001 #include "Headers.h" 00002 #include "Peer.h" 00003 00004 CPeer::CPeer() 00005 { 00006 this->session = 0; 00007 } 00008 00009 CPeer::~CPeer() 00010 { 00011 } 00012 00013 __uint32 CPeer::SetChannel(__uint32 channel, __time timestamp, __time duration) 00014 { 00015 // Save the session 00016 this->channel = channel; 00017 this->timeStart = timestamp; 00018 this->timeFinish = timestamp + duration; 00019 00020 // Return the session number 00021 return ++this->session; 00022 } 00023 00024 void CPeer::SetParent(__uint32 channel, __uint32 layer, CPeer* parent) 00025 { 00026 assert(channel == this->channel); 00027 this->parents[layer] = parent; 00028 } 00029 00030 bool CPeer::VerifyParent(__uint32 channel, __uint32 layer, CPeer* parent) 00031 { 00032 // Check that the argument can be a parent for the current peer (the current peer is not an ascendent of the the argument) 00033 assert(channel == this->channel); 00034 00035 for(CPeer* peer = parent; peer; peer = peer->Parent(channel, layer)) 00036 if(peer == this) return false; 00037 return true; 00038 } 00039
Last updated: February 8, 2011