#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////////////////////////////////////////
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
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>
- void 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.
event is signaled
\param[in] descriptor The type of event to register */
- boost::posix_time::ptime eventTime(); ///< Return timestamp of the currently processing
- ///< event
- };
+ ClockService::clock_type eventTime(); ///< Return timestamp of the currently processing
+ ///< event
- /** \brief Connect compatible connectors
+ void destroy();
- 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);
+#ifndef DOXYGEN
+ virtual void macro_SENF_PPI_MODULE_missing() = 0;
+#endif
+
+ private:
+ virtual void init();
+
+ EventManager & eventManager();
+ ModuleManager & moduleManager();
+
+ void registerConnector(connector::Connector & connector);
+ RouteBase & addRoute(std::auto_ptr<RouteBase> route);
+
+ typedef std::vector<connector::Connector *> ConnectorRegistry;
+ ConnectorRegistry connectorRegistry_;
+
+ typedef boost::ptr_vector<RouteBase> RouteInfoBase;
+ RouteInfoBase routes_;
+
+ template <class Source, class Target>
+ friend class detail::RouteHelper;
+ friend class senf::ppi::ModuleManager;
+ };
+
+# 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