X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FSocketHandle.hh;h=36cac8c4badc008341cb01bdd9e3a64bbd3bb575;hb=532240d72e09e19e57fac9bb55c2560b9c9e5b97;hp=6cb2c4be387a76856539bdca5d67bdb345e028a7;hpb=85ab07d100a382467a42e19d741d403a7a96c951;p=senf.git diff --git a/Socket/SocketHandle.hh b/Socket/SocketHandle.hh index 6cb2c4b..36cac8c 100644 --- a/Socket/SocketHandle.hh +++ b/Socket/SocketHandle.hh @@ -1,9 +1,9 @@ -// $Id$ +// $Id:SocketHandle.hh 218 2007-03-20 14:39:32Z tho $ // // 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 @@ -24,18 +24,18 @@ \brief SocketHandle public header */ -#ifndef HH_SocketHandle_ -#define HH_SocketHandle_ 1 +#ifndef HH_SENF_Socket_SocketHandle_ +#define HH_SENF_Socket_SocketHandle_ 1 + +//#include "SocketHandle.mpp" +#include "SocketHandle.ih" // Custom includes #include // std::auto_ptr #include "FileHandle.hh" #include "SocketPolicy.hh" -//#include "SocketHandle.mpp" -#include "SocketHandle.ih" ///////////////////////////////hh.p//////////////////////////////////////// -#include "SocketHandle.ih" namespace senf { @@ -44,26 +44,28 @@ namespace senf { /** \brief basic SocketHandle supporting protocol and policy abstraction - The senf::SocketHandle class introduces the two abstraction layers of the socket + The %senf::SocketHandle class introduces the two abstraction layers of the socket library. senf::SocketHandle does \e not provide socket functions it only provides the infrastructure necessary to support both, the protocol and the policy interface. - senf::SocketHandle takes the socket policy as a template argument. senf::SocketHandle also + %SocketHandle takes the socket policy as a template argument. %SocketHandle also introduces the protocol class. However, the class has no public constructors (see the derived classes senf::ProtocolClientSocketHandle and senf::ProtocolServerSocketHandle). - The most important functionality provided by senf::SocketHandle is the conversion + The most important functionality provided by %SocketHandle is the conversion constructor. This allows to implicitly convert between compatible socket handle types as specified by the socket policy. The conversion constructor is defined in such a way, that only valid conversions are possible (see the implementation source for a more complete discussion). + \tparam SPolicy socket policy + \note This class is \e not meant to be used as a base-class outside the library implementation; The protected interface is for internal use only. \todo Create a SocketHandleBase class and move some non-Policy dependent code there */ - template + template class SocketHandle : public FileHandle { @@ -71,7 +73,7 @@ namespace senf { /////////////////////////////////////////////////////////////////////////// // Types - typedef SocketPolicy Policy; + typedef SPolicy Policy; /** \brief Check policy compatibility @@ -81,18 +83,21 @@ namespace senf { */ template struct IsCompatible - : public boost::enable_if< SocketPolicyIsBaseOf, - SocketHandle > + : public boost::enable_if< SocketPolicyIsBaseOf, SocketHandle > {}; /////////////////////////////////////////////////////////////////////////// ///\name Structors and default members ///@{ + // default default constructor // default copy constructor // default copy assignment // default destructor + // here to implement + SocketHandle(); + // conversion constructors template @@ -112,7 +117,7 @@ namespace senf { void state(SocketStateMap & map, unsigned lod=0); ///< Inquire state information of socket handle /**< The map argument (a string to string mapping) will be - filled with information coverning the current state of + filled with information covering the current state of the socket. The information provided depends on the socket protocol. The amount of information returned can be controlled using the \p lod value. @@ -122,8 +127,8 @@ namespace senf { \param map string to string mapping to be filled with state information - \param lod level of detail requesten. The interpretation - of this value is protocol specific + \param lod level of %detail requested. The + interpretation of this value is protocol specific \implementation This member will be re-implemented in every derived class. This is very important since @@ -135,12 +140,25 @@ namespace senf { /**< Formats the complete state map value and returns it as a single multi-line string. + \param lod level of %detail requested. The + interpretation of this value is protocol specific + \implementation This member will be re-implemented in every derived class. See the state() documentation. */ + template + Facet & facet(); ///< Access a protocol facet + /**< This member will try to access the given protocol facet + of the socket. If \a Facet is a valid facet of the + protocol, it is returned, otherwise \c std::bad_cast + will be thrown. + \throws std::bad_cast if \a Facet is not a protocol + facet of this socket + \returns the \a Facet protocol facet of this socket */ + protected: - explicit SocketHandle(std::auto_ptr protocol, bool isServer); + explicit SocketHandle(std::auto_ptr body); ///< Initialize SocketHandle providing the protocol /**< \param protocol Protocol class of the protocol implemented by this socket handle @@ -162,8 +180,7 @@ namespace senf { \param isChecked has to be \c true \todo Answer, why the heck I need the \c isChecked - parameter ?? - */ + parameter ?? */ SocketBody & body(); ///< Access socket body /**< This member replaces the corresponding FileHandle @@ -173,7 +190,7 @@ namespace senf { /**< This member replaces the corresponding FileHandle member and returns an appropriately cast body reference */ - SocketProtocol const & protocol() const; + SocketProtocol & protocol() const; ///< Access protocol class void assign(FileHandle other); /**< \internal */ @@ -194,8 +211,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 @@ -231,7 +248,7 @@ namespace senf { /** \brief dynamically check cast validity - This function will check, wether the given cast is valid. This is the same as checking, that + This function will check, whether the given cast is valid. This is the same as checking, that dynamic_socket_cast does not throw. This member is needed, since there is no 'null' SocketHandle (comparable to a null pointer) @@ -258,4 +275,6 @@ namespace senf { // c-file-style: "senf" // indent-tabs-mode: nil // ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// comment-column: 40 // End: