You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(89) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(208) |
Feb
(76) |
Mar
(55) |
Apr
(74) |
May
(43) |
Jun
(116) |
Jul
(109) |
Aug
(46) |
Sep
(36) |
Oct
(106) |
Nov
(159) |
Dec
(128) |
| 2007 |
Jan
(54) |
Feb
(225) |
Mar
(200) |
Apr
(229) |
May
(7) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Frank M. H. <fm...@us...> - 2007-02-21 20:28:18
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25834/thread_safe_signals Modified Files: connection.hpp slot.hpp Log Message: Made add_tracked() a public member of the slot class, so arbitrary objects can be added for the purpose of automatic connection management. Index: connection.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/connection.hpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- connection.hpp 18 Feb 2007 22:47:18 -0000 1.17 +++ connection.hpp 21 Feb 2007 20:28:14 -0000 1.18 @@ -121,9 +121,7 @@ } const GroupKey& group_key() const {return _group_key;} void set_group_key(const GroupKey &key) {_group_key = key;} - /* base class mutex should be locked and nolock_nograb_blocked() checked - before slot is called, to prevent races - with connect() and disconnect() */ + const SlotFunction slot; mutable mutex_type mutex; private: Index: slot.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/slot.hpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- slot.hpp 17 Feb 2007 03:12:22 -0000 1.11 +++ slot.hpp 21 Feb 2007 20:28:14 -0000 1.12 @@ -97,13 +97,14 @@ friend class signalslib::detail::tracked_objects_visitor; template<typename GroupKey, typename SlotFunction> friend class ConnectionBody; - private: - typedef std::vector<boost::weak_ptr<void> > tracked_objects_container; void add_tracked(const shared_ptr<void> &tracked) { _trackedObjects.push_back(tracked); } + private: + typedef std::vector<boost::weak_ptr<void> > tracked_objects_container; + const tracked_objects_container& get_all_tracked() const {return _trackedObjects;} tracked_objects_container _trackedObjects; |
|
From: Frank M. H. <fm...@us...> - 2007-02-21 19:15:58
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/signals/test In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28978 Modified Files: trackable_test.cpp Log Message: Made the test of an already auto-disconnected slot actually test something (the slot was never connected to the signal). Index: trackable_test.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/signals/test/trackable_test.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- trackable_test.cpp 7 Feb 2007 01:21:51 -0000 1.1 +++ trackable_test.cpp 21 Feb 2007 19:15:57 -0000 1.2 @@ -57,7 +57,7 @@ sig_type::slot_type slot(boost::bind<int>(swallow(), shorty, _1)); delete shorty; - + s1.connect(slot); BOOST_CHECK(s1(5) == 0); } |
|
From: Frank M. H. <fm...@us...> - 2007-02-21 15:15:25
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27522 Modified Files: track.hpp Log Message: It's silly to make track() support reference-wrapped arguments. Index: track.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/track.hpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- track.hpp 20 Feb 2007 01:19:25 -0000 1.6 +++ track.hpp 21 Feb 2007 15:15:23 -0000 1.7 @@ -65,17 +65,9 @@ return tracked<T>(ptr); } template<class T> - tracked<T> track(const boost::reference_wrapper<shared_ptr<T> > &ref) { - return tracked<T>(ref.get()); - } - template<class T> tracked<T> track(const boost::weak_ptr<T>& ptr) { return tracked<T>(ptr); } - template<class T> - tracked<T> track(const boost::reference_wrapper<weak_ptr<T> > &ref) { - return tracked<T>(ref.get()); - } // get_pointer lets mem_fn bind a tracked template<typename T> T* get_pointer(const signalslib::tracked<T> &tracked) {return shared_ptr<T>(tracked).get();} |
|
From: Frank M. H. <fm...@us...> - 2007-02-20 21:50:10
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/signals/doc/reference In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4105/reference Modified Files: signal_header.xml Log Message: Added ThreadingModel template parameter to signal reference documentation. Index: signal_header.xml =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/signals/doc/reference/signal_header.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- signal_header.xml 20 Feb 2007 21:34:45 -0000 1.2 +++ signal_header.xml 20 Feb 2007 21:50:06 -0000 1.3 @@ -302,7 +302,7 @@ exception if no slots are connected to the signal, depending on the combiner used. The default combiner will not throw for zero slots when the return type is <code>void</code> or - <code>boost::optional<T></code>, + <classname>optional</classname><T>, but will throw when the return type is any other type (because there is no way to synthesize a return value).</simpara></notes> </overloaded-method> @@ -341,11 +341,14 @@ <default><classname>std::less</classname><Group></default> </template-type-parameter> <template-type-parameter name="SlotFunction"> - <default><classname>functionN</classname><Signature></default> + <default><classname>function</classname><Signature></default> + </template-type-parameter> + <template-type-parameter name="ThreadingModel"> + <default><classname>signals::single_threaded</classname></default> </template-type-parameter> </template> - <inherit access="public"><classname>signalN</classname><R, T1, T2, ..., TN, Combiner, Group, GroupCompare, SlotFunction></inherit> + <inherit access="public"><classname>signalN</classname><R, T1, T2, ..., TN, Combiner, Group, GroupCompare, SlotFunction, ThreadingModel></inherit> <purpose>Safe multicast callback.</purpose> <description> |
|
From: Frank M. H. <fm...@us...> - 2007-02-20 21:34:48
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/signals/doc/reference In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30550/reference Modified Files: signal_header.xml Log Message: Updated signalN reference to reflect changes for thread-safety. Index: signal_header.xml =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/signals/doc/reference/signal_header.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- signal_header.xml 7 Feb 2007 01:22:17 -0000 1.1 +++ signal_header.xml 20 Feb 2007 21:34:45 -0000 1.2 @@ -28,8 +28,10 @@ <template-type-parameter name="SlotFunction"> <default><classname>functionN</classname><R, T1, T2, ..., TN></default> </template-type-parameter> + <template-type-parameter name="ThreadingModel"> + <default><classname>signals::single_threaded</classname></default> + </template-type-parameter> </template> - <inherit access="public"><classname>signals::trackable</classname></inherit> <inherit access="private"> <type><classname>noncopyable</classname></type> <purpose>Exposition only</purpose> @@ -37,7 +39,7 @@ <purpose>Set of safe multicast callback types.</purpose> - <description> + <description> <para>The class template <classname>signalN</classname> covers several related classes signal0, signal1, signal2, etc., where the number suffix describes the number of function @@ -152,7 +154,7 @@ <throws><simpara>This routine meets the strong exception guarantee, where any exception thrown will cause the slot to not be - connected to the signal.</simpara></throws> + connected to the signal.</simpara></throws> <complexity><simpara>Constant time when connecting a slot without a group name or logarithmic in the number of groups @@ -196,7 +198,7 @@ number of slots connected to the signal.</simpara></complexity> </overloaded-method> - + <method name="disconnect_all_slots"> <type>void</type> <effects><simpara>Disconnects all slots connected to the signal.</simpara></effects> @@ -257,7 +259,7 @@ <parameter><paramtype>...</paramtype></parameter> <parameter name="aN"><paramtype>argN_type</paramtype></parameter> </signature> - + <signature cv="const"> <type>result_type</type> <parameter name="a1"><paramtype>arg1_type</paramtype></parameter> @@ -296,27 +298,31 @@ invoke the combiner as non-<computeroutput>const</computeroutput>.</simpara> - <simpara>Calling the function call operator may invoke undefined - behavior if no slots are connected to the signal, depending - on the combiner used. The default combiner is well-defined - for zero slots when the return type is void but is undefined - when the return type is any other type (because there is no + <simpara>Calling the function call operator may throw an + exception if no slots are connected to the signal, depending + on the combiner used. The default combiner will not throw + for zero slots when the return type is <code>void</code> or + <code>boost::optional<T></code>, + but will throw when the return type is any other type (because there is no way to synthesize a return value).</simpara></notes> </overloaded-method> </method-group> <method-group name="combiner access"> - <overloaded-method name="combiner"> - <signature> - <type>combiner_type&</type> - </signature> - <signature cv="const"> - <type>const combiner_type&</type> - </signature> + <method name="combiner" cv="const"> + <type>combiner_type</type> - <returns><simpara>A reference to the stored combiner.</simpara></returns> + <returns><simpara>A copy of the stored combiner.</simpara></returns> <throws><simpara>Will not throw.</simpara></throws> - </overloaded-method> + </method> + <method name="set_combiner"> + <type>void</type> + <parameter name="combiner"><paramtype>const combiner_type&</paramtype></parameter> + + <effects><simpara>Copies a new combiner into the signal for use with + future signal invocations.</simpara></effects> + <throws><simpara>Will not throw.</simpara></throws> + </method> </method-group> </class> @@ -350,7 +356,7 @@ type with N arguments instead of N separate arguments, and derives from the appropriate <classname>signalN</classname> instantiation.</para> - + <para>All functionality of this class template is in its base class <classname>signalN</classname>.</para> </description> |
|
From: Frank M. H. <fm...@us...> - 2007-02-20 20:07:18
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/signals/doc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23886 Modified Files: faq.xml Log Message: Updated faq wrt thread-safety. Index: faq.xml =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/signals/doc/faq.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- faq.xml 7 Feb 2007 01:21:50 -0000 1.1 +++ faq.xml 20 Feb 2007 20:07:09 -0000 1.2 @@ -3,7 +3,7 @@ "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd"> <section last-revision="$Date$"> <title>Frequently Asked Questions</title> - + <qandaset> <qandaentry> <question> @@ -23,10 +23,9 @@ <para>Is Boost.Signals thread-safe?</para> </question> <answer> - <para>No. Using Boost.Signals in a multithreaded concept is - very dangerous, and it is very likely that the results will be - less than satisfying. Boost.Signals will support thread safety - in the future.</para> + <para>Yes, if the ThreadingModel template parameter of the signal is set to + boost::signals::multi_threaded. If you use thread-safe signals + in your code, you will also have to link to libboost_thread.</para> </answer> </qandaentry> <qandaentry> @@ -71,7 +70,7 @@ ways to do this:</para> <para>The first way involves defining - the <code>BOOST_SIGNALS_NAMESPACE</code> + the <code>BOOST_SIGNALS_NAMESPACE</code> macro to some other identifier (e.g., <code>signalslib</code>) when building and using the Boost.Signals library. Then the namespace of the Boost.Signals library will be |
|
From: Frank M. H. <fm...@us...> - 2007-02-20 20:06:50
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/signals/doc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23831 Modified Files: signals.xml tutorial.xml Log Message: Updated tutorial to use new boost::track instead of old boost::trackable. Index: tutorial.xml =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/signals/doc/tutorial.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- tutorial.xml 7 Feb 2007 01:21:50 -0000 1.1 +++ tutorial.xml 20 Feb 2007 20:06:46 -0000 1.2 @@ -28,7 +28,7 @@ will not need to read the <emphasis>Advanced</emphasis> sections.</para> </section> -<section><title>Compatibility Note</title> +<section><title>Compatibility Note</title> <para>Boost.Signals has two syntactical forms: the preferred form and the compatibility form. The preferred form fits more closely with the @@ -101,12 +101,12 @@ <row> <entry> <programlisting> -struct HelloWorld +struct HelloWorld { - void operator()() const - { + void operator()() const + { std::cout << "Hello, World!" << std::endl; - } + } }; // ... @@ -124,12 +124,12 @@ </entry> <entry> <programlisting> -struct HelloWorld +struct HelloWorld { - void operator()() const - { + void operator()() const + { std::cout << "Hello, World!" << std::endl; - } + } }; // ... @@ -159,7 +159,7 @@ slots. The first slot will print "Hello" and may look like this:</para> <programlisting> -struct Hello +struct Hello { void operator()() const { @@ -482,7 +482,7 @@ max_value = *first; ++first; } - + return max_value; } }; @@ -512,13 +512,13 @@ <row> <entry> <programlisting> -<classname>boost::signal</classname><float (float x, float y), +<classname>boost::signal</classname><float (float x, float y), maximum<float> > sig; </programlisting> </entry> <entry> <programlisting> -<classname alt="boost::signalN">boost::signal2</classname><float, float, float, +<classname alt="boost::signalN">boost::signal2</classname><float, float, float, maximum<float> > sig; </programlisting> </entry> @@ -558,7 +558,7 @@ }; </programlisting> <para> -Again, we can create a signal with this new combiner: +Again, we can create a signal with this new combiner: </para> <informaltable> <tgroup cols="2" align="left"> @@ -572,7 +572,7 @@ <row> <entry> <programlisting> -<classname>boost::signal</classname><float (float, float), +<classname>boost::signal</classname><float (float, float), aggregate_values<std::vector<float> > > sig; sig.<methodname>connect</methodname>(&quotient); @@ -581,7 +581,7 @@ sig.<methodname>connect</methodname>(&difference); std::vector<float> results = sig(5, 3); -std::copy(results.begin(), results.end(), +std::copy(results.begin(), results.end(), std::ostream_iterator<float>(cout, " ")); </programlisting> </entry> @@ -596,7 +596,7 @@ sig.<methodname>connect</methodname>(&difference); std::vector<float> results = sig(5, 3); -std::copy(results.begin(), results.end(), +std::copy(results.begin(), results.end(), std::ostream_iterator<float>(cout, " ")); </programlisting> </entry> @@ -676,7 +676,7 @@ </programlisting> </section> -<section><title>Blocking Slots (Beginner)</title> +<section><title>Blocking Slots (Beginner)</title> <para>Slots can be temporarily "blocked", meaning that they will be ignored when the signal is invoked but have not been disconnected. The @@ -825,34 +825,45 @@ // ... NewsMessageArea newsMessageArea = new NewsMessageArea(/* ... */); // ... -deliverNews.<methodname>connect</methodname>(boost::bind(&NewsMessageArea::displayNews, +deliverNews.<methodname>connect</methodname>(boost::bind(&NewsMessageArea::displayNews, newsMessageArea, _1)); </programlisting> <para>However, what if the user closes the news message area, destroying the <code>newsMessageArea</code> object that <code>deliverNews</code> knows about? Most likely, a segmentation -fault will occur. However, with Boost.Signals one need only make -<code>NewsMessageArea</code> <emphasis>trackable</emphasis>, and the slot -involving <code>newsMessageArea</code> will be disconnected when -<code>newsMessageArea</code> is destroyed. The -<code>NewsMessageArea</code> class is made trackable by deriving -publicly from the <code>boost::signals::trackable</code> class, +fault will occur. However, with Boost.Signals one may track any object +which is managed by a shared_ptr, by using +<functionname>boost::track</functionname>. A slot will automatically +disconnect when any tracked objects bound to it are destroyed. In +addition, Boost.Signals will ensure that a tracked object is not +destroyed while the slot it is associated with is in mid-execution +(especially useful in multi-threaded code). +To track <code>NewsMessageArea</code>, we use a shared_ptr to manage +its lifetime, and wrap it in a call to <functionname>boost::track</functionname> +before passing it to <code>boost::bind</code>, e.g.:</para> <programlisting> -struct NewsMessageArea : public MessageArea, public boost::signals::trackable -{ - // ... -}; +// ... +boost::shared_ptr<NewsMessageArea> newsMessageArea(new NewsMessageArea(/* ... */)); +// ... +deliverNews.<methodname>connect</methodname>(boost::bind(&NewsMessageArea::displayNews, + boost::track(newsMessageArea), _1)); </programlisting> +<para> <functionname>boost::track</functionname> returns an object of type +<classname>boost::tracked<T></classname> when given a <code>shared_ptr<T></code> +as input. +<code>tracked<T></code> objects are implicitly convertible +to T&, T*, shared_ptr<T>, or weak_ptr<T>, and so can be bound to arguments +which require references or pointers.</para> <para>At this time there is a significant limitation to the use of -<code>trackable</code> objects in making slot connections: function -objects built using Boost.Bind are understood, such that pointers -or references to <code>trackable</code> objects passed to +tracked objects in making slot connections: only function +objects built using Boost.Bind are understood, such that <code>tracked</code> +objects passed to <code>boost::bind</code> will be found and tracked.</para> <para><emphasis role="bold">Warning</emphasis>: User-defined function objects and function objects from other libraries (e.g., Boost.Function or Boost.Lambda) -do not implement the required interfaces for <code>trackable</code> -object detection, and <emphasis>will silently ignore any bound trackable +do not implement the required interfaces for <code>tracked</code> +object detection, and <emphasis>will silently ignore any bound tracked objects</emphasis>. Future versions of the Boost libraries will address this limitation.</para> </section> @@ -865,7 +876,7 @@ <code>disconnect</code> method directly, or indirectly via the signal's <code>disconnect</code> method or <code>scoped_connection</code>'s destructor.</para></listitem> -<listitem><para>A <code>trackable</code> object bound to the slot is +<listitem><para>A <code>tracked</code> object bound to the slot is destroyed.</para></listitem> <listitem><para>The signal is destroyed.</para></listitem></itemizedlist> <para>These events can occur at any time without disrupting a signal's @@ -902,7 +913,7 @@ <row> <entry> <programlisting> -class Button +class Button { typedef boost::signal<void (int x, int y)> OnClick; @@ -933,7 +944,7 @@ </entry> <entry> <programlisting> -class Button +class Button { typedef <classname alt="boost::signalN">boost::signal2</classname><void,int,int> OnClick; @@ -976,7 +987,7 @@ <section> <title>Example: Document-View</title> - + <para>Signals can be used to implement flexible Document-View architectures. The document will contain a signal to which each of the views can connect. The following <code>Document</code> class Index: signals.xml =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/signals/doc/signals.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- signals.xml 7 Feb 2007 01:21:50 -0000 1.1 +++ signals.xml 20 Feb 2007 20:06:46 -0000 1.2 @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd"> -<library name="Signals" dirname="signals" - xmlns:xi="http://www.w3.org/2001/XInclude" id="signals" +<library name="Signals" dirname="signals" + xmlns:xi="http://www.w3.org/2001/XInclude" id="signals" last-revision="$Date$"> <libraryinfo> <author> @@ -10,6 +10,11 @@ <surname>Gregor</surname> <!-- <email>gr...@cs...</email> --> </author> + <author> + <firstname>Frank</firstname> + <surname>Hess</surname> + <!-- <email>fm...@us...</email> --> + </author> <copyright> <year>2001</year> @@ -18,6 +23,10 @@ <year>2004</year> <holder>Douglas Gregor</holder> </copyright> + <copyright> + <year>2007</year> + <holder>Frank Mori Hess</holder> + </copyright> <legalnotice> <para>Use, modification and distribution is subject to the Boost |
|
From: Frank M. H. <fm...@us...> - 2007-02-20 13:32:24
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/detail In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12224/thread_safe_signals/detail Modified Files: slot_call_iterator.hpp Log Message: Fixed a race that made it possible for two slot iterators to fail a test for equality after one was copy constructed or assigned from the other. Index: slot_call_iterator.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/detail/slot_call_iterator.hpp,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- slot_call_iterator.hpp 19 Feb 2007 03:48:35 -0000 1.18 +++ slot_call_iterator.hpp 20 Feb 2007 13:32:23 -0000 1.19 @@ -54,6 +54,7 @@ iter(iter_in), end(end_in), f(f), cache(&c), callable_iter(end_in) { + lockNextCallable(); } typename inherited::reference @@ -74,8 +75,6 @@ bool equal(const slot_call_iterator_t& other) const { - lockNextCallable(); - other.lockNextCallable(); return iter == other.iter; } |
|
From: Frank M. H. <fm...@us...> - 2007-02-20 01:19:26
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30407/thread_safe_signals Modified Files: track.hpp Log Message: Added implicit conversion to reference type to boost::tracked Index: track.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/track.hpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- track.hpp 15 Feb 2007 19:26:36 -0000 1.5 +++ track.hpp 20 Feb 2007 01:19:25 -0000 1.6 @@ -24,7 +24,6 @@ namespace boost { namespace signalslib { // The actual wrapper for tracked shared_ptr-referenced objects. - // (This probably needs a full smart pointer interface) template<class T> class tracked : public weak_ptr<T> { @@ -47,6 +46,14 @@ { return shared_ptr<const T>(*this); } + operator T& () + { + return *shared_ptr<T>(*this).get(); + } + operator const T& () + { + return *shared_ptr<const T>(*this).get(); + } operator shared_ptr<void> () const { return shared_ptr<void>(*this); |
|
From: Frank M. H. <fm...@us...> - 2007-02-20 00:40:46
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11998 Modified Files: deconstruct_ptr.hpp Log Message: Handle null pointers gracefully. Index: deconstruct_ptr.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/deconstruct_ptr.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- deconstruct_ptr.hpp 7 Feb 2007 18:14:48 -0000 1.2 +++ deconstruct_ptr.hpp 20 Feb 2007 00:40:44 -0000 1.3 @@ -50,6 +50,7 @@ template<typename T> shared_ptr<T> deconstruct_ptr(T *ptr) { + if(ptr == 0) return shared_ptr<T>(); shared_ptr<T> shared(ptr, boost::predestructing_deleter<T>()); deconstruct_detail::do_postconstruct(ptr); return shared; @@ -57,6 +58,7 @@ template<typename T, typename D> shared_ptr<T> deconstruct_ptr(T *ptr, D deleter) { + if(ptr == 0) return shared_ptr<T>(); shared_ptr<T> shared(ptr, deleter); deconstruct_detail::do_postconstruct(ptr); return shared; |
|
From: Jan G. <jan...@us...> - 2007-02-19 23:18:13
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9802/boost/circular_buffer Modified Files: base.hpp details.hpp Log Message: Fixed compilation issues. Index: base.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer/base.hpp,v retrieving revision 1.79 retrieving revision 1.80 diff -u -d -r1.79 -r1.80 --- base.hpp 18 Feb 2007 23:03:26 -0000 1.79 +++ base.hpp 19 Feb 2007 23:18:10 -0000 1.80 @@ -2109,7 +2109,12 @@ clear(); insert(begin(), first, last); } else { +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) + circular_buffer<value_type, allocator_type> tmp(new_capacity, m_alloc); + tmp.insert(begin(), first, last); +#else circular_buffer<value_type, allocator_type> tmp(new_capacity, first, last, m_alloc); +#endif // #if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) tmp.swap(*this); } } Index: details.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer/details.hpp,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- details.hpp 18 Feb 2007 23:03:26 -0000 1.21 +++ details.hpp 19 Feb 2007 23:18:10 -0000 1.22 @@ -78,7 +78,6 @@ explicit iterator_wrapper(Iterator it) : m_it(it) {} Iterator operator () () const { return m_it++; } private: - iterator_wrapper(const iterator_wrapper<Iterator>&); // do not generate iterator_wrapper<Iterator>& operator = (const iterator_wrapper<Iterator>&); // do not generate }; @@ -92,7 +91,6 @@ explicit item_wrapper(Value item) : m_item(item) {} Pointer operator () () const { return &m_item; } private: - item_wrapper(const item_wrapper<Pointer, Value>&); // do not generate item_wrapper<Pointer, Value>& operator = (const item_wrapper<Pointer, Value>&); // do not generate }; @@ -106,13 +104,12 @@ size_type m_n; Value m_item; Alloc& m_alloc; - explicit assign_n(size_type n, Value item, Alloc& alloc) : m_n(n), m_item(item), m_alloc(alloc) {} + assign_n(size_type n, Value item, Alloc& alloc) : m_n(n), m_item(item), m_alloc(alloc) {} template <class Pointer> void operator () (Pointer p) const { uninitialized_fill_n(p, m_n, m_item, m_alloc); } private: - assign_n(const assign_n<Value, Alloc>&); // do not generate assign_n<Value, Alloc>& operator = (const assign_n<Value, Alloc>&); // do not generate }; @@ -125,13 +122,12 @@ const Iterator& m_first; const Iterator& m_last; Alloc& m_alloc; - explicit assign_range(const Iterator& first, const Iterator& last, Alloc& alloc) : m_first(first), m_last(last), m_alloc(alloc) {} + assign_range(const Iterator& first, const Iterator& last, Alloc& alloc) : m_first(first), m_last(last), m_alloc(alloc) {} template <class Pointer> void operator () (Pointer p) const { uninitialized_copy(m_first, m_last, p, m_alloc); } private: - assign_range(const assign_range<Iterator, Alloc>&); // do not generate assign_range<Iterator, Alloc>& operator = (const assign_range<Iterator, Alloc>&); // do not generate }; |
|
From: Frank M. H. <fm...@us...> - 2007-02-19 03:48:38
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/detail In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11431/thread_safe_signals/detail Modified Files: slot_call_iterator.hpp Log Message: We still need to grab the tracked objects in the slot iterator before running the slot. Index: slot_call_iterator.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/detail/slot_call_iterator.hpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- slot_call_iterator.hpp 18 Feb 2007 22:47:19 -0000 1.17 +++ slot_call_iterator.hpp 19 Feb 2007 03:48:35 -0000 1.18 @@ -90,7 +90,9 @@ } for(;iter != end; ++iter) { - if((*iter)->blocked() == false) + lock_type lock((*iter)->mutex); + tracked_ptrs = (*iter)->nolock_grab_tracked_objects(); + if((*iter)->nolock_nograb_blocked() == false) { callable_iter = iter; break; |
|
From: Jan G. <jan...@us...> - 2007-02-18 23:03:40
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30871/boost/circular_buffer Modified Files: base.hpp details.hpp space_optimized.hpp Log Message: consistent usage of capacity_type Index: space_optimized.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer/space_optimized.hpp,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- space_optimized.hpp 23 Jan 2007 23:12:33 -0000 1.23 +++ space_optimized.hpp 18 Feb 2007 23:03:26 -0000 1.24 @@ -37,7 +37,7 @@ For detailed documentation of the space_optimized_circular_buffer visit: http://www.boost.org/libs/circular_buffer/doc/circular_buffer_adaptor.html */ -template<class T, class Alloc> +template <class T, class Alloc> class circular_buffer_space_optimized : private circular_buffer<T, Alloc> { public: // Typedefs @@ -59,6 +59,7 @@ typedef typename circular_buffer<T, Alloc>::param_value_type param_value_type; typedef typename circular_buffer<T, Alloc>::return_value_type return_value_type; +#if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) //! Capacity controller of the space optimized circular buffer. /*! <p><pre> @@ -77,7 +78,12 @@ which ensures compatibility of creating an instance of the <code>circular_buffer_space_optimized</code> with other STL containers.</p> */ + typedef cb_details::capacity_control<size_type, T, Alloc> capacity_type; +#else + /*! \cond */ typedef cb_details::capacity_control<size_type> capacity_type; + /*! \endcond */ +#endif // Inherited @@ -118,32 +124,8 @@ //! See the circular_buffer source documentation. size_type reserve() const { return capacity() - size(); } - //! Return the minimal guaranteed amount of allocated memory. - /*! - The allocated memory will never drop under this value. - */ - size_type min_capacity() const { return m_capacity_ctrl.m_min_capacity; } - - //! Change the minimal guaranteed amount of allocated memory. - /*! - \pre <code>(*this).capacity() >= new_min_capacity</code> - \post <code>(*this).min_capacity() == new_min_capacity</code> - Allocates memory specified by the <code>new_min_capacity</code> parameter. - \note It is considered as a bug if the precondition is not met (i.e. if - <code>new_min_capacity > (*this).capacity()</code>) and an assertion - will be invoked in the debug mode. - */ - void set_min_capacity(size_type new_min_capacity) { - BOOST_CB_ASSERT(capacity() >= new_min_capacity); // check for too large new min_capacity - m_capacity_ctrl.m_min_capacity = new_min_capacity; - if (new_min_capacity > circular_buffer<T, Alloc>::capacity()) - circular_buffer<T, Alloc>::set_capacity(new_min_capacity); - else - check_high_capacity(); - } - //! See the circular_buffer source documentation. - size_type capacity() const { return m_capacity_ctrl.m_capacity; } + const capacity_type& capacity() const { return m_capacity_ctrl; } #if defined(BOOST_CB_TEST) @@ -156,18 +138,25 @@ #endif // #if defined(BOOST_CB_TEST) - //! See the circular_buffer source documentation. + //! TODO Change the minimal guaranteed amount of allocated memory. /*! + \pre <code>(*this).capacity() >= new_min_capacity</code> + \post <code>(*this).min_capacity() == new_min_capacity</code> + Allocates memory specified by the <code>new_min_capacity</code> parameter. + \note It is considered as a bug if the precondition is not met (i.e. if + <code>new_min_capacity > (*this).capacity()</code>) and an assertion + will be invoked in the debug mode. + \pre <code>min_capacity() <= new_capacity</code> \note It is considered as a bug if the precondition is not met (i.e. if <code>new_capacity > min_capacity()</code>) and an assertion will be invoked in the debug mode. */ - void set_capacity(size_type new_capacity) { - BOOST_CB_ASSERT(new_capacity >= min_capacity()); // check for too low new capacity - if (new_capacity < circular_buffer<T, Alloc>::capacity()) - circular_buffer<T, Alloc>::set_capacity(new_capacity); - m_capacity_ctrl.m_capacity = new_capacity; + void set_capacity(const capacity_type& new_capacity) { + m_capacity_ctrl = new_capacity; + if (new_capacity.capacity() < circular_buffer<T, Alloc>::capacity()) + circular_buffer<T, Alloc>::set_capacity(new_capacity.capacity()); + set_min_capacity(new_capacity.min_capacity()); } //! See the circular_buffer source documentation. @@ -188,11 +177,11 @@ <code>new_capacity > min_capacity()</code>) and an assertion will be invoked in the debug mode. */ - void rset_capacity(size_type new_capacity) { - BOOST_CB_ASSERT(new_capacity >= min_capacity()); // check for too low new capacity - if (new_capacity < circular_buffer<T, Alloc>::capacity()) - circular_buffer<T, Alloc>::rset_capacity(new_capacity); - m_capacity_ctrl.m_capacity = new_capacity; + void rset_capacity(const capacity_type& new_capacity) { + m_capacity_ctrl = new_capacity; + if (new_capacity.capacity() < circular_buffer<T, Alloc>::capacity()) + circular_buffer<T, Alloc>::rset_capacity(new_capacity.capacity()); + set_min_capacity(new_capacity.min_capacity()); } //! See the circular_buffer source documentation. @@ -575,6 +564,14 @@ private: // Helper methods + //! Change the minimal guaranteed amount of allocated memory. + void set_min_capacity(size_type new_min_capacity) { + if (new_min_capacity > circular_buffer<T, Alloc>::capacity()) + circular_buffer<T, Alloc>::set_capacity(new_min_capacity); + else + check_high_capacity(); + } + //! Ensure the reserve for possible growth up. size_type ensure_reserve(size_type new_capacity, size_type size) const { if (size + new_capacity / 5 >= new_capacity) @@ -608,8 +605,8 @@ size_type new_capacity = circular_buffer<T, Alloc>::capacity(); while (new_capacity / 3 >= size()) { // (new_capacity / 3) -> avoid oscillations new_capacity /= 2; - if (new_capacity <= min_capacity()) { - new_capacity = min_capacity(); + if (new_capacity <= m_capacity_ctrl.m_min_capacity) { + new_capacity = m_capacity_ctrl.m_min_capacity; break; } } Index: details.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer/details.hpp,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- details.hpp 8 Oct 2006 21:31:28 -0000 1.20 +++ details.hpp 18 Feb 2007 23:03:26 -0000 1.21 @@ -77,6 +77,9 @@ mutable Iterator m_it; explicit iterator_wrapper(Iterator it) : m_it(it) {} Iterator operator () () const { return m_it++; } +private: + iterator_wrapper(const iterator_wrapper<Iterator>&); // do not generate + iterator_wrapper<Iterator>& operator = (const iterator_wrapper<Iterator>&); // do not generate }; /*! @@ -88,6 +91,9 @@ Value m_item; explicit item_wrapper(Value item) : m_item(item) {} Pointer operator () () const { return &m_item; } +private: + item_wrapper(const item_wrapper<Pointer, Value>&); // do not generate + item_wrapper<Pointer, Value>& operator = (const item_wrapper<Pointer, Value>&); // do not generate }; /*! @@ -106,7 +112,8 @@ uninitialized_fill_n(p, m_n, m_item, m_alloc); } private: - assign_n& operator = (const assign_n&); // do not generate + assign_n(const assign_n<Value, Alloc>&); // do not generate + assign_n<Value, Alloc>& operator = (const assign_n<Value, Alloc>&); // do not generate }; /*! @@ -124,15 +131,20 @@ uninitialized_copy(m_first, m_last, p, m_alloc); } private: - assign_range& operator = (const assign_range&); // do not generate + assign_range(const assign_range<Iterator, Alloc>&); // do not generate + assign_range<Iterator, Alloc>& operator = (const assign_range<Iterator, Alloc>&); // do not generate }; /*! \struct capacity_control \brief Capacity controller of the space optimized circular buffer. */ +#if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) +template <class Size, class T, class Alloc> +#else template <class Size> -struct capacity_control { +#endif +class capacity_control { //! The capacity of the space optimized circular buffer. Size m_capacity; @@ -140,6 +152,14 @@ //! The lowest guaranteed capacity of the adapted circular buffer. Size m_min_capacity; +#if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) + friend circular_buffer_space_optimized<T, Alloc>; +#else + template <class T, class Alloc> friend class circular_buffer_space_optimized; +#endif + +public: + //! Constructor. capacity_control(Size capacity, Size min_capacity = 0) : m_capacity(capacity), m_min_capacity(min_capacity) { @@ -149,6 +169,15 @@ // Default copy constructor. // Default assign operator. + + // Get the capacity of the space optimized circular buffer. + Size capacity() const { return m_capacity; } + + // Get the minimal capacity of the space optimized circular buffer. + Size min_capacity() const { return m_min_capacity; } + + //! Size operator - returns the capacity of the space optimized circular buffer. + operator Size() const { return m_capacity; } }; /*! @@ -393,8 +422,6 @@ return lhs.m_it < rhs.m_it; else if (rdiff == 0) return rhs.m_end; - else - return false; } else if (ldiff == 0) { if (rdiff < 0) return !lhs.m_end; Index: base.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer/base.hpp,v retrieving revision 1.78 retrieving revision 1.79 diff -u -d -r1.78 -r1.79 --- base.hpp 23 Jan 2007 23:12:33 -0000 1.78 +++ base.hpp 18 Feb 2007 23:03:26 -0000 1.79 @@ -379,7 +379,8 @@ /*! \param index The position of the element. \return A const reference to the element at the <code>index</code> position. - \throws std::out_of_range when the <code>index</code> is invalid (when <code>index >= size()</code>). + \throws <code>std::out_of_range</code> when the <code>index</code> is invalid (when + <code>index >= size()</code>). \par Complexity Constant (in the size of the <code>circular_buffer</code>). \par Exception Safety @@ -397,7 +398,8 @@ /*! \param index The position of the element. \return A const reference to the element at the <code>index</code> position. - \throws std::out_of_range when the <code>index</code> is invalid (when <code>index >= size()</code>). + \throws <code>std::out_of_range</code> when the <code>index</code> is invalid (when + <code>index >= size()</code>). \par Complexity Constant (in the size of the <code>circular_buffer</code>). \par Exception Safety @@ -742,7 +744,7 @@ Does not invalidate any iterators. \sa <code>reserve()</code>, <code>size()</code>, <code>max_size()</code>, <code>set_capacity()</code> */ - size_type capacity() const { return m_end - m_buff; } + capacity_type capacity() const { return m_end - m_buff; } //! Change the capacity of the <code>circular_buffer</code>. /*! @@ -761,7 +763,7 @@ Invalidates all iterators pointing to the <code>circular_buffer</code>. \sa <code>rset_capacity()</code>, <code>resize()</code> */ - void set_capacity(size_type new_capacity) { + void set_capacity(capacity_type new_capacity) { if (new_capacity == capacity()) return; pointer buff = allocate(new_capacity); @@ -824,7 +826,7 @@ Invalidates all iterators pointing to the <code>circular_buffer</code>. \sa <code>set_capacity()</code>, <code>rresize()</code> */ - void rset_capacity(size_type new_capacity) { + void rset_capacity(capacity_type new_capacity) { if (new_capacity == capacity()) return; pointer buff = allocate(new_capacity); @@ -1403,8 +1405,8 @@ //! Insert <code>n</code> copies of the <code>item</code> at the specified position. /*! \pre <code>pos</code> is a valid iterator pointing to the <code>circular_buffer</code> or its end. - \post The number of <code>min(n, (pos - begin()) + reserve())</code> elements will be inserted at the position - <code>pos</code>.<br>The number of <code>min(pos - begin(), max(0, n - reserve()))</code> elements will + \post The number of <code>min[n, (pos - begin()) + reserve()]</code> elements will be inserted at the position + <code>pos</code>.<br>The number of <code>min[pos - begin(), max[0, n - reserve()]]</code> elements will be overwritten at the beginning of the <code>circular_buffer</code>.<br>(See Example for the explanation.) \param pos An iterator specifying the position where the <code>item</code>s will be inserted. @@ -1451,9 +1453,9 @@ Valid range <code>[first, last)</code> where <code>first</code> and <code>last</code> meet the requirements of an <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>. \post Elements from the range - <code>[first + max(0, distance(first, last) - (pos - begin()) - reserve()), last)</code> will be - inserted at the position <code>pos</code>.<br>The number of <code>min(pos - begin(), max(0, - distance(first, last) - reserve()))</code> elements will be overwritten at the beginning of the + <code>[first + max[0, distance(first, last) - (pos - begin()) - reserve()], last)</code> will be + inserted at the position <code>pos</code>.<br>The number of <code>min[pos - begin(), max[0, + distance(first, last) - reserve()]]</code> elements will be overwritten at the beginning of the <code>circular_buffer</code>.<br>(See Example for the explanation.) \param pos An iterator specifying the position where the range will be inserted. \param first The beginning of the range to be inserted. @@ -1561,8 +1563,8 @@ //! Insert <code>n</code> copies of the <code>item</code> before the specified position. /*! \pre <code>pos</code> is a valid iterator pointing to the <code>circular_buffer</code> or its end. - \post The number of <code>min(n, (end() - pos) + reserve())</code> elements will be inserted before the - position <code>pos</code>.<br>The number of <code>min(end() - pos, max(0, n - reserve()))</code> elements + \post The number of <code>min[n, (end() - pos) + reserve()]</code> elements will be inserted before the + position <code>pos</code>.<br>The number of <code>min[end() - pos, max[0, n - reserve()]]</code> elements will be overwritten at the end of the <code>circular_buffer</code>.<br>(See Example for the explanation.) \param pos An iterator specifying the position where the <code>item</code>s will be inserted. \param n The number of <code>item</code>s the to be inserted. @@ -1600,9 +1602,9 @@ Valid range <code>[first, last)</code> where <code>first</code> and <code>last</code> meet the requirements of an <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>. \post Elements from the range - <code>[first, last - max(0, distance(first, last) - (end() - pos) - reserve()))</code> will be inserted - before the position <code>pos</code>.<br>The number of <code>min(end() - pos, max(0, - distance(first, last) - reserve()))</code> elements will be overwritten at the end of the + <code>[first, last - max[0, distance(first, last) - (end() - pos) - reserve()])</code> will be inserted + before the position <code>pos</code>.<br>The number of <code>min[end() - pos, max[0, + distance(first, last) - reserve()]]</code> elements will be overwritten at the end of the <code>circular_buffer</code>.<br>(See Example for the explanation.) \param pos An iterator specifying the position where the range will be inserted. \param first The beginning of the range to be inserted. @@ -2215,10 +2217,10 @@ template <class ForwardIterator> void insert(const iterator& pos, ForwardIterator first, ForwardIterator last, const std::forward_iterator_tag&) { BOOST_CB_ASSERT(std::distance(first, last) >= 0); // check for wrong range - difference_type n = std::distance(first, last); + size_type n = std::distance(first, last); if (n == 0) return; - difference_type copy = capacity() - (end() - pos); + size_type copy = capacity() - (end() - pos); if (copy == 0) return; if (n > copy) { |
|
From: Jan G. <jan...@us...> - 2007-02-18 23:03:40
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/test In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30871/libs/circular_buffer/test Modified Files: common.ipp space_optimized_test.cpp Log Message: consistent usage of capacity_type Index: space_optimized_test.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/test/space_optimized_test.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- space_optimized_test.cpp 23 Jan 2007 23:12:35 -0000 1.10 +++ space_optimized_test.cpp 18 Feb 2007 23:03:27 -0000 1.11 @@ -32,32 +32,32 @@ cb_space_optimized cb3(capacity_ctrl(20, 10), v.begin(), v.end()); BOOST_CHECK(cb1.size() == 0); - BOOST_CHECK(cb1.capacity() == 10); - BOOST_CHECK(cb1.min_capacity() == 10); + BOOST_CHECK(cb1.capacity().capacity() == 10); + BOOST_CHECK(cb1.capacity().min_capacity() == 10); BOOST_CHECK(cb2[0] == 1); BOOST_CHECK(cb2.size() == 10); BOOST_CHECK(cb2.capacity() == 10); - BOOST_CHECK(cb2.min_capacity() == 5); + BOOST_CHECK(cb2.capacity().min_capacity() == 5); BOOST_CHECK(cb3[0] == 1); BOOST_CHECK(cb3.size() == 5); BOOST_CHECK(cb3.capacity() == 20); - BOOST_CHECK(cb3.min_capacity() == 10); - BOOST_CHECK(cb1.min_capacity() <= cb1.internal_capacity()); - BOOST_CHECK(cb2.min_capacity() <= cb2.internal_capacity()); - BOOST_CHECK(cb3.min_capacity() <= cb3.internal_capacity()); + BOOST_CHECK(cb3.capacity().min_capacity() == 10); + BOOST_CHECK(cb1.capacity().min_capacity() <= cb1.internal_capacity()); + BOOST_CHECK(cb2.capacity().min_capacity() <= cb2.internal_capacity()); + BOOST_CHECK(cb3.capacity().min_capacity() <= cb3.internal_capacity()); cb2.erase(cb2.begin() + 2, cb2.end()); BOOST_CHECK(cb2.size() == 2); - BOOST_CHECK(cb2.min_capacity() <= cb2.internal_capacity()); + BOOST_CHECK(cb2.capacity().min_capacity() <= cb2.internal_capacity()); cb2.clear(); cb3.clear(); BOOST_CHECK(cb2.empty()); BOOST_CHECK(cb3.empty()); - BOOST_CHECK(cb2.min_capacity() <= cb2.internal_capacity()); - BOOST_CHECK(cb3.min_capacity() <= cb3.internal_capacity()); + BOOST_CHECK(cb2.capacity().min_capacity() <= cb2.internal_capacity()); + BOOST_CHECK(cb3.capacity().min_capacity() <= cb3.internal_capacity()); } // test main Index: common.ipp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/test/common.ipp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- common.ipp 22 Dec 2006 19:41:24 -0000 1.12 +++ common.ipp 18 Feb 2007 23:03:27 -0000 1.13 @@ -150,6 +150,8 @@ const CB_CONTAINER<MyInteger> cb2(10, 0); CB_CONTAINER<MyInteger>::allocator_type& alloc_ref = cb1.get_allocator(); CB_CONTAINER<MyInteger>::allocator_type alloc = cb2.get_allocator(); + alloc_ref.max_size(); + alloc.max_size(); generic_test(cb1); } |
|
From: Jan G. <jan...@us...> - 2007-02-18 23:03:40
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30871/libs/circular_buffer/doc Modified Files: circular_buffer.html circular_buffer_space_optimized.html Log Message: consistent usage of capacity_type Index: circular_buffer.html =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc/circular_buffer.html,v retrieving revision 1.60 retrieving revision 1.61 diff -u -d -r1.60 -r1.61 --- circular_buffer.html 23 Jan 2007 23:12:34 -0000 1.60 +++ circular_buffer.html 18 Feb 2007 23:03:26 -0000 1.61 @@ -226,13 +226,13 @@ bool <a href="#classboost_1_1circular__buffer_15be1c2a005ec9828549ef6dd7ebed583">empty</a>() const; bool <a href="#classboost_1_1circular__buffer_1fd0eef8ba91210d1575404b7e3e8207a">full</a>() const; size_type <a href="#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve</a>() const; - size_type <a href="#classboost_1_1circular__buffer_1de901b1737217f2c8140fc1691bf2d98">capacity</a>() const; + capacity_type <a href="#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity</a>() const; void <a href= -"#classboost_1_1circular__buffer_1902a2d89e6bfab28f548cdb21cc42456">set_capacity</a>(size_type new_capacity); +"#classboost_1_1circular__buffer_161714204ef5172d156e2c7eccd04998f">set_capacity</a>(capacity_type new_capacity); void <a href= "#classboost_1_1circular__buffer_180c2e2e66a8fa9d0b7adc1b54921a8c3">resize</a>(size_type new_size, const_reference item = value_type()); void <a href= -"#classboost_1_1circular__buffer_1e5b482668b1ea6c434b7354389bcca89">rset_capacity</a>(size_type new_capacity); +"#classboost_1_1circular__buffer_1477715e9d31d2cc5b02ad8ecf3c68c46">rset_capacity</a>(capacity_type new_capacity); void <a href= "#classboost_1_1circular__buffer_144ecd9ec5f54a2d61c7d132e445d3483">rresize</a>(size_type new_size, const_reference item = value_type()); circular_buffer<T, Alloc>& <a href= @@ -940,7 +940,7 @@ <b>Effect:</b> </dt> <dd> - <code><a href="#classboost_1_1circular__buffer_1de901b1737217f2c8140fc1691bf2d98">capacity()</a> == + <code><a href="#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a> == <a href="#classboost_1_1circular__buffer_157e2d506bc274b2a63fbe1b8fcafebd7">max_size()</a> && <a href="#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == 0</code> </dd> @@ -1028,7 +1028,7 @@ <b>Effect:</b> </dt> <dd> - <code><a href="#classboost_1_1circular__buffer_1de901b1737217f2c8140fc1691bf2d98">capacity()</a> == + <code><a href="#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a> == capacity && <a href= "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == 0</code> </dd> @@ -1068,7 +1068,7 @@ <b>Effect:</b> </dt> <dd> - <code><a href="#classboost_1_1circular__buffer_1de901b1737217f2c8140fc1691bf2d98">capacity()</a> == n + <code><a href="#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a> == n && <a href="#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == n && (*this)[0] == item && (*this)[1] == item && ... && (*this) [n - 1] == item</code> @@ -1156,7 +1156,7 @@ <b>Effect:</b> </dt> <dd> - <code><a href="#classboost_1_1circular__buffer_1de901b1737217f2c8140fc1691bf2d98">capacity()</a> == + <code><a href="#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a> == capacity && <a href= "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == n && (*this)[0] == item && (*this)[1] == item && ... && (*this)[n - 1] == @@ -1310,7 +1310,7 @@ <b>Effect:</b> </dt> <dd> - <code><a href="#classboost_1_1circular__buffer_1de901b1737217f2c8140fc1691bf2d98">capacity()</a> == + <code><a href="#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a> == std::distance(first, last) && <a href= "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == std::distance(first, last) && (*this)[0]== *first && (*this)[1] == *(first + 1) && ... && @@ -1401,7 +1401,7 @@ <b>Effect:</b> </dt> <dd> - <code><a href="#classboost_1_1circular__buffer_1de901b1737217f2c8140fc1691bf2d98">capacity()</a> == + <code><a href="#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a> == capacity && <a href= "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> <= std::distance(first, last) && (*this)[0]== *(last - capacity) && (*this)[1] == *(last - @@ -2375,8 +2375,8 @@ <b>Throws:</b> </dt> <dd> - std::out_of_range when the <code>index</code> is invalid (when <code>index >= <a href= - "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a></code>). + <code>std::out_of_range</code> when the <code>index</code> is invalid (when <code>index + >= <a href="#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a></code>). </dd> </dl> <dl> @@ -2450,8 +2450,8 @@ <b>Throws:</b> </dt> <dd> - std::out_of_range when the <code>index</code> is invalid (when <code>index >= <a href= - "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a></code>). + <code>std::out_of_range</code> when the <code>index</code> is invalid (when <code>index + >= <a href="#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a></code>). </dd> </dl> <dl> @@ -3225,7 +3225,7 @@ </dt> <dd> <code><a href= - "#classboost_1_1circular__buffer_1de901b1737217f2c8140fc1691bf2d98">capacity()</a></code>, + "#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a></code>, <code><a href= "#classboost_1_1circular__buffer_157e2d506bc274b2a63fbe1b8fcafebd7">max_size()</a></code>, <code><a href="#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a></code>, @@ -3289,7 +3289,7 @@ <dd> <code><a href="#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a></code>, <code><a href= - "#classboost_1_1circular__buffer_1de901b1737217f2c8140fc1691bf2d98">capacity()</a></code>, + "#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a></code>, <code><a href="#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a></code> </dd> </dl> @@ -3425,7 +3425,7 @@ <b>Returns:</b> </dt> <dd> - <code><a href="#classboost_1_1circular__buffer_1de901b1737217f2c8140fc1691bf2d98">capacity()</a> - + <code><a href="#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a> - <a href="#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a></code> </dd> </dl> @@ -3467,7 +3467,7 @@ </dt> <dd> <code><a href= - "#classboost_1_1circular__buffer_1de901b1737217f2c8140fc1691bf2d98">capacity()</a></code>, + "#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a></code>, <code><a href="#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a></code>, <code><a href="#classboost_1_1circular__buffer_157e2d506bc274b2a63fbe1b8fcafebd7">max_size()</a></code> </dd> @@ -3476,9 +3476,9 @@ </tr> <tr> <td> - <a id="classboost_1_1circular__buffer_1de901b1737217f2c8140fc1691bf2d98" name= - "classboost_1_1circular__buffer_1de901b1737217f2c8140fc1691bf2d98"></a><code><b><a href= - "#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> capacity() + <a id="classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77" name= + "classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77"></a><code><b><a href= + "#classboost_1_1circular__buffer_1dc642ff2be4db0be1a457810e5d09595">capacity_type</a> capacity() const;</b></code><br> <br> Get the capacity of the <code>circular_buffer</code>. @@ -3532,16 +3532,16 @@ <code><a href= "#classboost_1_1circular__buffer_157e2d506bc274b2a63fbe1b8fcafebd7">max_size()</a></code>, <code><a href= - "#classboost_1_1circular__buffer_1902a2d89e6bfab28f548cdb21cc42456">set_capacity()</a></code> + "#classboost_1_1circular__buffer_161714204ef5172d156e2c7eccd04998f">set_capacity()</a></code> </dd> </dl> </td> </tr> <tr> <td> - <a id="classboost_1_1circular__buffer_1902a2d89e6bfab28f548cdb21cc42456" name= - "classboost_1_1circular__buffer_1902a2d89e6bfab28f548cdb21cc42456"></a><code><b>void set_capacity(<a href= - "#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> + <a id="classboost_1_1circular__buffer_161714204ef5172d156e2c7eccd04998f" name= + "classboost_1_1circular__buffer_161714204ef5172d156e2c7eccd04998f"></a><code><b>void set_capacity(<a href= + "#classboost_1_1circular__buffer_1dc642ff2be4db0be1a457810e5d09595">capacity_type</a> new_capacity);</b></code><br> <br> Change the capacity of the <code>circular_buffer</code>. @@ -3550,7 +3550,7 @@ <b>Effect:</b> </dt> <dd> - <code><a href="#classboost_1_1circular__buffer_1de901b1737217f2c8140fc1691bf2d98">capacity()</a> == + <code><a href="#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a> == new_capacity</code><br> <br> If the current number of elements stored in the <code>circular_buffer</code> is greater than the @@ -3616,7 +3616,7 @@ </dt> <dd> <code><a href= - "#classboost_1_1circular__buffer_1e5b482668b1ea6c434b7354389bcca89">rset_capacity()</a></code>, + "#classboost_1_1circular__buffer_1477715e9d31d2cc5b02ad8ecf3c68c46">rset_capacity()</a></code>, <code><a href="#classboost_1_1circular__buffer_180c2e2e66a8fa9d0b7adc1b54921a8c3">resize()</a></code> </dd> </dl> @@ -3638,7 +3638,7 @@ <dd> <code><a href="#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == new_size && <a href= - "#classboost_1_1circular__buffer_1de901b1737217f2c8140fc1691bf2d98">capacity()</a> >= + "#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a> >= new_size</code><br> <br> If the new size is greater than the current size, copies of <code>item</code> will be inserted at the @@ -3720,16 +3720,16 @@ <dd> <code><a href="#classboost_1_1circular__buffer_144ecd9ec5f54a2d61c7d132e445d3483">rresize()</a></code>, <code><a href= - "#classboost_1_1circular__buffer_1902a2d89e6bfab28f548cdb21cc42456">set_capacity()</a></code> + "#classboost_1_1circular__buffer_161714204ef5172d156e2c7eccd04998f">set_capacity()</a></code> </dd> </dl> </td> </tr> <tr> <td> - <a id="classboost_1_1circular__buffer_1e5b482668b1ea6c434b7354389bcca89" name= - "classboost_1_1circular__buffer_1e5b482668b1ea6c434b7354389bcca89"></a><code><b>void rset_capacity(<a href= - "#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> + <a id="classboost_1_1circular__buffer_1477715e9d31d2cc5b02ad8ecf3c68c46" name= + "classboost_1_1circular__buffer_1477715e9d31d2cc5b02ad8ecf3c68c46"></a><code><b>void rset_capacity(<a href= + "#classboost_1_1circular__buffer_1dc642ff2be4db0be1a457810e5d09595">capacity_type</a> new_capacity);</b></code><br> <br> Change the capacity of the <code>circular_buffer</code>. @@ -3738,7 +3738,7 @@ <b>Effect:</b> </dt> <dd> - <code><a href="#classboost_1_1circular__buffer_1de901b1737217f2c8140fc1691bf2d98">capacity()</a> == + <code><a href="#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a> == new_capacity</code><br> <br> If the current number of elements stored in the <code>circular_buffer</code> is greater than the @@ -3804,7 +3804,7 @@ </dt> <dd> <code><a href= - "#classboost_1_1circular__buffer_1902a2d89e6bfab28f548cdb21cc42456">set_capacity()</a></code>, + "#classboost_1_1circular__buffer_161714204ef5172d156e2c7eccd04998f">set_capacity()</a></code>, <code><a href="#classboost_1_1circular__buffer_144ecd9ec5f54a2d61c7d132e445d3483">rresize()</a></code> </dd> </dl> @@ -3826,7 +3826,7 @@ <dd> <code><a href="#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == new_size && <a href= - "#classboost_1_1circular__buffer_1de901b1737217f2c8140fc1691bf2d98">capacity()</a> >= + "#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a> >= new_size</code><br> <br> If the new size is greater than the current size, copies of <code>item</code> will be inserted at the @@ -3908,7 +3908,7 @@ <dd> <code><a href="#classboost_1_1circular__buffer_144ecd9ec5f54a2d61c7d132e445d3483">rresize()</a></code>, <code><a href= - "#classboost_1_1circular__buffer_1902a2d89e6bfab28f548cdb21cc42456">set_capacity()</a></code> + "#classboost_1_1circular__buffer_161714204ef5172d156e2c7eccd04998f">set_capacity()</a></code> </dd> </dl> </td> @@ -4017,7 +4017,7 @@ <b>Effect:</b> </dt> <dd> - <code><a href="#classboost_1_1circular__buffer_1de901b1737217f2c8140fc1691bf2d98">capacity()</a> == n + <code><a href="#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a> == n && <a href="#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == n && (*this)[0] == item && (*this)[1] == item && ... && (*this) [n - 1] == item</code> @@ -4128,7 +4128,7 @@ <b>Effect:</b> </dt> <dd> - <code><a href="#classboost_1_1circular__buffer_1de901b1737217f2c8140fc1691bf2d98">capacity()</a> == + <code><a href="#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a> == capacity && <a href= "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == n && (*this)[0] == item && (*this)[1] == item && ... && (*this) [n - 1] == @@ -4249,7 +4249,7 @@ <b>Effect:</b> </dt> <dd> - <code><a href="#classboost_1_1circular__buffer_1de901b1737217f2c8140fc1691bf2d98">capacity()</a> == + <code><a href="#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a> == std::distance(first, last) && <a href= "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == std::distance(first, last) && (*this)[0]== *first && (*this)[1] == *(first + 1) && ... && @@ -4363,7 +4363,7 @@ <b>Effect:</b> </dt> <dd> - <code><a href="#classboost_1_1circular__buffer_1de901b1737217f2c8140fc1691bf2d98">capacity()</a> == + <code><a href="#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a> == capacity && <a href= "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> <= std::distance(first, last) && (*this)[0]== *(last - capacity) && (*this)[1] == *(last - @@ -4550,7 +4550,7 @@ <b>Effect:</b> </dt> <dd> - if <code><a href="#classboost_1_1circular__buffer_1de901b1737217f2c8140fc1691bf2d98">capacity()</a> + if <code><a href="#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a> > 0</code> then <code><a href= "#classboost_1_1circular__buffer_1d985d974020f88bb4255d8edbae0a30a">back()</a> == item</code><br> If the <code>circular_buffer</code> is full, the first element will be removed. If the capacity is @@ -4632,7 +4632,7 @@ <b>Effect:</b> </dt> <dd> - if <code><a href="#classboost_1_1circular__buffer_1de901b1737217f2c8140fc1691bf2d98">capacity()</a> + if <code><a href="#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a> > 0</code> then <code><a href= "#classboost_1_1circular__buffer_10d5fdeabeb352f47d1f7bb1ea8d9819f">front()</a> == item</code><br> If the <code>circular_buffer</code> is full, the last element will be removed. If the capacity is @@ -4969,13 +4969,13 @@ <b>Effect:</b> </dt> <dd> - The number of <code>min(n, (pos - <a href= + The number of <code>min[n, (pos - <a href= "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>) + <a href= - "#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a>)</code> elements will + "#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a>]</code> elements will be inserted at the position <code>pos</code>.<br> - The number of <code>min(pos - <a href= - "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>, max(0, n - <a href= - "#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a>))</code> elements + The number of <code>min[pos - <a href= + "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>, max[0, n - <a href= + "#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a>]]</code> elements will be overwritten at the beginning of the <code>circular_buffer</code>.<br> (See Example for the explanation.) </dd> @@ -5104,14 +5104,14 @@ <b>Effect:</b> </dt> <dd> - Elements from the range <code>[first + max(0, distance(first, last) - (pos - <a href= + Elements from the range <code>[first + max[0, distance(first, last) - (pos - <a href= "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>) - <a href= - "#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a>), last)</code> will + "#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a>], last)</code> will be inserted at the position <code>pos</code>.<br> - The number of <code>min(pos - <a href= - "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>, max(0, distance(first, + The number of <code>min[pos - <a href= + "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>, max[0, distance(first, last) - <a href= - "#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a>))</code> elements + "#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a>]]</code> elements will be overwritten at the beginning of the <code>circular_buffer</code>.<br> (See Example for the explanation.) </dd> @@ -5345,13 +5345,13 @@ <b>Effect:</b> </dt> <dd> - The number of <code>min(n, (<a href= + The number of <code>min[n, (<a href= "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a> - pos) + <a href= - "#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a>)</code> elements will + "#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a>]</code> elements will be inserted before the position <code>pos</code>.<br> - The number of <code>min(<a href= - "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a> - pos, max(0, n - - <a href="#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a>))</code> + The number of <code>min[<a href= + "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a> - pos, max[0, n - + <a href="#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a>]]</code> elements will be overwritten at the end of the <code>circular_buffer</code>.<br> (See Example for the explanation.) </dd> @@ -5479,14 +5479,14 @@ <b>Effect:</b> </dt> <dd> - Elements from the range <code>[first, last - max(0, distance(first, last) - (<a href= + Elements from the range <code>[first, last - max[0, distance(first, last) - (<a href= "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a> - pos) - <a href= - "#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a>))</code> will be + "#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a>])</code> will be inserted before the position <code>pos</code>.<br> - The number of <code>min(<a href= - "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a> - pos, max(0, + The number of <code>min[<a href= + "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a> - pos, max[0, distance(first, last) - <a href= - "#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a>))</code> elements + "#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a>]]</code> elements will be overwritten at the end of the <code>circular_buffer</code>.<br> (See Example for the explanation.) </dd> Index: circular_buffer_space_optimized.html =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc/circular_buffer_space_optimized.html,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- circular_buffer_space_optimized.html 23 Jan 2007 23:12:35 -0000 1.35 +++ circular_buffer_space_optimized.html 18 Feb 2007 23:03:27 -0000 1.36 @@ -112,7 +112,7 @@ typedef std::pair<const_pointer, size_type> <a href= "circular_buffer.html#classboost_1_1circular__buffer_11885d7f475b7e7a74c95b2448d243025">const_array_range</a>; typedef <i>implementation-defined</i> <a href= -"#classboost_1_1circular__buffer__space__optimized_1051350e031c50c8b4a7ca1e1902e92f0">capacity_type</a>; +"#classboost_1_1circular__buffer__space__optimized_1e805212e7de49dcb60f2cad1ef304bb3">capacity_type</a>; explicit <a href= "#classboost_1_1circular__buffer__space__optimized_1a05f824b31cd93d7695f4039edc7597f">circular_buffer_space_optimized</a>(const allocator_type& alloc = allocator_type()); @@ -187,14 +187,10 @@ bool <a href="#classboost_1_1circular__buffer__space__optimized_142f4a13c50904a4ac0bf746c88451954">full</a>() const; size_type <a href= "#classboost_1_1circular__buffer__space__optimized_170eec72a6e8d088b58e26ac7e2dd7c9f">reserve</a>() const; - size_type <a href= -"#classboost_1_1circular__buffer__space__optimized_1f3e4b9caed10cf7383682c6dea794917">min_capacity</a>() const; - void <a href= -"#classboost_1_1circular__buffer__space__optimized_1b3667b889d9633e88d62adb98c1b1291">set_min_capacity</a>(size_type new_min_capacity); - size_type <a href= -"#classboost_1_1circular__buffer__space__optimized_1f15db4d5579775966e300c91b3fef33a">capacity</a>() const; + const capacity_type& <a href= +"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity</a>() const; void <a href= -"#classboost_1_1circular__buffer__space__optimized_1c804242b924b93eb3db7f3f4587a096c">set_capacity</a>(size_type new_capacity); +"#classboost_1_1circular__buffer__space__optimized_143fa35280fc3cad2a6510065a065d67c">set_capacity</a>(const capacity_type& new_capacity); void <a href= "#classboost_1_1circular__buffer__space__optimized_1f244ff5576b79f8d60e273c02d71c9f2">resize</a>(size_type new_size, const_reference item = value_type()); void <a href= @@ -321,8 +317,8 @@ </tr> <tr> <td> - <a id="classboost_1_1circular__buffer__space__optimized_1051350e031c50c8b4a7ca1e1902e92f0" name= - "classboost_1_1circular__buffer__space__optimized_1051350e031c50c8b4a7ca1e1902e92f0"><code>capacity_type</code></a> + <a id="classboost_1_1circular__buffer__space__optimized_1e805212e7de49dcb60f2cad1ef304bb3" name= + "classboost_1_1circular__buffer__space__optimized_1e805212e7de49dcb60f2cad1ef304bb3"><code>capacity_type</code></a> </td> <td> Capacity controller of the space optimized circular buffer. @@ -423,7 +419,7 @@ </dt> <dd> <code>(*this).<a href= - "#classboost_1_1circular__buffer__space__optimized_1f15db4d5579775966e300c91b3fef33a">capacity()</a> == + "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a> == capacity && (*this).size == 0</code><br> Allocates memory specified by the <code>min_capacity</code> parameter. </dd> @@ -649,7 +645,7 @@ </dt> <dd> <code>(*this).<a href= - "#classboost_1_1circular__buffer__space__optimized_1f15db4d5579775966e300c91b3fef33a">capacity()</a> == + "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a> == capacity</code><br> Allocates at least as much memory as specified by the - TODO change <code>min_capacity</code> parameter.<br> @@ -723,33 +719,33 @@ </tr> <tr> <td> - <a id="classboost_1_1circular__buffer__space__optimized_1f3e4b9caed10cf7383682c6dea794917" name= - "classboost_1_1circular__buffer__space__optimized_1f3e4b9caed10cf7383682c6dea794917"></a><code><b><a href= - "circular_buffer.html#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> - min_capacity() const;</b></code><br> + <a id="classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa" name= + "classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa"></a><code><b>const + <a href= + "circular_buffer.html#classboost_1_1circular__buffer_1dc642ff2be4db0be1a457810e5d09595">capacity_type</a>& + capacity() const;</b></code><br> + <br> + See the <a href="circular_buffer.html#classboost_1_1circular__buffer">circular_buffer</a> source + documentation.<br> <br> - Return the minimal guaranteed amount of allocated memory. - <p> - The allocated memory will never drop under this value. - </p> </td> </tr> <tr> <td> - <a id="classboost_1_1circular__buffer__space__optimized_1b3667b889d9633e88d62adb98c1b1291" name= - "classboost_1_1circular__buffer__space__optimized_1b3667b889d9633e88d62adb98c1b1291"></a><code><b>void - set_min_capacity(<a href= - "circular_buffer.html#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> - new_min_capacity);</b></code><br> + <a id="classboost_1_1circular__buffer__space__optimized_143fa35280fc3cad2a6510065a065d67c" name= + "classboost_1_1circular__buffer__space__optimized_143fa35280fc3cad2a6510065a065d67c"></a><code><b>void + set_capacity(const <a href= + "circular_buffer.html#classboost_1_1circular__buffer_1dc642ff2be4db0be1a457810e5d09595">capacity_type</a>& + new_capacity);</b></code><br> <br> - Change the minimal guaranteed amount of allocated memory. + TODO Change the minimal guaranteed amount of allocated memory. <dl> <dt> <b>Precondition:</b> </dt> <dd> <code>(*this).<a href= - "#classboost_1_1circular__buffer__space__optimized_1f15db4d5579775966e300c91b3fef33a">capacity()</a> + "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a> >= new_min_capacity</code> </dd> </dl> @@ -758,9 +754,8 @@ <b>Effect:</b> </dt> <dd> - <code>(*this).<a href= - "#classboost_1_1circular__buffer__space__optimized_1f3e4b9caed10cf7383682c6dea794917">min_capacity()</a> - == new_min_capacity</code> Allocates memory specified by the <code>new_min_capacity</code> parameter. + <code>(*this).min_capacity() == new_min_capacity</code> Allocates memory specified by the + <code>new_min_capacity</code> parameter. </dd> </dl> <dl> @@ -770,42 +765,16 @@ <dd> It is considered as a bug if the precondition is not met (i.e. if <code>new_min_capacity > (*this).<a href= - "#classboost_1_1circular__buffer__space__optimized_1f15db4d5579775966e300c91b3fef33a">capacity()</a></code>) + "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a></code>) and an assertion will be invoked in the debug mode. </dd> </dl> - </td> - </tr> - <tr> - <td> - <a id="classboost_1_1circular__buffer__space__optimized_1f15db4d5579775966e300c91b3fef33a" name= - "classboost_1_1circular__buffer__space__optimized_1f15db4d5579775966e300c91b3fef33a"></a><code><b><a href= - "circular_buffer.html#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> - capacity() const;</b></code><br> - <br> - See the <a href="circular_buffer.html#classboost_1_1circular__buffer">circular_buffer</a> source - documentation.<br> - <br> - </td> - </tr> - <tr> - <td> - <a id="classboost_1_1circular__buffer__space__optimized_1c804242b924b93eb3db7f3f4587a096c" name= - "classboost_1_1circular__buffer__space__optimized_1c804242b924b93eb3db7f3f4587a096c"></a><code><b>void - set_capacity(<a href= - "circular_buffer.html#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> - new_capacity);</b></code><br> - <br> - See the <a href="circular_buffer.html#classboost_1_1circular__buffer">circular_buffer</a> source - documentation. <dl> <dt> <b>Precondition:</b> </dt> <dd> - <code><a href= - "#classboost_1_1circular__buffer__space__optimized_1f3e4b9caed10cf7383682c6dea794917">min_capacity()</a> - <= new_capacity</code> + <code>min_capacity() <= new_capacity</code> </dd> </dl> <dl> @@ -813,9 +782,8 @@ <b>Note:</b> </dt> <dd> - It is considered as a bug if the precondition is not met (i.e. if <code>new_capacity > <a href= - "#classboost_1_1circular__buffer__space__optimized_1f3e4b9caed10cf7383682c6dea794917">min_capacity()</a></code>) - and an assertion will be invoked in the debug mode. + It is considered as a bug if the precondition is not met (i.e. if <code>new_capacity > + min_capacity()</code>) and an assertion will be invoked in the debug mode. </dd> </dl> </td> @@ -850,9 +818,7 @@ <b>Precondition:</b> </dt> <dd> - <code><a href= - "#classboost_1_1circular__buffer__space__optimized_1f3e4b9caed10cf7383682c6dea794917">min_capacity()</a> - <= new_capacity</code> + <code>min_capacity() <= new_capacity</code> </dd> </dl> <dl> @@ -860,9 +826,8 @@ <b>Note:</b> </dt> <dd> - It is considered as a bug if the precondition is not met (i.e. if <code>new_capacity > <a href= - "#classboost_1_1circular__buffer__space__optimized_1f3e4b9caed10cf7383682c6dea794917">min_capacity()</a></code>) - and an assertion will be invoked in the debug mode. + It is considered as a bug if the precondition is not met (i.e. if <code>new_capacity > + min_capacity()</code>) and an assertion will be invoked in the debug mode. </dd> </dl> </td> |
|
From: Frank M. H. <fm...@us...> - 2007-02-18 22:47:24
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23851/thread_safe_signals Modified Files: connection.hpp multi_threaded.hpp single_threaded.hpp Log Message: Clean-ups made possible by reduced scope of locking in slot iterator. Index: connection.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/connection.hpp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- connection.hpp 17 Feb 2007 16:03:32 -0000 1.16 +++ connection.hpp 18 Feb 2007 22:47:18 -0000 1.17 @@ -91,7 +91,7 @@ class ConnectionBody: public ConnectionBodyBase { public: - typedef typename ThreadingModel::recursive_try_mutex_type mutex_type; + typedef typename ThreadingModel::try_mutex_type mutex_type; ConnectionBody(const slot<SlotFunction> &slot_in): ConnectionBodyBase(slot_in.get_all_tracked()), slot(slot_in.get_slot_function()) { Index: single_threaded.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/single_threaded.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- single_threaded.hpp 17 Feb 2007 03:12:22 -0000 1.1 +++ single_threaded.hpp 18 Feb 2007 22:47:19 -0000 1.2 @@ -39,6 +39,7 @@ { public: typedef detail::null_mutex mutex_type; + typedef detail::null_mutex try_mutex_type; typedef detail::null_mutex recursive_try_mutex_type; }; } // end namespace signalslib Index: multi_threaded.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/multi_threaded.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- multi_threaded.hpp 17 Feb 2007 03:12:22 -0000 1.1 +++ multi_threaded.hpp 18 Feb 2007 22:47:19 -0000 1.2 @@ -23,7 +23,7 @@ { public: typedef mutex mutex_type; - typedef recursive_try_mutex recursive_try_mutex_type; + typedef try_mutex try_mutex_type; }; } // end namespace signalslib } // end namespace boost |
|
From: Frank M. H. <fm...@us...> - 2007-02-18 22:47:24
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/detail In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23851/thread_safe_signals/detail Modified Files: slot_call_iterator.hpp Log Message: Clean-ups made possible by reduced scope of locking in slot iterator. Index: slot_call_iterator.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/detail/slot_call_iterator.hpp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- slot_call_iterator.hpp 18 Feb 2007 18:16:57 -0000 1.16 +++ slot_call_iterator.hpp 18 Feb 2007 22:47:19 -0000 1.17 @@ -52,38 +52,14 @@ slot_call_iterator_t(Iterator iter_in, Iterator end_in, Function f, boost::optional<result_type> &c): iter(iter_in), end(end_in), f(f), - cache(&c), lock_iter(end_in) - { - } - slot_call_iterator_t(const slot_call_iterator_t &other): iter(other.iter), - end(other.end), f(other.f), cache(other.cache), lock_iter(other.lock_iter), - tracked_ptrs(other.tracked_ptrs) + cache(&c), callable_iter(end_in) { - if(other.lock) - lock.reset(new(lock_pool) lock_type(lock_pool, (*iter)->mutex)); - } - const slot_call_iterator_t& operator =(const slot_call_iterator_t &other) - { - if(this == &other) return; - iter = other.iter; - end = other.end; - f = other.f; - cache = other.cache; - if(other.lock) - lock.reset(new(lock_pool) lock_type(lock_pool, (*iter)->mutex)); - else - lock.reset(); - lock_iter = other.lock_iter; - tracked_ptrs = other.tracked_ptrs; - return *this; } typename inherited::reference dereference() const { if (!(*cache)) { - lock_iter = end; - lock.reset(); cache->reset(f(*iter)); } return cache->get(); @@ -104,86 +80,25 @@ } private: - class lock_type; - // lock_memory_pool and the lock_type class exist to optimize our dynamic allocation of scoped_locks. - // It makes a noticeable difference in benchmarks when invoking a signal in an inner loop with - // an empty slot connected. I tried using boost::object_pool<lock_type> but it was slower. - class lock_memory_pool - { - public: - lock_memory_pool() - { - unsigned i; - for(i = 0; i < _max_objects; ++i) - _allocated[i] = false; - } - void * malloc() - { - unsigned i; - for(i = 0; i < _max_objects; ++i) - { - if(_allocated[i] == false) - { - _allocated[i] = true; - return &_chunks[i]; - } - } - BOOST_ASSERT(false); - return 0; - } - void free(void *ptr) - { - aligned_storage_type *typed_ptr = - static_cast<aligned_storage_type*>(ptr); - _allocated[typed_ptr - _chunks] = false; - } - private: - typedef aligned_storage<sizeof(lock_type), alignment_of<lock_type>::value> aligned_storage_type; - - static const unsigned _max_objects = 2; - - aligned_storage_type _chunks[_max_objects]; - bool _allocated[_max_objects]; - }; - class lock_type: public ConnectionBody::mutex_type::scoped_lock - { - public: - lock_type(lock_memory_pool &pool, typename ConnectionBody::mutex_type &mutex): - ConnectionBody::mutex_type::scoped_lock(mutex), _pool(pool) - {} - static void* operator new(unsigned num_bytes, lock_memory_pool &pool) - { - return pool.malloc(); - } - static void operator delete(void *ptr) - { - if(ptr == 0) return; - lock_type *typed_ptr = static_cast<lock_type*>(ptr); - lock_memory_pool &pool = typed_ptr->_pool; - pool.free(typed_ptr); - } - private: - lock_memory_pool &_pool; - }; - + typedef typename ConnectionBody::mutex_type::scoped_lock lock_type; void lockNextCallable() const { - if(iter == lock_iter) + if(iter == callable_iter) { return; } for(;iter != end; ++iter) { - lock.reset(new(lock_pool) lock_type(lock_pool, (*iter)->mutex)); - lock_iter = iter; - tracked_ptrs = (*iter)->nolock_grab_tracked_objects(); - if((*iter)->nolock_nograb_blocked() == false) break; + if((*iter)->blocked() == false) + { + callable_iter = iter; + break; + } } if(iter == end) { - lock.reset(); - lock_iter = end; + callable_iter = end; } } @@ -191,9 +106,7 @@ Iterator end; Function f; optional<result_type>* cache; - mutable lock_memory_pool lock_pool; - mutable scoped_ptr<lock_type> lock; - mutable Iterator lock_iter; + mutable Iterator callable_iter; mutable typename ConnectionBody::shared_ptrs_type tracked_ptrs; }; } // end namespace detail |
|
From: Marcin K. <ka...@us...> - 2007-02-18 18:34:29
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/property_tree/detail In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1675 Modified Files: xml_parser_read_spirit.hpp Log Message: Compatibility fix with spirit Index: xml_parser_read_spirit.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/property_tree/detail/xml_parser_read_spirit.hpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- xml_parser_read_spirit.hpp 18 Dec 2006 23:54:13 -0000 1.9 +++ xml_parser_read_spirit.hpp 18 Feb 2007 17:48:15 -0000 1.10 @@ -53,7 +53,7 @@ { if (c.stack.empty()) BOOST_PROPERTY_TREE_THROW(xml_parser_error("xml parse error", - b.get_position().file, + detail::narrow(b.get_position().file.c_str()), b.get_position().line)); Str name(b, e); Ptree *child = &c.stack.back()->push_back(std::make_pair(name, Ptree()))->second; @@ -69,7 +69,7 @@ { if (c.stack.size() <= 1) BOOST_PROPERTY_TREE_THROW(xml_parser_error("xml parse error", - b.get_position().file, + detail::narrow(b.get_position().file.c_str()), b.get_position().line)); c.stack.pop_back(); } @@ -708,7 +708,8 @@ // Initialize iterators It begin(v.begin(), v.end()); It end; - begin.set_position(filename); + + begin.set_position(detail::widen<Ch>(filename.c_str())); // Prepare grammar Ptree local; @@ -720,7 +721,7 @@ boost::spirit::parse_info<It> result = boost::spirit::parse(begin, end, g); if (!result.full || g.c.stack.size() != 1) BOOST_PROPERTY_TREE_THROW(xml_parser_error("xml parse error", - result.stop.get_position().file, + detail::narrow(result.stop.get_position().file.c_str()), result.stop.get_position().line)); // Swap local and pt |
|
From: Frank M. H. <fm...@us...> - 2007-02-18 18:16:58
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/detail In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12902/thread_safe_signals/detail Modified Files: slot_call_iterator.hpp Log Message: reset lock_iter too when lock is deleted. Index: slot_call_iterator.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/detail/slot_call_iterator.hpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- slot_call_iterator.hpp 18 Feb 2007 17:41:48 -0000 1.15 +++ slot_call_iterator.hpp 18 Feb 2007 18:16:57 -0000 1.16 @@ -82,6 +82,7 @@ dereference() const { if (!(*cache)) { + lock_iter = end; lock.reset(); cache->reset(f(*iter)); } |
|
From: Frank M. H. <fm...@us...> - 2007-02-18 17:41:51
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/detail In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31455/thread_safe_signals/detail Modified Files: slot_call_iterator.hpp Log Message: Drop slot lock right before slot is actually executed. Index: slot_call_iterator.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/detail/slot_call_iterator.hpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- slot_call_iterator.hpp 17 Feb 2007 23:01:43 -0000 1.14 +++ slot_call_iterator.hpp 18 Feb 2007 17:41:48 -0000 1.15 @@ -82,6 +82,7 @@ dereference() const { if (!(*cache)) { + lock.reset(); cache->reset(f(*iter)); } return cache->get(); |
|
From: t_stange <t_s...@us...> - 2007-02-18 17:30:40
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/signals/detail/legacy In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11388/signals/detail/legacy Removed Files: legacy_implementation.hpp named_slot_map.hpp signal_impl_base.hpp slot_tracking_base.hpp Log Message: Simplified the template interface; some code cleanup; added Allocator template parameter; work-in-progress; --- signal_impl_base.hpp DELETED --- --- slot_tracking_base.hpp DELETED --- --- legacy_implementation.hpp DELETED --- --- named_slot_map.hpp DELETED --- |
|
From: t_stange <t_s...@us...> - 2007-02-18 17:06:06
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/signals In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17176 Added Files: multi_threaded.hpp single_threaded.hpp Log Message: --- NEW FILE: single_threaded.hpp --- // Boost.Signals library // Copyright Timmo Stange 2007. 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_SIGNALS_SINGLE_THREADED_HEADER #define BOOST_SIGNALS_SINGLE_THREADED_HEADER #include <boost/signals/detail/signals_common.hpp> #include <boost/signals/detail/slot_tracking_base.hpp> #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif namespace boost { namespace BOOST_SIGNALS_NAMESPACE { namespace detail { // single_threaded_impl_base class. class single_threaded_impl_base : noncopyable { }; // null_signal_lock class. class null_signal_lock { public: template<typename T> null_signal_lock(const weak_ptr<T>& p) : exists_(!p.expired()) { } typedef bool null_signal_lock::*unspecified_bool_type; operator unspecified_bool_type() const { return exists_ ? &null_signal_lock::exists_ : 0; } bool exists_; }; // simple_signal_call_lock class. class simple_signal_call_lock { public: template<typename T> simple_signal_call_lock(const weak_ptr<T>& p) : ptr_(p.lock()) { } template<typename T> simple_signal_call_lock(const shared_ptr<T>& p) : ptr_(p) { } typedef const shared_ptr<single_threaded_impl_base> simple_signal_call_lock::*unspecified_bool_type; operator unspecified_bool_type() const { return ptr_ ? &simple_signal_call_lock::ptr_ : 0; } const shared_ptr<single_threaded_impl_base> ptr_; }; // null_local_lock class. class null_local_lock { public: null_local_lock(single_threaded_impl_base*) { } }; } // end namespace detail // single_threaded policy class. // Provides the necessary typedefs for single threaded signal operations. class single_threaded { public: // Base type for signal implementations of this threading model. typedef detail::single_threaded_impl_base signal_impl_threading_base_type; // Tracking base type for slot implementations with this threading model. typedef detail::dual_slot_tracking_base slot_tracking_base_type; // Return types for combiner access. template<typename Combiner> struct get_combiner_type { typedef Combiner& type; }; template<typename Combiner> struct get_combiner_const_type { typedef const Combiner& type; }; // Lock class to synchronize access to a signal implementation. typedef detail::null_signal_lock signal_lock; // Lock class to synchronize access to and ensure the lifetime of // a signal implementation. typedef detail::simple_signal_call_lock signal_call_lock; // Lock class for use from within the signal implementation. typedef detail::null_local_lock local_lock; }; } // end namespace BOOST_SIGNALS_NAMESPACE } // end namespace boost #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX #endif #endif // BOOST_SIGNALS_SINGLE_THREADED_HEADER --- NEW FILE: multi_threaded.hpp --- // Boost.Signals library // Copyright Timmo Stange 2007. 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_SIGNALS_MULTI_THREADED_HEADER #define BOOST_SIGNALS_MULTI_THREADED_HEADER #include <boost/signals/detail/signals_common.hpp> #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif namespace boost { namespace BOOST_SIGNALS_NAMESPACE { namespace detail { } // end namespace detail } // end namespace BOOST_SIGNALS_NAMESPACE } // end namespace boost #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX #endif #endif // BOOST_SIGNALS_MULTI_THREADED_HEADER |
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/signals/detail In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17176/detail Added Files: epilogue.hpp named_slot_container.hpp prologue.hpp slot_tracking_base.hpp type_selection.hpp unnamed_slot_container.hpp Log Message: --- NEW FILE: epilogue.hpp --- // Boost.Signals library // Copyright Timmo Stange 2007. 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 #undef BOOST_SIGNALS_TEMPLATE_PARMS #undef BOOST_SIGNALS_TEMPLATE_ARGS #undef BOOST_SIGNALS_PARMS #undef BOOST_SIGNALS_ARGS #undef BOOST_SIGNALS_BOUND_ARGS #undef BOOST_SIGNALS_SEMICOLON #undef BOOST_SIGNALS_ARG_AS_MEMBER #undef BOOST_SIGNALS_ARGS_AS_MEMBERS #undef BOOST_SIGNALS_COPY_PARMS #undef BOOST_SIGNALS_INIT_ARG #undef BOOST_SIGNALS_INIT_ARGS #undef BOOST_SIGNALS_ARG_TYPE #undef BOOST_SIGNALS_ARG_TYPES #undef BOOST_SIGNALS_TRAITS_ARG_TYPE #undef BOOST_SIGNALS_TRAITS_ARG_TYPES #undef BOOST_SIGNAL_FUNCTION_N_HEADER #undef BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS #undef BOOST_SIGNALS_STANDARD_ARG_TYPES #undef BOOST_SIGNALS_SIGNAL #undef BOOST_SIGNALS_FUNCTION #undef BOOST_SIGNALS_ARGS_STRUCT #undef BOOST_SIGNALS_CALL_BOUND #undef BOOST_SIGNALS_SELECT_SLOT_FUNCTION #undef BOOST_SIGNALS_ARGS_STRUCT_INST --- NEW FILE: unnamed_slot_container.hpp --- // Boost.Signals library // Copyright Timmo Stange 2007. // 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_SIGNALS_DETAIL_UNNAMED_SLOT_CONTAINER_HEADER #define BOOST_SIGNALS_DETAIL_UNNAMED_SLOT_CONTAINER_HEADER #include <boost/signals/detail/signals_common.hpp> #include <boost/signals/detail/connect_position.hpp> #include <list> #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif namespace boost { namespace BOOST_SIGNALS_NAMESPACE { namespace detail { // unnamed_slot_container class template. // Manages slots for non-grouping signals. template<typename T, typename Allocator> class unnamed_slot_container { #ifdef BOOST_NO_STD_ALLOCATOR typedef std::list<T> list_type; #else typedef std::list<T, typename Allocator::template rebind<T>::other> list_type; #endif public: typedef typename list_type::iterator iterator; // Constructor (group comparison value is ignored). unnamed_slot_container(const no_name_compare&) { } // Insert a value. iterator insert(const T& v, connect_position at) { if(at == at_back) { return list_.insert(v, list_.end()); } else { return list_.insert(v, list_.begin()); } } // Erase a value iterator erase(iterator pos) { return list_.erase(pos); } // Begin and end. iterator begin() { return list_.begin(); } iterator end() { return list_.end(); } // Retrieve size. std::size_t size() const { return std::count_if(list_.begin(), list_.end(), is_connected()); } // Check for emptiness. bool empty() const { return size() == 0; } private: list_type list_; }; } // end namespace detail } // end namespace BOOST_SIGNALS_NAMESPACE } // end namespace boost #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX #endif #endif // BOOST_SIGNALS_DETAIL_UNNAMED_SLOT_CONTAINER_HEADER --- NEW FILE: slot_tracking_base.hpp --- // Boost.Signals library // Copyright Timmo Stange 2007. // 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_SIGNALS_DETAIL_SLOT_TRACKING_BASE_HEADER #define BOOST_SIGNALS_DETAIL_SLOT_TRACKING_BASE_HEADER #include <boost/signals/detail/config.hpp> #include <boost/signals/detail/slot_connection_interface.hpp> #include <boost/signals/trackable.hpp> #include <boost/bind.hpp> #include <boost/visit_each.hpp> #include <boost/smart_ptr.hpp> #include <vector> #include <algorithm> #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif namespace boost { namespace BOOST_SIGNALS_NAMESPACE { namespace detail { class BOOST_SIGNALS_DECL slot_tracking_base : public slot_connection_interface, public enable_shared_from_this<slot_tracking_base> { public: slot_tracking_base(set_function_type s, get_function_type g) : slot_connection_interface(s, g) { } ~slot_tracking_base() { stop_tracking(); } template<class T> void setup_tracking(const T& t) const { } void start_tracking() const { } void stop_tracking() const { } // Check the lifetime of tracked objects. bool check_tracked_objects() const { return true; } protected: typedef std::vector<void*> tracked_pointer_container; mutable tracked_pointer_container tracked_pointers_; }; class BOOST_SIGNALS_DECL dual_slot_tracking_base : public slot_tracking_base { public: dual_slot_tracking_base(set_function_type s, get_function_type g) : slot_tracking_base(s, g) { } ~dual_slot_tracking_base() { stop_tracking(); } // Enumerate and store the trackable-derived objects in a target function. template<class T> void setup_tracking(const T& t) const { trackable_objects_visitor do_bind(trackable_objects_); visit_each(do_bind, t); this->slot_tracking_base::setup_tracking(t); } // Establish a connection to the tracked objects. void start_tracking() const { std::for_each(trackable_objects_.begin(), trackable_objects_.end(), bind(&trackable::add_slot, _1, const_cast<dual_slot_tracking_base*>(this))); this->slot_tracking_base::start_tracking(); } // Disconnect this slot from all tracked objects. void stop_tracking() const { std::for_each(trackable_objects_.begin(), trackable_objects_.end(), bind(&trackable::remove_slot, _1, this)); trackable_objects_.clear(); this->slot_tracking_base::stop_tracking(); } // Check the lifetime of tracked objects. bool check_tracked_objects() const { // This is always given with the trackable base approach, so we just // forward the call to the base. return this->slot_tracking_base::check_tracked_objects(); } protected: typedef std::vector<const trackable*> trackable_objects_container; mutable trackable_objects_container trackable_objects_; }; } // end namespace detail } // end namespace BOOST_SIGNALS_NAMESPACE } // end namespace boost #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX #endif #endif // BOOST_SIGNALS_DETAIL_SLOT_TRACKING_BASE_HEADER --- NEW FILE: named_slot_container.hpp --- // Boost.Signals library // Copyright Timmo Stange 2007. // 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_SIGNALS_DETAIL_NAMED_SLOT_CONTAINER_HEADER #define BOOST_SIGNALS_DETAIL_NAMED_SLOT_CONTAINER_HEADER #include <boost/signals/detail/signals_common.hpp> #include <boost/signals/detail/connect_position.hpp> #include <boost/iterator/iterator_facade.hpp> #include <list> #include <map> #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif namespace boost { namespace BOOST_SIGNALS_NAMESPACE { namespace detail { // named_slot_container class template. // Manages slots for grouping signals. template<typename T, typename Group, typename GroupCompare, typename Allocator> class named_slot_container { // The internal map needs to differentiate between named and // unnamed slots. Unnamed slots are either positioned at the // front or back of the map. struct key { enum group_type { type_front, type_group, type_back }; // Construct a key from a group name. This is for a named slot. key(const Group& group) : type_(type_group), group_(group) { } // Construct a key from a position. This is for an unnamed slot. key(connect_position at) : group_() { if(at == at_back) type_ = type_back; else type_ = type_front; } group_type type_; Group group_; }; // The comparison operation for internal keys struct key_compare { // Construct from a group comparison operator. key_compare(const GroupCompare& group_compare) : group_compare_(group_compare) { } bool operator()(const key& lhs, const key& rhs) const { // Both keys are for named slots. Compare the names. if(lhs.type_ == key::type_group && rhs.type_ == key::type_group) return group_compare_(lhs.group_, rhs.group_); // If lhs is a key for an unnamed back slot, it belongs to the end // of the map. If the other key is for an unnamed front slot, it // belongs behind it. if(lhs.type_ == key::type_back || rhs.type_ == key::type_front) return false; // If the rhs key is for an unnamed back slot, the lhs key belongs // in front of it. if(rhs.type_ == key::type_back) return true; } GroupCompare group_compare_; }; // Internal storage is a map of lists of slots. #ifdef BOOST_NO_STD_ALLOCATOR typedef std::list<T> list_type; typedef std::map<key, list_type, key_compare> map_type; #else typedef std::list<T, typename Allocator::template rebind<T>::other> list_type; typedef std::map<key, list_type, key_compare, typename Allocator::template rebind<list_type>::other> map_type; #endif public: // The named_slot_container iterator class. class iterator : public iterator_facade<iterator, T, forward_traversal_tag> { public: // Copy construction. iterator(const iterator& other) : map_pos_(other.map_pos_), list_pos_(other.list_pos_), map_end_(other.map_end_) { } // Copy assignment. iterator& operator=(const iterator& other) { map_pos_ = other.map_pos_; list_pos_ = other.list_pos_; map_end_ = other.map_end_; return *this; } private: friend class iterator_core_access; friend named_slot_container; // Construct from a map iterator a list iterator and the map's end. iterator(const typename map_type::iterator map_it, const typename list_type::iterator list_it, const typename map_type::iterator map_end) : map_pos_(map_it), list_pos_(list_it), map_end_(map_end) { } T& dereference() const { return *list_pos_; } void increment() { if(++list_pos_ == map_pos_->second.end()) { ++map_pos_; if(map_pos_ != map_end_) list_pos_ = map_pos_->second.begin(); } } bool equal(const iterator& other) const { if(map_pos_ != other.map_pos_) return false; if(map_pos_ == map_end_) return true; return list_pos_ == other.list_pos_; } typename map_type::iterator map_pos_; typename map_type::const_iterator map_end_; typename list_type::iterator list_pos_; }; // Constructor (group comparison value is ignored). named_slot_container(const GroupCompare& comp) : map_(key_compare(comp)) { } // Insert a value. iterator insert(const T& v, connect_position at) { return do_insert(v, key(at), at); } // Insert a value with a given group name. iterator insert(const T& v, const Group& group, connect_position at) { return do_insert(v, key(group), at); } // Erase a single entry. iterator erase(iterator pos) { iterator tmp = pos++; tmp.map_pos_->second.erase(tmp.list_pos_); if(tmp.map_pos_->second.empty()) map_.erase(tmp.map_pos_->first); return pos; } // Begin and end. iterator begin() { if(!map_.empty()) return iterator(map_.begin(), map_.begin()->second.begin(), map_.end()); return iterator(map_.begin(), typename list_type::iterator(), map_.end()); } iterator end() { return iterator(map_.end(), typename list_type::iterator(), map_.end()); } // Retrieve size. std::size_t size() const { return count_if(begin(), end(), is_connected()); } // Check for emptiness. bool empty() const { return size() == 0; } // Get an iterator pair for a specific group range. std::pair<iterator, iterator> group_range(const Group& group) { typename map_type::iterator map_it = map_.find(key(group)); if(map_it == map_.end()) { return std::make_pair(end(), end()); } typename map_type::iterator next = map_it; ++next; if(next == map_.end()) { return std::make_pair( iterator(map_it, map_it->second.begin(), map_.end()), end()); } return std::make_pair( iterator(map_it, map_it->second.begin(), map_.end()), iterator(next, next->second.begin(), map_.end())); } private: iterator do_insert(const T& v, const key& k, connect_position at) { typename map_type::iterator map_it = map_.find(k); if(map_it == map_.end()) { // Insert an empty list for the given key into the map. map_it = map_.insert(k, list_type()); } // Insert the value into the appropriate list. typename list_type::iterator list_it; if(at == at_back) { list_it = map_it->second.insert(v, map_it->second.end()); } else { list_it = map_it->second.insert(v, map_it->second.begin()); } return iterator(map_it, list_it, map_.end()); } map_type map_; }; } // end namespace detail } // end namespace BOOST_SIGNALS_NAMESPACE } // end namespace boost #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX #endif #endif // BOOST_SIGNALS_DETAIL_NAMED_SLOT_CONTAINER_HEADER --- NEW FILE: type_selection.hpp --- // Boost.Signals library // Copyright Timmo Stange 2007. // 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_SIGNALS_DETAIL_TYPE_SELECTION_HEADER #define BOOST_SIGNALS_DETAIL_TYPE_SELECTION_HEADER #include <boost/signals/detail/signals_common.hpp> #include <boost/signals/detail/signal_base.hpp> #include <boost/mpl/if.hpp> #include <boost/type_traits/is_same.hpp> #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif #ifndef BOOST_SIGNALS_DEFAULT_ALLOCATOR // NOTE: We should check if a standard allocator is available here. # define BOOST_SIGNALS_DEFAULT_ALLOCATOR std::allocator<int> #endif namespace boost { namespace BOOST_SIGNALS_NAMESPACE { // use_default type. // Used to leave signal template arguments to their default value while // specializing arguments that are further behind in the list of template // parameters. struct use_default; namespace detail { // select_group template structure. // Determine the appropriate group type from the Group template argument. template<typename Group> struct select_group { typedef Group type; }; template<> struct select_group<use_default> { typedef int type; }; // select_group_compare template structure. // Determine the appropriate group compare type from the Group and GroupCompare // template arguments. template<typename Group, typename GroupCompare> struct select_group_compare { typedef typename mpl::if_< is_same<Group, no_name>, no_name_compare, typename mpl::if_< is_same<GroupCompare, use_default>, std::less<typename select_group<Group>::type>, GroupCompare >::type >::type type; }; // select_combiner template structure. // Determine the appropriate combiner type from the Combiner and R template // arguments. template<typename Combiner, typename R> struct select_combiner { typedef typename mpl::if_< is_same<Combiner, use_default>, last_value<R>, Combiner >::type type; }; // select_threading_model template structure. // Determine the appropriate threading model type from the ThreadingModel // template argument. template<typename ThreadingModel> struct select_threading_model { typedef ThreadingModel type; }; template<> struct select_threading_model<use_default> { typedef single_threaded type; }; // select_allocator template structure. // Determine the appropriate allocator type from the Allocator // template argument. template<typename Allocator> struct select_allocator { typedef Allocator type; }; template<> struct select_allocator<use_default> { typedef BOOST_SIGNALS_DEFAULT_ALLOCATOR type; }; // select_signal_base template structure. // Determine the appropriate signal base class from the signal // template arguments. template<typename Combiner, typename R, typename Group, typename GroupCompare, typename ThreadingModel, typename Allocator> struct select_signal_base { typedef signal_base< typename select_combiner<Combiner, R>::type, typename select_group<Group>::type, typename select_group_compare<Group, GroupCompare>::type, typename select_threading_model<ThreadingModel>::type, typename select_allocator<Allocator>::type > type; }; // select_result_type template structure. // Determine the result type of a slot call. template<typename R> struct select_result_type { typedef R type; }; template<> struct select_result_type<void> { typedef unusable type; }; } // end namespace detail } // end namespace BOOST_SIGNALS_NAMESPACE } // end namespace boost #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX #endif #endif // BOOST_SIGNALS_DETAIL_TYPE_SELECTION_HEADER --- NEW FILE: prologue.hpp --- // Boost.Signals library // Copyright Timmo Stange 2007. 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_SIGNALS_DETAIL_PROLOGUE_HEADERS_INCLUDED #define BOOST_SIGNALS_DETAIL_PROLOGUE_HEADERS_INCLUDED # include <boost/config.hpp> # include <boost/signals/connection.hpp> # include <boost/utility.hpp> # include <boost/ref.hpp> # include <boost/signals/slot.hpp> # include <boost/last_value.hpp> # include <boost/signals/detail/type_selection.hpp> # include <boost/signals/detail/signal_base.hpp> # include <boost/signals/detail/slot_call_iterator.hpp> # include <boost/mpl/bool.hpp> # include <boost/type_traits/is_convertible.hpp> # include <boost/preprocessor/comma_if.hpp> # include <boost/preprocessor/enum.hpp> # include <boost/preprocessor/enum_params.hpp> # include <boost/preprocessor/repetition/enum_binary_params.hpp> # include <boost/preprocessor/punctuation/paren.hpp> # include <boost/preprocessor/repeat.hpp> # include <boost/preprocessor/cat.hpp> # include <boost/preprocessor/inc.hpp> # include <boost/preprocessor/empty.hpp> # include <cassert> # include <functional> # include <memory> #endif // ndef BOOST_SIGNALS_DETAIL_PROLOGUE_HEADERS_INCLUDED // Template parameter list ("typename T0, typename T1, ...") #define BOOST_SIGNALS_TEMPLATE_PARMS \ BOOST_PP_ENUM_PARAMS(BOOST_SIGNALS_NUM_ARGS, typename T) // Template argument list ("T0, T1, T2, ...") #define BOOST_SIGNALS_TEMPLATE_ARGS \ BOOST_PP_ENUM_PARAMS(BOOST_SIGNALS_NUM_ARGS, T) // Template argument variable name pairs list ("T0 a0, T1 a1, ...") #define BOOST_SIGNALS_PARMS \ BOOST_PP_ENUM_BINARY_PARAMS(BOOST_SIGNALS_NUM_ARGS, T, a) // Variable names list ("a0, a1, a2, ...") #define BOOST_SIGNALS_ARGS \ BOOST_PP_ENUM_PARAMS(BOOST_SIGNALS_NUM_ARGS, a) // Bound arguments accessor list ("args->a0, args->a1, ...") #define BOOST_SIGNALS_BOUND_ARGS \ BOOST_PP_ENUM_PARAMS(BOOST_SIGNALS_NUM_ARGS, args->a) #define BOOST_SIGNALS_SEMICOLON ; // Bound arguments as member declarations ("T0 a0; T1 a1; ...") #define BOOST_SIGNALS_ARG_AS_MEMBER(z, n, d) \ BOOST_PP_CAT(T,n) BOOST_PP_CAT(a,n); #define BOOST_SIGNALS_ARGS_AS_MEMBERS \ BOOST_PP_REPEAT(BOOST_SIGNALS_NUM_ARGS,BOOST_SIGNALS_ARG_AS_MEMBER,BOOST_PP_EMPTY) // Bound arguments as constructor parameter list ("T0 ia0, T1 ia1, ...") #define BOOST_SIGNALS_COPY_PARMS \ BOOST_PP_ENUM_BINARY_PARAMS(BOOST_SIGNALS_NUM_ARGS, T, ia) // Bound arguments as initializer list ("a0(ia0), a1(ia1), a2(ia2)...") #if BOOST_SIGNALS_NUM_ARGS > 0 # define BOOST_SIGNALS_INIT_ARG(z, n, d) \ BOOST_PP_COMMA_IF(n) BOOST_PP_CAT(a,n) ( BOOST_PP_CAT(ia,n) ) # define BOOST_SIGNALS_INIT_ARGS \ : BOOST_PP_REPEAT(BOOST_SIGNALS_NUM_ARGS, BOOST_SIGNALS_INIT_ARG, BOOST_PP_EMPTY) #else # define BOOST_SIGNALS_INIT_ARGS #endif // Argument type typedefs ("typedef T0 arg1_type; typedef T1 arg2_type; ...") #define BOOST_SIGNALS_ARG_TYPE(z, n, d) \ typedef BOOST_PP_CAT(T,n) BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(n)),_type); #define BOOST_SIGNALS_ARG_TYPES \ BOOST_PP_REPEAT(BOOST_SIGNALS_NUM_ARGS, BOOST_SIGNALS_ARG_TYPE, BOOST_PP_EMPTY) // Function traits member typedefs as template parameters list // (typename traits::arg1_type, typename traits::arg_type, ...) #define BOOST_SIGNALS_TRAITS_ARG_TYPE(z, n, d) \ BOOST_PP_COMMA_IF(n) BOOST_PP_CAT(BOOST_PP_CAT(typename traits::arg, BOOST_PP_INC(n)),_type) #define BOOST_SIGNALS_TRAITS_ARG_TYPES \ BOOST_PP_REPEAT(BOOST_SIGNALS_NUM_ARGS, BOOST_SIGNALS_TRAITS_ARG_TYPE, BOOST_PP_EMPTY) // Include the appropriate functionN header #define BOOST_SIGNAL_FUNCTION_N_HEADER \ BOOST_JOIN(<boost/function/function,BOOST_SIGNALS_NUM_ARGS.hpp>) #include BOOST_SIGNAL_FUNCTION_N_HEADER // Determine if a comma should follow a listing of the arguments/parameters #if BOOST_SIGNALS_NUM_ARGS == 0 # define BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS #else # define BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS , #endif // BOOST_SIGNALS_NUM_ARGS > 0 // Standard library argument type member typedefs #if BOOST_SIGNALS_NUM_ARGS == 1 # define BOOST_SIGNALS_STANDARD_ARG_TYPES typedef T0 argument_type; #elif BOOST_SIGNALS_NUM_ARGS == 2 # define BOOST_SIGNALS_STANDARD_ARG_TYPES \ typedef T0 first_argument_type;\ typedef T1 second_argument_type; #else # define BOOST_SIGNALS_STANDARD_ARG_TYPES #endif // Define class names used #define BOOST_SIGNALS_SIGNAL BOOST_JOIN(signal,BOOST_SIGNALS_NUM_ARGS) #define BOOST_SIGNALS_FUNCTION BOOST_JOIN(function,BOOST_SIGNALS_NUM_ARGS) #define BOOST_SIGNALS_ARGS_STRUCT BOOST_JOIN(args,BOOST_SIGNALS_NUM_ARGS) #define BOOST_SIGNALS_CALL_BOUND BOOST_JOIN(call_bound,BOOST_SIGNALS_NUM_ARGS) #define BOOST_SIGNALS_SELECT_SLOT_FUNCTION \ BOOST_JOIN(select_slot_function,BOOST_SIGNALS_NUM_ARGS) // Define commonly-used instantiations #define BOOST_SIGNALS_ARGS_STRUCT_INST \ BOOST_SIGNALS_NAMESPACE::detail::BOOST_SIGNALS_ARGS_STRUCT<BOOST_SIGNALS_TEMPLATE_ARGS> |
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/signals/detail In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11388/signals/detail Modified Files: config.hpp signal_base.hpp signal_impl_base.hpp signals_common.hpp slot_signal_interface.hpp Removed Files: threading_model.hpp Log Message: Simplified the template interface; some code cleanup; added Allocator template parameter; work-in-progress; Index: signal_base.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/signals/detail/signal_base.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- signal_base.hpp 9 Feb 2007 06:34:51 -0000 1.2 +++ signal_base.hpp 18 Feb 2007 16:51:21 -0000 1.3 @@ -28,30 +28,35 @@ namespace BOOST_SIGNALS_NAMESPACE { namespace detail { // signal_impl class template. - // Holds the compiner and derives from a signal_impl_base instantiation - // providing the slot maintenance functionality. - template<class Combiner, class ThreadingModel> - class signal_impl : public signal_impl_base<ThreadingModel> + // Holds the combiner and derives from a signal_impl_base instantiation + // which is providing the slot maintenance functionality. + template<typename Combiner, + typename Group, + typename GroupCompare, + typename ThreadingModel, + typename Allocator> + class signal_impl + : public signal_impl_base<Group, GroupCompare, ThreadingModel, Allocator> { - typedef signal_impl_base<ThreadingModel> base_type; public: -#ifdef BOOST_SIGNALS_NO_LEGACY_SUPPORT - signal_impl(const Combiner& c) - : base_type(), combiner_(c) - { } -#else + typedef signal_impl_base<Group, GroupCompare, ThreadingModel, + Allocator> base_type; + signal_impl(const Combiner& c, - const legacy_implementation::compare_type& comp) + const GroupCompare& comp) : base_type(comp), combiner_(c) { } -#endif // def BOOST_SIGNALS_NO_LEGACY_SUPPORT - Combiner& combiner() { + // Combiner access. + Combiner& combiner() + { return combiner_; } - const Combiner& combiner() const { + const Combiner& combiner() const + { return combiner_; } + private: Combiner combiner_; }; @@ -64,26 +69,25 @@ // Implement common functionality for all signal types which is not // dependent on the signal call signature. Holds the shared_ptr to // the actual implementation. - template<class Combiner, class ThreadingModel> - class BOOST_SIGNALS_DECL signal_base : public signal_base_tag, public noncopyable + template<typename Combiner, + typename Group, + typename GroupCompare, + typename ThreadingModel, + typename Allocator> + class BOOST_SIGNALS_DECL signal_base + : public signal_base_tag, + public noncopyable { protected: - typedef signal_impl<Combiner, ThreadingModel> signal_impl_type; + typedef signal_impl<Combiner, Group, GroupCompare, ThreadingModel, + Allocator> impl_type; + typedef typename impl_type::base_type impl_base_type; public: -#ifdef BOOST_SIGNALS_NO_LEGACY_SUPPORT - signal_base(const Combiner& combiner) - : impl_(new signal_impl_type(combiner)) - { } - -#else - typedef typename signal_impl_type::compare_type compare_type; - - signal_base(const Combiner& combiner, const compare_type& comp) - : impl_(new signal_impl_type(combiner, comp)) + signal_base(const Combiner& combiner, const GroupCompare& comp) + : impl_(new impl_type(combiner, comp)) { } -#endif ~signal_base() { impl_->disconnect_all_slots(); @@ -107,15 +111,15 @@ protected: connection connect_slot( - const shared_ptr<slot_signal_interface<signal_impl_type> >& slot, + const shared_ptr<slot_signal_interface<impl_type> >& slot, connect_position at) { return impl_->connect_slot(slot, at); } - typedef typename signal_impl_type::slot_iterator iterator; + typedef typename impl_type::slot_iterator iterator; - shared_ptr<signal_impl_type> impl_; + shared_ptr<impl_type> impl_; }; } // end namespace detail } // end namespace BOOST_SIGNALS_NAMESPACE Index: config.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/signals/detail/config.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- config.hpp 7 Feb 2007 01:21:35 -0000 1.1 +++ config.hpp 18 Feb 2007 16:51:21 -0000 1.2 @@ -17,30 +17,30 @@ #include <boost/config.hpp> -#ifdef BOOST_HAS_DECLSPEC -# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SIGNALS_DYN_LINK) -# ifdef BOOST_SIGNALS_SOURCE -# define BOOST_SIGNALS_DECL __declspec(dllexport) -# else -# define BOOST_SIGNALS_DECL __declspec(dllimport) -# endif // BOOST_SIGNALS_SOURCE -# endif // DYN_LINK -#endif // BOOST_HAS_DECLSPEC +//#ifdef BOOST_HAS_DECLSPEC +//# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SIGNALS_DYN_LINK) +//# ifdef BOOST_SIGNALS_SOURCE +//# define BOOST_SIGNALS_DECL __declspec(dllexport) +//# else +//# define BOOST_SIGNALS_DECL __declspec(dllimport) +//# endif // BOOST_SIGNALS_SOURCE +//# endif // DYN_LINK +//#endif // BOOST_HAS_DECLSPEC #ifndef BOOST_SIGNALS_DECL # define BOOST_SIGNALS_DECL #endif -// Setup autolinking -#if !defined(BOOST_SIGNALS_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SIGNALS_NO_LIB) -# define BOOST_LIB_NAME boost_signals - -# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SIGNALS_DYN_LINK) -# define BOOST_DYN_LINK -# endif - -# include <boost/config/auto_link.hpp> -#endif // autolinking on +//// Setup autolinking +//#if !defined(BOOST_SIGNALS_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SIGNALS_NO_LIB) +//# define BOOST_LIB_NAME boost_signals +// +//# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SIGNALS_DYN_LINK) +//# define BOOST_DYN_LINK +//# endif +// +//# include <boost/config/auto_link.hpp> +//#endif // autolinking on #endif // BOOST_SIGNALS_CONFIG_HPP Index: signals_common.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/signals/detail/signals_common.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- signals_common.hpp 9 Feb 2007 06:34:51 -0000 1.2 +++ signals_common.hpp 18 Feb 2007 16:51:21 -0000 1.3 @@ -25,7 +25,17 @@ namespace boost { namespace BOOST_SIGNALS_NAMESPACE { + // no_name type + // Represents disabled grouping of slots when provided as a group + // type. + struct no_name { }; + namespace detail { + // no_name_compare type + // Simple comparison predicate replacement for signals using the no_name + // group type. + struct no_name_compare { }; + // The unusable class is a placeholder for unused function arguments // It is also completely unusable except that it constructable from // anything. This helps compilers without partial specialization @@ -34,17 +44,6 @@ unusable() {} }; - // Determine the result type of a slot call - template<typename R> - struct slot_result_type { - typedef R type; - }; - - template<> - struct slot_result_type<void> { - typedef unusable type; - }; - struct signal_base_tag; template<typename T> Index: slot_signal_interface.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/signals/detail/slot_signal_interface.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- slot_signal_interface.hpp 11 Feb 2007 06:13:30 -0000 1.4 +++ slot_signal_interface.hpp 18 Feb 2007 16:51:21 -0000 1.5 @@ -26,11 +26,11 @@ // library that are aware of the signal implementation in use. template<class SignalImpl> class slot_signal_interface - : public SignalImpl::slot_tracker_base_type + : public SignalImpl::slot_tracking_base_type { typedef typename SignalImpl::slot_iterator iterator; typedef typename SignalImpl::signal_lock signal_lock; - typedef typename SignalImpl::slot_tracker_base_type base_type; + typedef typename SignalImpl::slot_tracking_base_type base_type; public: // Acquire the slot from a locked signal context (protect it from being // removed). This and release() below is used to ensure a valid iterator @@ -57,16 +57,26 @@ } } + // Release if not already disconnected. + void disconnect() + { + if(!disconnected()) + release(); + } + // Check the connection state from a locked signal context. - bool disconnected() const { + bool disconnected() const + { return disconnected_; } // Check the blocking state from a locked signal context. - bool blocked() const { + bool blocked() const + { return block_ != 0; } // Check the callability from a locked signal context. - bool callable() const { + bool callable() const + { return !disconnected_ && (block_ == 0); } Index: signal_impl_base.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/signals/detail/signal_impl_base.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- signal_impl_base.hpp 11 Feb 2007 06:13:30 -0000 1.2 +++ signal_impl_base.hpp 18 Feb 2007 16:51:21 -0000 1.3 @@ -11,11 +11,13 @@ #ifndef BOOST_SIGNALS_DETAIL_SIGNAL_IMPL_HEADER #define BOOST_SIGNALS_DETAIL_SIGNAL_IMPL_HEADER -#include <boost/signals/detail/config.hpp> #include <boost/signals/detail/signals_common.hpp> -#include <boost/signals/detail/connect_position.hpp> +#include <boost/signals/detail/unnamed_slot_container.hpp> +#include <boost/signals/detail/named_slot_container.hpp> #include <boost/signals/detail/slot_signal_interface.hpp> #include <boost/signals/connection.hpp> +#include <boost/mpl/if.hpp> +#include <boost/type_traits/is_same.hpp> #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX @@ -24,17 +26,42 @@ namespace boost { namespace BOOST_SIGNALS_NAMESPACE { namespace detail { + // select_slot_container template. + // Determine the proper type for slot storage from the Group and GroupCompare + // template arguments. + template<typename T, + typename Group, + typename GroupCompare, + typename Allocator + > + struct select_slot_container + { + typedef typename mpl::if_< + is_same<Group, no_name>, + unnamed_slot_container<T, Allocator>, + named_slot_container<T, Group, GroupCompare, Allocator> + >::type type; + }; + // signal_impl_base class template. - template<class ThreadingModel> + template<typename Group, + typename GroupCompare, + typename ThreadingModel, + typename Allocator + > class BOOST_SIGNALS_DECL signal_impl_base - : public ThreadingModel, - public enable_shared_from_this<signal_impl_base<ThreadingModel> > + : public ThreadingModel::signal_impl_threading_base_type, + public enable_shared_from_this<signal_impl_base<Group, + GroupCompare, + ThreadingModel, + Allocator> >, + public ThreadingModel { public: typedef slot_signal_interface<signal_impl_base> slot_interface; - typedef slot_tracking_base slot_tracker_base_type; - signal_impl_base() + signal_impl_base(const GroupCompare& comp) + : slots_(comp) { } ~signal_impl_base() { } @@ -62,22 +89,43 @@ return slots_.size(); } + // Connect an unnamed slot. connection connect_slot(const shared_ptr<slot_interface>& slot, connect_position at) { local_lock lock(this); - slot_iterator pos; - if(at == at_back) { - pos = slots_.insert(slots_.end(), slot); - } else { - pos = slots_.insert(slots_.begin(), slot); - } + slot_iterator pos = slots_.insert(slot, at); + slot->reset(shared_from_this(), pos); + return connection(slot); + } + + // Connect a named slot. + connection connect_slot(const shared_ptr<slot_interface>& slot, + const Group& group, + connect_position at) + { + local_lock lock(this); + slot_iterator pos = slots_.insert(slot, group, at); slot->reset(shared_from_this(), pos); return connection(slot); } + // Disconnect a slot group. + void disconnect(const Group& group) + { + local_lock lock(this); + std::pair<slot_iterator, slot_iterator> range = slots_.group_range(group); + slot_iterator it = range.first; + while(it != range.second) { + slot_iterator tmp = it++; + (*tmp)->disconnect(); + } + } public: - typedef std::list<shared_ptr<slot_interface> > slot_container; + typedef typename select_slot_container<shared_ptr<slot_interface>, + Group, + GroupCompare, + Allocator>::type slot_container; typedef typename slot_container::iterator slot_iterator; void remove_slot(const slot_iterator& pos) { --- threading_model.hpp DELETED --- |
|
From: t_stange <t_s...@us...> - 2007-02-18 16:51:54
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11388 Modified Files: signal.hpp Log Message: Simplified the template interface; some code cleanup; added Allocator template parameter; work-in-progress; Index: signal.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/signal.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- signal.hpp 11 Feb 2007 06:13:30 -0000 1.2 +++ signal.hpp 18 Feb 2007 16:51:21 -0000 1.3 @@ -35,35 +35,26 @@ #ifndef BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX -// Define generation-dependent part of the signature -# ifndef BOOST_SIGNALS_NO_LEGACY_SUPPORT -# define BOOST_SIGNALS_GENERATION_TEMPLATE_PARMS_WITH_DEFAULT \ - typename Group = int,\ - typename GroupCompare = std::less<Group> -# define BOOST_SIGNALS_GENERATION_TEMPLATE_PARMS typename Group,\ - typename GroupCompare -# define BOOST_SIGNALS_GENERATION_TEMPLATE_ARGS Group, GroupCompare - -# else -# define BOOST_SIGNALS_GENERATION_TEMPLATE_PARMS_WITH_DEFAULT \ - typename ThreadingModel = BOOST_SIGNALS_NAMESPACE::single_threaded -# define BOOST_SIGNALS_GENERATION_TEMPLATE_PARMS typename ThreadingModel -# define BOOST_SIGNALS_GENERATION_TEMPLATE_ARGS ThreadingModel -# endif // ndef BOOST_SIGNALS_NO_LEGACY_SUPPORT - namespace boost { namespace BOOST_SIGNALS_NAMESPACE { namespace detail { template<typename Signature, typename Combiner, - BOOST_SIGNALS_GENERATION_TEMPLATE_PARMS, - typename SlotFunction> + typename Group, + typename GroupCompare, + typename SlotFunction, + typename ThreadingModel, + typename Allocator + > struct get_signal_impl : public real_get_signal_impl<(function_traits<Signature>::arity), Signature, Combiner, - BOOST_SIGNALS_GENERATION_TEMPLATE_ARGS, - SlotFunction> + Group, + GroupCompare, + SlotFunction, + ThreadingModel, + Allocator> { }; @@ -75,40 +66,41 @@ // class name. template< typename Signature, // function type R (T1, T2, ..., TN) - typename Combiner = last_value<typename function_traits<Signature>::result_type>, - BOOST_SIGNALS_GENERATION_TEMPLATE_PARMS_WITH_DEFAULT, - typename SlotFunction = function<Signature> + typename Combiner = BOOST_SIGNALS_NAMESPACE::use_default, + typename Group = BOOST_SIGNALS_NAMESPACE::use_default, + typename GroupCompare = BOOST_SIGNALS_NAMESPACE::use_default, + typename SlotFunction = BOOST_SIGNALS_NAMESPACE::use_default, + typename ThreadingModel = BOOST_SIGNALS_NAMESPACE::use_default, + typename Allocator = BOOST_SIGNALS_NAMESPACE::use_default > class signal : - public BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl<Signature, Combiner, - BOOST_SIGNALS_GENERATION_TEMPLATE_ARGS, - SlotFunction>::type + public BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl<Signature, + Combiner, + Group, + GroupCompare, + SlotFunction, + ThreadingModel, + Allocator>::type { typedef typename BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl< Signature, Combiner, - BOOST_SIGNALS_GENERATION_TEMPLATE_ARGS, - SlotFunction>::type base_type; + Group, + GroupCompare, + SlotFunction, + ThreadingModel, + Allocator>::type base_type; public: -# ifdef BOOST_SIGNALS_NO_LEGACY_SUPPORT - explicit signal(const Combiner& combiner = Combiner()) - : base_type(combiner) - { } - -# else - explicit signal(const Combiner& combiner = Combiner(), - const GroupCompare& group_compare = GroupCompare()) : - base_type(combiner, group_compare) + explicit signal(const typename base_type::combiner_type& + combiner = combiner_type(), + const typename base_type::group_compare_type& + group_compare = group_compare_type()) + : base_type(combiner, group_compare) { } -# endif // def BOOST_SIGNALS_NO_LEGACY_SUPPORT }; } // end namespace boost -# undef BOOST_SIGNALS_GENERATION_TEMPLATE_PARMS_WITH_DEFAULT -# undef BOOST_SIGNALS_GENERATION_TEMPLATE_PARMS -# undef BOOST_SIGNALS_GENERATION_TEMPLATE_ARGS - #endif // ndef BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX #ifdef BOOST_HAS_ABI_HEADERS |