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
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
15 \brief Policy Framework non-inline template implemenation
18 #include "SocketPolicy.ih"
21 #include <senf/Utils/Exception.hh>
22 #include "senf/Utils/IgnoreValue.hh"
25 //-/////////////////////////////////////////////////////////////////////////////////////////////////
27 #define SP_TemplateArgs(x1,x2,n,SomePolicy) BOOST_PP_COMMA_IF(n) class BOOST_PP_CAT(SomePolicy,_)
28 #define SP_TemplateParams(x1,x2,n,SomePolicy) BOOST_PP_COMMA_IF(n) BOOST_PP_CAT(SomePolicy,_)
30 template < BOOST_PP_SEQ_FOR_EACH_I( SP_TemplateArgs, , SENF_SOCKET_POLICIES ) >
31 prefix_ void senf::SocketPolicy< BOOST_PP_SEQ_FOR_EACH_I( SP_TemplateParams, , SENF_SOCKET_POLICIES ) >::
32 checkBaseOf(SocketPolicyBase const & other)
34 // check, wether each policy of other is (dynamically!) convertible
35 // to the corresponding (static) policy of this class. Throws
36 // std::bad_cast on failure
38 # define SP_CheckPolicy(x1,x2,SomePolicy) \
39 senf::IGNORE( dynamic_cast<BOOST_PP_CAT(SomePolicy,_) const &>( \
40 other.BOOST_PP_CAT(the,SomePolicy)()) );
43 BOOST_PP_SEQ_FOR_EACH( SP_CheckPolicy, , SENF_SOCKET_POLICIES )
45 SENF_WRAP_EXC_MSG(std::bad_cast, "in SP_CheckPolicy")
47 # undef SP_CheckPolicy
50 #undef SP_TemplateArgs
51 #undef SP_TemplateParams
53 //-/////////////////////////////////////////////////////////////////////////////////////////////////
60 // c-file-style: "senf"
61 // indent-tabs-mode: nil
62 // ispell-local-dictionary: "american"
63 // compile-command: "scons -u test"