NEW FILE HEADER / COPYRIGHT FORMAT
[senf.git] / PPI / EventManager.hh
index 46631e6..8cd1278 100644 (file)
@@ -1,8 +1,8 @@
 // $Id$
 //
 // Copyright (C) 2007 
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
+// Fraunhofer Institute for Open Communication Systems (FOKUS) 
+// Competence Center NETwork research (NET), St. Augustin, GERMANY 
 //     Stefan Bund <g0dil@berlios.de>
 //
 // This program is free software; you can redistribute it and/or modify
@@ -27,8 +27,8 @@
 #define HH_EventManager_ 1
 
 // Custom includes
-#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 "detail/Callback.hh"
 #include "detail/EventBinding.hh"
 namespace senf {
 namespace ppi {
 
-    /** \brief
+    /** \brief Event registry and control
+
+        The EventManager control event registration and manages global event parameters. The
+        EventManager controls event dispatch but does \e not control event generation. This is the
+        responsibility of an external component (the Scheduler)
       */
     class EventManager
     {
@@ -47,16 +51,13 @@ namespace ppi {
         ///////////////////////////////////////////////////////////////////////////
         // Types
 
-        template <class Descriptor>
 #ifndef DOXYGEN
+        // Somehow doxygen barfs on this definition
+        template <class Descriptor>
         struct Callback
-#else
-        // This is SO stupid but doxygen must have some scoping problems if the 
-        // struct is called 'Callback' and will hang in an endless loop somewhere
-        struct Callback_
-#endif
-            : public detail::Callback<typename Descriptor::Event const &>
+            : public detail::Callback<typename Descriptor::EventArg>
         {};
+#endif
 
         ///////////////////////////////////////////////////////////////////////////
         ///\name Structors and default members
@@ -74,24 +75,28 @@ namespace ppi {
         ///@}
         ///////////////////////////////////////////////////////////////////////////
 
+        ClockService::clock_type now(); ///< Current time at last event dispatch
+        ClockService::clock_type time(); ///< Expected time of the last event
+
+    protected:
+
+    private:
         template <class Descriptor>
         void registerEvent(module::Module & module,
                            typename Callback<Descriptor>::type callback,
                            Descriptor & descriptor);
 
-        boost::posix_time::ptime eventTime();
+        void destroyModule(module::Module & module);
 
-    protected:
-
-    private:
         typedef boost::ptr_vector<detail::EventBindingBase> EventRegistrations;
         EventRegistrations registrations_;
 
-        void eventTime(boost::posix_time::ptime time);
+        void eventTime(ClockService::clock_type time);
 
-        boost::posix_time::ptime eventTime_;
+        ClockService::clock_type eventTime_;
 
         friend class detail::EventBindingBase;
+        friend class module::Module;
     };
 
 }}