X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FSocketHandle.cti;h=310dfddccb3cb7bd04274b358bf578d815625718;hb=fd3a0e8ac95d1158e9ea661ddf9187b67c70169f;hp=39b32734aa07196df15eee2ac2306b701a58ed0e;hpb=d2459b6c8249291588fd3d0d125ed3d38e003b55;p=senf.git diff --git a/Socket/SocketHandle.cti b/Socket/SocketHandle.cti index 39b3273..310dfdd 100644 --- a/Socket/SocketHandle.cti +++ b/Socket/SocketHandle.cti @@ -27,9 +27,8 @@ #include "SocketHandle.ih" // Custom includes -#include "../Utils/senfassert.hh" #include -#include +#include "../Utils/senfassert.hh" #include "../Utils/TypeInfo.hh" #define prefix_ inline @@ -69,7 +68,7 @@ prefix_ senf::SocketHandle::SocketHandle(FileHandle other, bool isCheck : FileHandle(other) { SENF_ASSERT( isChecked ); - SENF_ASSERT( dynamic_cast(&FileHandle::body()) ); + SENF_ASSERT( ! valid() || dynamic_cast(&FileHandle::body()) ); } template @@ -88,7 +87,7 @@ prefix_ senf::SocketBody const & senf::SocketHandle::body() } template -prefix_ senf::SocketProtocol const & senf::SocketHandle::protocol() +prefix_ senf::SocketProtocol & senf::SocketHandle::protocol() const { return body().protocol(); @@ -133,11 +132,11 @@ prefix_ Target senf::static_socket_cast(Source handle) template prefix_ Target senf::dynamic_socket_cast(Source handle) { - BOOST_STATIC_ASSERT(( - boost::is_convertible::value && - boost::is_convertible::value && - ( boost::is_convertible::value || - boost::is_convertible::value ) )); +// BOOST_STATIC_ASSERT(( +// boost::is_convertible::value && +// boost::is_convertible::value && +// ( boost::is_convertible::value || +// boost::is_convertible::value ) )); try { return Target::cast_dynamic(handle); } @@ -147,11 +146,11 @@ prefix_ Target senf::dynamic_socket_cast(Source handle) template prefix_ bool senf::check_socket_cast(Source handle) { - BOOST_STATIC_ASSERT(( - boost::is_convertible::value && - boost::is_convertible::value && - ( boost::is_convertible::value || - boost::is_convertible::value ) )); +// BOOST_STATIC_ASSERT(( +// boost::is_convertible::value && +// boost::is_convertible::value && +// ( boost::is_convertible::value || +// boost::is_convertible::value ) )); // we don't have a non-throwing variant of cast_dynamic // for two reasons: // a) since the handle is passed back by value, we cannot return @@ -187,6 +186,17 @@ prefix_ std::string senf::SocketHandle::dumpState(unsigned lod) return detail::dumpState(map); } +template +template +prefix_ Facet & senf::SocketHandle::facet() + +{ + try { + return dynamic_cast(protocol()); + } + SENF_WRAP_EXC(std::bad_cast) +} + /////////////////////////////////////////////////////////////////////////// // senf::ProtocolSocketBody