00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00027 #ifndef HH_SENF_PPI_Module_
00028 #define HH_SENF_PPI_Module_ 1
00029
00030
00031 #include <vector>
00032 #include <boost/utility.hpp>
00033 #include <boost/ptr_container/ptr_vector.hpp>
00034 #include <senf/Scheduler/ClockService.hh>
00035 #include "predecl.hh"
00036 #include "ModuleManager.hh"
00037
00038
00039
00040
00041 namespace senf {
00042 namespace ppi {
00043
00044 namespace detail { class EventBindingBase; }
00045
00046 namespace module {
00047
00178 class Module
00179 : ModuleManager::Initializable, boost::noncopyable
00180 {
00181 public:
00182 virtual ~Module();
00183
00184 protected:
00185 Module();
00186
00187 #ifndef DOXYGEN
00188 template <class Source, class Target>
00189 Route<Source, Target> & route(Source & source, Target & target);
00190 #else
00191 Route<connector::InputConnector, connector::OutputConnector> &
00192 route(connector::InputConnector & input, connector::OutputConnector & output);
00194
00221 Route<connector::InputConnector, EventDescriptor> &
00222 route(connector::InputConnector & input, EventDescriptor & output);
00224
00237 Route<EventDescriptor, connector::OutputConnector> &
00238 route(EventDescriptor & input, connector::OutputConnector & output);
00240
00251 #endif
00252
00253 void noroute(connector::Connector & connector);
00254
00264 #ifndef DOXYGEN
00265 template <class Descriptor, class Target>
00266 void registerEvent(Descriptor & descriptor, Target target);
00267 #else
00268 template <class Target>
00269 void registerEvent(EventDescriptor & descriptor, Target target);
00271
00288 #endif
00289
00290 ClockService::clock_type time() const;
00291
00294 ClockService::clock_type now() const;
00295
00296 #ifndef DOXYGEN
00297 virtual void macro_SENF_PPI_MODULE_missing() = 0;
00298
00299 private:
00300 #endif
00301 virtual void v_init();
00302
00309 #ifndef DOXYGEN
00310 public:
00311 #endif
00312 void destroy();
00313
00314 private:
00315 EventManager & eventManager() const;
00316 ModuleManager & moduleManager() const;
00317
00318 void registerConnector(connector::Connector & connector);
00319 void unregisterConnector(connector::Connector & connector);
00320 void unregisterEvent(EventDescriptor & event);
00321
00322 RouteBase & addRoute(std::auto_ptr<RouteBase> route);
00323
00324 typedef std::vector<connector::Connector *> ConnectorRegistry;
00325 ConnectorRegistry connectorRegistry_;
00326
00327 typedef boost::ptr_vector<RouteBase> RouteInfoBase;
00328 RouteInfoBase routes_;
00329
00330 template <class Source, class Target>
00331 friend class detail::RouteHelper;
00332 friend class senf::ppi::ModuleManager;
00333 friend class connector::Connector;
00334 friend class senf::ppi::detail::EventBindingBase;
00335 };
00336
00343 # define SENF_PPI_MODULE(name) \
00344 public: \
00345 ~ name() { destroy(); } \
00346 void macro_SENF_PPI_MODULE_missing() {} \
00347 private:
00348
00349 }}}
00350
00351
00352 #include "Module.cci"
00353 #include "Module.ct"
00354
00355 #endif
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366