⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hgpsrequesttable.cc

📁 在Linux下做的QuadTree的程序
💻 CC
字号:
/* requesttable.h   implement a table to keep track of the most current request   number we've heard from a node in terms of that node's id   Modified slightly from dmaltz' implementation of DSR   $Id: hgpsrequesttable.cc,v 1.1.1.1 2000/08/28 18:40:22 jinyang Exp $*/#include "hgpsrequesttable.h"HGPSRequestTable::HGPSRequestTable(int s): size(s){  table = new HGPSEntry[size];  size = size;  ptr = 0;}HGPSRequestTable::~HGPSRequestTable(){  delete[] table;}intHGPSRequestTable::find(nsaddr_t net_id) {  for (int c = 0 ; c < size ; c++)    if (table[c].id == net_id)      return c;  return size;}intHGPSRequestTable::get(nsaddr_t id) {  int existing_entry = find(id);  if (existing_entry >= size)        {      return 0;    }  return table[existing_entry].req_num;}HGPSEntry*HGPSRequestTable::getHGPSEntry(nsaddr_t id){  int existing_entry = find(id);  if (existing_entry >= size)        {      table[ptr].id = id;      table[ptr].req_num = 0;      table[ptr].rt_reqs_outstanding = 0;      table[ptr].last_rt_req = -(RT_RQ_PERIOD + 1.0);      existing_entry = ptr;      ptr = (ptr+1)%size;    }  return &(table[existing_entry]);}voidHGPSRequestTable::insert(nsaddr_t net_id, int req_num){  int existing_entry = find(net_id);  if (existing_entry < size)    {      table[existing_entry].req_num = req_num;      return;    }  // otherwise add it in  table[ptr].id = net_id;  table[ptr].req_num = req_num;  table[ptr].rt_reqs_outstanding = 0;  table[ptr].last_rt_req = -(RT_RQ_PERIOD + 1.0);  ptr = (ptr+1)%size;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -