From: g0dil Date: Fri, 1 Feb 2008 12:31:58 +0000 (+0000) Subject: Socket: Fix template parameter names to correct doxygen images X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=c778649a04a9835ecaad9108b9613832d76c2d15;p=senf.git Socket: Fix template parameter names to correct doxygen images git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@656 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Socket/ClientSocketHandle.ct b/Socket/ClientSocketHandle.ct index a9d78dc..4ba87e5 100644 --- a/Socket/ClientSocketHandle.ct +++ b/Socket/ClientSocketHandle.ct @@ -93,17 +93,17 @@ writeto(Handle & handle, ForwardReadableRange & range, typename Handle::Address // senf::ClientSocketHandle::read -template -prefix_ std::string senf::ClientSocketHandle::read(unsigned limit) +template +prefix_ std::string senf::ClientSocketHandle::read(unsigned limit) { std::string rv; this->read(rv,limit); return rv; } -template +template template -prefix_ void senf::ClientSocketHandle::read(Sequence & container, unsigned limit) +prefix_ void senf::ClientSocketHandle::read(Sequence & container, unsigned limit) { unsigned nread (available()); if (limit>0 && nread>limit) @@ -113,21 +113,21 @@ prefix_ void senf::ClientSocketHandle::read(Sequence & container, unsign container.end()); } -// senf::ClientSocketHandle::readfrom +// senf::ClientSocketHandle::readfrom -template -prefix_ std::pair -senf::ClientSocketHandle::readfrom(unsigned limit) +template +prefix_ std::pair +senf::ClientSocketHandle::readfrom(unsigned limit) { std::string rv; - typename Policy::AddressingPolicy::Address addr; + typename SPolicy::AddressingPolicy::Address addr; this->readfrom(rv,addr,limit); return std::make_pair(rv,addr); } -template +template template -prefix_ void senf::ClientSocketHandle::readfrom(Sequence & container, Address & from, +prefix_ void senf::ClientSocketHandle::readfrom(Sequence & container, Address & from, unsigned limit) { unsigned nread (available()); @@ -141,10 +141,10 @@ prefix_ void senf::ClientSocketHandle::readfrom(Sequence & container, Ad //////////////////////////////////////// // private members -// senf::ClientSocketHandle::available +// senf::ClientSocketHandle::available -template -prefix_ unsigned senf::ClientSocketHandle::available() +template +prefix_ unsigned senf::ClientSocketHandle::available() { unsigned nread = this->protocol().available(); if (nread == 0 && this->blocking()) { diff --git a/Socket/ClientSocketHandle.cti b/Socket/ClientSocketHandle.cti index 9a5cd7b..74f2307 100644 --- a/Socket/ClientSocketHandle.cti +++ b/Socket/ClientSocketHandle.cti @@ -97,69 +97,69 @@ writeto(Handle & handle, ForwardReadableRange & range, typename Handle::Address //////////////////////////////////////// // structors -template -prefix_ senf::ClientSocketHandle::ClientSocketHandle() +template +prefix_ senf::ClientSocketHandle::ClientSocketHandle() {} #ifndef DOXYGEN -template +template template -prefix_ senf::ClientSocketHandle:: +prefix_ senf::ClientSocketHandle:: ClientSocketHandle(ClientSocketHandle other, - typename SocketHandle::template IsCompatible::type *) - : SocketHandle(other,true) + typename SocketHandle::template IsCompatible::type *) + : SocketHandle(other,true) {} #else -template +template template -prefix_ senf::ClientSocketHandle:: +prefix_ senf::ClientSocketHandle:: ClientSocketHandle(ClientSocketHandle other) {} #endif -template -prefix_ senf::ClientSocketHandle::ClientSocketHandle(FileHandle other, bool isChecked) - : SocketHandle(other, isChecked) +template +prefix_ senf::ClientSocketHandle::ClientSocketHandle(FileHandle other, bool isChecked) + : SocketHandle(other, isChecked) {} -template +template prefix_ -senf::ClientSocketHandle::ClientSocketHandle(std::auto_ptr body) - : SocketHandle(body) +senf::ClientSocketHandle::ClientSocketHandle(std::auto_ptr body) + : SocketHandle(body) {} #ifndef DOXYGEN -template +template template -prefix_ typename senf::SocketHandle::template IsCompatible::type const & -senf::ClientSocketHandle::operator=(ClientSocketHandle other) +prefix_ typename senf::SocketHandle::template IsCompatible::type const & +senf::ClientSocketHandle::operator=(ClientSocketHandle other) { assign(other); return *this; } #else -template +template template prefix_ OtherPolicy const & -senf::ClientSocketHandle::operator=(ClientSocketHandle other) +senf::ClientSocketHandle::operator=(ClientSocketHandle other) {} #endif //////////////////////////////////////// // reading and writing -// senf::ClientSocketHandle::read +// senf::ClientSocketHandle::read #ifndef DOXYGEN -template +template template prefix_ typename boost::range_iterator::type -senf::ClientSocketHandle:: +senf::ClientSocketHandle:: read(ForwardWritableRange const & range, typename boost::disable_if< boost::is_convertible >::type *) { return detail::ReadRange< - ClientSocketHandle, + ClientSocketHandle, ForwardWritableRange const, contiguous_storage_iterator< typename boost::range_iterator::type @@ -167,24 +167,24 @@ read(ForwardWritableRange const & range, >::read(*this, range); } #else -template +template template prefix_ typename boost::range_iterator::type -senf::ClientSocketHandle:: +senf::ClientSocketHandle:: read(ForwardWritableRange const & range) {} #endif #ifndef DOXYGEN -template +template template prefix_ typename boost::range_iterator::type -senf::ClientSocketHandle:: +senf::ClientSocketHandle:: read(ForwardWritableRange & range, typename boost::disable_if< boost::is_convertible >::type *) { return detail::ReadRange< - ClientSocketHandle, + ClientSocketHandle, ForwardWritableRange, contiguous_storage_iterator< typename boost::range_iterator::type @@ -192,29 +192,29 @@ read(ForwardWritableRange & range, >::read(*this, range); } #else -template +template template prefix_ typename boost::range_iterator::type -senf::ClientSocketHandle:: +senf::ClientSocketHandle:: read(ForwardWritableRange & range) {} #endif -template -prefix_ char * senf::ClientSocketHandle::read(char * start, char * end) +template +prefix_ char * senf::ClientSocketHandle::read(char * start, char * end) { - return start + Policy::ReadPolicy::read(*this, start, end-start); + return start + SPolicy::ReadPolicy::read(*this, start, end-start); } -// senf::ClientSocketHandle::readfrom +// senf::ClientSocketHandle::readfrom -template +template template prefix_ typename boost::range_iterator::type -senf::ClientSocketHandle::readfrom(ForwardWritableRange const & range, Address & from) +senf::ClientSocketHandle::readfrom(ForwardWritableRange const & range, Address & from) { return detail::ReadRange< - ClientSocketHandle, + ClientSocketHandle, ForwardWritableRange const, contiguous_storage_iterator< typename boost::range_iterator::type @@ -222,13 +222,13 @@ senf::ClientSocketHandle::readfrom(ForwardWritableRange const & range, A >::readfrom(*this, range, from); } -template +template template prefix_ typename boost::range_iterator::type -senf::ClientSocketHandle::readfrom(ForwardWritableRange & range, Address & from) +senf::ClientSocketHandle::readfrom(ForwardWritableRange & range, Address & from) { return detail::ReadRange< - ClientSocketHandle, + ClientSocketHandle, ForwardWritableRange, contiguous_storage_iterator< typename boost::range_iterator::type @@ -236,22 +236,22 @@ senf::ClientSocketHandle::readfrom(ForwardWritableRange & range, Address >::readfrom(*this, range, from); } -template -prefix_ char * senf::ClientSocketHandle::readfrom(char * start, char * end, +template +prefix_ char * senf::ClientSocketHandle::readfrom(char * start, char * end, Address & from) { - return start + Policy::ReadPolicy::readfrom(*this, start, end-start, from); + return start + SPolicy::ReadPolicy::readfrom(*this, start, end-start, from); } -// senf::ClientSocketHandle::write +// senf::ClientSocketHandle::write -template +template template prefix_ typename boost::range_const_iterator::type -senf::ClientSocketHandle::write(ForwardReadableRange const & range) +senf::ClientSocketHandle::write(ForwardReadableRange const & range) { return detail::WriteRange< - ClientSocketHandle, + ClientSocketHandle, ForwardReadableRange const, contiguous_storage_iterator< typename boost::range_iterator::type @@ -259,21 +259,21 @@ senf::ClientSocketHandle::write(ForwardReadableRange const & range) >::write(*this, range); } -template -prefix_ char const * senf::ClientSocketHandle::write(char const * start, char const * end) +template +prefix_ char const * senf::ClientSocketHandle::write(char const * start, char const * end) { - return start + Policy::WritePolicy::write(*this, start, end-start); + return start + SPolicy::WritePolicy::write(*this, start, end-start); } -// senf::ClientSocketHandle::writeto +// senf::ClientSocketHandle::writeto -template +template template prefix_ typename boost::range_const_iterator::type -senf::ClientSocketHandle::writeto(AddressParam addr, ForwardReadableRange const & range) +senf::ClientSocketHandle::writeto(AddressParam addr, ForwardReadableRange const & range) { return detail::WriteRange< - ClientSocketHandle, + ClientSocketHandle, ForwardReadableRange const, contiguous_storage_iterator< typename boost::range_iterator::type @@ -281,85 +281,85 @@ senf::ClientSocketHandle::writeto(AddressParam addr, ForwardReadableRang >::writeto(*this, range, addr); } -template -prefix_ char const * senf::ClientSocketHandle::writeto(AddressParam addr, +template +prefix_ char const * senf::ClientSocketHandle::writeto(AddressParam addr, char const * start, char const * end) { - return start + Policy::WritePolicy::writeto(*this, addr, start, end-start); + return start + SPolicy::WritePolicy::writeto(*this, addr, start, end-start); } //////////////////////////////////////// // addressing -// senf::ClientSocketHandle::peer +// senf::ClientSocketHandle::peer -template -prefix_ typename Policy::AddressingPolicy::Address -senf::ClientSocketHandle::peer() +template +prefix_ typename SPolicy::AddressingPolicy::Address +senf::ClientSocketHandle::peer() { - typename Policy::AddressingPolicy::Address addr; + typename SPolicy::AddressingPolicy::Address addr; this->peer(addr); return addr; } -template -prefix_ void senf::ClientSocketHandle:: -peer(typename Policy::AddressingPolicy::Address & addr) +template +prefix_ void senf::ClientSocketHandle:: +peer(typename SPolicy::AddressingPolicy::Address & addr) { - Policy::AddressingPolicy::peer(*this,addr); + SPolicy::AddressingPolicy::peer(*this,addr); } -// senf::ClientSocketHandle::local +// senf::ClientSocketHandle::local -template -prefix_ typename Policy::AddressingPolicy::Address -senf::ClientSocketHandle::local() +template +prefix_ typename SPolicy::AddressingPolicy::Address +senf::ClientSocketHandle::local() { - typename Policy::AddressingPolicy::Address addr; + typename SPolicy::AddressingPolicy::Address addr; this->local(addr); return addr; } -template -prefix_ void senf::ClientSocketHandle:: -local(typename Policy::AddressingPolicy::Address & addr) +template +prefix_ void senf::ClientSocketHandle:: +local(typename SPolicy::AddressingPolicy::Address & addr) { - Policy::AddressingPolicy::local(*this,addr); + SPolicy::AddressingPolicy::local(*this,addr); } -// senf::ClientSocketHandle::connect +// senf::ClientSocketHandle::connect -template -prefix_ void senf::ClientSocketHandle::connect(AddressParam addr) +template +prefix_ void senf::ClientSocketHandle::connect(AddressParam addr) { - Policy::AddressingPolicy::connect(*this,addr); + SPolicy::AddressingPolicy::connect(*this,addr); } -// senf::ClientSocketHandle::bind +// senf::ClientSocketHandle::bind -template -prefix_ void senf::ClientSocketHandle:: -bind(typename boost::call_traits::param_type addr) +template +prefix_ void senf::ClientSocketHandle:: +bind(typename boost::call_traits::param_type addr) { - Policy::AddressingPolicy::bind(*this,addr); + SPolicy::AddressingPolicy::bind(*this,addr); } //////////////////////////////////////// // Casting -template -prefix_ senf::ClientSocketHandle -senf::ClientSocketHandle::cast_static(FileHandle handle) +template +prefix_ senf::ClientSocketHandle +senf::ClientSocketHandle::cast_static(FileHandle handle) { return ClientSocketHandle(handle, true); } -template -prefix_ senf::ClientSocketHandle -senf::ClientSocketHandle::cast_dynamic(FileHandle handle) +template +prefix_ senf::ClientSocketHandle +senf::ClientSocketHandle::cast_dynamic(FileHandle handle) { - SocketHandle h (SocketHandle::cast_dynamic(handle)); + SocketHandle h (SocketHandle::cast_dynamic(handle)); if (static_cast(FileHandle::body(h)).isServer()) throw std::bad_cast(); return cast_static(handle); @@ -368,15 +368,15 @@ senf::ClientSocketHandle::cast_dynamic(FileHandle handle) //////////////////////////////////////// // State information -template -prefix_ void senf::ClientSocketHandle::state(SocketStateMap & map, unsigned lod) +template +prefix_ void senf::ClientSocketHandle::state(SocketStateMap & map, unsigned lod) { map["handle"] = prettyName(typeid(*this)); this->body().state(map,lod); } -template -prefix_ std::string senf::ClientSocketHandle::dumpState(unsigned lod) +template +prefix_ std::string senf::ClientSocketHandle::dumpState(unsigned lod) { SocketStateMap map; state(map,lod); diff --git a/Socket/ClientSocketHandle.hh b/Socket/ClientSocketHandle.hh index 93cd252..bbae9b0 100644 --- a/Socket/ClientSocketHandle.hh +++ b/Socket/ClientSocketHandle.hh @@ -42,7 +42,7 @@ namespace senf { /// \addtogroup handle_group /// @{ - template class ServerSocketHandle; + template class ServerSocketHandle; /** \brief Generic SocketHandle with client interface @@ -85,16 +85,16 @@ namespace senf { \see \ref policy_group \n \ref protocol_group */ - template + template class ClientSocketHandle - : public SocketHandle + : public SocketHandle { public: /////////////////////////////////////////////////////////////////////////// // Types /// Address type from the addressing policy - typedef typename Policy::AddressingPolicy::Address Address; + typedef typename SPolicy::AddressingPolicy::Address Address; /// 'Best' type for passing address as parameter /** Depending on the type of \c Address, this will be either Address or Address const &. See ServerSocketHandle; + typedef ServerSocketHandle ServerSocketHandle; /////////////////////////////////////////////////////////////////////////// ///\name Structors and default members @@ -124,18 +124,18 @@ namespace senf { # ifndef DOXYGEN template ClientSocketHandle(ClientSocketHandle other, - typename SocketHandle::template IsCompatible::type * = 0); + typename SocketHandle::template IsCompatible::type * = 0); # else ClientSocketHandle(ClientSocketHandle other); # endif # ifndef DOXYGEN template - typename SocketHandle::template IsCompatible::type const & + typename SocketHandle::template IsCompatible::type const & operator=(ClientSocketHandle other); # else template - OtherPolicy const & operator=(ClientSocketHandle other); + ClientSocketHandle const & operator=(ClientSocketHandle other); # endif ///@} @@ -434,7 +434,7 @@ namespace senf { private: unsigned available(); - friend class senf::ServerSocketHandle; + friend class senf::ServerSocketHandle; }; /// @} diff --git a/Socket/CommunicationPolicy.cti b/Socket/CommunicationPolicy.cti index 3579bee..c877ff3 100644 --- a/Socket/CommunicationPolicy.cti +++ b/Socket/CommunicationPolicy.cti @@ -32,34 +32,34 @@ ///////////////////////////////cti.p/////////////////////////////////////// #ifndef DOXYGEN -template +template prefix_ void senf::ConnectedCommunicationPolicy:: -listen(ServerSocketHandle handle, unsigned backlog, - typename IfAddressingPolicyIsNot::type *) +listen(ServerSocketHandle handle, unsigned backlog, + typename IfAddressingPolicyIsNot::type *) { do_listen(handle, backlog); } #else -template +template prefix_ void senf::ConnectedCommunicationPolicy:: -listen(ServerSocketHandle handle, unsigned backlog) +listen(ServerSocketHandle handle, unsigned backlog) {} #endif #ifndef DOXYGEN -template +template prefix_ int senf::ConnectedCommunicationPolicy:: -accept(ServerSocketHandle handle, - typename ServerSocketHandle::Address & address, - typename IfAddressingPolicyIsNot::type *) +accept(ServerSocketHandle handle, + typename ServerSocketHandle::Address & address, + typename IfAddressingPolicyIsNot::type *) { return do_accept(handle,address.sockaddr_p(),address.sockaddr_len()); } #else -template +template prefix_ int senf::ConnectedCommunicationPolicy:: -accept(ServerSocketHandle handle, - typename ServerSocketHandle::Address & address) +accept(ServerSocketHandle handle, + typename ServerSocketHandle::Address & address) {} #endif diff --git a/Socket/CommunicationPolicy.hh b/Socket/CommunicationPolicy.hh index 588d735..39c0fc6 100644 --- a/Socket/CommunicationPolicy.hh +++ b/Socket/CommunicationPolicy.hh @@ -42,7 +42,7 @@ namespace senf { /// \addtogroup policy_impl_group /// @{ - template class ServerSocketHandle; + template class ServerSocketHandle; /** \brief CommunicationPolicy for connected sockets @@ -52,26 +52,26 @@ namespace senf { struct ConnectedCommunicationPolicy : public CommunicationPolicyBase { # ifndef DOXYGEN - template - static void listen(ServerSocketHandle handle, unsigned backlog, - typename IfAddressingPolicyIsNot::type * = 0); + template + static void listen(ServerSocketHandle handle, unsigned backlog, + typename IfAddressingPolicyIsNot::type * = 0); # else - template - static void listen(ServerSocketHandle handle, unsigned backlog); + template + static void listen(ServerSocketHandle handle, unsigned backlog); ///< Enable establishing new connections on the socket /**< \param[in] handle socket handle to enable reception on \param[in] backlog size of backlog queue */ # endif # ifndef DOXYGEN - template - static int accept(ServerSocketHandle handle, - typename ServerSocketHandle::Address & address, - typename IfAddressingPolicyIsNot::type * = 0); + template + static int accept(ServerSocketHandle handle, + typename ServerSocketHandle::Address & address, + typename IfAddressingPolicyIsNot::type * = 0); # else - template - static int accept(ServerSocketHandle handle, - typename ServerSocketHandle::Address & address); + template + static int accept(ServerSocketHandle handle, + typename ServerSocketHandle::Address & address); ///< accept a new connection on the socket. /**< The accept() member will return a new client file descriptor. This file descriptor will be used by the diff --git a/Socket/Protocols/GenericAddressingPolicy.cti b/Socket/Protocols/GenericAddressingPolicy.cti index 94b3e05..d003fff 100644 --- a/Socket/Protocols/GenericAddressingPolicy.cti +++ b/Socket/Protocols/GenericAddressingPolicy.cti @@ -36,42 +36,42 @@ #ifndef DOXYGEN template -template +template prefix_ void senf::GenericAddressingPolicy
:: -peer(SocketHandle handle, Address & addr, - typename IfCommunicationPolicyIs::type *) +peer(SocketHandle handle, Address & addr, + typename IfCommunicationPolicyIs::type *) { addr.clear(); do_peer(handle,addr.sockaddr_p(),addr.sockaddr_len()); } #else template -template +template prefix_ void senf::GenericAddressingPolicy
:: -peer(SocketHandle handle, Address & addr) +peer(SocketHandle handle, Address & addr) {} #endif #ifndef DOXYGEN template -template +template prefix_ void senf::GenericAddressingPolicy
:: -connect(SocketHandle handle, Address const & addr, - typename IfCommunicationPolicyIs::type *) +connect(SocketHandle handle, Address const & addr, + typename IfCommunicationPolicyIs::type *) { do_connect(handle,addr.sockaddr_p(),addr.sockaddr_len()); } #else template -template +template prefix_ void senf::GenericAddressingPolicy
:: -connect(SocketHandle handle, Address const & addr) +connect(SocketHandle handle, Address const & addr) {} #endif template prefix_ void senf::GenericAddressingPolicy
::local(FileHandle handle, - Address & addr) + Address & addr) { addr.clear(); do_local(handle,addr.sockaddr_p(),addr.sockaddr_len()); @@ -94,6 +94,6 @@ prefix_ void senf::GenericAddressingPolicy
::bind(FileHandle handle, // c-file-style: "senf" // indent-tabs-mode: nil // ispell-local-dictionary: "american" -// compile-command: "scons -u test" +// compile-command: "scons -u ../test" // comment-column: 40 // End: diff --git a/Socket/Protocols/GenericAddressingPolicy.hh b/Socket/Protocols/GenericAddressingPolicy.hh index ef35b63..c9e9cfe 100644 --- a/Socket/Protocols/GenericAddressingPolicy.hh +++ b/Socket/Protocols/GenericAddressingPolicy.hh @@ -85,12 +85,12 @@ namespace senf { : private GenericAddressingPolicy_Base { # ifndef DOXYGEN - template - static void peer(SocketHandle handle, Address & addr, - typename IfCommunicationPolicyIs::type * = 0); + template + static void peer(SocketHandle handle, Address & addr, + typename IfCommunicationPolicyIs::type * = 0); # else - template - static void peer(SocketHandle handle, Address & addr); + template + static void peer(SocketHandle handle, Address & addr); ///< Return address of remote peer on connected sockets /**< This member is only available if the socket handles communication policy is ConnectedCommunicationPolicy. @@ -104,12 +104,12 @@ namespace senf { \param[out] addr local socket address */ # ifndef DOXYGEN - template - static void connect(SocketHandle handle, Address const & addr, - typename IfCommunicationPolicyIs::type * = 0); + template + static void connect(SocketHandle handle, Address const & addr, + typename IfCommunicationPolicyIs::type * = 0); # else - template - static void connect(SocketHandle handle, Address const & addr); + template + static void connect(SocketHandle handle, Address const & addr); ///< Connect to remote host /**< This member is only available if the socket handles communication policy is ConnectedCommunicationPolicy. @@ -142,6 +142,6 @@ namespace senf { // c-file-style: "senf" // indent-tabs-mode: nil // ispell-local-dictionary: "american" -// compile-command: "scons -u test" +// compile-command: "scons -u ../test" // comment-column: 40 // End: diff --git a/Socket/ReadWritePolicy.cti b/Socket/ReadWritePolicy.cti index 40e5410..4f71d4a 100644 --- a/Socket/ReadWritePolicy.cti +++ b/Socket/ReadWritePolicy.cti @@ -32,51 +32,51 @@ ///////////////////////////////cti.p/////////////////////////////////////// #ifndef DOXYGEN -template +template prefix_ unsigned senf::ReadablePolicy:: -readfrom(ClientSocketHandle handle, char * buffer, unsigned size, - typename Policy::AddressingPolicy::Address & address, - typename IfCommunicationPolicyIs::type *) +readfrom(ClientSocketHandle handle, char * buffer, unsigned size, + typename SPolicy::AddressingPolicy::Address & address, + typename IfCommunicationPolicyIs::type *) { return do_rcvfrom(handle, buffer, size, address.sockaddr_p(), address.sockaddr_len()); } #else -template +template prefix_ unsigned senf::ReadablePolicy:: -readfrom(ClientSocketHandle handle, char * buffer, unsigned size, +readfrom(ClientSocketHandle handle, char * buffer, unsigned size, typename Policy::AddressingPolicy::Address & address) {} #endif #ifndef DOXYGEN -template +template prefix_ unsigned senf::WriteablePolicy:: -write(ClientSocketHandle handle, char const * buffer, unsigned size, - typename IfCommunicationPolicyIs::type *) +write(ClientSocketHandle handle, char const * buffer, unsigned size, + typename IfCommunicationPolicyIs::type *) { return do_write(handle,buffer,size); } #else -template +template prefix_ unsigned senf::WriteablePolicy:: -write(ClientSocketHandle handle, char const * buffer, unsigned size) +write(ClientSocketHandle handle, char const * buffer, unsigned size) {} #endif #ifndef DOXYGEN -template +template prefix_ unsigned senf::WriteablePolicy:: -writeto(ClientSocketHandle handle, - typename boost::call_traits::param_type addr, +writeto(ClientSocketHandle handle, + typename boost::call_traits::param_type addr, char const * buffer, unsigned size, - typename IfCommunicationPolicyIs::type *) + typename IfCommunicationPolicyIs::type *) { return do_writeto(handle, buffer, size, addr.sockaddr_p(), addr.sockaddr_len()); } #else -template +template prefix_ unsigned senf::WriteablePolicy:: -writeto(ClientSocketHandle handle, +writeto(ClientSocketHandle handle, typename Policy::AddressingPolicy::Address const & addr, char const * buffer, unsigned size) {} diff --git a/Socket/ReadWritePolicy.hh b/Socket/ReadWritePolicy.hh index c173abc..c324e67 100644 --- a/Socket/ReadWritePolicy.hh +++ b/Socket/ReadWritePolicy.hh @@ -59,14 +59,14 @@ namespace senf { \param[in] size size of buffer \returns number of bytes read */ # ifndef DOXYGEN - template - static unsigned readfrom(ClientSocketHandle handle, char * buffer, unsigned size, - typename Policy::AddressingPolicy::Address & address, + template + static unsigned readfrom(ClientSocketHandle handle, char * buffer, unsigned size, + typename SPolicy::AddressingPolicy::Address & address, typename IfCommunicationPolicyIs< - Policy,UnconnectedCommunicationPolicy>::type * = 0); + SPolicy,UnconnectedCommunicationPolicy>::type * = 0); # else - template - static unsigned readfrom(ClientSocketHandle handle, char * buffer, unsigned size, + template + static unsigned readfrom(ClientSocketHandle handle, char * buffer, unsigned size, typename Policy::AddressingPolicy::Address & address); ///< read data from socket returning peer address /**< \param[in] handle socket handle to read from @@ -98,13 +98,13 @@ namespace senf { struct WriteablePolicy : public WritePolicyBase { # ifndef DOXYGEN - template - static unsigned write(ClientSocketHandle handle, char const * buffer, unsigned size, + template + static unsigned write(ClientSocketHandle handle, char const * buffer, unsigned size, typename IfCommunicationPolicyIs< - Policy,ConnectedCommunicationPolicy>::type * = 0); + SPolicy,ConnectedCommunicationPolicy>::type * = 0); # else - template - static unsigned write(ClientSocketHandle handle, char const * buffer, + template + static unsigned write(ClientSocketHandle handle, char const * buffer, unsigned size); ///< write data to socket /**< This member is only enabled if the socket uses @@ -118,16 +118,16 @@ namespace senf { \returns number of bytes written */ # endif # ifndef DOXYGEN - template - static unsigned writeto(ClientSocketHandle handle, + template + static unsigned writeto(ClientSocketHandle handle, typename boost::call_traits< - typename Policy::AddressingPolicy::Address>::param_type addr, + typename SPolicy::AddressingPolicy::Address>::param_type addr, char const * buffer, unsigned size, typename IfCommunicationPolicyIs< - Policy,UnconnectedCommunicationPolicy>::type * = 0); + SPolicy,UnconnectedCommunicationPolicy>::type * = 0); # else - template - static unsigned writeto(ClientSocketHandle handle, + template + static unsigned writeto(ClientSocketHandle handle, typename Policy::AddressingPolicy::Address const & addr, char const * buffer, unsigned size); ///< write data to socket sending to given peer diff --git a/Socket/ServerSocketHandle.cti b/Socket/ServerSocketHandle.cti index e0e133f..29e1541 100644 --- a/Socket/ServerSocketHandle.cti +++ b/Socket/ServerSocketHandle.cti @@ -34,28 +34,28 @@ #define prefix_ inline ///////////////////////////////cti.p/////////////////////////////////////// -template -prefix_ senf::ServerSocketHandle::ServerSocketHandle() +template +prefix_ senf::ServerSocketHandle::ServerSocketHandle() {} -template +template template -prefix_ senf::ServerSocketHandle:: +prefix_ senf::ServerSocketHandle:: ServerSocketHandle(ServerSocketHandle other, - typename SocketHandle::template IsCompatible::type *) - : SocketHandle(other,true) + typename SocketHandle::template IsCompatible::type *) + : SocketHandle(other,true) {} -template -prefix_ senf::ServerSocketHandle:: +template +prefix_ senf::ServerSocketHandle:: ServerSocketHandle(std::auto_ptr body) - : SocketHandle(body) + : SocketHandle(body) {} -template +template template -prefix_ typename senf::SocketHandle::template IsCompatible::type const & -senf::ServerSocketHandle::operator=(ServerSocketHandle other) +prefix_ typename senf::SocketHandle::template IsCompatible::type const & +senf::ServerSocketHandle::operator=(ServerSocketHandle other) { assign(other); return *this; @@ -64,45 +64,45 @@ senf::ServerSocketHandle::operator=(ServerSocketHandle -prefix_ void senf::ServerSocketHandle::bind(AddressParam addr) +template +prefix_ void senf::ServerSocketHandle::bind(AddressParam addr) { - Policy::AddressingPolicy::bind(*this,addr); + SPolicy::AddressingPolicy::bind(*this,addr); } -template -prefix_ void senf::ServerSocketHandle::listen(unsigned backlog) +template +prefix_ void senf::ServerSocketHandle::listen(unsigned backlog) { - Policy::CommunicationPolicy::listen(*this,backlog); + SPolicy::CommunicationPolicy::listen(*this,backlog); } -template -prefix_ typename senf::ServerSocketHandle::Address -senf::ServerSocketHandle::local() +template +prefix_ typename senf::ServerSocketHandle::Address +senf::ServerSocketHandle::local() { - typename Policy::AddressingPolicy::Address addr; + typename SPolicy::AddressingPolicy::Address addr; this->local(addr); return addr; } -template -prefix_ void senf::ServerSocketHandle::local(Address & addr) +template +prefix_ void senf::ServerSocketHandle::local(Address & addr) { - Policy::AddressingPolicy::local(*this,addr); + SPolicy::AddressingPolicy::local(*this,addr); } -template -prefix_ typename senf::ServerSocketHandle::ClientSocketHandle -senf::ServerSocketHandle::accept() +template +prefix_ typename senf::ServerSocketHandle::ClientSocketHandle +senf::ServerSocketHandle::accept() { return ClientSocketHandle(this->body().clone( - Policy::CommunicationPolicy::accept(*this), false)); + SPolicy::CommunicationPolicy::accept(*this), false)); } -template -prefix_ std::pair::ClientSocketHandle, - typename senf::ServerSocketHandle::Address> -senf::ServerSocketHandle::acceptfrom() +template +prefix_ std::pair::ClientSocketHandle, + typename senf::ServerSocketHandle::Address> +senf::ServerSocketHandle::acceptfrom() { Address address; @@ -110,48 +110,48 @@ senf::ServerSocketHandle::acceptfrom() return std::make_pair(handle,address); } -template -prefix_ typename senf::ServerSocketHandle::ClientSocketHandle -senf::ServerSocketHandle::acceptfrom(Address & addr) +template +prefix_ typename senf::ServerSocketHandle::ClientSocketHandle +senf::ServerSocketHandle::acceptfrom(Address & addr) { return ClientSocketHandle(this->protocol().clone(), - Policy::CommunicationPolicy::accept(*this,addr)); + SPolicy::CommunicationPolicy::accept(*this,addr)); } /////////////////////////////////////////////////////////////////////////// -template -prefix_ senf::ServerSocketHandle::ServerSocketHandle(FileHandle other, +template +prefix_ senf::ServerSocketHandle::ServerSocketHandle(FileHandle other, bool isChecked) - : SocketHandle(other, isChecked) + : SocketHandle(other, isChecked) {} -template -prefix_ senf::ServerSocketHandle -senf::ServerSocketHandle::cast_static(FileHandle handle) +template +prefix_ senf::ServerSocketHandle +senf::ServerSocketHandle::cast_static(FileHandle handle) { return ServerSocketHandle(handle,true); } -template -prefix_ senf::ServerSocketHandle -senf::ServerSocketHandle::cast_dynamic(FileHandle handle) +template +prefix_ senf::ServerSocketHandle +senf::ServerSocketHandle::cast_dynamic(FileHandle handle) { - SocketHandle h (SocketHandle::cast_dynamic(handle)); + SocketHandle h (SocketHandle::cast_dynamic(handle)); if (! static_cast(FileHandle::body(handle)).isServer()) throw std::bad_cast(); return cast_static(handle); } -template -prefix_ void senf::ServerSocketHandle::state(SocketStateMap & map, unsigned lod) +template +prefix_ void senf::ServerSocketHandle::state(SocketStateMap & map, unsigned lod) { map["handle"] = prettyName(typeid(*this)); this->body().state(map,lod); } -template -prefix_ std::string senf::ServerSocketHandle::dumpState(unsigned lod) +template +prefix_ std::string senf::ServerSocketHandle::dumpState(unsigned lod) { SocketStateMap map; state(map,lod); diff --git a/Socket/ServerSocketHandle.hh b/Socket/ServerSocketHandle.hh index 68f29b0..a123698 100644 --- a/Socket/ServerSocketHandle.hh +++ b/Socket/ServerSocketHandle.hh @@ -42,7 +42,7 @@ namespace senf { /// \addtogroup handle_group /// @{ - template class ClientSocketHandle; + template class ClientSocketHandle; /** \brief Generic SocketHandle with server interface @@ -72,16 +72,16 @@ namespace senf { classes. You can also find a summary of all members available in the leaf protocol class documentation. */ - template + template class ServerSocketHandle - : public SocketHandle + : public SocketHandle { public: /////////////////////////////////////////////////////////////////////////// // Types /// Address type from the addressing policy - typedef typename Policy::AddressingPolicy::Address Address; + typedef typename SPolicy::AddressingPolicy::Address Address; /// 'Best' type for passing address as parameter /** Depending on the type of \c Address, this will be either Address or Address const &. See ::param_type AddressParam; /// Corresponding client socket handle with the same policy - typedef ClientSocketHandle ClientSocketHandle; + typedef ClientSocketHandle ClientSocketHandle; /////////////////////////////////////////////////////////////////////////// ///\name Structors and default members @@ -107,10 +107,10 @@ namespace senf { // conversion constructors template ServerSocketHandle(ServerSocketHandle other, - typename SocketHandle::template IsCompatible::type * = 0); + typename SocketHandle::template IsCompatible::type * = 0); template - typename SocketHandle::template IsCompatible::type const & + typename SocketHandle::template IsCompatible::type const & operator=(ServerSocketHandle other); ///@} diff --git a/Socket/SocketHandle.cc b/Socket/SocketHandle.cc index 042d267..afd1d89 100644 --- a/Socket/SocketHandle.cc +++ b/Socket/SocketHandle.cc @@ -85,13 +85,6 @@ prefix_ std::string senf::detail::dumpState(SocketStateMap const & map) return s.str(); } -template -prefix_ std::ostream & senf::operator<<(std::ostream & os, SocketHandle handle) -{ - os << handle.dumpState(); - return os; -} - ///////////////////////////////cc.e//////////////////////////////////////// #undef prefix_ //#include "SocketHandle.mpp" diff --git a/Socket/SocketHandle.cti b/Socket/SocketHandle.cti index 983c5a5..f059c56 100644 --- a/Socket/SocketHandle.cti +++ b/Socket/SocketHandle.cti @@ -36,85 +36,85 @@ ///////////////////////////////cti.p/////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// -// senf::SocketHandle +// senf::SocketHandle -template -prefix_ senf::SocketHandle::SocketHandle() +template +prefix_ senf::SocketHandle::SocketHandle() {} -template +template template -prefix_ senf::SocketHandle::SocketHandle(SocketHandle other, +prefix_ senf::SocketHandle::SocketHandle(SocketHandle other, typename IsCompatible::type *) : FileHandle(other) {} -template +template template -prefix_ typename senf::SocketHandle::template IsCompatible::type const & -senf::SocketHandle::operator=(SocketHandle other) +prefix_ typename senf::SocketHandle::template IsCompatible::type const & +senf::SocketHandle::operator=(SocketHandle other) { assign(other); return *this; } -template +template prefix_ -senf::SocketHandle::SocketHandle(std::auto_ptr body) +senf::SocketHandle::SocketHandle(std::auto_ptr body) : FileHandle(std::auto_ptr(body.release())) {} -template -prefix_ senf::SocketHandle::SocketHandle(FileHandle other, bool isChecked) +template +prefix_ senf::SocketHandle::SocketHandle(FileHandle other, bool isChecked) : FileHandle(other) { SENF_ASSERT( isChecked ); SENF_ASSERT( dynamic_cast(&FileHandle::body()) ); } -template -prefix_ senf::SocketBody & senf::SocketHandle::body() +template +prefix_ senf::SocketBody & senf::SocketHandle::body() { SENF_ASSERT( dynamic_cast(&FileHandle::body()) ); return static_cast(FileHandle::body()); } -template -prefix_ senf::SocketBody const & senf::SocketHandle::body() +template +prefix_ senf::SocketBody const & senf::SocketHandle::body() const { SENF_ASSERT( dynamic_cast(&FileHandle::body()) ); return static_cast(FileHandle::body()); } -template -prefix_ senf::SocketProtocol const & senf::SocketHandle::protocol() +template +prefix_ senf::SocketProtocol const & senf::SocketHandle::protocol() const { return body().protocol(); } -template -prefix_ void senf::SocketHandle::assign(FileHandle other) +template +prefix_ void senf::SocketHandle::assign(FileHandle other) { FileHandle::operator=(other); } -template -prefix_ senf::SocketHandle -senf::SocketHandle::cast_static(FileHandle handle) +template +prefix_ senf::SocketHandle +senf::SocketHandle::cast_static(FileHandle handle) { return SocketHandle(handle,true); } -template -prefix_ senf::SocketHandle -senf::SocketHandle::cast_dynamic(FileHandle handle) +template +prefix_ senf::SocketHandle +senf::SocketHandle::cast_dynamic(FileHandle handle) { // throws bad_cast if the body is not a SocketBody SocketBody & body (dynamic_cast(FileHandle::body(handle))); // throws bad_cast if the policy is not compatible - SocketPolicy::checkBaseOf(body.protocol().policy()); + SPolicy::checkBaseOf(body.protocol().policy()); return cast_static(handle); } @@ -164,8 +164,8 @@ prefix_ bool senf::check_socket_cast(Source handle) return true; } -template -prefix_ void senf::SocketHandle::state(SocketStateMap & map, unsigned lod) +template +prefix_ void senf::SocketHandle::state(SocketStateMap & map, unsigned lod) { // We use typeid here even though the type of *this is static // (SocketHandle is not polymorphic and has no vtable). This will @@ -176,8 +176,8 @@ prefix_ void senf::SocketHandle::state(SocketStateMap & map, unsig body().state(map,lod); } -template -prefix_ std::string senf::SocketHandle::dumpState(unsigned lod) +template +prefix_ std::string senf::SocketHandle::dumpState(unsigned lod) { SocketStateMap map; state(map,lod); @@ -197,6 +197,15 @@ prefix_ senf::ProtocolSocketBody::ProtocolSocketBody(bool isServer, i : SocketBody(isServer, fd) {} +/////////////////////////////////////////////////////////////////////////// + +template +prefix_ std::ostream & senf::operator<<(std::ostream & os, SocketHandle handle) +{ + os << handle.dumpState(); + return os; +} + ///////////////////////////////cti.e/////////////////////////////////////// #undef prefix_ diff --git a/Socket/SocketHandle.hh b/Socket/SocketHandle.hh index 85a14b6..7b64f53 100644 --- a/Socket/SocketHandle.hh +++ b/Socket/SocketHandle.hh @@ -63,7 +63,7 @@ namespace senf { \todo Create a SocketHandleBase class and move some non-Policy dependent code there */ - template + template class SocketHandle : public FileHandle { @@ -71,7 +71,7 @@ namespace senf { /////////////////////////////////////////////////////////////////////////// // Types - typedef SocketPolicy Policy; + typedef SPolicy Policy; /** \brief Check policy compatibility @@ -81,8 +81,7 @@ namespace senf { */ template struct IsCompatible - : public boost::enable_if< SocketPolicyIsBaseOf, - SocketHandle > + : public boost::enable_if< SocketPolicyIsBaseOf, SocketHandle > {}; /////////////////////////////////////////////////////////////////////////// @@ -200,8 +199,8 @@ namespace senf { \related senf::SocketHandle */ - template - std::ostream & operator<<(std::ostream & os, SocketHandle handle); + template + std::ostream & operator<<(std::ostream & os, SocketHandle handle); /** \brief static socket (down-)cast diff --git a/Socket/SocketPolicy.hh b/Socket/SocketPolicy.hh index b9070f2..fbb2980 100644 --- a/Socket/SocketPolicy.hh +++ b/Socket/SocketPolicy.hh @@ -207,10 +207,10 @@ \code struct ExampleAddressingPolicy { - template - void connect(senf::SocketHandle handle, Address & addr, + template + void connect(senf::SocketHandle handle, Address & addr, typename senf::IfCommmunicationPolicyIs< - Policy, senf::ConnectedCommunicationPolicy>::type * = 0); + SPolicy, senf::ConnectedCommunicationPolicy>::type * = 0); }; \endcode diff --git a/Socket/SocketPolicy.test.cc b/Socket/SocketPolicy.test.cc index 0a99bdf..2bcb149 100644 --- a/Socket/SocketPolicy.test.cc +++ b/Socket/SocketPolicy.test.cc @@ -56,7 +56,7 @@ namespace { struct WritablePolicy : public WritePolicyBase {}; struct UnwritablePolicy : public WritePolicyBase {}; - template + template struct ConvertibleValue { ConvertibleValue() {} @@ -64,14 +64,14 @@ namespace { template ConvertibleValue(ConvertibleValue const & other, - typename boost::enable_if< SocketPolicyIsBaseOf >::type * = 0) + typename boost::enable_if< SocketPolicyIsBaseOf >::type * = 0) {} ConvertibleValue const & operator=(ConvertibleValue const & other) { return *this; } template - typename boost::enable_if< SocketPolicyIsBaseOf, + typename boost::enable_if< SocketPolicyIsBaseOf, ConvertibleValue >::type const & operator=(ConvertibleValue const & other) { return *this; } diff --git a/Socket/SocketProtocol.hh b/Socket/SocketProtocol.hh index 5a25dd7..52f8195 100644 --- a/Socket/SocketProtocol.hh +++ b/Socket/SocketProtocol.hh @@ -251,8 +251,8 @@ namespace senf { friend class SocketBody; }; - template class ClientSocketHandle; - template class ServerSocketHandle; + template class ClientSocketHandle; + template class ServerSocketHandle; /** \brief Concrete Socket Protocol implementation base class