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

Module.cci

Go to the documentation of this file.
00001 // $Id: Module.cci 1772 2011-03-10 12:45:21Z tho $
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 // Custom includes
00027 #include "Route.hh"
00028 #include "Connectors.hh"
00029 #include "EventManager.hh"
00030 #include <boost/lambda/lambda.hpp>
00031 #include <boost/lambda/bind.hpp>
00032 #include <algorithm>
00033 
00034 #define prefix_ inline
00035 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00036 
00037 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00038 // senf::ppi::module::Module
00039 
00040 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00041 // private members
00042 
00043 prefix_ void senf::ppi::module::Module::v_init()
00044 {}
00045 
00046 prefix_ senf::ppi::EventManager & senf::ppi::module::Module::eventManager()
00047     const
00048 {
00049     return EventManager::instance();
00050 }
00051 
00052 prefix_ senf::ppi::ModuleManager & senf::ppi::module::Module::moduleManager()
00053     const
00054 {
00055     return ModuleManager::instance();
00056 }
00057 
00058 prefix_ void senf::ppi::module::Module::unregisterEvent(EventDescriptor & event)
00059 {
00060     routes_.erase_if(boost::bind(&RouteBase::hasEvent, _1, boost::cref(event)));
00061 }
00062 
00063 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00064 // public members
00065 
00066 prefix_ senf::ppi::module::Module::~Module()
00067 {
00068     SENF_ASSERT(connectorRegistry_.empty(),
00069                 "Internal failure: connectors still registered in Module destructor ??");
00070     SENF_ASSERT(routes_.empty(),
00071                 "internal failure: routes still registered in Module destructor ??");
00072 
00073     moduleManager().unregisterModule(*this);
00074 }
00075 
00076 prefix_ senf::ClockService::clock_type senf::ppi::module::Module::time()
00077     const
00078 {
00079     return eventManager().time();
00080 }
00081 
00082 prefix_ senf::ClockService::clock_type senf::ppi::module::Module::now()
00083     const
00084 {
00085     return eventManager().now();
00086 }
00087 
00088 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00089 // protected members
00090 
00091 prefix_ senf::ppi::module::Module::Module()
00092 {
00093     moduleManager().registerModule(*this);
00094 }
00095 
00096 prefix_ void senf::ppi::module::Module::destroy()
00097 {
00098     eventManager().destroyModule(*this);
00099 }
00100 
00101 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00102 #undef prefix_
00103 
00104 
00105 // Local Variables:
00106 // mode: c++
00107 // fill-column: 100
00108 // comment-column: 40
00109 // c-file-style: "senf"
00110 // indent-tabs-mode: nil
00111 // ispell-local-dictionary: "american"
00112 // compile-command: "scons -u test"
00113 // End:

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