switch to new MPL based Fraunhofer FOKUS Public License
[senf.git] / senf / Socket / ProtocolClientSocketHandle.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 ProtocolClientSocketHandle Boost.Preprocessor external iteration include
30  */
31
32 #if !BOOST_PP_IS_ITERATING && !defined(MPP_ProtocolClientSocketHandle_)
33 #define MPP_ProtocolClientSocketHandle_ 1
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 //-///////////////////////////mpp.p////////////////////////////////////////
41 #elif BOOST_PP_IS_ITERATING //-////////////////////////////////////////////
42 //-////////////////////////////////////////////////////////////////////////
43 // Local Macros
44
45 #define mpp_Arg(z,n,data) BOOST_PP_CAT(A,n) const & BOOST_PP_CAT(a,n)
46 #define mpp_TemplateParameters() BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A )
47 #define mpp_MethodParameters() BOOST_PP_ENUM(BOOST_PP_ITERATION(), mpp_Arg, )
48 #define mpp_CallParameters() BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), a )
49
50 //-////////////////////////////////////////////////////////////////////////
51 #if BOOST_PP_ITERATION_FLAGS()==1 //-//////////////////////////////////////
52 //-////////////////////////////////////////////////////////////////////////
53 // senf::ProtocolClientSocketHandle<SocketProtocol>::
54 // ProtocolClientSocketHandle (constructor) declaration
55
56 template < mpp_TemplateParameters() >
57 explicit ProtocolClientSocketHandle( mpp_MethodParameters() );
58
59 //-////////////////////////////////////////////////////////////////////////
60 #elif BOOST_PP_ITERATION_FLAGS()==2 //-////////////////////////////////////
61 //-////////////////////////////////////////////////////////////////////////
62 // senf::ProtocolClientSocketHandle<SocketProtocol>::
63 // ProtocolClientSocketHandle (constructor) implementation
64
65 template <class SocketProtocol>
66 template < mpp_TemplateParameters() >
67 prefix_ senf::ProtocolClientSocketHandle<SocketProtocol>::
68 ProtocolClientSocketHandle( mpp_MethodParameters() )
69     : ClientSocketHandle<typename SocketProtocol::Policy>(
70         std::auto_ptr<senf::SocketBody>(new ProtocolSocketBody<SocketProtocol>(false)))
71 {
72     this->protocol().init_client( mpp_CallParameters() );
73 }
74
75 //-////////////////////////////////////////////////////////////////////////
76 #endif //-/////////////////////////////////////////////////////////////////
77 //-////////////////////////////////////////////////////////////////////////
78 // Undefine local Macros
79
80 #undef mpp_Arg
81 #undef mpp_TemplateParameters
82 #undef mpp_MethodParameters
83 #undef mpp_CallParameters
84
85 //-////////////////////////////////////////////////////////////////////////
86 #endif //-/////////////////////////////////////////////////////////////////
87 //-///////////////////////////mpp.e////////////////////////////////////////
88
89 \f
90 // Local Variables:
91 // mode: c++
92 // fill-column: 100
93 // c-file-style: "senf"
94 // indent-tabs-mode: nil
95 // ispell-local-dictionary: "american"
96 // compile-command: "scons -u test"
97 // comment-column: 40
98 // End: