Alex Bikfalvi
SimStream Documentation
LinkQueue.h
00001 #pragma once 00002 00003 #include "Packet.h" 00004 00005 #define LINK_QUEUE_NEXT(ptr) ((ptr + 1) % this->size) 00006 00007 class CLinkQueue 00008 { 00009 protected: 00010 CPacket** queue; 00011 __time* time; 00012 __uint32 size; 00013 __uint32 ptr; 00014 __uint32 count; 00015 __bits usage; 00016 00017 public: 00018 CLinkQueue( 00019 __uint32 size 00020 ); 00021 ~CLinkQueue(); 00022 00023 inline bool IsEmpty() { return this->count == 0; } 00024 inline bool IsFull() { return this->count == this->size; } 00025 00026 inline CPacket* First() { return this->count?this->queue[this->ptr]:NULL; } 00027 inline CPacket* Last() { return this->count?this->queue[(this->ptr + this->count - 1) % this->size]:NULL; } 00028 00029 inline __uint32 Size() { return this->size; } 00030 inline __uint32 Packets() { return this->count; } 00031 inline __bits Usage() { return this->usage; } 00032 00033 inline __time TimeFirst() { return this->time[this->ptr]; } 00034 00035 void Add(__time time, CPacket* packet); 00036 void Remove(); 00037 };
Last updated: February 8, 2011