switch to new MPL based Fraunhofer FOKUS Public License
[senf.git] / senf / Socket / ProtocolServerSocketHandle.mpp
1 // $Id$
2 //
3 // Copyright (C) 2006
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 //
6 // The contents of this file are subject to the Fraunhofer FOKUS Public License
7 // Version 1.0 (the "License"); you may not use this file except in compliance
8 // with the License. You may obtain a copy of the License at 
9 // http://senf.berlios.de/license.html
10 //
11 // The Fraunhofer FOKUS Public License Version 1.0 is based on, 
12 // but modifies the Mozilla Public License Version 1.1.
13 // See the full license text for the amendments.
14 //
15 // Software distributed under the License is distributed on an "AS IS" basis, 
16 // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 
17 // for the specific language governing rights and limitations under the License.
18 //
19 // The Original Code is Fraunhofer FOKUS code.
20 //
21 // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V. 
22 // (registered association), Hansastraße 27 c, 80686 Munich, Germany.
23 //
24 // Contributor(s):
25 //   Stefan Bund <g0dil@berlios.de>
26
27
28 /** \file
29     \brief ssenf::ProtocolServerSocketHandle Boost.Preprocessor external iteration include
30  */
31
32 #if !BOOST_PP_IS_ITERATING
33 #ifndef MPP_SENF_Socket_ProtocolServerSocketHandle_
34
35 // Custom includes
36 #include <boost/preprocessor/iteration/iterate.hpp>
37 #include <boost/preprocessor/enum.hpp>
38 #include <boost/preprocessor/cat.hpp>
39
40 //-/////////////////////////////////////////////////////////////////////////////////////////////////
41 // Local Macros
42
43 #define mpp_PSSH_Arg(z,n,data) BOOST_PP_CAT(A,n) const & BOOST_PP_CAT(a,n)
44
45 #define mpp_PSSH_TemplateParameters() BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A )
46 #define mpp_PSSH_MethodParameters() BOOST_PP_ENUM(BOOST_PP_ITERATION(), mpp_PSSH_Arg, )
47 #define mpp_PSSH_CallParameters() BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), a )
48
49 //-/////////////////////////////////////////////////////////////////////////////////////////////////
50 #endif
51 #else
52 //-/////////////////////////////////////////////////////////////////////////////////////////////////
53
54 //-/////////////////////////////////////////////////////////////////////////////////////////////////
55 #if BOOST_PP_ITERATION_FLAGS()==1
56 //-/////////////////////////////////////////////////////////////////////////////////////////////////
57 // senf::ProtocolServerSocketHandle<SocketProtocol>::
58 // ProtocolServerSocketHandle (constructor) declaration
59
60 template < mpp_PSSH_TemplateParameters() >
61 explicit ProtocolServerSocketHandle( mpp_PSSH_MethodParameters() );
62
63 //-/////////////////////////////////////////////////////////////////////////////////////////////////
64 #elif BOOST_PP_ITERATION_FLAGS()==2
65 //-/////////////////////////////////////////////////////////////////////////////////////////////////
66 // senf::ProtocolServerSocketHandle<SocketProtocol>::
67 // ProtocolServerSocketHandle (constructor) implementation
68
69 template <class SocketProtocol>
70 template < mpp_PSSH_TemplateParameters() >
71 prefix_ senf::ProtocolServerSocketHandle<SocketProtocol>::
72 ProtocolServerSocketHandle( mpp_PSSH_MethodParameters() )
73     : ServerSocketHandle<typename SocketProtocol::Policy>(
74         std::auto_ptr<senf::SocketBody>(new ProtocolSocketBody<SocketProtocol>(true)))
75 {
76     this->protocol().init_server( mpp_PSSH_CallParameters() );
77 }
78
79 //-/////////////////////////////////////////////////////////////////////////////////////////////////
80 #endif
81 #endif
82 #if !BOOST_PP_IS_ITERATING
83 #ifdef MPP_SENF_Socket_ProtocolServerSocketHandle_
84 //-/////////////////////////////////////////////////////////////////////////////////////////////////
85 // Undefine local Macros
86
87 #undef mpp_PSSH_Arg
88 #undef mpp_PSSH_TemplateParameters
89 #undef mpp_PSSH_MethodParameters
90 #undef mpp_PSSH_CallParameters
91
92 //-/////////////////////////////////////////////////////////////////////////////////////////////////
93 #else
94 #define MPP_SENF_Socket_ProtocolServerSocketHandle_ 1
95 #endif
96 #endif
97
98 \f
99 // Local Variables:
100 // mode: c++
101 // fill-column: 100
102 // c-file-style: "senf"
103 // indent-tabs-mode: nil
104 // ispell-local-dictionary: "american"
105 // End: