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

📄 data.h

📁 一个linux下的各种组播路由算法编程
💻 H
字号:
/*****************************************************************************
***                       Date: September 9, 1994                          ***
***                            File: data.h                                ***
*** Defining a data packet for the purpose of simulating computer networks ***
*****************************************************************************/
#ifndef DATA_H
#define DATA_H

#include <stdio.h>

#define Nonsense     2

class Data {   // A data packet

   private: 
	double	t;	        // arrival time 
	int	addr;	        // destination(s) address
        int     tp;             // type of traffic = 0 for background traffic
                                //                 = 1 for multicast or unicast
                                //                     traffic
                                //                 = 2 for nonsense, e.g. if a
                                //                     queue is empty 
        int      pr;            // priority of the traffic 
        unsigned long sn;       //  sequence number of the packet 
        void     *srce;         // points to the source node of the packet
	int      jStop;         // to prevent jitter calculation if the cell
	                        // is the 1st cell after a traffic source 
			        // leaves the idle mode
 
   public:
        Data(unsigned long n = 0, int tpe = 0, int p = 0, double tt = 0, 
             int a = 0, void *s = NULL, int js = 0) 
                      { tp = tpe; pr =p; t =tt; addr = a; srce = s; 
			sn = n; jStop = js; };
        double time() { return(t); };
        void   time(double tt) { t = tt; };
        int    address() { return(addr); };
        void   address(int a) { addr = a; };
        int    type() { return(tp); };
        void   type(int tt) { tp = tt; };
        void   *source() { return(srce); };
        void   source(void *s) { srce = s; };
        void   priority(int p) { pr = p; };
        int    priority() { return(pr); };
        unsigned long seqNum() { return(sn); };
        void seqNum(unsigned long n) { sn = n; };
	void stopJitter(int js) { jStop = js; };
	int stopJitter() { return(jStop); };
}; //Data

class DataList {   // An element of a linked list of data packets

   private:
      Data *d;       //pointer to a data packet
      DataList *n;   //pointer to the next list entry

   public:
      DataList() { d = new Data; };
      ~DataList() { delete d; };
      Data *data() { 
          if (d == NULL) printf("NULL\n");
          return(d);           
      };
      void data(Data dd) { (*d) = dd; };
      DataList *next() { return(n); };
      void next(DataList *nn) { n =nn; };

}; //DataList

#endif

⌨️ 快捷键说明

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