PPI: Make timing-critical RateFilter tests optional
[senf.git] / senf / PPI / MultiConnectorMixin.ih
1 // $Id$
2 //
3 // Copyright (C) 2009 
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 //     Stefan Bund <g0dil@berlios.de>
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
23 /** \file
24     \brief MultiConnectorMixin internal header */
25
26 #ifndef IH_SENF_PPI_MultiConnectorMixin_
27 #define IH_SENF_PPI_MultiConnectorMixin_ 1
28
29 // Custom includes
30
31 ///////////////////////////////ih.p////////////////////////////////////////
32
33 namespace senf {
34 namespace ppi {
35 namespace module {
36 namespace detail {
37
38     struct MultiConnectorMixinAccess
39     {
40 #       define BOOST_PP_ITERATION_PARAMS_1 (4, ( \
41             0, \
42             SENF_MULTI_CONNECTOR_MAX_ARGS,                              \
43             SENF_ABSOLUTE_INCLUDE_PATH(PPI/MultiConnectorMixin.mpp),    \
44             8 ))
45 #       include BOOST_PP_ITERATE()
46     };
47
48     template <class KeyType, class ConnectorType>
49     struct MultiConnectorDefaultContainer 
50     { 
51         typedef boost::ptr_map<KeyType, ConnectorType> type; 
52     };
53
54 #ifndef DOXYGEN
55
56     template <class ConnectorType>
57     struct MultiConnectorDefaultContainer<void,ConnectorType> 
58     { 
59         typedef boost::ptr_vector<ConnectorType> type;
60     };
61
62 #endif
63
64     template <class ConnectorType>
65     struct MultiConnectorSelectBase
66         : public boost::mpl::if_< 
67               boost::is_base_of<connector::InputConnector, ConnectorType>,
68               ppi::detail::DisableStandardInput, ppi::detail::DisableStandardOutput >
69     {};
70
71     template <class T> senf::mpl::rv<0> isMulticonnector(...);
72     template <class T> senf::mpl::rv<1> isMulticonnector(
73         typename boost::enable_if<boost::is_base_of<connector::OutputConnector, 
74                                                     typename T::ConnectorType>, 
75                                   int>::type);
76     template <class T> senf::mpl::rv<2> isMulticonnector(
77         typename boost::enable_if<boost::is_base_of<connector::InputConnector, 
78                                                     typename T::ConnectorType>, 
79                                   int>::type);
80
81     template <class T, unsigned N>
82     struct IsMulticonnectorSource_
83         : public boost::false_type
84     {};
85
86     template <class T>
87     struct IsMulticonnectorSource_<T, 1u>
88         : public boost::true_type
89     {};
90
91     template <class T>
92     struct IsMulticonnectorSource
93         : public IsMulticonnectorSource_<T, SENF_MPL_RV(isMulticonnector<T>(0))>
94     {};
95
96     template <class T, unsigned N>
97     struct IsMulticonnectorTarget_
98         : public boost::false_type
99     {};
100
101     template <class T>
102     struct IsMulticonnectorTarget_<T, 2u>
103         : public boost::true_type
104     {};
105
106     template <class T>
107     struct IsMulticonnectorTarget
108         : public IsMulticonnectorTarget_<T, SENF_MPL_RV(isMulticonnector<T>(0))>
109     {};
110
111
112
113 }}}}
114
115 ///////////////////////////////ih.e////////////////////////////////////////
116 #endif
117
118 \f
119 // Local Variables:
120 // mode: c++
121 // fill-column: 100
122 // comment-column: 40
123 // c-file-style: "senf"
124 // indent-tabs-mode: nil
125 // ispell-local-dictionary: "american"
126 // compile-command: "scons -u test"
127 // End: