74231e6eaa9be5c070a7738bf66d7fa61052f903
[senf.git] / Socket / ProtocolClientSocketHandle.mpp
1 // $Id$
2 //
3 // Copyright (C) 2006 
4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 //     Stefan Bund <stefan.bund@fokus.fraunhofer.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 ProtocolClientSocketHandle Boost.Preprocessor external iteration include
25  */
26
27 #if !BOOST_PP_IS_ITERATING && !defined(MPP_ProtocolClientSocketHandle_)
28 #define MPP_ProtocolClientSocketHandle_ 1
29
30 // Custom includes
31 #include <boost/preprocessor/iteration/iterate.hpp>
32 #include <boost/preprocessor/enum.hpp>
33 #include <boost/preprocessor/cat.hpp>
34
35 // ///////////////////////////mpp.p////////////////////////////////////////
36 #endif // /////////////////////////////////////////////////////////////////
37 // ////////////////////////////////////////////////////////////////////////
38 // Local Macros
39
40 #define mpp_Arg(z,n,data) BOOST_PP_CAT(A,n) const & BOOST_PP_CAT(a,n)
41 #define mpp_TemplateParameters() BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A )
42 #define mpp_MethodParameters() BOOST_PP_ENUM(BOOST_PP_ITERATION(), mpp_Arg, )
43 #define mpp_CallParameters() BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), a )
44
45 // ////////////////////////////////////////////////////////////////////////
46 #if BOOST_PP_IS_ITERATING // //////////////////////////////////////////////
47 #if BOOST_PP_ITERATION_FLAGS()==1 // //////////////////////////////////////
48 // ////////////////////////////////////////////////////////////////////////
49 // senf::ProtocolClientSocketHandle<SocketProtocol>::
50 // ProtocolClientSocketHandle (constructor) declaration
51
52 template < mpp_TemplateParameters() >
53 ProtocolClientSocketHandle( mpp_MethodParameters() );
54
55 // ////////////////////////////////////////////////////////////////////////
56 #elif BOOST_PP_ITERATION_FLAGS()==2 // ////////////////////////////////////
57 // ////////////////////////////////////////////////////////////////////////
58 // senf::ProtocolClientSocketHandle<SocketProtocol>::
59 // ProtocolClientSocketHandle (constructor) implementation
60
61 template <class SocketProtocol>
62 template < mpp_TemplateParameters() >
63 prefix_ senf::ProtocolClientSocketHandle<SocketProtocol>::
64 ProtocolClientSocketHandle( mpp_MethodParameters() )
65     : ClientSocketHandle<typename SocketProtocol::Policy>(
66         std::auto_ptr<senf::SocketProtocol>(new SocketProtocol()))
67 {
68     this->protocol().init_client( mpp_CallParameters() );
69 }
70
71 // ////////////////////////////////////////////////////////////////////////
72 #endif // /////////////////////////////////////////////////////////////////
73 #endif // /////////////////////////////////////////////////////////////////
74 // ////////////////////////////////////////////////////////////////////////
75 // Undefine local Macros
76
77 #undef mpp_Arg
78 #undef mpp_TemplateParameters
79 #undef mpp_MethodParameters
80 #undef mpp_CallParameters
81
82 // ////////////////////////////////////////////////////////////////////////
83 // ///////////////////////////mpp.e////////////////////////////////////////
84
85 \f
86 // Local Variables:
87 // mode: c++
88 // c-file-style: "senf"
89 // End: