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

Jack.hh

Go to the documentation of this file.
00001 // $Id: Jack.hh 1742 2010-11-04 14:51:56Z g0dil $
00002 //
00003 // Copyright (C) 2009
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_Jack_
00027 #define HH_SENF_PPI_Jack_ 1
00028 
00029 // Custom includes
00030 #include <boost/utility.hpp>
00031 #include <boost/type_traits.hpp>
00032 #include "Connectors.hh"
00033 #include "Setup.hh"
00034 
00035 //#include "Jack.mpp"
00036 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00037 
00038 namespace senf {
00039 namespace ppi {
00040 namespace connector {
00041 
00044     class Jack
00045         : private boost::noncopyable, private ppi::detail::DisableStandardConnect
00046     {};
00047 
00050     class GenericActiveInputJack
00051         : public Jack
00052     {
00053     public:
00054         explicit GenericActiveInputJack(GenericActiveInput & input);
00055 
00056         GenericActiveInput & connector(); 
00057 
00058         void reset(GenericActiveInput & input); 
00059 
00061     private:
00062         GenericActiveInput * input_;
00063     };
00064 
00067     class GenericActiveOutputJack
00068         : public Jack
00069     {
00070     public:
00071         explicit GenericActiveOutputJack(GenericActiveOutput & output);
00072 
00073         GenericActiveOutput & connector(); 
00074 
00075         void reset(GenericActiveOutput & output); 
00076 
00078     private:
00079         GenericActiveOutput * output_;
00080     };
00081 
00084     class GenericPassiveInputJack
00085         : public Jack
00086     {
00087     public:
00088         explicit GenericPassiveInputJack(GenericPassiveInput & input);
00089 
00090         GenericPassiveInput & connector(); 
00091 
00092         void reset(GenericPassiveInput & input); 
00093 
00095     private:
00096         GenericPassiveInput * input_;
00097     };
00098 
00101     class GenericPassiveOutputJack
00102         : public Jack
00103     {
00104     public:
00105         explicit GenericPassiveOutputJack(GenericPassiveOutput & output);
00106 
00107         GenericPassiveOutput & connector(); 
00108 
00109         void reset(GenericPassiveOutput & output); 
00110 
00112     private:
00113         GenericPassiveOutput * output_;
00114     };
00115 
00118     template <class PacketType=Packet>
00119     class ActiveInputJack
00120         : public GenericActiveInputJack
00121     {
00122     public:
00123         explicit ActiveInputJack(ActiveInput<PacketType> & input);
00124         explicit ActiveInputJack(ActiveInput<> & input);
00125 
00126         explicit ActiveInputJack(ActiveInputJack & input);
00127         explicit ActiveInputJack(ActiveInputJack<> & input);
00128 
00129         void reset(ActiveInput<PacketType> & input);
00130         void reset(ActiveInput<> & input);
00131 
00132         void reset(ActiveInputJack & input);
00133         void reset(ActiveInputJack<> & input);
00134     };
00135 
00136 #ifndef DOXYGEN
00137 
00138     template <>
00139     class ActiveInputJack<Packet>
00140         : public GenericActiveInputJack
00141     {
00142     public:
00143         explicit ActiveInputJack(GenericActiveInput & input);
00144         explicit ActiveInputJack(GenericActiveInputJack input);
00145 
00146         void reset(GenericActiveInput & input);
00147         void reset(GenericActiveInputJack input);
00148     };
00149 
00150 #endif
00151 
00154     template <class PacketType=Packet>
00155     class ActiveOutputJack
00156         : public GenericActiveOutputJack
00157     {
00158     public:
00159         explicit ActiveOutputJack(ActiveOutput<PacketType> & output);
00160         explicit ActiveOutputJack(ActiveOutput<> & output);
00161 
00162         explicit ActiveOutputJack(ActiveOutputJack & output);
00163         explicit ActiveOutputJack(ActiveOutputJack<> & output);
00164 
00165         void reset(ActiveOutput<PacketType> & output);
00166         void reset(ActiveOutput<> & output);
00167 
00168         void reset(ActiveOutputJack & output);
00169         void reset(ActiveOutputJack<> & output);
00170     };
00171 
00172 #ifndef DOXYGEN
00173 
00174     template <>
00175     class ActiveOutputJack<Packet>
00176         : public GenericActiveOutputJack
00177     {
00178     public:
00179         explicit ActiveOutputJack(GenericActiveOutput & output);
00180         explicit ActiveOutputJack(GenericActiveOutputJack & output);
00181 
00182         void reset(GenericActiveOutput & output);
00183         void reset(GenericActiveOutputJack & output);
00184     };
00185 
00186 #endif
00187 
00190     template <class PacketType=Packet>
00191     class PassiveInputJack
00192         : public GenericPassiveInputJack
00193     {
00194     public:
00195         explicit PassiveInputJack(PassiveInput<PacketType> & input);
00196         explicit PassiveInputJack(PassiveInput<> & input);
00197 
00198         explicit PassiveInputJack(PassiveInputJack & input);
00199         explicit PassiveInputJack(PassiveInputJack<> & input);
00200 
00201         void reset(PassiveInput<PacketType> & input);
00202         void reset(PassiveInput<> & input);
00203 
00204         void reset(PassiveInputJack & input);
00205         void reset(PassiveInputJack<> & input);
00206     };
00207 
00208 #ifndef DOXYGEN
00209 
00210     template <>
00211     class PassiveInputJack<Packet>
00212         : public GenericPassiveInputJack
00213     {
00214     public:
00215         explicit PassiveInputJack(GenericPassiveInput & input);
00216         explicit PassiveInputJack(GenericPassiveInputJack & input);
00217 
00218         void reset(GenericPassiveInput & input);
00219         void reset(GenericPassiveInputJack & input);
00220     };
00221 
00222 #endif
00223 
00226     template <class PacketType=Packet>
00227     class PassiveOutputJack
00228         : public GenericPassiveOutputJack
00229     {
00230     public:
00231         explicit PassiveOutputJack(PassiveOutput<PacketType> & output);
00232         explicit PassiveOutputJack(PassiveOutput<> & output);
00233 
00234         explicit PassiveOutputJack(PassiveOutputJack & output);
00235         explicit PassiveOutputJack(PassiveOutputJack<> & output);
00236 
00237         void reset(PassiveOutput<PacketType> & output);
00238         void reset(PassiveOutput<> & output);
00239 
00240         void reset(PassiveOutputJack & output);
00241         void reset(PassiveOutputJack<> & output);
00242     };
00243 
00244 #ifndef DOXYGEN
00245 
00246     template <>
00247     class PassiveOutputJack<Packet>
00248         : public GenericPassiveOutputJack
00249     {
00250     public:
00251         explicit PassiveOutputJack(GenericPassiveOutput & output);
00252         explicit PassiveOutputJack(GenericPassiveOutputJack & output);
00253 
00254         void reset(GenericPassiveOutput & output);
00255         void reset(GenericPassiveOutputJack & output);
00256     };
00257 
00258 #endif
00259 }
00260 
00261 #ifndef DOXYGEN
00262 
00263     template <class T>
00264     void connect(connector::GenericActiveOutputJack & source, T & target,
00265                  typename boost::disable_if< boost::is_base_of<connector::Jack, T> >::type * = 0);
00266     template <class T>
00267     void connect(connector::GenericPassiveOutputJack & source, T & target,
00268                  typename boost::disable_if< boost::is_base_of<connector::Jack, T> >::type * = 0);
00269 
00270     template <class T>
00271     void connect(T & source, connector::GenericActiveInputJack & target,
00272                  typename boost::disable_if< boost::is_base_of<connector::Jack, T> >::type * = 0);
00273     template <class T>
00274     void connect(T & source, connector::GenericPassiveInputJack & target,
00275                  typename boost::disable_if< boost::is_base_of<connector::Jack, T> >::type * = 0);
00276 
00277     void connect(connector::GenericActiveOutputJack & source,
00278                  connector::GenericPassiveInputJack & target);
00279     void connect(connector::GenericPassiveOutputJack & source,
00280                  connector::GenericActiveInputJack & target);
00281 
00282     void connect(connector::GenericActiveOutputJack & source,
00283                  connector::GenericPassiveInput & target);
00284     void connect(connector::GenericPassiveOutputJack & source,
00285                  connector::GenericActiveInput & target);
00286 
00287     void connect(connector::GenericActiveOutput & source,
00288                  connector::GenericPassiveInputJack & target);
00289     void connect(connector::GenericPassiveOutput & source,
00290                  connector::GenericActiveInputJack & target);
00291 
00292 #endif
00293 }}
00294 
00295 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00296 #include "Jack.cci"
00297 //#include "Jack.ct"
00298 #include "Jack.cti"
00299 #endif
00300 
00301 
00302 // Local Variables:
00303 // mode: c++
00304 // fill-column: 100
00305 // comment-column: 40
00306 // c-file-style: "senf"
00307 // indent-tabs-mode: nil
00308 // ispell-local-dictionary: "american"
00309 // compile-command: "scons -u test"
00310 // End:

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