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

EventManager.hh

Go to the documentation of this file.
00001 // $Id: EventManager.hh 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 #ifndef HH_SENF_PPI_EventManager_
00027 #define HH_SENF_PPI_EventManager_ 1
00028 
00029 // Custom includes
00030 #include <boost/ptr_container/ptr_vector.hpp>
00031 #include <senf/Scheduler/ClockService.hh>
00032 #include "predecl.hh"
00033 #include "detail/Callback.hh"
00034 #include "detail/EventBinding.hh"
00035 
00036 //#include "EventManager.mpp"
00037 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00038 
00039 namespace senf {
00040 namespace ppi {
00041 
00048     class EventManager
00049     {
00050     public:
00051         //-////////////////////////////////////////////////////////////////////////
00052         // Types
00053 
00054 #ifndef DOXYGEN
00055         // Somehow doxygen barfs on this definition
00056         template <class Descriptor>
00057         struct Callback
00058             : public detail::Callback<typename Descriptor::EventArg>
00059         {};
00060 #endif
00061 
00062         //-////////////////////////////////////////////////////////////////////////
00064         //\{
00065 
00066         static EventManager & instance();
00067 
00068         // default default constructor
00069         // default copy constructor
00070         // default copy assignment
00071         // default destructor
00072 
00073         // no conversion constructors
00074 
00075         //\}
00076         //-////////////////////////////////////////////////////////////////////////
00077 
00078         ClockService::clock_type now(); 
00079         ClockService::clock_type time(); 
00080 
00081     protected:
00082 
00083     private:
00084         template <class Descriptor>
00085         void registerEvent(module::Module & module,
00086                            typename Callback<Descriptor>::type callback,
00087                            Descriptor & descriptor);
00088 
00089         void destroyModule(module::Module & module);
00090         void destroyEvent(EventDescriptor & event);
00091 
00092         typedef boost::ptr_vector<detail::EventBindingBase> EventRegistrations;
00093         EventRegistrations registrations_;
00094 
00095         void eventTime(ClockService::clock_type time);
00096 
00097         ClockService::clock_type eventTime_;
00098 
00099         friend class detail::EventBindingBase;
00100         friend class module::Module;
00101         friend class EventDescriptor;
00102     };
00103 
00104 }}
00105 
00106 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00107 #include "EventManager.cci"
00108 #include "EventManager.ct"
00109 //#include "EventManager.cti"
00110 #endif
00111 
00112 
00113 // Local Variables:
00114 // mode: c++
00115 // fill-column: 100
00116 // comment-column: 40
00117 // c-file-style: "senf"
00118 // indent-tabs-mode: nil
00119 // ispell-local-dictionary: "american"
00120 // compile-command: "scons -u test"
00121 // End:

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