Joins.ct
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 
14 /** \file
15  \brief Joins non-inline template implementation */
16 
17 #include "Joins.hh"
18 
19 // Custom includes
20 #include <algorithm>
21 #include <boost/bind.hpp>
22 #include <boost/lambda/lambda.hpp>
23 #include <boost/lambda/bind.hpp>
24 
25 #define prefix_
26 //-/////////////////////////////////////////////////////////////////////////////////////////////////
27 
28 //-/////////////////////////////////////////////////////////////////////////////////////////////////
29 // senf::ppi::module::PassiveJoin
30 
31 template <class PacketType>
32 prefix_ senf::ppi::module::PassiveJoin<PacketType>::PassiveJoin()
33 {
34  noroute(output);
35  output.onThrottle(&PassiveJoin::onThrottle);
36  output.onUnthrottle(&PassiveJoin::onUnthrottle);
37 }
38 
39 //-/////////////////////////////////////////////////////////////////////////////////////////////////
40 // private members
41 
42 template <class PacketType>
43 prefix_ void senf::ppi::module::PassiveJoin<PacketType>::connectorSetup(connector::PassiveInput<PacketType> & conn)
44 {
45  noroute(conn);
46  conn.onRequest(boost::bind(&PassiveJoin::request,this,boost::ref(conn)));
47  conn.throttlingDisc( ThrottlingDiscipline::NONE);
48 }
49 
50 template <class PacketType>
51 prefix_ void senf::ppi::module::PassiveJoin<PacketType>::onThrottle()
52 {
53  using boost::lambda::_1;
54  using boost::lambda::bind;
55  std::for_each(this->connectors().begin(), this->connectors().end(),
56  bind(&connector::GenericPassiveInput::throttle, _1));
57 }
58 
59 template <class PacketType>
60 prefix_ void senf::ppi::module::PassiveJoin<PacketType>::onUnthrottle()
61 {
62  using boost::lambda::_1;
63  using boost::lambda::bind;
64  std::for_each(this->connectors().begin(), this->connectors().end(),
65  bind(&connector::GenericPassiveInput::unthrottle, _1));
66 }
67 
68 //-/////////////////////////////////////////////////////////////////////////////////////////////////
69 #undef prefix_
70 
71 
72 // Local Variables:
73 // mode: c++
74 // fill-column: 100
75 // comment-column: 40
76 // c-file-style: "senf"
77 // indent-tabs-mode: nil
78 // ispell-local-dictionary: "american"
79 // compile-command: "scons -u test"
80 // End: