PPI: Checkin of first compiling (yet not working) version
[senf.git] / PPI / Module.ct
1 // Copyright (C) 2007 
2 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
3 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
4 //     Stefan Bund <g0dil@berlios.de>
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the
18 // Free Software Foundation, Inc.,
19 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20
21 /** \file
22     \brief Module non-inline template implementation  */
23
24 #include "Module.ih"
25
26 // Custom includes
27
28 #define prefix_
29 ///////////////////////////////ct.p////////////////////////////////////////
30
31 ///////////////////////////////////////////////////////////////////////////
32 // senf::ppi::module::Module
33
34 template <class Source, class Target>
35 prefix_ senf::ppi::Route<Source, Target> &
36 senf::ppi::module::Module::route(Source & source, Target & target)
37 {
38     detail::RouteHelper<Source,Target>::route(*this, source, target, source, target);
39     return static_cast< Route<Source,Target> & >(
40         addRoute(std::auto_ptr< RouteBase >(
41                      new Route<Source,Target>(*this, source, target))));
42 }
43
44 template <class Target, class Descriptor>
45 prefix_ void senf::ppi::module::Module::registerEvent(Target target, Descriptor & descriptor)
46 {
47     eventManager().registerEvent(
48         *this,
49         EventManager::Callback<Descriptor>::make(target,*this),
50         descriptor);
51 }
52
53 ///////////////////////////////////////////////////////////////////////////
54 // senf::ppi::module::detail namespace members
55
56 template <class Source, class Target>
57 prefix_ void senf::ppi::module::detail::RouteHelper<Source,Target>::
58 route(Module & module, Source & source, Target & target,
59       connector::InputConnector &, connector::OutputConnector &)
60 {
61     module.registerConnector(source);
62     module.registerConnector(target);
63 }
64
65 template <class Source, class Target>
66 prefix_ void senf::ppi::module::detail::RouteHelper<Source,Target>::
67 route(Module & module, Source & source, Target & target,
68       connector::InputConnector &, EventDescriptor &)
69 {
70     module.registerConnector(source);
71 }
72
73 template <class Source, class Target>
74 prefix_ void senf::ppi::module::detail::RouteHelper<Source,Target>::
75 route(Module & module, Source & source, Target & target,
76       EventDescriptor &, connector::OutputConnector &)
77 {
78     module.registerConnector(target);
79 }
80
81 ///////////////////////////////ct.e////////////////////////////////////////
82 #undef prefix_
83
84 \f
85 // Local Variables:
86 // mode: c++
87 // fill-column: 100
88 // comment-column: 40
89 // c-file-style: "senf"
90 // indent-tabs-mode: nil
91 // ispell-local-dictionary: "american"
92 // compile-command: "scons -u test"
93 // End: