Search:

SENF Extensible Network Framework

  • Home
  • Download
  • Wiki
  • BerliOS
  • ChangeLog
  • Browse SVN
  • Bug Tracker
  • Overview
  • Examples
  • HowTos
  • Glossary
  • PPI
  • Packets
  • Scheduler
  • Socket
  • Utils
  • Console
  • Daemon
  • Logger
  • Termlib
  • Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • Directories
  • File List
  • File Members

Events.cti

Go to the documentation of this file.
00001 // $Id: Events.cti 1742 2010-11-04 14:51:56Z g0dil $
00002 //
00003 // Copyright (C) 2007
00004 // Fraunhofer (FOKUS)
00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY
00006 //     Stefan Bund <g0dil@berlios.de>
00007 //
00008 // This program is free software; you can redistribute it and/or modify
00009 // it under the terms of the GNU General Public License as published by
00010 // the Free Software Foundation; either version 2 of the License, or
00011 // (at your option) any later version.
00012 //
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU General Public License
00019 // along with this program; if not, write to the
00020 // Free Software Foundation, Inc.,
00021 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022 
00026 #include "Events.ih"
00027 
00028 // Custom includes
00029 #include <senf/Utils/senfassert.hh>
00030 #include "detail/EventBinding.hh"
00031 
00032 #define prefix_ inline
00033 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00034 
00035 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00036 // senf::ppi::EventImplementationHelper<EventType,Self>
00037 
00038 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00039 // protected members
00040 
00041 template <class EventType, class Self>
00042 prefix_ void
00043 senf::ppi::EventImplementationHelper<EventType,Self>::callback(EventArg event,
00044                                                                ClockService::clock_type time)
00045 {
00046     binding().callback(event,time);
00047 }
00048 
00049 template <class EventType, class Self>
00050 prefix_ void senf::ppi::EventImplementationHelper<EventType,Self>::callback(EventArg event)
00051 {
00052     binding().callback(event);
00053 }
00054 
00055 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00056 // private members
00057 
00058 template <class EventType, class Self>
00059 prefix_ senf::ppi::detail::EventBinding<EventType> &
00060 senf::ppi::EventImplementationHelper<EventType,Self>::binding()
00061 {
00062     SENF_ASSERT( static_cast<Self*>(this)->binding_,
00063                  "senf::ppi::EventImplementationHelper::binding(): Missing registerEvent()" );
00064     return * static_cast<Self*>(this)->binding_;
00065 }
00066 
00067 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00068 // senf::ppi::EventImplementationHelper<void,Self>
00069 
00070 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00071 // protected members
00072 
00073 template <class Self>
00074 prefix_ void
00075 senf::ppi::EventImplementationHelper<void,Self>::callback(ClockService::clock_type time)
00076 {
00077     binding().callback(time);
00078 }
00079 
00080 template <class Self>
00081 prefix_ void senf::ppi::EventImplementationHelper<void,Self>::callback()
00082 {
00083     binding().callback();
00084 }
00085 
00086 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00087 // private members
00088 
00089 template <class Self>
00090 prefix_ senf::ppi::detail::EventBinding<void> &
00091 senf::ppi::EventImplementationHelper<void,Self>::binding()
00092 {
00093     SENF_ASSERT( static_cast<Self*>(this)->binding_,
00094                  "senf::ppi::EventImplementationHelper::binding(): Missing registerEvent()" );
00095     return * static_cast<Self*>(this)->binding_;
00096 }
00097 
00098 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00099 // senf::ppi::EventImplementation<EventType>
00100 
00101 template <class EventType>
00102 prefix_ senf::ppi::module::Module & senf::ppi::EventImplementation<EventType>::module()
00103     const
00104 {
00105     return binding_->module();
00106 }
00107 
00108 template <class EventType>
00109 prefix_ senf::ppi::EventManager & senf::ppi::EventImplementation<EventType>::manager()
00110     const
00111 {
00112     return binding_->manager();
00113 }
00114 
00115 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00116 // protected members
00117 
00118 template <class EventType>
00119 prefix_ senf::ppi::EventImplementation<EventType>::EventImplementation()
00120     : binding_(0)
00121 {}
00122 
00123 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00124 // private members
00125 
00126 template <class EventType>
00127 prefix_ bool senf::ppi::EventImplementation<EventType>::v_isRegistered()
00128 {
00129     return binding_;
00130 }
00131 
00132 template <class EventType>
00133 prefix_ void
00134 senf::ppi::EventImplementation<EventType>::setBinding(detail::EventBinding<Event> & binding)
00135 {
00136     binding_ = & binding;
00137 }
00138 
00139 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00140 #undef prefix_
00141 
00142 
00143 // Local Variables:
00144 // mode: c++
00145 // fill-column: 100
00146 // comment-column: 40
00147 // c-file-style: "senf"
00148 // indent-tabs-mode: nil
00149 // ispell-local-dictionary: "american"
00150 // compile-command: "scons -u test"
00151 // End:

Contact: senf-dev@lists.berlios.de | © 2006-2010 Fraunhofer Institute for Open Communication Systems, Network Research