X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FSocketHandle.cci;h=ec22ca325dc05341b1fd85e91837e1a8a389319e;hb=3863d46dd898b7bc35ea8c6ccd8563b18762a6b6;hp=42f2a0c4a3342b2ba9fe7dcd56fc149f063dce3e;hpb=31d85cd6b8e03c5ecc924ca8892906be1bab702f;p=senf.git diff --git a/Socket/SocketHandle.cci b/Socket/SocketHandle.cci index 42f2a0c..ec22ca3 100644 --- a/Socket/SocketHandle.cci +++ b/Socket/SocketHandle.cci @@ -1,9 +1,9 @@ // $Id$ // // Copyright (C) 2006 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) -// Stefan Bund +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY +// Stefan Bund // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -27,48 +27,51 @@ #include "SocketHandle.ih" // Custom includes -#include "Utils/Exception.hh" +#include "../Utils/senfassert.hh" +#include "../Utils/Exception.hh" #include "SocketProtocol.hh" #define prefix_ inline ///////////////////////////////cci.p/////////////////////////////////////// -prefix_ senf::SocketBody::SocketBody(std::auto_ptr protocol, - bool isServer) - : protocol_(protocol), isServer_(isServer) +prefix_ senf::SocketBody::SocketBody(bool isServer) + : isServer_(isServer) +{} + +prefix_ senf::SocketBody::SocketBody(bool isServer, int fd) + : FileBody(fd), isServer_(isServer) +{} + +prefix_ senf::SocketProtocol & senf::SocketBody::protocol() + const { - BOOST_ASSERT( ! protocol_->body_ ); - protocol_->body_ = this; + return const_cast(v_protocol()); } -prefix_ senf::SocketBody::SocketBody(std::auto_ptr protocol, - bool isServer, int fd) - : FileBody(fd), protocol_(protocol), isServer_(isServer) +prefix_ bool senf::SocketBody::isServer() { - BOOST_ASSERT( ! protocol_->body_ ); - protocol_->body_ = this; + return isServer_; } -prefix_ senf::SocketProtocol const & senf::SocketBody::protocol() +prefix_ std::auto_ptr senf::SocketBody::clone(bool isServer) const { - return *protocol_; + return protocol().clone(isServer); } -prefix_ bool senf::SocketBody::isServer() +prefix_ std::auto_ptr senf::SocketBody::clone(int fd, bool isServer) + const { - return isServer_; + return protocol().clone(fd, isServer); } /////////////////////////////////////////////////////////////////////////// -// senf::detail::ConvertibleString - -prefix_ senf::detail::ConvertibleString::ConvertibleString() -{} +// senf::detail::StreamableString -prefix_ senf::detail::ConvertibleString::ConvertibleString(bool v) - : std::string(v ? "true" : "false") -{} +prefix_ senf::detail::StreamableString & senf::detail::StreamableString::operator<<(bool v) +{ + return (*this) << std::string(v ? "true" : "false"); +} ///////////////////////////////cci.e/////////////////////////////////////// #undef prefix_ @@ -81,4 +84,5 @@ prefix_ senf::detail::ConvertibleString::ConvertibleString(bool v) // indent-tabs-mode: nil // ispell-local-dictionary: "american" // compile-command: "scons -u test" +// comment-column: 40 // End: