Jack.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
17 #ifndef HH_SENF_PPI_Jack_
18 #define HH_SENF_PPI_Jack_ 1
19 
20 // Custom includes
21 #include <boost/noncopyable.hpp>
22 #include <boost/type_traits/is_base_of.hpp>
23 #include "Connectors.hh"
24 #include "Setup.hh"
25 
26 //#include "Jack.mpp"
27 //-/////////////////////////////////////////////////////////////////////////////////////////////////
28 
29 namespace senf {
30 namespace ppi {
31 namespace connector {
32 
35  class Jack
36  : private boost::noncopyable,
38  {};
39 
43  : public Jack
44  {
45  public:
47 
48  GenericActiveInput & connector();
49  GenericActiveInput * operator->();
50 
51  void reset(GenericActiveInput & input);
52 
54  private:
55  GenericActiveInput * input_;
56  };
57 
61  : public Jack
62  {
63  public:
65 
66  GenericActiveOutput & connector();
67  GenericActiveOutput * operator->();
68 
69  void reset(GenericActiveOutput & output);
70 
72  private:
73  GenericActiveOutput * output_;
74  };
75 
79  : public Jack
80  {
81  public:
83 
84  GenericPassiveInput & connector();
85  GenericPassiveInput * operator->();
86 
87  void reset(GenericPassiveInput & input);
88 
90  private:
91  GenericPassiveInput * input_;
92  };
93 
97  : public Jack
98  {
99  public:
101 
102  GenericPassiveOutput & connector();
103  GenericPassiveOutput * operator->();
104 
105  void reset(GenericPassiveOutput & output);
106 
108  private:
109  GenericPassiveOutput * output_;
110  };
111 
114  template <class PacketType=Packet>
116  : public GenericActiveInputJack
117  {
118  public:
119  explicit ActiveInputJack(ActiveInput<PacketType> & input);
120  explicit ActiveInputJack(ActiveInput<> & input);
121 
122  explicit ActiveInputJack(ActiveInputJack & input);
123  explicit ActiveInputJack(ActiveInputJack<> & input);
124 
125  void reset(ActiveInput<PacketType> & input);
126  void reset(ActiveInput<> & input);
127 
128  void reset(ActiveInputJack & input);
129  void reset(ActiveInputJack<> & input);
130  };
131 
132 #ifndef DOXYGEN
133 
134  template <>
135  class ActiveInputJack<Packet>
136  : public GenericActiveInputJack
137  {
138  public:
139  explicit ActiveInputJack(GenericActiveInput & input);
140  explicit ActiveInputJack(GenericActiveInputJack input);
141 
142  void reset(GenericActiveInput & input);
143  void reset(GenericActiveInputJack input);
144  };
145 
146 #endif
147 
150  template <class PacketType=Packet>
152  : public GenericActiveOutputJack
153  {
154  public:
155  explicit ActiveOutputJack(ActiveOutput<PacketType> & output);
156  explicit ActiveOutputJack(ActiveOutput<> & output);
157 
158  explicit ActiveOutputJack(ActiveOutputJack & output);
159  explicit ActiveOutputJack(ActiveOutputJack<> & output);
160 
161  void reset(ActiveOutput<PacketType> & output);
162  void reset(ActiveOutput<> & output);
163 
164  void reset(ActiveOutputJack & output);
165  void reset(ActiveOutputJack<> & output);
166  };
167 
168 #ifndef DOXYGEN
169 
170  template <>
171  class ActiveOutputJack<Packet>
172  : public GenericActiveOutputJack
173  {
174  public:
175  explicit ActiveOutputJack(GenericActiveOutput & output);
176  explicit ActiveOutputJack(GenericActiveOutputJack & output);
177 
178  void reset(GenericActiveOutput & output);
179  void reset(GenericActiveOutputJack & output);
180  };
181 
182 #endif
183 
186  template <class PacketType=Packet>
188  : public GenericPassiveInputJack
189  {
190  public:
191  explicit PassiveInputJack(PassiveInput<PacketType> & input);
192  explicit PassiveInputJack(PassiveInput<> & input);
193 
194  explicit PassiveInputJack(PassiveInputJack & input);
195  explicit PassiveInputJack(PassiveInputJack<> & input);
196 
197  void reset(PassiveInput<PacketType> & input);
198  void reset(PassiveInput<> & input);
199 
200  void reset(PassiveInputJack & input);
201  void reset(PassiveInputJack<> & input);
202  };
203 
204 #ifndef DOXYGEN
205 
206  template <>
207  class PassiveInputJack<Packet>
208  : public GenericPassiveInputJack
209  {
210  public:
211  explicit PassiveInputJack(GenericPassiveInput & input);
212  explicit PassiveInputJack(GenericPassiveInputJack & input);
213 
214  void reset(GenericPassiveInput & input);
215  void reset(GenericPassiveInputJack & input);
216  };
217 
218 #endif
219 
222  template <class PacketType=Packet>
224  : public GenericPassiveOutputJack
225  {
226  public:
227  explicit PassiveOutputJack(PassiveOutput<PacketType> & output);
228  explicit PassiveOutputJack(PassiveOutput<> & output);
229 
230  explicit PassiveOutputJack(PassiveOutputJack & output);
231  explicit PassiveOutputJack(PassiveOutputJack<> & output);
232 
233  void reset(PassiveOutput<PacketType> & output);
234  void reset(PassiveOutput<> & output);
235 
236  void reset(PassiveOutputJack & output);
237  void reset(PassiveOutputJack<> & output);
238  };
239 
240 #ifndef DOXYGEN
241 
242  template <>
243  class PassiveOutputJack<Packet>
244  : public GenericPassiveOutputJack
245  {
246  public:
247  explicit PassiveOutputJack(GenericPassiveOutput & output);
248  explicit PassiveOutputJack(GenericPassiveOutputJack & output);
249 
250  void reset(GenericPassiveOutput & output);
251  void reset(GenericPassiveOutputJack & output);
252  };
253 
254 #endif
255 }
256 
257 #ifndef DOXYGEN
258 
259  template <class T>
260  void connect(connector::GenericActiveOutputJack & source, T & target,
261  typename boost::disable_if< boost::is_base_of<connector::Jack, T> >::type * = 0);
262  template <class T>
263  void connect(connector::GenericPassiveOutputJack & source, T & target,
264  typename boost::disable_if< boost::is_base_of<connector::Jack, T> >::type * = 0);
265 
266  template <class T>
267  void connect(T & source, connector::GenericActiveInputJack & target,
268  typename boost::disable_if< boost::is_base_of<connector::Jack, T> >::type * = 0);
269  template <class T>
270  void connect(T & source, connector::GenericPassiveInputJack & target,
271  typename boost::disable_if< boost::is_base_of<connector::Jack, T> >::type * = 0);
272 
277 
282 
287 
288 #endif
289 }}
290 
291 //-/////////////////////////////////////////////////////////////////////////////////////////////////
292 #include "Jack.cci"
293 //#include "Jack.ct"
294 #include "Jack.cti"
295 #endif
296 
297 
298 // Local Variables:
299 // mode: c++
300 // fill-column: 100
301 // comment-column: 40
302 // c-file-style: "senf"
303 // indent-tabs-mode: nil
304 // ispell-local-dictionary: "american"
305 // compile-command: "scons -u test"
306 // End:
Connector actively sending packets.
Definition: Connectors.hh:677
Jack referencing a PassiveOutput.
Definition: Jack.hh:96
Jack referencing an ActiveInput.
Definition: Jack.hh:42
Connector Jack base class.
Definition: Jack.hh:35
Jack referencing an ActiveOutput.
Definition: Jack.hh:60
Connectors public header.
u8 type
Combination of PassiveConnector and OutputConnector.
Definition: Connectors.hh:513
Combination of ActiveConnector and InputConnector.
Definition: Connectors.hh:538
Connector actively reading packets.
Definition: Connectors.hh:632
Jack with packet type referencing an ActiveOutput.
Definition: Jack.hh:151
Combination of ActiveConnector and OutputConnector.
Definition: Connectors.hh:563
Jack with packet type referencing a PassiveOutput.
Definition: Jack.hh:223
void connect(connector::FastActiveOutput< PacketType > &source, connector::FastPassiveInput< PacketType > &target)
Jack with packet type referencing an ActiveInput.
Definition: Jack.hh:115
Jack with packet type referencing a PassiveInput.
Definition: Jack.hh:187
Setup public header.
Jack referencing a PassiveInput.
Definition: Jack.hh:78
Connector passively providing packets.
Definition: Connectors.hh:697
Combination of PassiveConnector and InputConnector.
Definition: Connectors.hh:478
Connector passively receiving packets.
Definition: Connectors.hh:655