39 next.
forward(
this, &Packet_Generator::handle_next);
48 it_assert(Packet_size > 0,
"Packet_Generator::set_parameters(): ");
49 packet_size = Packet_size;
50 max_packets = Max_packets;
64 void Packet_Generator::handle_next(
Packet*)
69 if (max_packets &&
id >= max_packets)
74 void Packet_Generator::handle_start(
const bool run)
76 if (run && !keep_running) {
87 const int Packet_size,
88 const unsigned long int Max_packets):
Packet_Generator(Packet_size, Max_packets)
96 const int Packet_size,
97 const unsigned long int Max_packets)
100 it_assert(Avg_bit_rate > 0.0,
"Packet_Generator::set_parameters(): ");
137 Tr =
Navg * Packet_size * 8.0 / Avg_bit_rate -
Ti * (
Navg - 1);
164 it_assert(Max_packets > 0,
"Sink::Sink(): ");
165 max_packets = Max_packets;
175 std::cout <<
"Received " << Ncp <<
" packets in sequence." << std::endl;
176 std::cout <<
"Receive average bit rate = " << Nbytes*8.0 / (
Event_Queue::now() - start_time) <<
" [bits/second]." << std::endl;
180 void Sink::handle_packet_input(
Packet *P)
182 it_assert(P != NULL,
"Sink::handle_packet_input(): ");
186 if (Ncp >= max_packets) {
188 std::cout <<
"Simulation stopped because : Ncp > max_packets" << std::endl;