Alex Bikfalvi
SimStream Documentation
Peer.h
00001 #pragma once 00002 00003 #include "Codes.h" 00004 #include "Address.h" 00005 00006 class CPeer 00007 { 00008 private: 00009 CAddress address; 00010 __uint32 channel; 00011 __uint32 session; 00012 __time timeStart; 00013 __time timeFinish; 00014 CPeer* parents[MAX_LAYERS]; 00015 00016 public: 00017 CPeer(); 00018 virtual ~CPeer(); 00019 00020 void SetAddress(CAddress address) { this->address = address; } 00021 __uint32 SetChannel(__uint32 channel, __time timestamp, __time duration); 00022 void SetParent(__uint32 channel, __uint32 layer, CPeer* parent); 00023 bool VerifyParent(__uint32 channel, __uint32 layer, CPeer* parent); 00024 00025 inline CAddress Address() { return this->address; } 00026 inline CPeer* Parent(__uint32 channel, __uint32 layer) { assert(channel == this->channel); return this->parents[layer]; } 00027 inline __time Elapsed(__time time, __uint32 channel) { return time - this->timeStart; } 00028 inline __time Remaining(__time time, __uint32 channel) { return this->timeFinish - time; } 00029 00030 inline __uint32 Channel() { return this->channel; } 00031 inline __uint32 Session() { return this->session; } 00032 }; 00033
Last updated: February 8, 2011