X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=PPI%2FSetup.hh;h=7ca50683275964384c53777cf74712ce8d871e1a;hb=f2f5d59e83863f3b513950173baee1b6da2aee3c;hp=5f0613a28286b88b7d72034b5d6a2f646a30da04;hpb=81ffa1c459b96dd44472bcef37e1e373934ee138;p=senf.git diff --git a/PPI/Setup.hh b/PPI/Setup.hh index 5f0613a..7ca5068 100644 --- a/PPI/Setup.hh +++ b/PPI/Setup.hh @@ -1,8 +1,8 @@ // $Id$ // -// Copyright (C) 2007 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) +// 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 @@ -23,10 +23,12 @@ /** \file \brief Setup public header */ -#ifndef HH_Setup_ -#define HH_Setup_ 1 +#ifndef HH_SENF_PPI_Setup_ +#define HH_SENF_PPI_Setup_ 1 // Custom includes +#include +#include #include "predecl.hh" //#include "Setup.mpp" @@ -35,17 +37,92 @@ namespace senf { namespace ppi { - void connect(connector::ActiveOutput & source, connector::PassiveInput & target); - void connect(connector::PassiveOutput & source, connector::ActiveInput & target); +#ifdef DOXYGEN + /** \brief Connect modules + + senf::ppi::connect() establishes a connection between two modules or, to be more precise, + between two connectors. It will connect any input to any output connector as long as one is + active and the other passive. + + If a module has an output connector called \c output, the module may be directly specified + as \a source argument. In the same way, if a module has an input connector called \c input, + the module may be given directly as \a target argument. This simplifies the most common case + of a module with one input and one output connector. + + The connect call will check at runtime, whether the two connectors are type-compatible: + \li Either or both of the connectors are untyped (they accept/send arbitrary senf::Packet's) + \li Both connectors send/accept the exactly same packet type. + + Depending on the type of input or output, the connect call may require additional + arguments. See the respective module documentation for more information + + \throws connector::IncompatibleConnectorsException if the two connectors are not type + compatible. + + \see \ref ppi_connections + */ + void connect(connector::OutputConnector & source, connector::InputConnector & target, ...); + +#else + + void connect(connector::GenericActiveOutput & source, connector::GenericPassiveInput & target); + void connect(connector::GenericPassiveOutput & source, connector::GenericActiveInput & target); + +#endif + +#ifndef DOXYGEN + + template + void connect(T & source, C & target, + typename boost::disable_if< boost::is_base_of >::type * = 0, + typename boost::enable_if< boost::is_base_of >::type * = 0, + typename boost::disable_if< boost::is_base_of >:: type * = 0); + + template + void connect(C & source, T & target, + typename boost::enable_if< boost::is_base_of >::type * = 0, + typename boost::disable_if< boost::is_base_of >::type * = 0, + typename boost::disable_if< boost::is_base_of >:: type * = 0); + + template + void connect(T1 & source, T2 & target, + typename boost::disable_if< boost::is_base_of >::type * = 0, + typename boost::disable_if< boost::is_base_of >::type * = 0, + typename boost::disable_if< boost::is_base_of >:: type * = 0, + typename boost::disable_if< boost::is_base_of >:: type * = 0); + +#endif + + /** \brief Start the network + + Calling senf::ppi::run() will start processing the network. The main event loop is managed + by the Scheduler. Before starting the Scheduler main loop, all Module init() members are + called. + + senf::ppi::run() will return when no more work is to be done, that is when no events are + enabled (Since the events are enabled and disabled by the throttle notifications which + depend among other things on the packet queues, this is the same as checking for packets in + any queue). It is Ok to call senf::ppi::run() multiple times during the program lifetime. + + \see \ref ppi_run + */ void run(); + /** \brief Manually initialize the network + + For debugging purposes, it is sometimes simpler to not use senf::ppi::run() but instead + drive the network via explicit calls using the debug modules. However, it is still necessary + to initialize the network. This operation is performed by senf::ppi::init(). + */ + void init(); + }} ///////////////////////////////hh.e//////////////////////////////////////// #include "Setup.cci" //#include "Setup.ct" -//#include "Setup.cti" +#include "Setup.cti" #endif