FastConnector.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_FastConnector_
18 #define HH_SENF_PPI_FastConnector_ 1
19 
20 // Custom includes
21 #include <boost/noncopyable.hpp>
22 #include <senf/Packets/Packets.hh>
23 #include <senf/Utils/FastDelegate/FastDelegate.h>
24 #include "Connectors.hh"
25 
26 //#include "FastConnector.mpp"
28 
29 
30 namespace senf {
31 namespace ppi {
32 namespace connector {
33 
34  template <class PacketType=Packet> class FastPassiveInput;
35  template <class PacketType=Packet> class FastActiveOutput;
36 
37 }}}
38 
39 namespace senf {
40 namespace ppi {
41 
42  template <class PacketType>
45 
46 }}
47 
48 namespace senf {
49 namespace ppi {
50 namespace connector {
51 
52  class FastConnector : public Connector {};
53 
73  //\{
75 
78  template <class PacketType>
79  class FastPassiveInput : public FastConnector
80  {
81  public:
85 
87  virtual ~FastPassiveInput();
88 
90 
91  FastActiveOutput<PacketType> & peer() const;
92 
93  template <class Handler>
94  void onRequest(Handler handler);
95 
96  PacketType const & operator()() const;
97 
98  protected:
99 
100  private:
101  virtual void v_init();
102 
103  fastdelegate::FastDelegate<void ()> cb_;
104  PacketType const * packet_;
105 
106  friend class FastActiveOutput<PacketType>;
107  };
108 
111  template <class PacketType>
112  class FastActiveOutput : public FastConnector
113  {
114  public:
118 
120  virtual ~FastActiveOutput();
121 
123 
124  FastPassiveInput<PacketType> & peer() const;
125 
126  template <class Handler>
127  void onRequest(Handler handler);
128 
129  void operator()(PacketType const & packet) const;
130 
131  protected:
132 
133  private:
134  virtual void v_init();
135 
136  template <class PT>
139  };
140 
142 
143 }}}
144 
146 //#include "FastConnector.cci"
147 //#include "FastConnector.ct"
148 #include "FastConnector.cti"
149 #endif
150 
151 
152 // Local Variables:
153 // mode: c++
154 // fill-column: 100
155 // comment-column: 40
156 // c-file-style: "senf"
157 // indent-tabs-mode: nil
158 // ispell-local-dictionary: "american"
159 // compile-command: "scons -u test"
160 // End:
Connectors public header.
Fast passive input connector.
void connect(connector::FastActiveOutput< PacketType > &source, connector::FastPassiveInput< PacketType > &target)
Connector base-class.
Definition: Connectors.hh:156
Fast active output connector.