Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
itpp
protocol
packet_channel.h
Go to the documentation of this file.
1
29
#ifndef PACKET_CHANNEL_H
30
#define PACKET_CHANNEL_H
31
32
#include <
itpp/base/vec.h
>
33
34
#if (defined(_MSC_VER) && defined(ITPP_SHARED_LIB) && !(defined(itpp_EXPORTS) || defined(itpp_debug_EXPORTS)))
35
36
#ifndef ITPP_PROTOCOL_EXCLUDED
37
#define ITPP_PROTOCOL_EXCLUDED
38
#pragma message( "PROTOCOL definitions are not available for MSVC shared builds" )
39
#endif
40
41
#else
42
43
#include <
itpp/protocol/packet.h
>
44
45
namespace
itpp
46
{
47
49
50
52
class
Packet_Channel
53
{
54
public
:
56
Packet_Channel
();
58
Packet_Channel
(
const
double
Pr,
const
Ttype
Delay,
const
double
Block_rate,
const
int
Max_slots = 0);
59
61
~Packet_Channel
();
62
63
// -- Slots -- //
65
Slot<Packet_Channel, bool>
start
;
67
Slot<Packet_Channel, Link_Packet*>
input
;
69
Slot<Packet_Channel, int>
nof_inputs
;
70
71
// -- Signals -- //
73
Signal<Link_Packet*>
output
;
75
Signal<int>
input_request
;
77
Signal<void*>
get_nof_inputs
;
78
80
void
set_parameters
(
const
double
Pr,
const
Ttype
Delay,
const
double
Block_rate,
const
int
Max_slots);
81
83
void
set_errors
(
const
ivec &Lost);
84
85
private
:
86
void
block_rate_loop();
87
void
handle_input(
Link_Packet
* M);
88
void
handle_start(
const
bool
start
);
89
void
handle_nof_inputs(
const
int
N);
90
91
bool
keep_running;
92
bool
parameters_ok;
93
bool
explicit_errors;
94
bool
lose;
95
double
pr;
96
Ttype
delay;
97
double
block_time;
98
int
max_slots;
99
ivec lost;
100
int
k, K, L;
101
};
102
103
105
class
ACK_Channel
106
{
107
public
:
109
ACK_Channel
();
110
112
ACK_Channel
(
const
double
Pr,
const
Ttype
Delay);
113
115
~ACK_Channel
();
116
117
// -- Slots -- //
119
Slot<ACK_Channel, ACK*>
input
;
120
121
// -- Signals -- //
123
Signal<ACK*>
output
;
124
126
void
set_parameters
(
const
double
Pr,
const
Ttype
Delay);
128
void
set_errors
(
const
ivec& Lost);
129
130
private
:
131
void
handle_input(
ACK
* M);
132
133
bool
parameters_ok;
134
bool
explicit_errors;
135
bool
lose;
136
double
pr;
137
Ttype
delay;
138
ivec lost;
139
int
k, K, L;
140
};
141
143
144
}
// namespace itpp
145
146
#endif
147
148
#endif // #ifndef PACKET_CHANNEL_H
149
Generated on Sat Jul 6 2013 10:54:24 for IT++ by
Doxygen
1.8.2