#define HH_Module_ 1
// Custom includes
+#include <vector>
#include <boost/utility.hpp>
-#include <boost/date_time/posix_time/posix_time_types.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
+#include "Scheduler/ClockService.hh"
+#include "predecl.hh"
//#include "Module.mpp"
///////////////////////////////hh.p////////////////////////////////////////
namespace senf {
namespace ppi {
+namespace module {
/** \brief Module baseclass
class Module
: boost::noncopyable
{
+ public:
+ virtual ~Module();
+
protected:
Module();
- ~Module();
template <class Source, class Target>
- Route<Source, Target> & route(Source const & source, Target const & target);
+ Route<Source, Target> & route(Source & source, Target & target);
///< Define flow information
/**< Using the route() and noroute() members, the
information flow within the module is defined. Routing
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 <class Connector>
- 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
\param[in] connector Terminal connector to declare */
template <class Target, class Descriptor>
- 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
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 */
- \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. */
+ ClockService::clock_type time() const; ///< Return timestamp of the currently processing
+ ///< event
- boost::posix_time::ptime eventTime(); ///< Return timestamp of the currently processing event
- };
+ ClockService::clock_type now() const;
- /** \brief Automatically manage dynamic module deallocation
+ void destroy();
- The dynamicModule helper will create a new dynamically managed module instance.
+#ifndef DOXYGEN
+ virtual void macro_SENF_PPI_MODULE_missing() = 0;
+#endif
- The \a args template parameter is only a placeholder. All arguments to dynamicModule will be
- passed to the Module constructor.
+ private:
+ virtual void init();
- \implementation dynamicModule should just register the Instance in a different way with the
- Infrastructure and return a reference to the new module.
- */
- template <class Module, class Args>
- unspecified dynamicModule(Args args);
+ EventManager & eventManager() const;
+ ModuleManager & moduleManager() const;
+
+ void registerConnector(connector::Connector & connector);
+ RouteBase & addRoute(std::auto_ptr<RouteBase> route);
+ typedef std::vector<connector::Connector *> ConnectorRegistry;
+ ConnectorRegistry connectorRegistry_;
- /** \brief Connect compatible connectors
+ typedef boost::ptr_vector<RouteBase> RouteInfoBase;
+ RouteInfoBase routes_;
- connect() will connect two compatible connectors: One connector must be active, the other
- passive.
- */
- template <class Source, class Target>
- void connect(Source const & source, Target const & target);
+ template <class Source, class Target>
+ friend class detail::RouteHelper;
+ friend class senf::ppi::ModuleManager;
+ };
- /** \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 <class Source, class Target, class Adaptor)
- Adaptor const & connect(Source const & source, Target const & target,
- Adaptor const & adaptor);
+# define SENF_PPI_MODULE(name) \
+ public: \
+ ~ name() { destroy(); } \
+ void macro_SENF_PPI_MODULE_missing() {} \
+ private:
-}}
+}}}
///////////////////////////////hh.e////////////////////////////////////////
-//#include "Module.cci"
-//#include "Module.ct"
+#include "Module.cci"
+#include "Module.ct"
//#include "Module.cti"
#endif
// c-file-style: "senf"
// indent-tabs-mode: nil
// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// comment-column: 40
// End: