ProtocolServerSocketHandle.mpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
14 /** \file
15  \brief ssenf::ProtocolServerSocketHandle Boost.Preprocessor external iteration include
16  */
17 
18 #if !BOOST_PP_IS_ITERATING
19 #ifndef MPP_SENF_Socket_ProtocolServerSocketHandle_
20 
21 // Custom includes
22 #include <boost/preprocessor/iteration/iterate.hpp>
23 #include <boost/preprocessor/enum.hpp>
24 #include <boost/preprocessor/cat.hpp>
25 
26 //-/////////////////////////////////////////////////////////////////////////////////////////////////
27 // Local Macros
28 
29 #define mpp_PSSH_Arg(z,n,data) BOOST_PP_CAT(A,n) const & BOOST_PP_CAT(a,n)
30 
31 #define mpp_PSSH_TemplateParameters() BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A )
32 #define mpp_PSSH_MethodParameters() BOOST_PP_ENUM(BOOST_PP_ITERATION(), mpp_PSSH_Arg, )
33 #define mpp_PSSH_CallParameters() BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), a )
34 
35 //-/////////////////////////////////////////////////////////////////////////////////////////////////
36 #endif
37 #else
38 //-/////////////////////////////////////////////////////////////////////////////////////////////////
39 
40 //-/////////////////////////////////////////////////////////////////////////////////////////////////
41 #if BOOST_PP_ITERATION_FLAGS()==1
42 //-/////////////////////////////////////////////////////////////////////////////////////////////////
43 // senf::ProtocolServerSocketHandle<SocketProtocol>::
44 // ProtocolServerSocketHandle (constructor) declaration
45 
46 template < mpp_PSSH_TemplateParameters() >
47 explicit ProtocolServerSocketHandle( mpp_PSSH_MethodParameters() );
48 
49 //-/////////////////////////////////////////////////////////////////////////////////////////////////
50 #elif BOOST_PP_ITERATION_FLAGS()==2
51 //-/////////////////////////////////////////////////////////////////////////////////////////////////
52 // senf::ProtocolServerSocketHandle<SocketProtocol>::
53 // ProtocolServerSocketHandle (constructor) implementation
54 
55 template <class SocketProtocol>
56 template < mpp_PSSH_TemplateParameters() >
57 prefix_ senf::ProtocolServerSocketHandle<SocketProtocol>::
58 ProtocolServerSocketHandle( mpp_PSSH_MethodParameters() )
59  : ServerSocketHandle<typename SocketProtocol::Policy>(
60  std::auto_ptr<senf::SocketBody>(new ProtocolSocketBody<SocketProtocol>(true)))
61 {
62  this->protocol().init_server( mpp_PSSH_CallParameters() );
63 }
64 
65 //-/////////////////////////////////////////////////////////////////////////////////////////////////
66 #endif
67 #endif
68 #if !BOOST_PP_IS_ITERATING
69 #ifdef MPP_SENF_Socket_ProtocolServerSocketHandle_
70 //-/////////////////////////////////////////////////////////////////////////////////////////////////
71 // Undefine local Macros
72 
73 #undef mpp_PSSH_Arg
74 #undef mpp_PSSH_TemplateParameters
75 #undef mpp_PSSH_MethodParameters
76 #undef mpp_PSSH_CallParameters
77 
78 //-/////////////////////////////////////////////////////////////////////////////////////////////////
79 #else
80 #define MPP_SENF_Socket_ProtocolServerSocketHandle_ 1
81 #endif
82 #endif
83 
84 
85 // Local Variables:
86 // mode: c++
87 // fill-column: 100
88 // c-file-style: "senf"
89 // indent-tabs-mode: nil
90 // ispell-local-dictionary: "american"
91 // End: