00001 00029 #ifndef PACKET_CHANNEL_H 00030 #define PACKET_CHANNEL_H 00031 00032 #include <itpp/protocol/packet.h> 00033 #include <itpp/base/vec.h> 00034 00035 00036 namespace itpp 00037 { 00038 00040 00041 00043 class Packet_Channel 00044 { 00045 public: 00047 Packet_Channel(); 00049 Packet_Channel(const double Pr, const Ttype Delay, const double Block_rate, const int Max_slots = 0); 00050 00052 ~Packet_Channel(); 00053 00054 // -- Slots -- // 00056 Slot<Packet_Channel, bool> start; 00058 Slot<Packet_Channel, Link_Packet*> input; 00060 Slot<Packet_Channel, int> nof_inputs; 00061 00062 // -- Signals -- // 00064 Signal<Link_Packet*> output; 00066 Signal<int> input_request; 00068 Signal<void*> get_nof_inputs; 00069 00071 void set_parameters(const double Pr, const Ttype Delay, const double Block_rate, const int Max_slots); 00072 00074 void set_errors(const ivec &Lost); 00075 00076 private: 00077 void block_rate_loop(); 00078 void handle_input(Link_Packet* M); 00079 void handle_start(const bool start); 00080 void handle_nof_inputs(const int N); 00081 00082 bool keep_running; 00083 bool parameters_ok; 00084 bool explicit_errors; 00085 bool lose; 00086 double pr; 00087 Ttype delay; 00088 double block_time; 00089 int max_slots; 00090 ivec lost; 00091 int k, K, L; 00092 }; 00093 00094 00096 class ACK_Channel 00097 { 00098 public: 00100 ACK_Channel(); 00101 00103 ACK_Channel(const double Pr, const Ttype Delay); 00104 00106 ~ACK_Channel(); 00107 00108 // -- Slots -- // 00110 Slot<ACK_Channel, ACK*> input; 00111 00112 // -- Signals -- // 00114 Signal<ACK*> output; 00115 00117 void set_parameters(const double Pr, const Ttype Delay); 00119 void set_errors(const ivec& Lost); 00120 00121 private: 00122 void handle_input(ACK* M); 00123 00124 bool parameters_ok; 00125 bool explicit_errors; 00126 bool lose; 00127 double pr; 00128 Ttype delay; 00129 ivec lost; 00130 int k, K, L; 00131 }; 00132 00134 00135 } // namespace itpp 00136 00137 #endif // #ifndef PACKET_CHANNEL_H 00138
Generated on Wed Jul 27 2011 16:27:05 for IT++ by Doxygen 1.7.4