NEW FILE HEADER / COPYRIGHT FORMAT
[senf.git] / Socket / SocketHandle.cti
index f573e43..018620b 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 //
-// Copyright (C) 2006 
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
-//     Stefan Bund <stefan.bund@fokus.fraunhofer.de>
+// Copyright (C) 2006
+// Fraunhofer Institute for Open Communication Systems (FOKUS) 
+// Competence Center NETwork research (NET), St. Augustin, GERMANY 
+//     Stefan Bund <g0dil@berlios.de>
 //
 // 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
 // Free Software Foundation, Inc.,
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-// Definition of inline template functions
+/** \file
+    \brief SocketHandle inline template implementation
+ */
 
 #include "SocketHandle.ih"
 
 // Custom includes
 #include <typeinfo>
 #include <boost/lexical_cast.hpp>
-#include "Utils/TypeInfo.hh"
+#include "../Utils/TypeInfo.hh"
 
 #define prefix_ inline
 ///////////////////////////////cti.p///////////////////////////////////////
 
 template <class SocketPolicy>
+prefix_ senf::SocketHandle<SocketPolicy>::SocketHandle()
+{}
+
+template <class SocketPolicy>
 template <class OtherPolicy>
 prefix_ senf::SocketHandle<SocketPolicy>::SocketHandle(SocketHandle<OtherPolicy> other,
                                                               typename IsCompatible<OtherPolicy>::type *)
@@ -49,7 +55,7 @@ senf::SocketHandle<SocketPolicy>::operator=(SocketHandle<OtherPolicy> other)
 }
 
 template <class SocketPolicy>
-prefix_ 
+prefix_
 senf::SocketHandle<SocketPolicy>::SocketHandle(std::auto_ptr<SocketProtocol> protocol,
                                                       bool isServer)
     : FileHandle(std::auto_ptr<FileBody>(new SocketBody(protocol,isServer)))
@@ -104,7 +110,7 @@ senf::SocketHandle<SocketPolicy>::cast_dynamic(FileHandle handle)
 {
     // throws bad_cast if the body is not a SocketBody
     SocketBody & body (dynamic_cast<SocketBody&>(FileHandle::body(handle)));
-    // throws bad_cast if the poplicy is not compatible
+    // throws bad_cast if the policy is not compatible
     SocketPolicy::checkBaseOf(body.protocol().policy());
     return cast_static(handle);
 }
@@ -158,7 +164,12 @@ prefix_ bool senf::check_socket_cast(Source handle)
 template <class SocketPolicy>
 prefix_ void senf::SocketHandle<SocketPolicy>::state(SocketStateMap & map, unsigned lod)
 {
-    map["handle"] = prettyName(typeid(*this));
+    // We use typeid here even though the type of *this is static
+    // (SocketHandle is not polymorphic and has no vtable). This will
+    // automatically include the SocketPolicy template parameter in
+    // the type name and therefore show the \e static policy of the
+    // socket handle.
+    map["handle"] << prettyName(typeid(*this));
     body().state(map,lod);
 }
 
@@ -170,19 +181,16 @@ prefix_ std::string senf::SocketHandle<SocketPolicy>::dumpState(unsigned lod)
     return detail::dumpState(map);
 }
 
-///////////////////////////////////////////////////////////////////////////
-// senf::detail::ConvertibleString
-
-template <class T>
-prefix_ senf::detail::ConvertibleString::ConvertibleString(T const & other)
-    : std::string(boost::lexical_cast<std::string>(other))
-{}
-
 ///////////////////////////////cti.e///////////////////////////////////////
 #undef prefix_
 
 \f
 // Local Variables:
 // mode: c++
+// fill-column: 100
 // c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// comment-column: 40
 // End: