Boost logo

Boost-Commit :

From: fmhess_at_[hidden]
Date: 2008-01-03 17:10:01


Author: fmhess
Date: 2008-01-03 17:10:00 EST (Thu, 03 Jan 2008)
New Revision: 42446
URL: http://svn.boost.org/trac/boost/changeset/42446

Log:
Added support for tracking signal objects. Moved signal_base out
of detail namespace, since it is used as an argument in a public
method now. Fixed track_test.cpp to use new signal tracking
method.

Added:
   sandbox/thread_safe_signals/boost/signals/signal_base.hpp (contents, props changed)
   sandbox/thread_safe_signals/boost/signals/slot_base.hpp (contents, props changed)
   sandbox/thread_safe_signals/boost/thread_safe_signals/signal_base.hpp
      - copied, changed from r42392, /sandbox/thread_safe_signals/boost/thread_safe_signals/detail/signal_base.hpp
Removed:
   sandbox/thread_safe_signals/boost/thread_safe_signals/detail/signal_base.hpp
Text files modified:
   sandbox/thread_safe_signals/boost/thread_safe_signals/detail/signal_template.hpp | 2 +-
   sandbox/thread_safe_signals/boost/thread_safe_signals/detail/signals_common.hpp | 3 +--
   sandbox/thread_safe_signals/boost/thread_safe_signals/detail/slot_template.hpp | 5 +++++
   sandbox/thread_safe_signals/boost/thread_safe_signals/signal_base.hpp | 18 ++++++++----------
   sandbox/thread_safe_signals/boost/thread_safe_signals/slot_base.hpp | 4 ++--
   sandbox/thread_safe_signals/libs/thread_safe_signals/doc/reference/reference.xml | 1 +
   sandbox/thread_safe_signals/libs/thread_safe_signals/doc/reference/signal_header.xml | 7 ++++---
   sandbox/thread_safe_signals/libs/thread_safe_signals/doc/reference/slot.xml | 24 +++++++++++++++++++-----
   sandbox/thread_safe_signals/libs/thread_safe_signals/test/track_test.cpp | 2 +-
   9 files changed, 42 insertions(+), 24 deletions(-)

Added: sandbox/thread_safe_signals/boost/signals/signal_base.hpp
==============================================================================
--- (empty file)
+++ sandbox/thread_safe_signals/boost/signals/signal_base.hpp 2008-01-03 17:10:00 EST (Thu, 03 Jan 2008)
@@ -0,0 +1,3 @@
+
+#include <boost/thread_safe_signals/signal_base.hpp>
+

Added: sandbox/thread_safe_signals/boost/signals/slot_base.hpp
==============================================================================
--- (empty file)
+++ sandbox/thread_safe_signals/boost/signals/slot_base.hpp 2008-01-03 17:10:00 EST (Thu, 03 Jan 2008)
@@ -0,0 +1,3 @@
+
+#include <boost/thread_safe_signals/slot_base.hpp>
+

Deleted: sandbox/thread_safe_signals/boost/thread_safe_signals/detail/signal_base.hpp
==============================================================================
--- sandbox/thread_safe_signals/boost/thread_safe_signals/detail/signal_base.hpp 2008-01-03 17:10:00 EST (Thu, 03 Jan 2008)
+++ (empty file)
@@ -1,41 +0,0 @@
-// Boost.Signals library
-
-// Copyright Douglas Gregor 2001-2004. Use, modification and
-// distribution is subject to the Boost Software License, Version
-// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// For more information, see http://www.boost.org
-
-#ifndef BOOST_TSS_SIGNALS_SIGNAL_BASE_HEADER
-#define BOOST_TSS_SIGNALS_SIGNAL_BASE_HEADER
-
-#include <boost/noncopyable.hpp>
-
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_PREFIX
-#endif
-
-namespace boost {
- namespace signalslib {
- class slot_base;
- namespace detail {
-
- class signal_base : public noncopyable
- {
- public:
- friend class boost::signalslib::slot_base;
-
- virtual ~signal_base() {}
- protected:
- virtual shared_ptr<void> lock_pimpl() const = 0;
- };
- } // end namespace detail
- } // end namespace BOOST_SIGNALS_NAMESPACE
-} // end namespace boost
-
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_SUFFIX
-#endif
-
-#endif // BOOST_TSS_SIGNALS_SIGNAL_BASE_HEADER

Modified: sandbox/thread_safe_signals/boost/thread_safe_signals/detail/signal_template.hpp
==============================================================================
--- sandbox/thread_safe_signals/boost/thread_safe_signals/detail/signal_template.hpp (original)
+++ sandbox/thread_safe_signals/boost/thread_safe_signals/detail/signal_template.hpp 2008-01-03 17:10:00 EST (Thu, 03 Jan 2008)
@@ -376,7 +376,7 @@
   }
 
   template<BOOST_SIGNAL_TEMPLATE_DEFAULTED_DECL>
- class BOOST_SIGNAL_CLASS_NAME: public signalslib::detail::signal_base
+ class BOOST_SIGNAL_CLASS_NAME: public signalslib::signal_base
   {
   public:
     typedef signalslib::detail::BOOST_WEAK_SIGNAL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION> weak_signal_type;

Modified: sandbox/thread_safe_signals/boost/thread_safe_signals/detail/signals_common.hpp
==============================================================================
--- sandbox/thread_safe_signals/boost/thread_safe_signals/detail/signals_common.hpp (original)
+++ sandbox/thread_safe_signals/boost/thread_safe_signals/detail/signals_common.hpp 2008-01-03 17:10:00 EST (Thu, 03 Jan 2008)
@@ -14,7 +14,7 @@
 #include <boost/mpl/bool.hpp>
 #include <boost/mpl/if.hpp>
 #include <boost/ref.hpp>
-#include <boost/thread_safe_signals/detail/signal_base.hpp>
+#include <boost/thread_safe_signals/signal_base.hpp>
 #include <boost/type_traits.hpp>
 
 #ifdef BOOST_HAS_ABI_HEADERS
@@ -44,7 +44,6 @@
       };
 
       // Determine if the given type T is a signal
- class signal_base;
       template<typename T>
       class is_signal: public mpl::bool_<is_convertible<T*, signal_base*>::value>
       {};

Modified: sandbox/thread_safe_signals/boost/thread_safe_signals/detail/slot_template.hpp
==============================================================================
--- sandbox/thread_safe_signals/boost/thread_safe_signals/detail/slot_template.hpp (original)
+++ sandbox/thread_safe_signals/boost/thread_safe_signals/detail/slot_template.hpp 2008-01-03 17:10:00 EST (Thu, 03 Jan 2008)
@@ -92,6 +92,11 @@
       _trackedObjects.push_back(tracked);
       return *this;
     }
+ BOOST_SLOT_CLASS_NAME(BOOST_SIGNALS_NUM_ARGS)& track(const signalslib::signal_base &signal)
+ {
+ track_signal(signal);
+ return *this;
+ }
     BOOST_SLOT_CLASS_NAME(BOOST_SIGNALS_NUM_ARGS)& track(const signalslib::slot_base &slot)
     {
       tracked_container_type::const_iterator it;

Copied: sandbox/thread_safe_signals/boost/thread_safe_signals/signal_base.hpp (from r42392, /sandbox/thread_safe_signals/boost/thread_safe_signals/detail/signal_base.hpp)
==============================================================================
--- /sandbox/thread_safe_signals/boost/thread_safe_signals/detail/signal_base.hpp (original)
+++ sandbox/thread_safe_signals/boost/thread_safe_signals/signal_base.hpp 2008-01-03 17:10:00 EST (Thu, 03 Jan 2008)
@@ -19,18 +19,16 @@
 namespace boost {
   namespace signalslib {
     class slot_base;
- namespace detail {
 
- class signal_base : public noncopyable
- {
- public:
- friend class boost::signalslib::slot_base;
+ class signal_base : public noncopyable
+ {
+ public:
+ friend class boost::signalslib::slot_base;
 
- virtual ~signal_base() {}
- protected:
- virtual shared_ptr<void> lock_pimpl() const = 0;
- };
- } // end namespace detail
+ virtual ~signal_base() {}
+ protected:
+ virtual shared_ptr<void> lock_pimpl() const = 0;
+ };
   } // end namespace BOOST_SIGNALS_NAMESPACE
 } // end namespace boost
 

Modified: sandbox/thread_safe_signals/boost/thread_safe_signals/slot_base.hpp
==============================================================================
--- sandbox/thread_safe_signals/boost/thread_safe_signals/slot_base.hpp (original)
+++ sandbox/thread_safe_signals/boost/thread_safe_signals/slot_base.hpp 2008-01-03 17:10:00 EST (Thu, 03 Jan 2008)
@@ -14,7 +14,7 @@
 
 #include <boost/shared_ptr.hpp>
 #include <boost/weak_ptr.hpp>
-#include <boost/thread_safe_signals/detail/signal_base.hpp>
+#include <boost/thread_safe_signals/signal_base.hpp>
 #include <vector>
 
 #ifdef BOOST_HAS_ABI_HEADERS
@@ -68,7 +68,7 @@
         return false;
       }
     protected:
- void track_signal(const signalslib::detail::signal_base &signal)
+ void track_signal(const signalslib::signal_base &signal)
       {
         _trackedObjects.push_back(signal.lock_pimpl());
       }

Modified: sandbox/thread_safe_signals/libs/thread_safe_signals/doc/reference/reference.xml
==============================================================================
--- sandbox/thread_safe_signals/libs/thread_safe_signals/doc/reference/reference.xml (original)
+++ sandbox/thread_safe_signals/libs/thread_safe_signals/doc/reference/reference.xml 2008-01-03 17:10:00 EST (Thu, 03 Jan 2008)
@@ -4,6 +4,7 @@
 <library-reference xmlns:xi="http://www.w3.org/2001/XInclude"
                    last-revision="$Date: 2007-03-06 16:51:55 -0500 (Tue, 06 Mar 2007) $">
   <xi:include href="signal_header.xml"/>
+ <xi:include href="signal_base.xml"/>
   <xi:include href="slot.xml"/>
   <xi:include href="slot_base.xml"/>
   <xi:include href="connection.xml"/>

Modified: sandbox/thread_safe_signals/libs/thread_safe_signals/doc/reference/signal_header.xml
==============================================================================
--- sandbox/thread_safe_signals/libs/thread_safe_signals/doc/reference/signal_header.xml (original)
+++ sandbox/thread_safe_signals/libs/thread_safe_signals/doc/reference/signal_header.xml 2008-01-03 17:10:00 EST (Thu, 03 Jan 2008)
@@ -2,6 +2,8 @@
 <!DOCTYPE header PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
   "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
 <header name="boost/signal.hpp" last-revision="$Date: 2007-03-06 16:51:55 -0500 (Tue, 06 Mar 2007) $">
+ <using-namespace name="boost"/>
+ <using-namespace name="boost::signalslib"/>
   <namespace name="boost">
     <namespace name="signalslib">
       <enum name="connect_position">
@@ -32,9 +34,8 @@
           <default><classname>signalslib::auto_threaded</classname></default>
         </template-type-parameter>
       </template>
- <inherit access="private">
- <type><classname>noncopyable</classname></type>
- <purpose>Exposition only</purpose>
+ <inherit access="public">
+ <type><classname>signal_base</classname></type>
       </inherit>
 
       <purpose>Set of safe multicast callback types.</purpose>

Modified: sandbox/thread_safe_signals/libs/thread_safe_signals/doc/reference/slot.xml
==============================================================================
--- sandbox/thread_safe_signals/libs/thread_safe_signals/doc/reference/slot.xml (original)
+++ sandbox/thread_safe_signals/libs/thread_safe_signals/doc/reference/slot.xml 2008-01-03 17:10:00 EST (Thu, 03 Jan 2008)
@@ -189,14 +189,28 @@
           </signature>
           <signature>
             <type>slotN &amp;</type>
+ <parameter name="tracked_signal">
+ <paramtype>const <classname>signalslib::signal_base</classname> &amp;</paramtype>
+ </parameter>
+ </signature>
+ <signature>
+ <type>slotN &amp;</type>
             <parameter name="tracked_slot">
- <paramtype>const signalslib::slot_base &amp;</paramtype>
+ <paramtype>const <classname>signalslib::slot_base</classname> &amp;</paramtype>
             </parameter>
           </signature>
- <effects><para>Adds object(s) to the slot's tracked object list. Should any of the
- tracked objects expire, then subsequent attempts to call the slot's <code>operator()</code>
- or <code>lock()</code> methods will throw an <classname>expired_slot</classname> exception.</para>
- <para>In the case of passing another slot as the argument to <code>track()</code>,
+ <effects>
+ <para>
+ Adds object(s) to the slot's tracked object list. Should any of the
+ tracked objects expire, then subsequent attempts to call the slot's <code>operator()</code>
+ or <code>lock()</code> methods will throw an <classname>expired_slot</classname> exception.
+ </para>
+ <para>When tracking a signal, a <classname>shared_ptr</classname>
+ internal to the signal class is used for tracking. The signal does not
+ need to be owned by an external <code>shared_ptr</code>.
+ </para>
+ <para>
+ In the case of passing another slot as the argument to <code>track()</code>,
               only the objects currently in the other slot's tracked object list are added
               to the tracked object list of <code>this</code>. The other slot object itself
               is not tracked.

Modified: sandbox/thread_safe_signals/libs/thread_safe_signals/test/track_test.cpp
==============================================================================
--- sandbox/thread_safe_signals/libs/thread_safe_signals/test/track_test.cpp (original)
+++ sandbox/thread_safe_signals/libs/thread_safe_signals/test/track_test.cpp 2008-01-03 17:10:00 EST (Thu, 03 Jan 2008)
@@ -88,7 +88,7 @@
   // Test binding of a signal as a slot
   {
     sig_type s2;
- s1.connect(sig_type::slot_type(s2));
+ s1.connect(sig_type::slot_type(s2).track(s2));
     s2.connect(sig_type::slot_type(&myfunc, _1, 0.7));
     BOOST_CHECK(s1(4) == 4);
   }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk