Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
// Copyright (C) 2007
// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
// Stefan Bund <g0dil@berlios.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the
// Free Software Foundation, Inc.,
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
\brief Module public header */
#ifndef HH_Module_
#define HH_Module_ 1
// Custom includes
#include <boost/utility.hpp>
//#include "Module.mpp"
///////////////////////////////hh.p////////////////////////////////////////
namespace senf {
namespace ppi {
/** \brief Module baseclass
senf::ppi::Module is the baseclass of all PPI modules. It provides the module implementation
with interfaces to several PPI facilities:
\li Connector management
\li Flow management
\li Event handling
To provide internal bookkeeping, most access to the PPI infrastructure is managed through
this base class.
Instances of this class may be allocated either statically or dynamically. Dynamic instances
are automatically managed using the dynamicModule adaptor.
*/
class Module
: boost::noncopyable
{
protected:
Module();
~Module();
template <class Source, class Target>
Route route(Source const & source, Target const & target); ///< Define flow information
/**< Using the route() and noroute() members, the
information flow within the module is defined. Routing
may be specified either between inputs, outputs and
events. The routing information is used to perform
automatic throttling. The throttling behavior may
however be controlled manually.
Even if no automatic throttling is desired <em>it is
vital to define the flow information for all inputs and
outputs</em>. Without flow information important
internal state of the module cannot be
initialized. This includes, explicitly defining
terminal inputs and outputs using noroute. Event
routing however is optional.
The return value may be used to alter routing
parameters like throttling parameters.
\param[in] source Data source, object which controlls
incoming data
\param[in] target Data target, object which controlls
outgoing data
\returns Route instance describing this route */
template <class Connector>
void noroute(Connector const & connector); ///<Define terminal connectors
/**<
The noroute() member explicitly declares, that a
connector is terminal and does not directly
receive/forward data from/to some other
connector. <em>It is mandatory to define routing
information for terminal connectors</em>.
See the route() documentation for more on routing
\param[in] connector Terminal connector to declare */
template <class Target, class Descriptor>
typename Descriptor::EventBinding const registerEvent(Target target,
Descriptor const & descriptor);
///< Register an external event
/**< The \a target argument may be either an arbitrary
callable object or it may be a member function pointer
pointing to a member function of the Module derived
classed. The handler may \e optionally take an Argument
of type <tt>typename Descriptor::Event const
&</tt>. This object allows to access detailed
information on the event delivered.
The \a descriptor describes the event to signal. This
may be a timer event or some type of I/O event on a
file descriptor or socket.
The return value may be used to modify the
binding. This allows to temporarily inhibit event
delivery or to remove the binding explicitly. Depending
on the type of event, other operations may be
possible. See the event descriptor documentation.
\param[in] target The handler to call whenever the event
is signaled
\param[in] descriptor The type of event to register
\returns An event binding instance of the appropriate
type. */
};
}}
///////////////////////////////hh.e////////////////////////////////////////
//#include "Module.cci"
//#include "Module.ct"
//#include "Module.cti"
#endif
// Local Variables:
// mode: c++
// fill-column: 100
// c-file-style: "senf"
// indent-tabs-mode: nil
// ispell-local-dictionary: "american"
// End: