X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=PPI%2FModule.hh;h=b2b3ecdc82c74315ae5fa26509f493f25f4ab313;hb=f2f5d59e83863f3b513950173baee1b6da2aee3c;hp=a55b3f0a030974f860ee04ccc9eaffa50ea2feaa;hpb=416cdd1c85cdf2669785e93a71426a3206166758;p=senf.git diff --git a/PPI/Module.hh b/PPI/Module.hh index a55b3f0..b2b3ecd 100644 --- a/PPI/Module.hh +++ b/PPI/Module.hh @@ -1,8 +1,8 @@ // $Id$ // -// Copyright (C) 2007 -// Fraunhofer Institute for Open Communication Systems (FOKUS) -// Competence Center NETwork research (NET), St. Augustin, GERMANY +// Copyright (C) 2007 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund // // This program is free software; you can redistribute it and/or modify @@ -24,8 +24,8 @@ \brief Module public header */ -#ifndef HH_Module_ -#define HH_Module_ 1 +#ifndef HH_SENF_PPI_Module_ +#define HH_SENF_PPI_Module_ 1 // Custom includes #include @@ -33,6 +33,7 @@ #include #include "../Scheduler/ClockService.hh" #include "predecl.hh" +#include "ModuleManager.hh" //#include "Module.mpp" ///////////////////////////////hh.p//////////////////////////////////////// @@ -60,8 +61,6 @@ namespace module { \li \ref io_modules receive external data or forward packets out of the PPI \li \ref routing_modules forward packets within the network \li \ref adapter_modules are used to connect incompatible connectors to each other - - \todo Implement Spliters: PassiveSplitter, PrioritySplitter, CloneSplitter */ /** \defgroup io_modules Source/Sink Modules @@ -157,6 +156,13 @@ namespace module { event.enable(); } + void v_init() { + // Optional. Called after before running the module but after connections have been + // set up. This is either directly before senf::ppi::run() or senf::ppi::init() is + // called or, for modules created while the PPI is already running, after returning + // from all event handlers but before going back to the event loop. + } + }; \endcode @@ -167,7 +173,7 @@ namespace module { \see \ref ppi_modules */ class Module - : boost::noncopyable + : ModuleManager::Initializable, boost::noncopyable { public: virtual ~Module(); @@ -232,7 +238,7 @@ namespace module { event to a connector defines the event as the conceptual 'source' of the data. This means, the event controls how packets are sent (Example: Routing from an - IOEVent to an output defines, that output data will be + IOEvent to an output defines, that output data will be generated whenever the event is signaled). This event routing allows to automatically @@ -289,7 +295,13 @@ namespace module { private: #endif - virtual void init(); ///< Called just before the network is run + virtual void v_init(); ///< Called after module setup + /**< This member is called directly before the PPI (resumes) + execution. It is called after connections have been + setup before entering the PPI main loop. + + You may overload this member. Your overload should + always call the base-class implementation. */ #ifndef DOXYGEN public: