PPI: introduced SENF_PPI_NOTRACE define
tho [Mon, 2 Aug 2010 12:34:03 +0000 (12:34 +0000)]
Socket,PPI: pass handle parameter by reference

git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1655 270642c3-0616-0410-b53a-bc976706d245

25 files changed:
.project
SConstruct
senf/PPI/Connectors.cc
senf/PPI/Connectors.cci
senf/PPI/QueueingSocketSink.ct
senf/PPI/QueueingSocketSink.cti
senf/PPI/QueueingSocketSink.hh
senf/PPI/SocketSink.cc
senf/PPI/SocketSink.cci
senf/PPI/SocketSink.ct
senf/PPI/SocketSink.cti
senf/PPI/SocketSink.hh
senf/PPI/SocketSource.ct
senf/PPI/SocketSource.cti
senf/PPI/SocketSource.hh
senf/Socket/CommunicationPolicy.cc
senf/Socket/CommunicationPolicy.cci
senf/Socket/CommunicationPolicy.cti
senf/Socket/CommunicationPolicy.hh
senf/Socket/Protocols/BSDAddressingPolicy.cc
senf/Socket/Protocols/BSDAddressingPolicy.cti
senf/Socket/Protocols/BSDAddressingPolicy.hh
senf/Socket/ReadWritePolicy.cc
senf/Socket/ReadWritePolicy.cti
senf/Socket/ReadWritePolicy.hh

index 144c5b8..35e578c 100644 (file)
--- a/.project
+++ b/.project
@@ -6,6 +6,11 @@
        </projects>
        <buildSpec>
                <buildCommand>
+                       <name>org.python.pydev.PyDevBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
                        <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
                        <triggers>clean,full,incremental,</triggers>
                        <arguments>
                                </dictionary>
                                <dictionary>
                                        <key>org.eclipse.cdt.make.core.buildArguments</key>
-                                       <value></value>
+                                       <value>scons -j2</value>
                                </dictionary>
                                <dictionary>
                                        <key>org.eclipse.cdt.make.core.buildCommand</key>
-                                       <value>make</value>
+                                       <value>nice</value>
                                </dictionary>
                                <dictionary>
                                        <key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
-                                       <value>clean</value>
+                                       <value>-c</value>
                                </dictionary>
                                <dictionary>
                                        <key>org.eclipse.cdt.make.core.contents</key>
@@ -51,7 +56,7 @@
                                </dictionary>
                                <dictionary>
                                        <key>org.eclipse.cdt.make.core.fullBuildTarget</key>
-                                       <value>build</value>
+                                       <value>default</value>
                                </dictionary>
                                <dictionary>
                                        <key>org.eclipse.cdt.make.core.stopOnError</key>
@@ -59,7 +64,7 @@
                                </dictionary>
                                <dictionary>
                                        <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
-                                       <value>true</value>
+                                       <value>false</value>
                                </dictionary>
                        </arguments>
                </buildCommand>
@@ -74,5 +79,6 @@
                <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
                <nature>org.eclipse.cdt.core.cnature</nature>
                <nature>org.eclipse.cdt.core.ccnature</nature>
+               <nature>org.python.pydev.pythonNature</nature>
        </natures>
 </projectDescription>
index 3d97d47..08a96af 100644 (file)
@@ -104,7 +104,7 @@ env.Append(
    CPPDEFINES             = [ '$expandLogOption', '$CPPDEFINES_' ],
    expandLogOption        = senfutil.expandLogOption,
    CPPDEFINES_            = senfutil.BuildTypeOptions('CPPDEFINES'),
-   CPPDEFINES_final       = [ ],
+   CPPDEFINES_final       = [ 'SENF_PPI_NOTRACE'],
    CPPDEFINES_normal      = [ 'SENF_DEBUG' ],
    CPPDEFINES_debug       = [ '$CPPDEFINES_normal' ],
 
index 0813b41..0ee44f5 100644 (file)
@@ -80,7 +80,7 @@ senf::ppi::connector::Connector::TraceState senf::ppi::connector::Connector::tra
 
 prefix_ void senf::ppi::connector::Connector::trace(Packet const & p, char const * label)
 {
-    if (traceState_ ==  NO_TRACING)
+    if (traceState_ == NO_TRACING)
         return;
     SENF_LOG_BLOCK(({
                 std::string type (prettyName(p.typeId().id()));
@@ -119,6 +119,7 @@ namespace {
 
     ConsoleRegister::ConsoleRegister()
     {
+#ifndef SENF_PPI_NOTRACE
         senf::ppi::ModuleManager::instance().consoleDir()
             .add("tracing", senf::console::factory::Command(
                      SENF_FNP(senf::ppi::connector::Connector::TraceState,
@@ -158,6 +159,7 @@ namespace {
                               (senf::ppi::connector::Connector::TraceState)))
                  .arg("state", "new tracing state")
                 );
+#endif
     }
 
     ConsoleRegister consoleRegister;
@@ -224,7 +226,7 @@ prefix_ void senf::ppi::connector::PassiveConnector::notifyUnthrottle()
         if (!nativeThrottled_)
             emitUnthrottle();
     } else
-        throttleTrace("OUT", "not forwarding unthrottle event");
+        SENF_PPI_THROTTLE_TRACE("OUT", "not forwarding unthrottle event");
 }
 
 ///////////////////////////////////////////////////////////////////////////
@@ -241,7 +243,7 @@ prefix_ void senf::ppi::connector::ActiveConnector::v_init()
 
 prefix_ void senf::ppi::connector::ActiveConnector::notifyThrottle()
 {
-    throttleTrace("IN ", "throttle");
+    SENF_PPI_THROTTLE_TRACE("IN ", "throttle");
     if (! throttled_) {
         throttled_ = true;
         if (throttleCallback_)
@@ -255,7 +257,7 @@ prefix_ void senf::ppi::connector::ActiveConnector::notifyThrottle()
 
 prefix_ void senf::ppi::connector::ActiveConnector::notifyUnthrottle()
 {
-    throttleTrace("IN ", "unthrottle");
+    SENF_PPI_THROTTLE_TRACE("IN ", "unthrottle");
     if (throttled_) {
         throttled_ = false;
         if (unthrottleCallback_)
@@ -292,7 +294,7 @@ prefix_ senf::Packet senf::ppi::connector::InputConnector::operator()()
         queue_.pop_back();
         v_dequeueEvent();
     }
-    trace(p, "IN ");
+    SENF_PPI_TRACE(p, "IN ");
     return p;
 }
 
index 986a2a4..16948c0 100644 (file)
 #define prefix_ inline
 ///////////////////////////////cci.p///////////////////////////////////////
 
+#ifdef SENF_PPI_NOTRACE
+#   define SENF_PPI_THROTTLE_TRACE(label, type)
+#   define SENF_PPI_TRACE(packet, label)
+#else
+#   define SENF_PPI_THROTTLE_TRACE(label, type) throttleTrace(label, type)
+#   define SENF_PPI_TRACE(packet, label) trace(packet, label)
+#endif
+
 ///////////////////////////////////////////////////////////////////////////
 // senf::ppi::connector::Connector
 
@@ -119,14 +127,14 @@ prefix_ bool senf::ppi::connector::PassiveConnector::throttled()
 
 prefix_ void senf::ppi::connector::PassiveConnector::emitThrottle()
 {
-    throttleTrace("OUT", "throttle");
+    SENF_PPI_THROTTLE_TRACE("OUT", "throttle");
     if (connected())
         peer().notifyThrottle();
 }
 
 prefix_ void senf::ppi::connector::PassiveConnector::emitUnthrottle()
 {
-    throttleTrace("OUT", "unthrottle");
+    SENF_PPI_THROTTLE_TRACE("OUT", "unthrottle");
     if (connected()) {
         peer().notifyUnthrottle();
         v_unthrottleEvent();
@@ -193,10 +201,11 @@ prefix_ void senf::ppi::connector::PassiveConnector::emit()
 {
     // No event callback has been registered (onRequest() call missing)
     SENF_ASSERT(callback_, "senf::ppi::connector::PassiveConnector: missing onRequest()");
-    if (!throttled())
+    if (!throttled()) {
         callback_();
-    else
-        throttleTrace("IN ", "queueing packet");
+    } else {
+        SENF_PPI_THROTTLE_TRACE("IN ", "queueing packet");
+    }
 }
 
 ///////////////////////////////////////////////////////////////////////////
@@ -307,7 +316,7 @@ prefix_ senf::ppi::connector::InputConnector & senf::ppi::connector::OutputConne
 
 prefix_ void senf::ppi::connector::OutputConnector::operator()(Packet const & p)
 {
-    trace(p, "OUT");
+    SENF_PPI_TRACE(p, "OUT");
     if (connected())
         peer().enqueue(p);
 }
index 93a412e..594c501 100644 (file)
@@ -56,7 +56,7 @@ prefix_ senf::ppi::QueueingAlgorithm::ptr senf::ppi::detail::QueueingAlgorithmRe
 // senf::ppi::module::PassiveQueueingSocketSink<Writer>
 
 template <class Writer>
-prefix_ senf::ppi::module::PassiveQueueingSocketSink<Writer>::PassiveQueueingSocketSink(Handle handle, QueueingAlgorithm::ptr qAlgorithm)
+prefix_ senf::ppi::module::PassiveQueueingSocketSink<Writer>::PassiveQueueingSocketSink(Handle const & handle, QueueingAlgorithm::ptr qAlgorithm)
     : dir( this),
       handle_( handle), writer_( ),
       qAlgo_( qAlgorithm),
@@ -138,4 +138,4 @@ prefix_ void senf::ppi::module::PassiveQueueingSocketSink<Writer>::setQAlgorithm
 // indent-tabs-mode: nil
 // ispell-local-dictionary: "american"
 // compile-command: "scons -u test"
-// End:
+// End::
index 481ff99..c131ab7 100644 (file)
@@ -56,7 +56,7 @@ prefix_ typename Writer::Handle & senf::ppi::module::PassiveQueueingSocketSink<W
 }
 
 template <class Writer>
-prefix_ void senf::ppi::module::PassiveQueueingSocketSink<Writer>::handle(Handle handle)
+prefix_ void senf::ppi::module::PassiveQueueingSocketSink<Writer>::handle(Handle const & handle)
 {
     handle_ = handle;
     event_.set( handle_, IOEvent::Write);
index 83de20f..6d6ed8d 100644 (file)
@@ -146,11 +146,12 @@ namespace module {
         connector::PassiveInput<PacketType> input; ///< Input connector from which data is received
         console::ScopedDirectory<PassiveQueueingSocketSink<Writer> > dir;
 
-        explicit PassiveQueueingSocketSink(Handle handle, QueueingAlgorithm::ptr qAlgorithm);
+        explicit PassiveQueueingSocketSink(Handle const & handle, QueueingAlgorithm::ptr qAlgorithm);
 
         Writer & writer();              ///< Access the Writer
         Handle & handle();              ///< Access handle
-        void handle(Handle handle);     ///< Set handle
+        void handle(Handle const & handle);
+                                        ///< Set handle
                                         /**< Assigning an empty or in-valid() handle will disable
                                              the module until a new valid handle is assigned. */
         QueueingAlgorithm & qAlgorithm();
index b02f7e9..7e5e173 100644 (file)
@@ -54,7 +54,7 @@ prefix_ void senf::ppi::IPv4SourceForcingDgramWriter::destination(senf::INet4Soc
     protocolId_ = dest.port();
 }
 
-prefix_ bool senf::ppi::IPv4SourceForcingDgramWriter::operator()(Handle handle,
+prefix_ bool senf::ppi::IPv4SourceForcingDgramWriter::operator()(Handle & handle,
                                                                  Packet const & packet)
 {
     return sendtoandfrom(
@@ -133,7 +133,7 @@ prefix_ void senf::ppi::IPv6SourceForcingDgramWriter::destination(senf::INet6Soc
     protocolId_ = dest.port();
 }
 
-prefix_ bool senf::ppi::IPv6SourceForcingDgramWriter::operator()(Handle handle,
+prefix_ bool senf::ppi::IPv6SourceForcingDgramWriter::operator()(Handle & handle,
                                                                  Packet const & packet)
 {
     return sendtoandfrom(
index b137100..80897f7 100644 (file)
@@ -33,7 +33,7 @@
 ///////////////////////////////////////////////////////////////////////////
 // senf::ppi::ConnectedDgramWriter
 
-prefix_ bool senf::ppi::ConnectedDgramWriter::operator()(Handle handle,
+prefix_ bool senf::ppi::ConnectedDgramWriter::operator()(Handle & handle,
                                                          Packet const & packet)
 {
     return handle.write(packet.data()) != packet.data().begin();
index 4864625..1936ea3 100644 (file)
@@ -49,7 +49,7 @@ prefix_ senf::ppi::module::ActiveSocketSink<Writer>::ActiveSocketSink(Writer con
 }
 
 template <class Writer>
-prefix_ senf::ppi::module::ActiveSocketSink<Writer>::ActiveSocketSink(Handle handle)
+prefix_ senf::ppi::module::ActiveSocketSink<Writer>::ActiveSocketSink(Handle const &  handle)
     : handle_(handle), event_(handle_, IOEvent::Write), writer_()
 {
     registerEvent( event_, &ActiveSocketSink::write );
@@ -57,7 +57,7 @@ prefix_ senf::ppi::module::ActiveSocketSink<Writer>::ActiveSocketSink(Handle han
 }
 
 template <class Writer>
-prefix_ senf::ppi::module::ActiveSocketSink<Writer>::ActiveSocketSink(Handle handle,
+prefix_ senf::ppi::module::ActiveSocketSink<Writer>::ActiveSocketSink(Handle const & handle,
                                                                     Writer const & writer)
     : handle_(handle), event_(handle_, IOEvent::Write), writer_(writer)
 {
@@ -95,7 +95,7 @@ prefix_ senf::ppi::module::PassiveSocketSink<Writer>::PassiveSocketSink(Writer c
 }
 
 template <class Writer>
-prefix_ senf::ppi::module::PassiveSocketSink<Writer>::PassiveSocketSink(Handle handle)
+prefix_ senf::ppi::module::PassiveSocketSink<Writer>::PassiveSocketSink(Handle const & handle)
     : handle_(handle), writer_()
 {
     noroute(input);
@@ -104,7 +104,7 @@ prefix_ senf::ppi::module::PassiveSocketSink<Writer>::PassiveSocketSink(Handle h
 }
 
 template <class Writer>
-prefix_ senf::ppi::module::PassiveSocketSink<Writer>::PassiveSocketSink(Handle handle,
+prefix_ senf::ppi::module::PassiveSocketSink<Writer>::PassiveSocketSink(Handle const & handle,
                                                                       Writer const & writer)
     : handle_(handle), writer_(writer)
 {
index 4e2ebf7..2b11387 100644 (file)
@@ -59,7 +59,7 @@ senf::ppi::TargetDgramWriter<HandleType>::target(typename Handle::Address const
 }
 
 template <class HandleType>
-prefix_ bool senf::ppi::TargetDgramWriter<HandleType>::operator()(Handle handle,
+prefix_ bool senf::ppi::TargetDgramWriter<HandleType>::operator()(Handle & handle,
                                                                   Packet const & packet)
 {
     if (target_)
@@ -84,7 +84,7 @@ senf::ppi::module::ActiveSocketSink<Writer>::handle()
 }
 
 template <class Writer>
-prefix_ void senf::ppi::module::ActiveSocketSink<Writer>::handle(Handle handle)
+prefix_ void senf::ppi::module::ActiveSocketSink<Writer>::handle(Handle const & handle)
 {
     handle_ = handle;
     event_.set(handle_, IOEvent::Write);
@@ -106,7 +106,7 @@ prefix_ typename Writer::Handle & senf::ppi::module::PassiveSocketSink<Writer>::
 }
 
 template <class Writer>
-prefix_ void senf::ppi::module::PassiveSocketSink<Writer>::handle(Handle handle)
+prefix_ void senf::ppi::module::PassiveSocketSink<Writer>::handle(Handle const & handle)
 {
     handle_ = handle;
     checkThrottle();
index ab68990..7ee3b8e 100644 (file)
@@ -58,7 +58,7 @@ namespace ppi {
                                         ///< Handle type supported by this writer
         typedef Packet PacketType;
 
-        bool operator()(Handle handle, Packet const & packet);
+        bool operator()(Handle & handle, Packet const & packet);
                                         ///< Write \a packet to \a handle
                                         /**< Write the complete \a packet as a datagram to \a
                                              handle.
@@ -87,7 +87,7 @@ namespace ppi {
         typename Handle::Address target() const; ///< Get current target address
         void target(typename Handle::Address const & target); ///< Set target address
 
-        bool operator()(Handle handle, Packet const & packet); ///< Write \a packet to \a handle
+        bool operator()(Handle & handle, Packet const & packet); ///< Write \a packet to \a handle
                                         /**< Write the complete \a packet as a datagram to \a
                                              handle.
                                              \param[in] handle Handle to write data to
@@ -113,7 +113,7 @@ namespace ppi {
         void destination(senf::INet4SocketAddress & dest);
         senf::INet4SocketAddress destination();
 
-        bool operator()(Handle handle, Packet const & packet);
+        bool operator()(Handle & handle, Packet const & packet);
                                         ///< Write \a packet to \a handle
                                         /**< Write the complete \a packet as a datagram to \a
                                              handle.
@@ -142,7 +142,7 @@ namespace ppi {
         void destination(senf::INet6SocketAddress & dest);
         senf::INet6SocketAddress destination();
 
-        bool operator()(Handle handle, Packet const & packet);
+        bool operator()(Handle & handle, Packet const & packet);
                                         ///< Write \a packet to \a handle
                                         /**< Write the complete \a packet as a datagram to \a
                                              handle.
@@ -210,11 +210,12 @@ namespace module {
                                              \pre Requires \a Writer to be copy constructible
                                              \param[in] writer Writer helper writing packet date to
                                                  the socket */
-        explicit ActiveSocketSink(Handle handle); ///< Create new writer for the given handle
+        explicit ActiveSocketSink(Handle const & handle);
+                                        ///< Create new writer for the given handle
                                         /**< Data will be written to \a handle using \a Writer.
                                              \pre Requires \a Writer to be default constructible
                                              \param[in] handle Handle to write data to */
-        ActiveSocketSink(Handle handle, Writer const & writer);
+        ActiveSocketSink(Handle const & handle, Writer const & writer);
                                         ///< Create new writer for the given handle
                                         /**< Data will be written to \a handle using \a Writer.
                                              \pre Requires \a Writer to be copy constructible
@@ -224,7 +225,8 @@ namespace module {
 
         Writer & writer();              ///< Access the Writer
         Handle handle();                ///< Access handle
-        void handle(Handle handle);     ///< Set handle
+        void handle(Handle const & handle);
+                                        ///< Set handle
                                         /**< Assigning an empty or in-valid() handle will disable
                                              the module until a new. valid handle is assigned. */
 
@@ -286,11 +288,12 @@ namespace module {
                                              \pre Requires \a Writer to be copy constructible
                                              \param[in] writer Writer helper writing packet date to
                                                  the socket */
-        explicit PassiveSocketSink(Handle handle); ///< Create new writer for the given handle
+        explicit PassiveSocketSink(Handle const & handle);
+                                        ///< Create new writer for the given handle
                                         /**< Data will be written to \a handle using \a Writer.
                                              \pre Requires \a Writer to be default constructible
                                              \param[in] handle Handle to write data to */
-        PassiveSocketSink(Handle handle, Writer const & writer);
+        PassiveSocketSink(Handle const & handle, Writer const & writer);
                                         ///< Create new writer for the given handle
                                         /**< Data will be written to \a handle using \a Writer.
                                              \pre Requires \a Writer to be copy constructible
@@ -300,7 +303,8 @@ namespace module {
 
         Writer & writer();              ///< Access the Writer
         Handle & handle();              ///< Access handle
-        void handle(Handle handle);     ///< Set handle
+        void handle(Handle const & handle);
+                                        ///< Set handle
                                         /**< Assigning an empty or in-valid() handle will disable
                                              the module until a new valid handle is assigned. */
 
index 6eb9780..8429bd9 100644 (file)
@@ -34,7 +34,7 @@
 // senf::ppi::DgramReader<Packet,MaxSize>
 
 template <class Packet, unsigned MaxSize>
-prefix_ Packet senf::ppi::DgramReader<Packet,MaxSize>::operator()(Handle handle)
+prefix_ Packet senf::ppi::DgramReader<Packet,MaxSize>::operator()(Handle & handle)
 {
     Packet packet (Packet::create(senf::noinit));
     handle.read(packet.data(), MaxSize);
@@ -60,7 +60,7 @@ prefix_ senf::ppi::module::ActiveSocketSource<Reader>::ActiveSocketSource(Reader
 }
 
 template <class Reader>
-prefix_ senf::ppi::module::ActiveSocketSource<Reader>::ActiveSocketSource(Handle handle)
+prefix_ senf::ppi::module::ActiveSocketSource<Reader>::ActiveSocketSource(Handle const & handle)
     : handle_(handle), event_(handle_, IOEvent::Read)
 {
     registerEvent( event_, &ActiveSocketSource::read );
@@ -68,7 +68,7 @@ prefix_ senf::ppi::module::ActiveSocketSource<Reader>::ActiveSocketSource(Handle
 }
 
 template <class Reader>
-prefix_ senf::ppi::module::ActiveSocketSource<Reader>::ActiveSocketSource(Handle handle,
+prefix_ senf::ppi::module::ActiveSocketSource<Reader>::ActiveSocketSource(Handle const & handle,
                                                                           Reader reader)
     : handle_(handle), event_(handle_, IOEvent::Read), reader_(reader)
 {
@@ -96,7 +96,7 @@ prefix_ senf::ppi::module::ActiveBurstSocketSource<Reader>::ActiveBurstSocketSou
 }
 
 template <class Reader>
-prefix_ senf::ppi::module::ActiveBurstSocketSource<Reader>::ActiveBurstSocketSource(Handle handle, unsigned max_burst)
+prefix_ senf::ppi::module::ActiveBurstSocketSource<Reader>::ActiveBurstSocketSource(Handle const & handle, unsigned max_burst)
     : handle_(handle), event_(handle_, IOEvent::Read), maxBurst_(max_burst)
 {
     registerEvent( event_, &ActiveBurstSocketSource::read );
@@ -104,7 +104,7 @@ prefix_ senf::ppi::module::ActiveBurstSocketSource<Reader>::ActiveBurstSocketSou
 }
 
 template <class Reader>
-prefix_ senf::ppi::module::ActiveBurstSocketSource<Reader>::ActiveBurstSocketSource(Handle handle,
+prefix_ senf::ppi::module::ActiveBurstSocketSource<Reader>::ActiveBurstSocketSource(Handle const & handle,
                                                                           Reader reader, unsigned max_burst)
     : handle_(handle), event_(handle_, IOEvent::Read), reader_(reader), maxBurst_(max_burst)
 {
index 08f37bf..6403b03 100644 (file)
@@ -47,7 +47,7 @@ senf::ppi::module::ActiveSocketSource<Reader>::handle()
 }
 
 template <class Reader>
-prefix_ void senf::ppi::module::ActiveSocketSource<Reader>::handle(Handle handle)
+prefix_ void senf::ppi::module::ActiveSocketSource<Reader>::handle(Handle const & handle)
 {
     handle_ = handle;
     event_.set(handle_, IOEvent::Read);
@@ -76,7 +76,7 @@ senf::ppi::module::ActiveBurstSocketSource<Reader>::handle()
 }
 
 template <class Reader>
-prefix_ void senf::ppi::module::ActiveBurstSocketSource<Reader>::handle(Handle handle)
+prefix_ void senf::ppi::module::ActiveBurstSocketSource<Reader>::handle(Handle const & handle)
 {
     handle_ = handle;
     event_.set(handle_, IOEvent::Read);
index c41e314..d6af335 100644 (file)
@@ -59,7 +59,7 @@ namespace ppi {
                                     senf::DatagramFramingPolicy >::policy > Handle;
                                         ///< Handle type supported by this reader
 
-        Packet operator()(Handle handle);
+        Packet operator()(Handle & handle);
                                         ///< Read packet from \a handle
                                         /**< Read a datagram from \a handle and interpret is as
                                              packet of type \c Packet.
@@ -122,12 +122,13 @@ namespace module {
         explicit ActiveSocketSource(Reader reader); ///< Create non-connected reader
                                         /**< The reader will be disabled until a socket is set
                                              \pre Requires \a Reader to be copy constructible */
-        explicit ActiveSocketSource(Handle handle); ///< Create new reader for the given handle
+        explicit ActiveSocketSource(Handle const & handle);
+                                        ///< Create new reader for the given handle
                                         /**< Data will be read from \a handle and be parsed by \a
                                              Reader.
                                              \pre Requires \a Reader to be default constructible
                                              \param[in] handle Handle to read data from */
-        ActiveSocketSource(Handle handle, Reader reader);
+        ActiveSocketSource(Handle const & handle, Reader reader);
                                         ///< Create new reader for the given handle
                                         /**< Data will be read from \a handle and be parsed by \a
                                              Reader.
@@ -136,7 +137,8 @@ namespace module {
 
         Reader & reader();              ///< Access Reader helper
         Handle handle();                ///< Access handle
-        void handle(Handle handle);     ///< Set handle
+        void handle(Handle const & handle);
+                                        ///< Set handle
                                         /**< Assigning an empty or in-valid() handle will disable
                                              the module until a new, valid handle is assigned. */
     private:
@@ -162,12 +164,13 @@ namespace module {
 
         ActiveBurstSocketSource(unsigned max_burst);
         explicit ActiveBurstSocketSource(Reader reader, unsigned max_burst);
-        explicit ActiveBurstSocketSource(Handle handle, unsigned max_burst);
-        ActiveBurstSocketSource(Handle handle, Reader reader, unsigned max_burst);
+        explicit ActiveBurstSocketSource(Handle const & handle, unsigned max_burst);
+        ActiveBurstSocketSource(Handle const & handle, Reader reader, unsigned max_burst);
 
         Reader & reader();              ///< Access Reader helper
         Handle handle();                ///< Access handle
-        void handle(Handle handle);     ///< Set handle
+        void handle(Handle const & handle);
+                                        ///< Set handle
                                         /**< Assigning an empty or in-valid() handle will disable
                                              the module until a new, valid handle is assigned. */
 
index f6efbcc..b5ce292 100644 (file)
 #define prefix_
 ///////////////////////////////cc.p////////////////////////////////////////
 
-prefix_ void senf::ConnectedCommunicationPolicy::do_listen(FileHandle handle,
+prefix_ void senf::ConnectedCommunicationPolicy::do_listen(FileHandle const & handle,
                                                            unsigned backlog)
 {
     ::listen(handle.fd(),backlog);
 }
 
-prefix_ int senf::ConnectedCommunicationPolicy::do_accept(FileHandle handle,
+prefix_ int senf::ConnectedCommunicationPolicy::do_accept(FileHandle const & handle,
                                                           struct sockaddr * addr,
                                                           unsigned len)
 {
index ca9ddd6..6330e72 100644 (file)
@@ -28,7 +28,7 @@
 #define prefix_ inline
 ///////////////////////////////cci.p///////////////////////////////////////
 
-prefix_ int senf::ConnectedCommunicationPolicy::accept(FileHandle handle)
+prefix_ int senf::ConnectedCommunicationPolicy::accept(FileHandle const & handle)
 {
     return do_accept(handle, 0, 0);
 }
index 6675ed4..f1c857a 100644 (file)
@@ -34,7 +34,7 @@
 #ifndef DOXYGEN
 template <class SPolicy>
 prefix_ void senf::ConnectedCommunicationPolicy::
-listen(ServerSocketHandle<SPolicy> handle, unsigned backlog,
+listen(ServerSocketHandle<SPolicy> const & handle, unsigned backlog,
        typename IfAddressingPolicyIsNot<SPolicy,NoAddressingPolicy>::type *)
 {
     do_listen(handle, backlog);
@@ -42,14 +42,14 @@ listen(ServerSocketHandle<SPolicy> handle, unsigned backlog,
 #else
 template <class SPolicy>
 prefix_ void senf::ConnectedCommunicationPolicy::
-listen(ServerSocketHandle<SPolicy> handle, unsigned backlog)
+listen(ServerSocketHandle<SPolicy> const & handle, unsigned backlog)
 {}
 #endif
 
 #ifndef DOXYGEN
 template <class SPolicy>
 prefix_ int senf::ConnectedCommunicationPolicy::
-accept(ServerSocketHandle<SPolicy> handle,
+accept(ServerSocketHandle<SPolicy> const & handle,
        typename ServerSocketHandle<SPolicy>::Address & address,
        typename IfAddressingPolicyIsNot<SPolicy,NoAddressingPolicy>::type *)
 {
@@ -58,7 +58,7 @@ accept(ServerSocketHandle<SPolicy> handle,
 #else
 template <class SPolicy>
 prefix_ int senf::ConnectedCommunicationPolicy::
-accept(ServerSocketHandle<SPolicy> handle,
+accept(ServerSocketHandle<SPolicy> const & handle,
        typename ServerSocketHandle<SPolicy>::Address & address)
 {}
 #endif
index 47dc01f..c007d73 100644 (file)
@@ -53,11 +53,11 @@ namespace senf {
     {
 #       ifndef DOXYGEN
         template <class SPolicy>
-        static void listen(ServerSocketHandle<SPolicy> handle, unsigned backlog,
+        static void listen(ServerSocketHandle<SPolicy> const & handle, unsigned backlog,
                            typename IfAddressingPolicyIsNot<SPolicy,NoAddressingPolicy>::type * = 0);
 #       else
         template <class SPolicy>
-        static void listen(ServerSocketHandle<SPolicy> handle, unsigned backlog);
+        static void listen(ServerSocketHandle<SPolicy> const & 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 */
@@ -65,12 +65,12 @@ namespace senf {
 
 #       ifndef DOXYGEN
         template <class SPolicy>
-        static int accept(ServerSocketHandle<SPolicy> handle,
+        static int accept(ServerSocketHandle<SPolicy> const & handle,
                           typename ServerSocketHandle<SPolicy>::Address & address,
                           typename IfAddressingPolicyIsNot<SPolicy,NoAddressingPolicy>::type * = 0);
 #       else
         template <class SPolicy>
-        static int accept(ServerSocketHandle<SPolicy> handle,
+        static int accept(ServerSocketHandle<SPolicy> const & handle,
                           typename ServerSocketHandle<SPolicy>::Address & address);
                                         ///< accept a new connection on the socket.
                                         /**< The accept() member will return a new client file
@@ -84,7 +84,7 @@ namespace senf {
                                              \returns file descriptor of new client socket */
 #       endif
 
-        static int accept(FileHandle handle);
+        static int accept(FileHandle const & handle);
                                         ///< 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
@@ -95,8 +95,8 @@ namespace senf {
                                              \returns file descriptor of new client socket */
 
     private:
-        static void do_listen(FileHandle handle, unsigned backlog);
-        static int do_accept(FileHandle handle, struct sockaddr * addr, unsigned len);
+        static void do_listen(FileHandle const & handle, unsigned backlog);
+        static int do_accept(FileHandle const & handle, struct sockaddr * addr, unsigned len);
     };
 
     /** \brief CommunicationPolicy for unconnected sockets
index c8b9c12..06e263b 100644 (file)
@@ -36,7 +36,7 @@
 #define prefix_
 ///////////////////////////////cc.p////////////////////////////////////////
 
-prefix_ void senf::BSDAddressingPolicyMixinBase::do_local(FileHandle handle,
+prefix_ void senf::BSDAddressingPolicyMixinBase::do_local(FileHandle const & handle,
                                                                  struct sockaddr * addr,
                                                                  socklen_t * len)
 {
@@ -44,7 +44,7 @@ prefix_ void senf::BSDAddressingPolicyMixinBase::do_local(FileHandle handle,
         SENF_THROW_SYSTEM_EXCEPTION("");
 }
 
-prefix_ void senf::BSDAddressingPolicyMixinBase::do_peer(FileHandle handle,
+prefix_ void senf::BSDAddressingPolicyMixinBase::do_peer(FileHandle const & handle,
                                                                 struct sockaddr * addr,
                                                                 socklen_t * len)
 {
@@ -52,7 +52,7 @@ prefix_ void senf::BSDAddressingPolicyMixinBase::do_peer(FileHandle handle,
         SENF_THROW_SYSTEM_EXCEPTION("");
 }
 
-prefix_ void senf::BSDAddressingPolicyMixinBase::do_bind(FileHandle handle,
+prefix_ void senf::BSDAddressingPolicyMixinBase::do_bind(FileHandle const & handle,
                                                                 struct sockaddr const * addr,
                                                                 socklen_t len)
 {
@@ -60,7 +60,7 @@ prefix_ void senf::BSDAddressingPolicyMixinBase::do_bind(FileHandle handle,
         SENF_THROW_SYSTEM_EXCEPTION("");
 }
 
-prefix_ void senf::BSDAddressingPolicyMixinBase::do_connect(FileHandle handle,
+prefix_ void senf::BSDAddressingPolicyMixinBase::do_connect(FileHandle const & handle,
                                                                    struct sockaddr const * addr,
                                                                    socklen_t len)
 {
index abac866..75bc460 100644 (file)
@@ -38,7 +38,7 @@
 template <class Address>
 template <class SPolicy>
 prefix_ void senf::BSDAddressingPolicyMixin<Address>::
-peer(SocketHandle<SPolicy> handle, Address & addr,
+peer(SocketHandle<SPolicy> const & handle, Address & addr,
      typename IfCommunicationPolicyIs<SPolicy,ConnectedCommunicationPolicy>::type *)
 {
     try {
@@ -52,7 +52,7 @@ peer(SocketHandle<SPolicy> handle, Address & addr,
 template <class Address>
 template <class SPolicy>
 prefix_ void senf::BSDAddressingPolicyMixin<Address>::
-peer(SocketHandle<SPolicy> handle, Address & addr)
+peer(SocketHandle<SPolicy> const & handle, Address & addr)
 {}
 #endif
 
@@ -60,7 +60,7 @@ peer(SocketHandle<SPolicy> handle, Address & addr)
 template <class Address>
 template <class SPolicy>
 prefix_ void senf::BSDAddressingPolicyMixin<Address>::
-connect(SocketHandle<SPolicy> handle, Address const & addr,
+connect(SocketHandle<SPolicy> const & handle, Address const & addr,
         typename IfCommunicationPolicyIs<SPolicy,ConnectedCommunicationPolicy>::type *)
 {
     try {
@@ -74,12 +74,12 @@ connect(SocketHandle<SPolicy> handle, Address const & addr,
 template <class Address>
 template <class SPolicy>
 prefix_ void senf::BSDAddressingPolicyMixin<Address>::
-connect(SocketHandle<SPolicy> handle, Address const & addr)
+connect(SocketHandle<SPolicy> const & handle, Address const & addr)
 {}
 #endif
 
 template <class Address>
-prefix_ void senf::BSDAddressingPolicyMixin<Address>::local(FileHandle handle,
+prefix_ void senf::BSDAddressingPolicyMixin<Address>::local(FileHandle const & handle,
                                                            Address & addr)
 {
     try {
@@ -92,7 +92,7 @@ prefix_ void senf::BSDAddressingPolicyMixin<Address>::local(FileHandle handle,
 }
 
 template <class Address>
-prefix_ void senf::BSDAddressingPolicyMixin<Address>::bind(FileHandle handle,
+prefix_ void senf::BSDAddressingPolicyMixin<Address>::bind(FileHandle const & handle,
                                                                  Address const & addr)
 {
     try {
index 36b970d..a4b17ac 100644 (file)
@@ -50,10 +50,10 @@ namespace senf {
      */
     struct BSDAddressingPolicyMixinBase
     {
-        static void do_local(FileHandle handle, struct sockaddr * addr, socklen_t * len);
-        static void do_peer(FileHandle handle, struct sockaddr * addr, socklen_t * len);
-        static void do_bind(FileHandle handle, struct sockaddr const * addr, socklen_t len);
-        static void do_connect(FileHandle handle, struct sockaddr const * addr, socklen_t len);
+        static void do_local(FileHandle const & handle, struct sockaddr * addr, socklen_t * len);
+        static void do_peer(FileHandle const & handle, struct sockaddr * addr, socklen_t * len);
+        static void do_bind(FileHandle const & handle, struct sockaddr const * addr, socklen_t len);
+        static void do_connect(FileHandle const & handle, struct sockaddr const * addr, socklen_t len);
     };
 
     /** \brief Template for generic AddressingPolicy implementation based on the BSD socket API
@@ -86,11 +86,11 @@ namespace senf {
     {
 #       ifndef DOXYGEN
         template <class SPolicy>
-        static void peer(SocketHandle<SPolicy> handle, Address & addr,
+        static void peer(SocketHandle<SPolicy> const & handle, Address & addr,
                          typename IfCommunicationPolicyIs<SPolicy,ConnectedCommunicationPolicy>::type * = 0);
 #       else
         template <class SPolicy>
-        static void peer(SocketHandle<SPolicy> handle, Address & addr);
+        static void peer(SocketHandle<SPolicy> const & handle, Address & addr);
                                         ///< Return address of remote peer on connected sockets
                                         /**< This member is only available if the socket handles
                                              communication policy is ConnectedCommunicationPolicy.
@@ -98,18 +98,18 @@ namespace senf {
                                              \param[in] handle socket handle to get peer address of
                                              \param[out] addr address of remote peer */
 #       endif
-        static void local(FileHandle handle, Address & addr);
+        static void local(FileHandle const & handle, Address & addr);
                                         ///< Return local of socket
                                         /**< \param[in] handle socket handle to check
                                              \param[out] addr local socket address */
 
 #       ifndef DOXYGEN
         template <class SPolicy>
-        static void connect(SocketHandle<SPolicy> handle, Address const & addr,
+        static void connect(SocketHandle<SPolicy> const & handle, Address const & addr,
                             typename IfCommunicationPolicyIs<SPolicy,ConnectedCommunicationPolicy>::type * = 0);
 #       else
         template <class SPolicy>
-        static void connect(SocketHandle<SPolicy> handle, Address const & addr);
+        static void connect(SocketHandle<SPolicy> const & handle, Address const & addr);
                                         ///< Connect to remote host
                                         /**< This member is only available if the socket handles
                                              communication policy is ConnectedCommunicationPolicy.
@@ -118,7 +118,7 @@ namespace senf {
                                              \param[in] addr address of remote peer to connect
                                                  to */
 #       endif
-        static void bind(FileHandle handle, Address const & addr);
+        static void bind(FileHandle const & handle, Address const & addr);
                                         ///< Set local socket address
                                         /**< \param[in] handle socket handle
                                              \param[in] addr local socket address */
index 3c3138a..64dd850 100644 (file)
@@ -38,7 +38,7 @@
 #define prefix_
 ///////////////////////////////cc.p////////////////////////////////////////
 
-prefix_ unsigned senf::ReadablePolicy::read(FileHandle handle, char * buffer,
+prefix_ unsigned senf::ReadablePolicy::read(FileHandle & handle, char * buffer,
                                                    unsigned size)
 {
     int rv = -1;
@@ -59,7 +59,7 @@ prefix_ unsigned senf::ReadablePolicy::read(FileHandle handle, char * buffer,
     return rv;
 }
 
-prefix_ unsigned senf::ReadablePolicy::do_readfrom(FileHandle handle, char * buffer,
+prefix_ unsigned senf::ReadablePolicy::do_readfrom(FileHandle & handle, char * buffer,
                                                           unsigned size,
                                                           struct ::sockaddr * addr, socklen_t * len)
 {
@@ -80,7 +80,7 @@ prefix_ unsigned senf::ReadablePolicy::do_readfrom(FileHandle handle, char * buf
     return rv;
 }
 
-prefix_ unsigned senf::WriteablePolicy::do_write(FileHandle handle, char const * buffer,
+prefix_ unsigned senf::WriteablePolicy::do_write(FileHandle & handle, char const * buffer,
                                                         unsigned size)
 {
     int rv = -1;
@@ -109,7 +109,7 @@ prefix_ unsigned senf::WriteablePolicy::do_write(FileHandle handle, char const *
     return rv;
 }
 
-prefix_ unsigned senf::WriteablePolicy::do_writeto(FileHandle handle,
+prefix_ unsigned senf::WriteablePolicy::do_writeto(FileHandle & handle,
                                                           char const * buffer, unsigned size,
                                                           struct sockaddr const * addr, socklen_t len)
 {
index edb7915..0227184 100644 (file)
@@ -34,7 +34,7 @@
 #ifndef DOXYGEN
 template <class SPolicy>
 prefix_ unsigned senf::ReadablePolicy::
-readfrom(ClientSocketHandle<SPolicy> handle, char * buffer, unsigned size,
+readfrom(ClientSocketHandle<SPolicy> & handle, char * buffer, unsigned size,
          typename SPolicy::AddressingPolicy::Address & address,
          typename IfCommunicationPolicyIs<SPolicy,UnconnectedCommunicationPolicy>::type *)
 {
@@ -43,7 +43,7 @@ readfrom(ClientSocketHandle<SPolicy> handle, char * buffer, unsigned size,
 #else
 template <class SPolicy>
 prefix_ unsigned senf::ReadablePolicy::
-readfrom(ClientSocketHandle<SPolicy> handle, char * buffer, unsigned size,
+readfrom(ClientSocketHandle<SPolicy> & handle, char * buffer, unsigned size,
          typename Policy::AddressingPolicy::Address & address)
 {}
 #endif
@@ -51,7 +51,7 @@ readfrom(ClientSocketHandle<SPolicy> handle, char * buffer, unsigned size,
 #ifndef DOXYGEN
 template <class SPolicy>
 prefix_ unsigned senf::WriteablePolicy::
-write(ClientSocketHandle<SPolicy> handle, char const * buffer, unsigned size,
+write(ClientSocketHandle<SPolicy> & handle, char const * buffer, unsigned size,
       typename IfCommunicationPolicyIs<SPolicy,ConnectedCommunicationPolicy>::type *)
 {
     return do_write(handle,buffer,size);
@@ -59,14 +59,14 @@ write(ClientSocketHandle<SPolicy> handle, char const * buffer, unsigned size,
 #else
 template <class SPolicy>
 prefix_ unsigned senf::WriteablePolicy::
-write(ClientSocketHandle<SPolicy> handle, char const * buffer, unsigned size)
+write(ClientSocketHandle<SPolicy> & handle, char const * buffer, unsigned size)
 {}
 #endif
 
 #ifndef DOXYGEN
 template <class SPolicy>
 prefix_ unsigned senf::WriteablePolicy::
-writeto(ClientSocketHandle<SPolicy> handle,
+writeto(ClientSocketHandle<SPolicy> & handle,
         typename boost::call_traits<typename SPolicy::AddressingPolicy::Address>::param_type addr,
         char const * buffer, unsigned size,
         typename IfCommunicationPolicyIs<SPolicy,UnconnectedCommunicationPolicy>::type *)
@@ -76,7 +76,7 @@ writeto(ClientSocketHandle<SPolicy> handle,
 #else
 template <class SPolicy>
 prefix_ unsigned senf::WriteablePolicy::
-writeto(ClientSocketHandle<SPolicy> handle,
+writeto(ClientSocketHandle<SPolicy> & handle,
         typename Policy::AddressingPolicy::Address const & addr,
         char const * buffer, unsigned size)
 {}
index 98ec97e..f3faf27 100644 (file)
@@ -52,7 +52,7 @@ namespace senf {
      */
     struct ReadablePolicy : public ReadPolicyBase
     {
-        static unsigned read(FileHandle handle, char * buffer, unsigned size);
+        static unsigned read(FileHandle & handle, char * buffer, unsigned size);
                                         ///< read data from socket
                                         /**< \param[in] handle socket handle to read from
                                              \param[in] buffer address of buffer to write data to
@@ -60,13 +60,13 @@ namespace senf {
                                              \returns number of bytes read */
 #       ifndef DOXYGEN
         template <class SPolicy>
-        static unsigned readfrom(ClientSocketHandle<SPolicy> handle, char * buffer, unsigned size,
+        static unsigned readfrom(ClientSocketHandle<SPolicy> & handle, char * buffer, unsigned size,
                                  typename SPolicy::AddressingPolicy::Address & address,
                                  typename IfCommunicationPolicyIs<
                                      SPolicy,UnconnectedCommunicationPolicy>::type * = 0);
 #       else
         template <class SPolicy>
-        static unsigned readfrom(ClientSocketHandle<SPolicy> handle, char * buffer, unsigned size,
+        static unsigned readfrom(ClientSocketHandle<SPolicy> & 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
@@ -77,7 +77,7 @@ namespace senf {
 #       endif
 
     private:
-        static unsigned do_readfrom(FileHandle handle, char * buffer, unsigned size,
+        static unsigned do_readfrom(FileHandle & handle, char * buffer, unsigned size,
                                     struct ::sockaddr * addr, socklen_t * len);
     };
 
@@ -99,12 +99,12 @@ namespace senf {
     {
 #       ifndef DOXYGEN
         template <class SPolicy>
-        static unsigned write(ClientSocketHandle<SPolicy> handle, char const * buffer, unsigned size,
+        static unsigned write(ClientSocketHandle<SPolicy> & handle, char const * buffer, unsigned size,
                               typename IfCommunicationPolicyIs<
                                   SPolicy,ConnectedCommunicationPolicy>::type * = 0);
 #       else
         template <class SPolicy>
-        static unsigned write(ClientSocketHandle<SPolicy> handle, char const * buffer,
+        static unsigned write(ClientSocketHandle<SPolicy> & handle, char const * buffer,
                               unsigned size);
                                         ///< write data to socket
                                         /**< This member is only enabled if the socket uses
@@ -119,7 +119,7 @@ namespace senf {
 #       endif
 #       ifndef DOXYGEN
         template <class SPolicy>
-        static unsigned writeto(ClientSocketHandle<SPolicy> handle,
+        static unsigned writeto(ClientSocketHandle<SPolicy> & handle,
                                 typename boost::call_traits<
                                     typename SPolicy::AddressingPolicy::Address>::param_type addr,
                                 char const * buffer, unsigned size,
@@ -127,7 +127,7 @@ namespace senf {
                                     SPolicy,UnconnectedCommunicationPolicy>::type * = 0);
 #       else
         template <class SPolicy>
-        static unsigned writeto(ClientSocketHandle<SPolicy> handle,
+        static unsigned writeto(ClientSocketHandle<SPolicy> & handle,
                                 typename Policy::AddressingPolicy::Address const & addr,
                                 char const * buffer, unsigned size);
                                         ///< write data to socket sending to given peer
@@ -144,8 +144,8 @@ namespace senf {
 #       endif
 
     private:
-        static unsigned do_write(FileHandle handle, char const * buffer, unsigned size);
-        static unsigned do_writeto(FileHandle handle, char const * buffer, unsigned size,
+        static unsigned do_write(FileHandle & handle, char const * buffer, unsigned size);
+        static unsigned do_writeto(FileHandle & handle, char const * buffer, unsigned size,
                                    struct sockaddr const * addr, socklen_t len);
     };