df539796a3505712130f5bea746fc4ca0b434a85
[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 #if !BOOST_PP_IS_ITERATING
24 #ifndef MPP_ProtocolClientSocketHandle_
25
26 // Custom includes
27 #include <boost/preprocessor/iteration/iterate.hpp>
28 #include <boost/preprocessor/enum.hpp>
29 #include <boost/preprocessor/cat.hpp>
30
31 //////////////////////////////mpp.p////////////////////////////////////////
32 // Local Macros
33
34 #define mpp_PCSH_Arg(z,n,data) BOOST_PP_CAT(A,n) const & BOOST_PP_CAT(a,n)
35
36 #define mpp_PCSH_TemplateParameters() BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A )
37 #define mpp_PCSH_MethodParameters() BOOST_PP_ENUM(BOOST_PP_ITERATION(), mpp_PCSH_Arg, )
38 #define mpp_PCSH_CallParameters() BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), a )
39
40 //////
41 #endif
42 #else
43 ///////////////////////////////////////////////////////////////////////////
44
45 //////
46 #if BOOST_PP_ITERATION_FLAGS()==1
47 ///////////////////////////////////////////////////////////////////////////
48 // senf::ProtocolClientSocketHandle<SocketProtocol>::
49 // ProtocolClientSocketHandle (constructor) declaration
50
51 template < mpp_PCSH_TemplateParameters() >
52 ProtocolClientSocketHandle( mpp_PCSH_MethodParameters() );
53
54 //////
55 #elif BOOST_PP_ITERATION_FLAGS()==2
56 ///////////////////////////////////////////////////////////////////////////
57 // senf::ProtocolClientSocketHandle<SocketProtocol>::
58 // ProtocolClientSocketHandle (constructor) implementation
59
60 template <class SocketProtocol>
61 template < mpp_PCSH_TemplateParameters() >
62 prefix_ senf::ProtocolClientSocketHandle<SocketProtocol>::
63 ProtocolClientSocketHandle( mpp_PCSH_MethodParameters() )
64     : ClientSocketHandle<typename SocketProtocol::Policy>(
65         std::auto_ptr<senf::SocketProtocol>(new SocketProtocol()))
66 {
67     this->protocol().init_client( mpp_PCSH_CallParameters() );
68 }
69
70 //////
71 #endif
72 #endif
73 #if !BOOST_PP_IS_ITERATING
74 #ifdef MPP_PCSH__ProtocolClientSocketHandle_
75 ///////////////////////////////////////////////////////////////////////////
76 // Undefine local Macros
77
78 #undef mpp_PCSH_Arg
79 #undef mpp_PCSH_TemplateParameters
80 #undef mpp_PCSH_MethodParameters
81 #undef mpp_PCSH_CallParameters
82
83 //////////////////////////////mpp_PCSH_.e////////////////////////////////////////
84 #else
85 #define MPP_PCSH__ProtocolClientSocketHandle_ 1
86 #endif
87 #endif
88
89 \f
90 // Local Variables:
91 // mode: c++
92 // c-file-style: "senf"
93 // End: