4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Bund <g0dil@berlios.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 \brief Joins public header */
30 #include <boost/ptr_container/ptr_vector.hpp>
32 #include "Connectors.hh"
35 //#include "Joins.mpp"
36 ///////////////////////////////hh.p////////////////////////////////////////
43 template <class Source>
44 connector::PassiveInput & connect(Source & source, module::PassiveJoin & target);
46 template <class Source>
47 connector::ActiveInput & connect(Source & source, module::PriorityJoin & target);
53 /** \brief Join multiple packet streams with passive inputs
55 The PassiveJoin will combine any number of packet streams. You may connect any number of
56 ActiveOutput's to the PassiveJoin instance. The combined stream is then provided on the
57 ActiveOutput \a output.
59 Since PassiveJoin allows any number of incoming packet streams, the input connectors are
60 dynamically managed. A special senf::ppi::connect() overload is used to dynamically create
61 the needed input connectors. This hides this extra functionality from the user.
63 senf::ppi::module::PassiveJoin join;
65 ppi::connect(module1,join); // Connect first module to join's input
66 ppi::connect(module2.some_output,join); // Connect another module to join's input
67 ppi::connect(join,module3); // Forward combined stream to module3
70 \ingroup routing_modules
75 SENF_PPI_MODULE(PassiveJoin);
77 connector::ActiveOutput output;
82 connector::PassiveInput & newInput();
85 // I didn't get template friend functions to work ...
88 template <class Source>
89 connector::PassiveInput & connect(Source & source);
92 void request(connector::PassiveInput & input);
96 typedef boost::ptr_vector<connector::PassiveInput> Inputs;
100 /** \brief Join multiple packet streams with active inputs
102 The PriorityJoin will combine any number of packet streams. You may connect any number of
103 PassiveInput's to the PassiveJoin instance. The combined stream is then provided on the
104 PassiveOutput \a output.
106 When a packet request is received on Priorityjoin's \a output, The request will be serviced
107 from the first unthrottled input. The order, in which connectors are connected to the
108 PriorityJoin's input is important: The earlier connected peer has the higher priority and
109 will be serviced first.
111 Since PriorityJoin allows any number of incoming packet streams, the input connectors are
112 dynamically managed. A special senf::ppi::connect() overload is used to dynamically create
113 the needed input connectors. This hides this extra functionality from the user.
115 senf::ppi::module::PriorityJoin join;
117 ppi::connect(module1,join); // Connect first module to join's input
118 ppi::connect(module2.some_output,join); // Connect another module to join's input
119 ppi::connect(join,module3); // Forward combined stream to module3
121 Here, \a module1 has higher priority than \a module2 which will only be queried if \a
122 module1 is throttled.
124 \ingroup routing_modules
129 SENF_PPI_MODULE(PriorityJoin);
131 connector::PassiveOutput output;
136 connector::ActiveInput & newInput();
141 template <class Source>
142 connector::ActiveInput & connect(Source & source);
149 typedef boost::ptr_vector<connector::ActiveInput> Inputs;
155 ///////////////////////////////hh.e////////////////////////////////////////
157 //#include "Joins.ct"
165 // comment-column: 40
166 // c-file-style: "senf"
167 // indent-tabs-mode: nil
168 // ispell-local-dictionary: "american"
169 // compile-command: "scons -u test"