IT++ Logo

packet_channel.h

Go to the documentation of this file.
00001 
00030 #ifndef PACKET_CHANNEL_H
00031 #define PACKET_CHANNEL_H
00032 
00033 #include <itpp/protocol/packet.h>
00034 #include <itpp/base/vec.h>
00035 
00036 
00037 namespace itpp
00038 {
00039 
00041 
00042 
00044 class Packet_Channel
00045 {
00046 public:
00048   Packet_Channel();
00050   Packet_Channel(const double Pr, const Ttype Delay, const double Block_rate, const int Max_slots = 0);
00051 
00053   ~Packet_Channel();
00054 
00055   // -- Slots -- //
00057   Slot<Packet_Channel, bool> start;
00059   Slot<Packet_Channel, Link_Packet*> input;
00061   Slot<Packet_Channel, int> nof_inputs;
00062 
00063   // -- Signals -- //
00065   Signal<Link_Packet*> output;
00067   Signal<int> input_request;
00069   Signal<void*> get_nof_inputs;
00070 
00072   void set_parameters(const double Pr, const Ttype Delay, const double Block_rate, const int Max_slots);
00073 
00075   void set_errors(const ivec &Lost);
00076 
00077 private:
00078   void block_rate_loop();
00079   void handle_input(Link_Packet* M);
00080   void handle_start(const bool start);
00081   void handle_nof_inputs(const int N);
00082 
00083   bool keep_running;
00084   bool parameters_ok;
00085   bool explicit_errors;
00086   bool lose;
00087   double pr;
00088   Ttype delay;
00089   double block_time;
00090   int max_slots;
00091   ivec lost;
00092   int k, K, L;
00093 };
00094 
00095 
00097 class ACK_Channel
00098 {
00099 public:
00101   ACK_Channel();
00102 
00104   ACK_Channel(const double Pr, const Ttype Delay);
00105 
00107   ~ACK_Channel();
00108 
00109   // -- Slots -- //
00111   Slot<ACK_Channel, ACK*> input;
00112 
00113   // -- Signals -- //
00115   Signal<ACK*> output;
00116 
00118   void set_parameters(const double Pr, const Ttype Delay);
00120   void set_errors(const ivec& Lost);
00121 
00122 private:
00123   void handle_input(ACK* M);
00124 
00125   bool parameters_ok;
00126   bool explicit_errors;
00127   bool lose;
00128   double pr;
00129   Ttype delay;
00130   ivec lost;
00131   int k, K, L;
00132 };
00133 
00135 
00136 } // namespace itpp
00137 
00138 #endif // #ifndef PACKET_CHANNEL_H
00139 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
SourceForge Logo

Generated on Wed Feb 9 2011 13:47:24 for IT++ by Doxygen 1.7.3