X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=PPI%2FModule.hh;h=1a3d22bd1d81d07bd504292c5939d0d3c48172d9;hb=81ffa1c459b96dd44472bcef37e1e373934ee138;hp=6d3d634ac9c6f9870f21f086a5787dbb31c2bf69;hpb=89efe5f504c400212090aba703c7ee385f483c64;p=senf.git diff --git a/PPI/Module.hh b/PPI/Module.hh index 6d3d634..1a3d22b 100644 --- a/PPI/Module.hh +++ b/PPI/Module.hh @@ -26,14 +26,18 @@ #define HH_Module_ 1 // Custom includes +#include #include #include +#include +#include "predecl.hh" //#include "Module.mpp" ///////////////////////////////hh.p//////////////////////////////////////// namespace senf { namespace ppi { +namespace module { /** \brief Module baseclass @@ -55,10 +59,9 @@ namespace ppi { { protected: Module(); - ~Module(); template - Route & route(Source const & source, Target const & target); + Route & route(Source & source, Target & target); ///< Define flow information /**< Using the route() and noroute() members, the information flow within the module is defined. Routing @@ -78,14 +81,13 @@ namespace ppi { The return value may be used to alter routing parameters like throttling parameters. - \param[in] source Data source, object which controlls + \param[in] source Data source, object which controls incoming data - \param[in] target Data target, object which controlls + \param[in] target Data target, object which controls outgoing data \returns Route instance describing this route */ - template - void noroute(Connector const & connector); ///< Define terminal connectors + void noroute(connector::Connector & 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 @@ -97,7 +99,7 @@ namespace ppi { \param[in] connector Terminal connector to declare */ template - typename Descriptor & registerEvent(Target target, Descriptor const & descriptor); + void registerEvent(Target target, Descriptor & descriptor); ///< Register an external event /**< The \a target argument may be either an arbitrary callable object or it may be a member function pointer @@ -108,34 +110,32 @@ namespace ppi { 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. */ + \param[in] target The handler to call whenever the + event is signaled + \param[in] descriptor The type of event to register */ - boost::posix_time::ptime eventTime(); ///< Return timestamp of the currently processing event - }; + boost::posix_time::ptime eventTime(); ///< Return timestamp of the currently processing + ///< event - /** \brief Automatically manage dynamic module deallocation + private: + EventManager & eventManager(); + + void registerConnector(connector::Connector & connector); + RouteBase & addRoute(std::auto_ptr route); - The dynamicModule helper will create a new dynamically managed module instance. + typedef std::vector ConnectorRegistry; + ConnectorRegistry connectorRegistry_; - The \a args template parameter is only a placeholder. All arguments to dynamicModule will be - passed to the Module constructor. - */ - template - unspecified dynamicModule(Args args); + typedef boost::ptr_vector RouteInfoBase; + RouteInfoBase routes_; + template + friend class detail::RouteHelper; + }; /** \brief Connect compatible connectors @@ -145,22 +145,11 @@ namespace ppi { template void connect(Source const & source, Target const & target); - /** \brief Connect connectors via an adaptor module - - This connect() overload will insert an additional adaptor module into the connection. The - Adaptor module must have two connectors, \a input and \a output. The call will setup the - connections \a source to \a input and \a output to \a target. Each connector pair must be - compatible. - */ - template