Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

devPkt.h

Go to the documentation of this file.
00001 #include "dedevice.h"
00002 #include "probeband.h"
00003 #include "probemean.h"
00004 #include "probehistogram.h"
00005 
00006 #ifndef __DEV_PKT_H__
00007 #define __DEV_PKT_H__
00008 
00009 #define DBG_EV_WIDTH 21
00010 
00011 
00018 class SysSAloha;
00019 
00021 // Data Terminal
00022 
00023 class DevAP;
00024 class DevPktGen;
00025 
00027 
00031 class DevPkt : public DEDevice
00032 {
00033 protected:
00034   
00036   int ID;
00037 
00039   DevAP *theAP;
00040   
00042   DevPktGen *thePktGen;
00043   
00045   double meanWaitingSlots;
00046   
00048   DETime generationTime;
00049 
00051   int attempt_counter;
00052   
00054   ProbeHistogram *theTxTimeProbeHist;
00055 
00057   ProbeHistogram *theTxAttemptsProbeHist;
00058   
00059 public:
00060 
00062   static void setup(ParamManager *Param, GlobalProbeManager *Results);
00063   
00065   void Initialize();
00066   
00068   DevPkt(DESystem *_System, 
00069         DevPktGen* _thePktGen,
00070         DevAP *_theAP,
00071         int _ID
00072         );
00073 
00075   virtual const char *Type() const
00076   {
00077     return "DevPkt";
00078   };
00079 
00081   void HEv_Pkt_Feedback(int type);
00082 };
00083 
00084 
00085 // *****************************************************************************
00086 // **  Events
00087 
00089 
00092 class Ev_Pkt_Feedback : public DEEvent
00093 {
00094 protected:
00095   DevPkt* sender;
00096   int type;
00097   
00098 public:
00099     Ev_Pkt_Feedback(DevPkt* _sender, int _type)
00100     : DEEvent(), sender(_sender), type(_type)
00101   {};
00102   
00103   virtual const char *Type() const
00104   {
00105     return "Ev_Pkt_Feedback";
00106   };
00107   
00108   void Handler() { sender->HEv_Pkt_Feedback(type); };
00109   
00110   virtual void print(ostream &os) const
00111   {
00112     os << Time << ": " << setw(DBG_EV_WIDTH) << Type() << " to: " << *sender << ((type==0)?" ACK":" NACK");
00113   };
00114 };
00115 
00116 
00117 #endif

Generated on Wed Dec 22 23:26:43 2004 for NePSing Slotted Aloha example by doxygen 1.3.9.1 ---- Hosted by SourceForge.net Logo