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
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
15 \brief FastConnector inline template implementation */
17 //#include "FastConnector.ih"
20 #include <senf/Utils/type_traits.hh>
22 #define prefix_ inline
23 ///////////////////////////////cti.p///////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////
26 // senf::ppi::connector::FastPassiveInput<PacketType>
28 template <class PacketType>
29 prefix_ senf::ppi::connector::FastPassiveInput<PacketType>::FastPassiveInput()
32 template <class PacketType>
33 prefix_ senf::ppi::connector::FastPassiveInput<PacketType>::~FastPassiveInput()
35 unregisterConnector();
38 template <class PacketType>
39 prefix_ senf::ppi::connector::FastActiveOutput<PacketType> &
40 senf::ppi::connector::FastPassiveInput<PacketType>::peer()
43 return static_cast<FastActiveOutput<PacketType> &>(Connector::peer());
46 template <class PacketType>
47 template <class Handler>
48 prefix_ void senf::ppi::connector::FastPassiveInput<PacketType>::onRequest(Handler handler)
50 cb_.bind(static_cast<typename senf::member_class<Handler>::type *>(& module()), handler);
53 template <class PacketType>
54 prefix_ PacketType const & senf::ppi::connector::FastPassiveInput<PacketType>::operator()()
57 SENF_ASSERT( packet_, "FastPassiveInput::operator() called without being signaled (no packet)" );
61 template <class PacketType>
62 prefix_ void senf::ppi::connector::FastPassiveInput<PacketType>::v_init()
65 ///////////////////////////////////////////////////////////////////////////
66 // senf::ppi::connector::FastActiveOutput<PacketType>
68 template <class PacketType>
69 prefix_ senf::ppi::connector::FastActiveOutput<PacketType>::FastActiveOutput()
72 template <class PacketType>
73 prefix_ senf::ppi::connector::FastActiveOutput<PacketType>::~FastActiveOutput()
75 unregisterConnector();
78 template <class PacketType>
79 prefix_ senf::ppi::connector::FastPassiveInput<PacketType> &
80 senf::ppi::connector::FastActiveOutput<PacketType>::peer()
83 return static_cast<FastPassiveInput<PacketType> &>(Connector::peer());
86 template <class PacketType>
88 senf::ppi::connector::FastActiveOutput<PacketType>::operator()(PacketType const & packet)
91 peer().packet_ = & packet;
96 template <class PacketType>
97 prefix_ void senf::ppi::connector::FastActiveOutput<PacketType>::v_init()
100 ///////////////////////////////////////////////////////////////////////////
102 template <class PacketType>
103 prefix_ void senf::ppi::connect(connector::FastActiveOutput<PacketType> & source,
104 connector::FastPassiveInput<PacketType> & target)
106 source.connect(target);
109 ///////////////////////////////cti.e///////////////////////////////////////
116 // comment-column: 40
117 // c-file-style: "senf"
118 // indent-tabs-mode: nil
119 // ispell-local-dictionary: "american"
120 // compile-command: "scons -u test"