Alex Bikfalvi
SimStream Documentation
Link.h
00001 #pragma once 00002 00003 #include "Object.h" 00004 #include "Codes.h" 00005 #include "LinkQueue.h" 00006 00007 class CLink : public CObject 00008 { 00009 protected: 00010 __uint32 id; 00011 CObject* nodes[2]; 00012 __uint32 nodeEntries[2]; 00013 CLinkQueue* queues[2][2]; 00014 __uint32 currentNode; 00015 00016 __bitrate bandwidth[2]; 00017 __time delay[2]; 00018 00019 double statUtil[2][2]; 00020 __uint64 statPackets[2][2]; 00021 __uint64 statDiscard[2][2]; 00022 __uint64 statBits[2][2]; 00023 double statQueue[2][2]; 00024 __time statQueueLast[2][2]; 00025 00026 __time meterTime[2]; 00027 __bitrate meterUtil[2]; 00028 00029 static double meterSmoothFactor; 00030 00031 public: 00032 CLink( 00033 __uint32 id, 00034 CSimHandler* sim, 00035 __uint32 queue, 00036 __bitrate bandwidth0, 00037 __bitrate bandwidth1, 00038 __time delay0, 00039 __time delay1 00040 ); 00041 virtual ~CLink(); 00042 00043 inline __uint32 Id() { return this->id; } 00044 inline __bitrate Bandwidth(__byte entry) { return this->bandwidth[entry]; } 00045 00046 __uint32 AddNode(CObject* node, __uint32 entry); 00047 inline CObject* Node(__uint32 index) { assert(index < 2); return this->nodes[index]; } 00048 inline __uint32 NodeEntry(__uint32 index) { assert(index < 2); return this->nodeEntries[index]; } 00049 00050 virtual ENetworkCode Recv(CObject* sender, __uint32 entry, CPacket* packet); 00051 void Delay(__uint32 entry, CPacket* packet); 00052 void Send(__uint32 entry, CPacket* packet); 00053 00054 virtual void Finalize(); 00055 00056 inline CLinkQueue* Queue(__uint8 tos, __uint8 entry) { return this->queues[tos][entry]; } 00057 00058 __bitrate MeterUtil(__uint8 entry); 00059 __uint32 MeterQueue(__uint8 tos, __uint8 entry) { return this->queues[tos][entry]->Packets(); } 00060 00061 inline double StatUtilization(__byte tos, __byte entry) { return this->statUtil[tos][entry]; } 00062 inline __uint64 StatPackets(__byte tos, __byte entry) { return this->statPackets[tos][entry]; } 00063 inline __uint64 StatBits(__byte tos, __byte entry) { return this->statBits[tos][entry]; } 00064 inline __uint64 StatDiscard(__byte tos, __byte entry) { return this->statDiscard[tos][entry]; } 00065 inline double StatQueue(__byte tos, __byte entry) { return this->statQueue[tos][entry]; } 00066 };
Last updated: February 8, 2011