NEW FILE HEADER / COPYRIGHT FORMAT
[senf.git] / PPI / detail / EventBinding.cti
index aeb0555..4e2db74 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
 //#include "EventBinding.ih"
 
 // Custom includes
+#include "../EventManager.hh"
 
 #define prefix_ inline
 ///////////////////////////////cti.p///////////////////////////////////////
 
 ///////////////////////////////////////////////////////////////////////////
+// senf::ppi::detail::EventBindingHelper<EventType,Self>
+
+template <class EventType, class Self>
+prefix_ void
+senf::ppi::detail::EventBindingHelper<EventType,Self>::callback(EventArg event,
+                                                                ClockService::clock_type time)
+{
+    self().eventTime(time);
+    self().callback_(event);
+}
+
+template <class EventType, class Self>
+prefix_ void senf::ppi::detail::EventBindingHelper<EventType,Self>::callback(EventArg event)
+{
+    callback(event, self().manager().now());
+}
+
+////////////////////////////////////////
+// private members
+
+template <class EventType, class Self>
+prefix_ Self & senf::ppi::detail::EventBindingHelper<EventType,Self>::self()
+{
+    return * static_cast<Self*>(this);
+}
+
+///////////////////////////////////////////////////////////////////////////
+// senf::ppi::detail::EventBindingHelper<void,Self>
+
+template <class Self>
+prefix_ void
+senf::ppi::detail::EventBindingHelper<void,Self>::callback(ClockService::clock_type time)
+{
+    self().eventTime(time);
+    self().callback_();
+}
+
+template <class Self>
+prefix_ void senf::ppi::detail::EventBindingHelper<void,Self>::callback()
+{
+    callback(self().manager().now());
+}
+
+////////////////////////////////////////
+// private members
+
+template <class Self>
+prefix_ Self & senf::ppi::detail::EventBindingHelper<void,Self>::self()
+{
+    return * static_cast<Self*>(this);
+}
+
+///////////////////////////////////////////////////////////////////////////
 // senf::ppi::detail::EventBinding<EvImpl>
 
 template <class EventType>
@@ -41,20 +95,6 @@ prefix_ senf::ppi::detail::EventBinding<EventType>::EventBinding(EventManager &
     : EventBindingBase(manager, module, descriptor), callback_(callback)
 {}
 
-template <class EvImpl>
-prefix_ void senf::ppi::detail::EventBinding<EvImpl>::callback(EventArg event,
-                                                               boost::posix_time::ptime time)
-{
-    eventTime(time);
-    callback_(event);
-}
-
-template <class EvImpl>
-prefix_ void senf::ppi::detail::EventBinding<EvImpl>::callback(EventArg event)
-{
-    callback(event, boost::posix_time::microsec_clock::universal_time());
-}
-
 ///////////////////////////////cti.e///////////////////////////////////////
 #undef prefix_