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

MultiConnectorMixin.ih

Go to the documentation of this file.
00001 // $Id: MultiConnectorMixin.ih 1754 2010-12-09 15:45:42Z tho $
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 IH_SENF_PPI_MultiConnectorMixin_
00027 #define IH_SENF_PPI_MultiConnectorMixin_ 1
00028 
00029 // Custom includes
00030 #include "Setup.hh"
00031 
00032 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00033 
00034 namespace senf {
00035 namespace ppi {
00036 namespace module {
00037 namespace detail {
00038 
00039     struct MultiConnectorMixinAccess
00040     {
00041 #       define BOOST_PP_ITERATION_PARAMS_1 (4, ( \
00042             0, \
00043             SENF_MULTI_CONNECTOR_MAX_ARGS,                              \
00044             SENF_ABSOLUTE_INCLUDE_PATH(PPI/MultiConnectorMixin.mpp),    \
00045             8 ))
00046 #       include BOOST_PP_ITERATE()
00047     };
00048 
00049     template <class KeyType, class ConnectorType>
00050     struct MultiConnectorDefaultContainer
00051     {
00052         typedef boost::ptr_map<KeyType, ConnectorType> type;
00053     };
00054 
00055     template <class Module, class Connector>
00056     class MultiConnectorWrapper
00057         : public Connector
00058     {
00059     private:
00060         virtual void v_disconnected();
00061     };
00062 
00063 #ifndef DOXYGEN
00064 
00065     template <class ConnectorType>
00066     struct MultiConnectorDefaultContainer<void,ConnectorType>
00067     {
00068         typedef boost::ptr_vector<ConnectorType> type;
00069     };
00070 
00071 #endif
00072 
00073     template <class ConnectorType>
00074     struct MultiConnectorSelectBase
00075         : public boost::mpl::if_<
00076               boost::is_base_of<connector::InputConnector, ConnectorType>,
00077               ppi::detail::DisableStandardInput, ppi::detail::DisableStandardOutput >
00078     {};
00079 
00080     template <class T> senf::mpl::rv<0> isMulticonnector(...);
00081     template <class T> senf::mpl::rv<1> isMulticonnector(
00082         typename boost::enable_if<boost::is_base_of<connector::OutputConnector,
00083                                                     typename T::ConnectorType>,
00084                                   int>::type);
00085     template <class T> senf::mpl::rv<2> isMulticonnector(
00086         typename boost::enable_if<boost::is_base_of<connector::InputConnector,
00087                                                     typename T::ConnectorType>,
00088                                   int>::type);
00089 
00090     template <class T, unsigned N>
00091     struct IsMulticonnectorSource_
00092         : public boost::false_type
00093     {};
00094 
00095     template <class T>
00096     struct IsMulticonnectorSource_<T, 1u>
00097         : public boost::true_type
00098     {};
00099 
00100     template <class T>
00101     struct IsMulticonnectorSource
00102         : public IsMulticonnectorSource_<T, SENF_MPL_RV(isMulticonnector<T>(0))>
00103     {};
00104 
00105     template <class T, unsigned N>
00106     struct IsMulticonnectorTarget_
00107         : public boost::false_type
00108     {};
00109 
00110     template <class T>
00111     struct IsMulticonnectorTarget_<T, 2u>
00112         : public boost::true_type
00113     {};
00114 
00115     template <class T>
00116     struct IsMulticonnectorTarget
00117         : public IsMulticonnectorTarget_<T, SENF_MPL_RV(isMulticonnector<T>(0))>
00118     {};
00119 
00120 
00121 
00122 }}}}
00123 
00124 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00125 #endif
00126 
00127 
00128 // Local Variables:
00129 // mode: c++
00130 // fill-column: 100
00131 // comment-column: 40
00132 // c-file-style: "senf"
00133 // indent-tabs-mode: nil
00134 // ispell-local-dictionary: "american"
00135 // compile-command: "scons -u test"
00136 // End:

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