00001 // $Id: SocketPolicy.ct 1742 2010-11-04 14:51:56Z g0dil $ 00002 // 00003 // Copyright (C) 2006 00004 // Fraunhofer (FOKUS) 00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY 00006 // Stefan Bund <g0dil@berlios.de> 00007 // 00008 // This program is free software; you can redistribute it and/or modify 00009 // it under the terms of the GNU General Public License as published by 00010 // the Free Software Foundation; either version 2 of the License, or 00011 // (at your option) any later version. 00012 // 00013 // This program is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 // GNU General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU General Public License 00019 // along with this program; if not, write to the 00020 // Free Software Foundation, Inc., 00021 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00022 00027 #include "SocketPolicy.ih" 00028 00029 // Custom includes 00030 #include <senf/Utils/Exception.hh> 00031 #include "senf/Utils/IgnoreValue.hh" 00032 00033 #define prefix_ 00034 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00035 00036 #define SP_TemplateArgs(x1,x2,n,SomePolicy) BOOST_PP_COMMA_IF(n) class BOOST_PP_CAT(SomePolicy,_) 00037 #define SP_TemplateParams(x1,x2,n,SomePolicy) BOOST_PP_COMMA_IF(n) BOOST_PP_CAT(SomePolicy,_) 00038 00039 template < BOOST_PP_SEQ_FOR_EACH_I( SP_TemplateArgs, , SENF_SOCKET_POLICIES ) > 00040 prefix_ void senf::SocketPolicy< BOOST_PP_SEQ_FOR_EACH_I( SP_TemplateParams, , SENF_SOCKET_POLICIES ) >:: 00041 checkBaseOf(SocketPolicyBase const & other) 00042 { 00043 // check, wether each policy of other is (dynamically!) convertible 00044 // to the corresponding (static) policy of this class. Throws 00045 // std::bad_cast on failure 00046 00047 # define SP_CheckPolicy(x1,x2,SomePolicy) \ 00048 senf::IGNORE( dynamic_cast<BOOST_PP_CAT(SomePolicy,_) const &>( \ 00049 other.BOOST_PP_CAT(the,SomePolicy)()) ); 00050 00051 try { 00052 BOOST_PP_SEQ_FOR_EACH( SP_CheckPolicy, , SENF_SOCKET_POLICIES ) 00053 } 00054 SENF_WRAP_EXC(std::bad_cast) 00055 00056 # undef SP_CheckPolicy 00057 } 00058 00059 #undef SP_TemplateArgs 00060 #undef SP_TemplateParams 00061 00062 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00063 #undef prefix_ 00064 00065 00066 // Local Variables: 00067 // mode: c++ 00068 // fill-column: 100 00069 // c-file-style: "senf" 00070 // indent-tabs-mode: nil 00071 // ispell-local-dictionary: "american" 00072 // compile-command: "scons -u test" 00073 // comment-column: 40 00074 // End: