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: John M. <joh...@us...> - 2007-02-28 10:47:01
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/math_functions/test In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21546/libs/math_functions/test Modified Files: Tag: math_toolkit test_bernoulli.cpp Log Message: Median is supported now. Index: test_bernoulli.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/math_functions/test/Attic/test_bernoulli.cpp,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -u -d -r1.1.2.3 -r1.1.2.4 --- test_bernoulli.cpp 5 Jan 2007 12:46:50 -0000 1.1.2.3 +++ test_bernoulli.cpp 28 Feb 2007 10:46:59 -0000 1.1.2.4 @@ -130,10 +130,6 @@ static_cast<RealType>(5.11111111111111111111111111111111111111111111L), tolerance); - // median NOT implemented. - BOOST_CHECK_THROW( - median(bernoulli_distribution<RealType>(static_cast<RealType>(0.5L))), std::domain_error); - BOOST_CHECK_THROW( quantile( bernoulli_distribution<RealType>(static_cast<RealType>(2)), // prob >1 |
|
From: Frank M. H. <fm...@us...> - 2007-02-27 22:24:37
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/thread_safe_signals/test In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20668 Modified Files: track_test.cpp Log Message: Make tracking of double argument less meaningless by passing reference instead of copy. Index: track_test.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/thread_safe_signals/test/track_test.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- track_test.cpp 27 Feb 2007 21:19:25 -0000 1.1 +++ track_test.cpp 27 Feb 2007 22:24:33 -0000 1.2 @@ -8,6 +8,7 @@ // For more information, see http://www.boost.org +#include <boost/ref.hpp> #include <boost/shared_ptr.hpp> #include <boost/test/minimal.hpp> #include <boost/thread_safe_signal.hpp> @@ -74,7 +75,7 @@ // Test binding of a slot to another slot { boost::shared_ptr<int> shorty(new int(2)); - boost::slot<int (double)> other_slot(&myfunc, *shorty.get(), _1); + boost::slot<int (double)> other_slot(&myfunc, boost::cref(*shorty.get()), _1); other_slot.track(shorty); s1.connect(sig_type::slot_type(other_slot, 0.5).track(other_slot)); BOOST_CHECK(s1(3) == 2); |
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/detail In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22644/boost/thread_safe_signals/detail Modified Files: signal_base.hpp signal_template.hpp slot_call_iterator.hpp Added Files: signals_common_macros.hpp slot_template.hpp Log Message: Added Signature template parameter to slot class, so that an operator() could be added. Bind can be used to bind together slots with different signatures now. Added some syntactic sugar to slot constructors, so a bind() call is inserted automatically for the constructors that take more than one argument. All tracking for automatic connection management is now done through slot::track(). Added track_test.cpp test program, which tests some of the new functionality. 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.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- slot_call_iterator.hpp 20 Feb 2007 13:32:23 -0000 1.19 +++ slot_call_iterator.hpp 27 Feb 2007 21:19:25 -0000 1.20 @@ -18,6 +18,7 @@ #include <boost/optional.hpp> #include <boost/scoped_ptr.hpp> #include <boost/thread_safe_signals/connection.hpp> +#include <boost/thread_safe_signals/slot_base.hpp> #include <boost/type_traits.hpp> #ifdef BOOST_HAS_ABI_HEADERS @@ -43,11 +44,11 @@ boost::single_pass_traversal_tag, typename Function::result_type const&> inherited; - + typedef typename Function::result_type result_type; - + friend class boost::iterator_core_access; - + public: slot_call_iterator_t(Iterator iter_in, Iterator end_in, Function f, boost::optional<result_type> &c): @@ -56,7 +57,7 @@ { lockNextCallable(); } - + typename inherited::reference dereference() const { @@ -65,22 +66,22 @@ } return cache->get(); } - + void increment() { ++iter; lockNextCallable(); cache->reset(); } - + bool equal(const slot_call_iterator_t& other) const { return iter == other.iter; } - + private: typedef typename ConnectionBody::mutex_type::scoped_lock lock_type; - + void lockNextCallable() const { if(iter == callable_iter) @@ -102,13 +103,13 @@ callable_iter = end; } } - + mutable Iterator iter; Iterator end; Function f; optional<result_type>* cache; mutable Iterator callable_iter; - mutable typename ConnectionBody::shared_ptrs_type tracked_ptrs; + mutable typename slot_base::locked_container_type tracked_ptrs; }; } // end namespace detail } // end namespace BOOST_SIGNALS_NAMESPACE --- NEW FILE: signals_common_macros.hpp --- /* Template for Signa1, Signal2, ... classes that support signals with 1, 2, ... parameters Author: Frank Hess <fra...@ni...> Begin: 2007-01-23 */ /* This software was developed at the National Institute of Standards and * Technology by employees of the Federal Government in the course of * their official duties. Pursuant to title 17 Section 105 of the United * States Code this software is not subject to copyright protection and is * in the public domain. This is an experimental system. NIST assumes no * responsibility whatsoever for its use by other parties, and makes no * guarantees, expressed or implied, about its quality, reliability, or * any other characteristic. We would appreciate acknowledgement if the * software is used. */ // 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) #ifndef BOOST_SIGNALS_COMMON_MACROS_HEADER #define BOOST_SIGNALS_COMMON_MACROS_HEADER // argn #define BOOST_SIGNAL_SIGNATURE_ARG_NAME(z, n, data) BOOST_PP_CAT(arg, BOOST_PP_INC(n)) // Tn argn #define BOOST_SIGNAL_SIGNATURE_FULL_ARG(z, n, data) \ BOOST_PP_CAT(T, BOOST_PP_INC(n)) BOOST_SIGNAL_SIGNATURE_ARG_NAME(~, n, ~) // T1 arg1, T2 arg2, ..., Tn argn #define BOOST_SIGNAL_SIGNATURE_FULL_ARGS(arity) \ BOOST_PP_ENUM(arity, BOOST_SIGNAL_SIGNATURE_FULL_ARG, ~) // arg1, arg2, ..., argn #define BOOST_SIGNAL_SIGNATURE_ARG_NAMES(arity) BOOST_PP_ENUM(arity, BOOST_SIGNAL_SIGNATURE_ARG_NAME, ~) // typename R, typename T1, typename T2, ..., typename TN #define BOOST_SIGNAL_SIGNATURE_TEMPLATE_DECL(arity) \ typename R BOOST_PP_COMMA_IF(arity) BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), typename T) // R, T1, T2, ..., TN #define BOOST_SIGNAL_SIGNATURE_TEMPLATE_INSTANTIATION(arity) \ R BOOST_PP_COMMA_IF(arity) BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), T) // functionN<R, T1, T2, ..., TN> #define BOOST_FUNCTION_N_DECL(arity) BOOST_PP_CAT(function, arity)<\ BOOST_SIGNAL_SIGNATURE_TEMPLATE_INSTANTIATION(arity) > // slotN #define BOOST_SLOT_CLASS_NAME(arity) BOOST_PP_CAT(slot, arity) // typename function_traits<Signature>::argn_type #define BOOST_SIGNAL_SIGNATURE_TO_ARGN_TYPE(z, n, Signature) \ BOOST_PP_CAT(BOOST_PP_CAT(typename function_traits<Signature>::arg, BOOST_PP_INC(n)), _type) // typename function_traits<Signature>::result_type, // typename function_traits<Signature>::arg1_type, // typename function_traits<Signature>::arg2_type, // ..., // typename function_traits<Signature>::argn_type #define BOOST_SIGNAL_PORTABLE_SIGNATURE(arity, Signature) \ typename function_traits<Signature>::result_type \ BOOST_PP_COMMA_IF(arity) BOOST_PP_ENUM(arity, BOOST_SIGNAL_SIGNATURE_TO_ARGN_TYPE, Signature) #endif // BOOST_SIGNALS_COMMON_MACROS_HEADER --- NEW FILE: slot_template.hpp --- // Boost.Signals library // Copyright Frank Mori Hess 2007. // 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 // This file is included iteratively, and should not be protected from multiple inclusion #define BOOST_SIGNALS_NUM_ARGS BOOST_PP_ITERATION() #define BOOST_SLOT_IMPL_CLASS_NAME BOOST_PP_CAT(BOOST_SLOT_CLASS_NAME, _impl) #define BOOST_SLOT_IMPL_BASE_CLASS_NAME BOOST_PP_CAT(BOOST_SLOT_CLASS_NAME, _impl_base) namespace boost { // slot class template. template<BOOST_SIGNAL_SIGNATURE_TEMPLATE_DECL(BOOST_SIGNALS_NUM_ARGS), typename SlotFunction = BOOST_FUNCTION_N_DECL(BOOST_SIGNALS_NUM_ARGS)> class BOOST_SLOT_CLASS_NAME(BOOST_SIGNALS_NUM_ARGS): public signalslib::detail::slot_base { public: typedef R result_type; template<typename F> BOOST_SLOT_CLASS_NAME(BOOST_SIGNALS_NUM_ARGS)(const F& f): _slot_function(signalslib::detail::get_invocable_slot(f, signalslib::detail::tag_type(f))) { } // bind syntactic sugar // const ArgTypeN argN #define BOOST_SLOT_BINDING_ARG_DECL(z, n, data) \ BOOST_PP_CAT(ArgType, n) BOOST_PP_CAT(arg, n) // template<typename Func, typename ArgType0, typename ArgType1, ..., typename ArgTypen-1> slotN(... #define BOOST_SLOT_BINDING_CONSTRUCTOR(z, n, data) \ template<typename Func BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, typename ArgType)> \ BOOST_SLOT_CLASS_NAME(BOOST_SIGNALS_NUM_ARGS)(Func func BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM(n, BOOST_SLOT_BINDING_ARG_DECL, ~)): \ _slot_function(bind(func BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, arg))) \ {} #define BOOST_SLOT_MAX_BINDING_ARGS 10 BOOST_PP_REPEAT_FROM_TO(1, BOOST_SLOT_MAX_BINDING_ARGS, BOOST_SLOT_BINDING_CONSTRUCTOR, ~) #undef BOOST_SLOT_MAX_BINDING_ARGS #undef BOOST_SLOT_BINDING_ARG_DECL #undef BOOST_SLOT_BINDING_CONSTRUCTOR R operator()(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS)) { return _slot_function(BOOST_SIGNAL_SIGNATURE_ARG_NAMES(BOOST_SIGNALS_NUM_ARGS)); } BOOST_SLOT_CLASS_NAME(BOOST_SIGNALS_NUM_ARGS)& track(const weak_ptr<void> &tracked) { _trackedObjects.push_back(tracked); return *this; } BOOST_SLOT_CLASS_NAME(BOOST_SIGNALS_NUM_ARGS)& track(const slot_base &slot) { tracked_container_type::const_iterator it; for(it = slot.tracked_objects().begin(); it != slot.tracked_objects().end(); ++it) { track(*it); } return *this; } BOOST_SLOT_CLASS_NAME(BOOST_SIGNALS_NUM_ARGS)& track(const signalslib::detail::signal_base &signal) { track(signal.lock_pimpl()); return *this; } private: SlotFunction _slot_function; }; namespace signalslib { namespace detail { template<unsigned arity, typename Signature, typename SlotFunction> class slotN; // partial template specialization template<typename Signature, typename SlotFunction> class slotN<BOOST_SIGNALS_NUM_ARGS, Signature, SlotFunction> { public: typedef BOOST_SLOT_CLASS_NAME(BOOST_SIGNALS_NUM_ARGS)< BOOST_SIGNAL_PORTABLE_SIGNATURE(BOOST_SIGNALS_NUM_ARGS, Signature), SlotFunction> type; }; } } } // end namespace boost #undef BOOST_SIGNALS_NUM_ARGS #undef BOOST_SLOT_IMPL_CLASS_NAME #undef BOOST_SLOT_IMPL_BASE_CLASS_NAME Index: signal_template.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/detail/signal_template.hpp,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- signal_template.hpp 18 Feb 2007 00:13:37 -0000 1.34 +++ signal_template.hpp 27 Feb 2007 21:19:25 -0000 1.35 @@ -22,43 +22,31 @@ // This file is included iteratively, and should not be protected from multiple inclusion -#define EPG_SIGNALS_NUM_ARGS BOOST_PP_ITERATION() +#define BOOST_SIGNALS_NUM_ARGS BOOST_PP_ITERATION() -#define EPG_SIGNAL_CLASS_NAME BOOST_PP_CAT(signal, EPG_SIGNALS_NUM_ARGS) -#define EPG_WEAK_SIGNAL_CLASS_NAME BOOST_PP_CAT(weak_, EPG_SIGNAL_CLASS_NAME) -#define EPG_SIGNAL_IMPL_CLASS_NAME BOOST_PP_CAT(EPG_SIGNAL_CLASS_NAME, _impl) +#define BOOST_SIGNAL_CLASS_NAME BOOST_PP_CAT(signal, BOOST_SIGNALS_NUM_ARGS) +#define BOOST_WEAK_SIGNAL_CLASS_NAME BOOST_PP_CAT(weak_, BOOST_SIGNAL_CLASS_NAME) +#define BOOST_SIGNAL_IMPL_CLASS_NAME BOOST_PP_CAT(BOOST_SIGNAL_CLASS_NAME, _impl) -// argn -#define EPG_SIGNAL_SIGNATURE_ARG_NAME(z, n, data) BOOST_PP_CAT(arg, BOOST_PP_INC(n)) -// Tn argn -#define EPG_SIGNAL_SIGNATURE_FULL_ARG(z, n, data) \ - BOOST_PP_CAT(T, BOOST_PP_INC(n)) EPG_SIGNAL_SIGNATURE_ARG_NAME(~, n, ~) -// T1 arg1, T2 arg2, ... -// Tn argn -#define EPG_SIGNAL_SIGNATURE_FULL_ARGS(arity, data) \ - BOOST_PP_ENUM(arity, EPG_SIGNAL_SIGNATURE_FULL_ARG, data) -// arg1, arg2, ..., argn -#define EPG_SIGNAL_SIGNATURE_ARG_NAMES(arity) BOOST_PP_ENUM(arity, EPG_SIGNAL_SIGNATURE_ARG_NAME, ~) // typename R, typename T1, typename T2, ..., typename TN, typename Combiner = boost::last_value<R>, ... -#define EPG_SIGNAL_TEMPLATE_DEFAULTED_DECL \ - typename R, BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(EPG_SIGNALS_NUM_ARGS), typename T) BOOST_PP_COMMA_IF(EPG_SIGNALS_NUM_ARGS) \ +#define BOOST_SIGNAL_TEMPLATE_DEFAULTED_DECL \ + BOOST_SIGNAL_SIGNATURE_TEMPLATE_DECL(BOOST_SIGNALS_NUM_ARGS), \ typename Combiner = boost::last_value<R>, \ typename Group = int, \ typename GroupCompare = std::less<Group>, \ - typename SlotFunction = BOOST_PP_CAT(boost::function, EPG_SIGNALS_NUM_ARGS)<R BOOST_PP_COMMA_IF(EPG_SIGNALS_NUM_ARGS) \ - BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(EPG_SIGNALS_NUM_ARGS), T) >, \ + typename SlotFunction = BOOST_FUNCTION_N_DECL(BOOST_SIGNALS_NUM_ARGS), \ typename ThreadingModel = signalslib::single_threaded // typename R, typename T1, typename T2, ..., typename TN, typename Combiner, ... -#define EPG_SIGNAL_TEMPLATE_DECL \ - typename R, BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(EPG_SIGNALS_NUM_ARGS), typename T) BOOST_PP_COMMA_IF(EPG_SIGNALS_NUM_ARGS) \ +#define BOOST_SIGNAL_TEMPLATE_DECL \ + BOOST_SIGNAL_SIGNATURE_TEMPLATE_DECL(BOOST_SIGNALS_NUM_ARGS), \ typename Combiner, \ typename Group, \ typename GroupCompare, \ typename SlotFunction, \ typename ThreadingModel // R, T1, T2, ..., TN, Combiner, Group, GroupCompare, SlotFunction, ThreadingModel -#define EPG_SIGNAL_TEMPLATE_INSTANTIATION \ - R, BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(EPG_SIGNALS_NUM_ARGS), T) BOOST_PP_COMMA_IF(EPG_SIGNALS_NUM_ARGS) \ +#define BOOST_SIGNAL_TEMPLATE_INSTANTIATION \ + BOOST_SIGNAL_SIGNATURE_TEMPLATE_INSTANTIATION(BOOST_SIGNALS_NUM_ARGS), \ Combiner, Group, GroupCompare, SlotFunction, ThreadingModel namespace boost @@ -67,17 +55,20 @@ { namespace detail { - template<EPG_SIGNAL_TEMPLATE_DECL> - class EPG_SIGNAL_IMPL_CLASS_NAME + template<BOOST_SIGNAL_TEMPLATE_DECL> + class BOOST_SIGNAL_IMPL_CLASS_NAME { + public: + typedef BOOST_SLOT_CLASS_NAME(BOOST_SIGNALS_NUM_ARGS)<BOOST_SIGNAL_SIGNATURE_TEMPLATE_INSTANTIATION(BOOST_SIGNALS_NUM_ARGS), + SlotFunction> slot_type; private: class slot_invoker; typedef typename signalslib::detail::group_key<Group>::type group_key_type; - typedef shared_ptr<ConnectionBody<group_key_type, SlotFunction, ThreadingModel> > connection_body_type; + typedef shared_ptr<ConnectionBody<group_key_type, slot_type, ThreadingModel> > connection_body_type; typedef grouped_list<Group, GroupCompare, connection_body_type> connection_list_type; public: typedef SlotFunction slot_function_type; - typedef slot<slot_function_type> slot_type; + // typedef slotN<Signature, SlotFunction> slot_type; typedef typename slot_function_type::result_type slot_result_type; typedef Combiner combiner_type; typedef typename combiner_type::result_type result_type; @@ -86,7 +77,7 @@ typedef typename signalslib::detail::slot_call_iterator_t<slot_invoker, typename connection_list_type::iterator, ConnectionBody<group_key_type, SlotFunction, ThreadingModel> > slot_call_iterator; - EPG_SIGNAL_IMPL_CLASS_NAME(const combiner_type &combiner, + BOOST_SIGNAL_IMPL_CLASS_NAME(const combiner_type &combiner, const group_compare_type &group_compare): _shared_state(new invocation_state(connection_list_type(group_compare), combiner)), _garbage_collector_it(_shared_state->connection_bodies.end()) @@ -161,7 +152,7 @@ do_disconnect(slot, is_group()); } // emit signal - result_type operator ()(EPG_SIGNAL_SIGNATURE_FULL_ARGS(EPG_SIGNALS_NUM_ARGS, ~)) + result_type operator ()(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS)) { shared_ptr<invocation_state> local_state; typename connection_list_type::iterator it; @@ -175,14 +166,14 @@ during invocation. */ local_state = _shared_state; } - slot_invoker invoker BOOST_PP_IF(EPG_SIGNALS_NUM_ARGS, \ - (EPG_SIGNAL_SIGNATURE_ARG_NAMES(EPG_SIGNALS_NUM_ARGS)), ); + slot_invoker invoker BOOST_PP_IF(BOOST_SIGNALS_NUM_ARGS, \ + (BOOST_SIGNAL_SIGNATURE_ARG_NAMES(BOOST_SIGNALS_NUM_ARGS)), ); optional<typename signalslib::detail::slot_result_type_wrapper<slot_result_type>::type > cache; return local_state->combiner( slot_call_iterator(local_state->connection_bodies.begin(), local_state->connection_bodies.end(), invoker, cache), slot_call_iterator(local_state->connection_bodies.end(), local_state->connection_bodies.end(), invoker, cache)); } - result_type operator ()(EPG_SIGNAL_SIGNATURE_FULL_ARGS(EPG_SIGNALS_NUM_ARGS, ~)) const + result_type operator ()(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS)) const { shared_ptr<invocation_state> local_state; typename connection_list_type::iterator it; @@ -196,8 +187,8 @@ during invocation. */ local_state = _shared_state; } - slot_invoker invoker BOOST_PP_IF(EPG_SIGNALS_NUM_ARGS, \ - (EPG_SIGNAL_SIGNATURE_ARG_NAMES(EPG_SIGNALS_NUM_ARGS)), ); + slot_invoker invoker BOOST_PP_IF(BOOST_SIGNALS_NUM_ARGS, \ + (BOOST_SIGNAL_SIGNATURE_ARG_NAMES(BOOST_SIGNALS_NUM_ARGS)), ); optional<typename signalslib::detail::slot_result_type_wrapper<slot_result_type>::type > cache; return const_cast<const combiner_type&>(local_state->combiner)( slot_call_iterator(local_state->connection_bodies.begin(), local_state->connection_bodies.end(), invoker, cache), @@ -243,20 +234,20 @@ } private: typedef typename ThreadingModel::mutex_type mutex_type; - + // slot_invoker is passed to slot_call_iterator_t to run slots class slot_invoker { public: typedef typename signalslib::detail::slot_result_type_wrapper<slot_result_type>::type result_type; - slot_invoker(EPG_SIGNAL_SIGNATURE_FULL_ARGS(EPG_SIGNALS_NUM_ARGS, ~)) BOOST_PP_IF(EPG_SIGNALS_NUM_ARGS, :, ) + slot_invoker(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS)) BOOST_PP_IF(BOOST_SIGNALS_NUM_ARGS, :, ) // argn ( argn ) , -#define EPG_SIGNAL_MISC_STATEMENT(z, n, data) \ +#define BOOST_SIGNAL_MISC_STATEMENT(z, n, data) \ BOOST_PP_CAT(arg, n) ( BOOST_PP_CAT(arg, n) ) // arg1(arg1), arg2(arg2), ..., argn(argn) - BOOST_PP_ENUM_SHIFTED(BOOST_PP_INC(EPG_SIGNALS_NUM_ARGS), EPG_SIGNAL_MISC_STATEMENT, ~) -#undef EPG_SIGNAL_MISC_STATEMENT + BOOST_PP_ENUM_SHIFTED(BOOST_PP_INC(BOOST_SIGNALS_NUM_ARGS), BOOST_SIGNAL_MISC_STATEMENT, ~) +#undef BOOST_SIGNAL_MISC_STATEMENT {} result_type operator ()(const connection_body_type &connectionBody) const { @@ -265,20 +256,20 @@ resolver); } // Tn argn; -#define EPG_SIGNAL_MISC_STATEMENT(z, n, Signature) \ - BOOST_PP_CAT(T, BOOST_PP_INC(n)) EPG_SIGNAL_SIGNATURE_ARG_NAME(~, n, ~); - BOOST_PP_REPEAT(EPG_SIGNALS_NUM_ARGS, EPG_SIGNAL_MISC_STATEMENT, ~) -#undef EPG_SIGNAL_MISC_STATEMENT +#define BOOST_SIGNAL_MISC_STATEMENT(z, n, Signature) \ + BOOST_PP_CAT(T, BOOST_PP_INC(n)) BOOST_SIGNAL_SIGNATURE_ARG_NAME(~, n, ~); + BOOST_PP_REPEAT(BOOST_SIGNALS_NUM_ARGS, BOOST_SIGNAL_MISC_STATEMENT, ~) +#undef BOOST_SIGNAL_MISC_STATEMENT private: result_type m_invoke(const connection_body_type &connectionBody, const signalslib::detail::unusable *resolver) const { - connectionBody->slot(EPG_SIGNAL_SIGNATURE_ARG_NAMES(EPG_SIGNALS_NUM_ARGS)); + connectionBody->slot(BOOST_SIGNAL_SIGNATURE_ARG_NAMES(BOOST_SIGNALS_NUM_ARGS)); return signalslib::detail::unusable(); } result_type m_invoke(const connection_body_type &connectionBody, ...) const { - return connectionBody->slot(EPG_SIGNAL_SIGNATURE_ARG_NAMES(EPG_SIGNALS_NUM_ARGS)); + return connectionBody->slot(BOOST_SIGNAL_SIGNATURE_ARG_NAMES(BOOST_SIGNALS_NUM_ARGS)); } }; // a struct used to optimize (minimize) the number of shared_ptrs that need to be created @@ -296,7 +287,7 @@ connection_list_type connection_bodies; combiner_type combiner; }; - + // clean up disconnected connections void nolock_cleanup_connections(bool grab_tracked, const connection_list_type::iterator &begin, const connection_list_type::iterator &end) const @@ -315,7 +306,7 @@ }else { if(grab_tracked) - (*it)->nolock_grab_tracked_objects(); + (*it)->nolock_slot_expired(); connected = (*it)->nolock_nograb_connected(); } }// scoped lock destructs here, safe to erase now @@ -367,7 +358,7 @@ connection_body_type create_new_connection(const slot_type &slot) { nolock_force_unique_connection_list(); - return connection_body_type(new ConnectionBody<group_key_type, slot_function_type, ThreadingModel>(slot)); + return connection_body_type(new ConnectionBody<group_key_type, slot_type, ThreadingModel>(slot)); } void do_disconnect(const group_type &group, mpl::bool_<true> is_group) { @@ -397,46 +388,47 @@ mutable mutex_type _mutex; }; - template<EPG_SIGNAL_TEMPLATE_DECL> - class EPG_WEAK_SIGNAL_CLASS_NAME; + template<BOOST_SIGNAL_TEMPLATE_DECL> + class BOOST_WEAK_SIGNAL_CLASS_NAME; } } - template<EPG_SIGNAL_TEMPLATE_DEFAULTED_DECL> - class EPG_SIGNAL_CLASS_NAME: public signalslib::detail::signal_base + template<BOOST_SIGNAL_TEMPLATE_DEFAULTED_DECL> + class BOOST_SIGNAL_CLASS_NAME: public signalslib::detail::signal_base { public: - typedef signalslib::detail::EPG_WEAK_SIGNAL_CLASS_NAME<EPG_SIGNAL_TEMPLATE_INSTANTIATION> weak_signal_type; + typedef signalslib::detail::BOOST_WEAK_SIGNAL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION> weak_signal_type; friend class weak_signal_type; - friend class signalslib::detail::tracked_objects_visitor; typedef SlotFunction slot_function_type; - typedef slot<slot_function_type> slot_type; + // typedef slotN<Signature, SlotFunction> slot_type; + typedef BOOST_SLOT_CLASS_NAME(BOOST_SIGNALS_NUM_ARGS)<BOOST_SIGNAL_SIGNATURE_TEMPLATE_INSTANTIATION(BOOST_SIGNALS_NUM_ARGS), + slot_function_type> slot_type; typedef typename slot_function_type::result_type slot_result_type; typedef Combiner combiner_type; typedef typename combiner_type::result_type result_type; typedef Group group_type; typedef GroupCompare group_compare_type; - typedef signalslib::detail::EPG_SIGNAL_IMPL_CLASS_NAME<EPG_SIGNAL_TEMPLATE_INSTANTIATION>::slot_call_iterator + typedef signalslib::detail::BOOST_SIGNAL_IMPL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION>::slot_call_iterator slot_call_iterator; // typedef Tn argn_type; -#define EPG_SIGNAL_MISC_STATEMENT(z, n, data) \ +#define BOOST_SIGNAL_MISC_STATEMENT(z, n, data) \ typedef BOOST_PP_CAT(T, BOOST_PP_INC(n)) BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(n)), _type); - BOOST_PP_REPEAT(EPG_SIGNALS_NUM_ARGS, EPG_SIGNAL_MISC_STATEMENT, ~) -#undef EPG_SIGNAL_MISC_STATEMENT -#if EPG_SIGNALS_NUM_ARGS == 1 + BOOST_PP_REPEAT(BOOST_SIGNALS_NUM_ARGS, BOOST_SIGNAL_MISC_STATEMENT, ~) +#undef BOOST_SIGNAL_MISC_STATEMENT +#if BOOST_SIGNALS_NUM_ARGS == 1 typedef arg1_type argument_type; -#elif EPG_SIGNALS_NUM_ARGS == 2 +#elif BOOST_SIGNALS_NUM_ARGS == 2 typedef arg1_type first_argument_type; typedef arg2_type second_argument_type; #endif - static const int arity = EPG_SIGNALS_NUM_ARGS; + static const int arity = BOOST_SIGNALS_NUM_ARGS; - EPG_SIGNAL_CLASS_NAME(const combiner_type &combiner = combiner_type(), + BOOST_SIGNAL_CLASS_NAME(const combiner_type &combiner = combiner_type(), const group_compare_type &group_compare = group_compare_type()): - _pimpl(new signalslib::detail::EPG_SIGNAL_IMPL_CLASS_NAME<EPG_SIGNAL_TEMPLATE_INSTANTIATION>(combiner, group_compare)) + _pimpl(new signalslib::detail::BOOST_SIGNAL_IMPL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION>(combiner, group_compare)) {}; - ~EPG_SIGNAL_CLASS_NAME() + virtual ~BOOST_SIGNAL_CLASS_NAME() { disconnect_all_slots(); } @@ -462,13 +454,13 @@ { (*_pimpl).disconnect(slot); } - result_type operator ()(EPG_SIGNAL_SIGNATURE_FULL_ARGS(EPG_SIGNALS_NUM_ARGS, ~)) + result_type operator ()(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS)) { - return (*_pimpl)(EPG_SIGNAL_SIGNATURE_ARG_NAMES(EPG_SIGNALS_NUM_ARGS)); + return (*_pimpl)(BOOST_SIGNAL_SIGNATURE_ARG_NAMES(BOOST_SIGNALS_NUM_ARGS)); } - result_type operator ()(EPG_SIGNAL_SIGNATURE_FULL_ARGS(EPG_SIGNALS_NUM_ARGS, ~)) const + result_type operator ()(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS)) const { - return (*_pimpl)(EPG_SIGNAL_SIGNATURE_ARG_NAMES(EPG_SIGNALS_NUM_ARGS)); + return (*_pimpl)(BOOST_SIGNAL_SIGNATURE_ARG_NAMES(BOOST_SIGNALS_NUM_ARGS)); } std::size_t num_slots() const { @@ -486,13 +478,13 @@ { return (*_pimpl).set_combiner(combiner); } - private: - shared_ptr<void> lock_pimpl() const + protected: + virtual shared_ptr<void> lock_pimpl() const { return _pimpl; } - - shared_ptr<signalslib::detail::EPG_SIGNAL_IMPL_CLASS_NAME<EPG_SIGNAL_TEMPLATE_INSTANTIATION> > + private: + shared_ptr<signalslib::detail::BOOST_SIGNAL_IMPL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION> > _pimpl; }; @@ -501,33 +493,33 @@ namespace detail { // wrapper class for storing other signals as slots with automatic lifetime tracking - template<EPG_SIGNAL_TEMPLATE_DECL> - class EPG_WEAK_SIGNAL_CLASS_NAME + template<BOOST_SIGNAL_TEMPLATE_DECL> + class BOOST_WEAK_SIGNAL_CLASS_NAME { public: typedef SlotFunction slot_function_type; typedef typename slot_function_type::result_type slot_result_type; - typedef EPG_SIGNAL_CLASS_NAME<EPG_SIGNAL_TEMPLATE_INSTANTIATION>::result_type + typedef BOOST_SIGNAL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION>::result_type result_type; - EPG_WEAK_SIGNAL_CLASS_NAME(const EPG_SIGNAL_CLASS_NAME<EPG_SIGNAL_TEMPLATE_INSTANTIATION> + BOOST_WEAK_SIGNAL_CLASS_NAME(const BOOST_SIGNAL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION> &signal): _weak_pimpl(signal._pimpl) {} - result_type operator ()(EPG_SIGNAL_SIGNATURE_FULL_ARGS(EPG_SIGNALS_NUM_ARGS, ~)) + result_type operator ()(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS)) { - shared_ptr<signalslib::detail::EPG_SIGNAL_IMPL_CLASS_NAME<EPG_SIGNAL_TEMPLATE_INSTANTIATION> > + shared_ptr<signalslib::detail::BOOST_SIGNAL_IMPL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION> > shared_pimpl(_weak_pimpl); - return (*shared_pimpl)(EPG_SIGNAL_SIGNATURE_ARG_NAMES(EPG_SIGNALS_NUM_ARGS)); + return (*shared_pimpl)(BOOST_SIGNAL_SIGNATURE_ARG_NAMES(BOOST_SIGNALS_NUM_ARGS)); } - result_type operator ()(EPG_SIGNAL_SIGNATURE_FULL_ARGS(EPG_SIGNALS_NUM_ARGS, ~)) const + result_type operator ()(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS)) const { - shared_ptr<signalslib::detail::EPG_SIGNAL_IMPL_CLASS_NAME<EPG_SIGNAL_TEMPLATE_INSTANTIATION> > + shared_ptr<signalslib::detail::BOOST_SIGNAL_IMPL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION> > shared_pimpl(_weak_pimpl); - return (*shared_pimpl)(EPG_SIGNAL_SIGNATURE_ARG_NAMES(EPG_SIGNALS_NUM_ARGS)); + return (*shared_pimpl)(BOOST_SIGNAL_SIGNATURE_ARG_NAMES(BOOST_SIGNALS_NUM_ARGS)); } private: - boost::weak_ptr<signalslib::detail::EPG_SIGNAL_IMPL_CLASS_NAME<EPG_SIGNAL_TEMPLATE_INSTANTIATION> > + boost::weak_ptr<signalslib::detail::BOOST_SIGNAL_IMPL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION> > _weak_pimpl; }; @@ -537,30 +529,23 @@ // partial template specialization template<typename Signature, typename Combiner, typename Group, typename GroupCompare, typename SlotFunction, typename ThreadingModel> - class signalN<EPG_SIGNALS_NUM_ARGS, Signature, Combiner, Group, + class signalN<BOOST_SIGNALS_NUM_ARGS, Signature, Combiner, Group, GroupCompare, SlotFunction, ThreadingModel> { public: - typedef EPG_SIGNAL_CLASS_NAME<typename boost::function_traits<Signature>::result_type, -// typename boost::function_traits<Signature>::argn_type , -#define EPG_SIGNAL_MISC_STATEMENT(z, n, Signature) \ - BOOST_PP_CAT(BOOST_PP_CAT(typename boost::function_traits<Signature>::arg, BOOST_PP_INC(n)), _type) , - BOOST_PP_REPEAT(EPG_SIGNALS_NUM_ARGS, EPG_SIGNAL_MISC_STATEMENT, Signature) -#undef EPG_SIGNAL_MISC_STATEMENT - Combiner, Group, - GroupCompare, SlotFunction, ThreadingModel> type; + typedef BOOST_SIGNAL_CLASS_NAME< + BOOST_SIGNAL_PORTABLE_SIGNATURE(BOOST_SIGNALS_NUM_ARGS, Signature), + Combiner, Group, + GroupCompare, SlotFunction, ThreadingModel> type; }; } } } -#undef EPG_SIGNALS_NUM_ARGS -#undef EPG_SIGNAL_CLASS_NAME -#undef EPG_SIGNAL_IMPL_CLASS_NAME -#undef EPG_SIGNAL_SIGNATURE_ARG_NAME -#undef EPG_SIGNAL_SIGNATURE_FULL_ARG -#undef EPG_SIGNAL_SIGNATURE_FULL_ARGS -#undef EPG_SIGNAL_SIGNATURE_ARG_NAMES -#undef EPG_SIGNAL_TEMPLATE_DEFAULTED_DECL -#undef EPG_SIGNAL_TEMPLATE_DECL -#undef EPG_SIGNAL_TEMPLATE_INSTANTIATION +#undef BOOST_SIGNALS_NUM_ARGS +#undef BOOST_SIGNAL_CLASS_NAME +#undef BOOST_WEAK_SIGNAL_CLASS_NAME +#undef BOOST_SIGNAL_IMPL_CLASS_NAME +#undef BOOST_SIGNAL_TEMPLATE_DEFAULTED_DECL +#undef BOOST_SIGNAL_TEMPLATE_DECL +#undef BOOST_SIGNAL_TEMPLATE_INSTANTIATION Index: signal_base.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/detail/signal_base.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- signal_base.hpp 13 Feb 2007 16:17:28 -0000 1.1 +++ signal_base.hpp 27 Feb 2007 21:19:25 -0000 1.2 @@ -17,14 +17,21 @@ #endif namespace boost { - namespace signalslib { - namespace detail { - class signal_base : public noncopyable - { - public: - }; - } // end namespace detail - } // end namespace BOOST_SIGNALS_NAMESPACE + namespace signalslib { + namespace detail { + class slot_base; + + class signal_base : public noncopyable + { + public: + friend class slot_base; + + virtual ~signal_base() {} + protected: + virtual shared_ptr<void> lock_pimpl() const = 0; + }; + } // end namespace detail + } // end namespace BOOST_SIGNALS_NAMESPACE } // end namespace boost #ifdef BOOST_HAS_ABI_HEADERS |
|
From: Frank M. H. <fm...@us...> - 2007-02-27 21:19:26
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22644/boost/thread_safe_signals Modified Files: connection.hpp slot.hpp track.hpp Added Files: slot_base.hpp Log Message: Added Signature template parameter to slot class, so that an operator() could be added. Bind can be used to bind together slots with different signatures now. Added some syntactic sugar to slot constructors, so a bind() call is inserted automatically for the constructors that take more than one argument. All tracking for automatic connection management is now done through slot::track(). Added track_test.cpp test program, which tests some of the new functionality. Index: track.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/track.hpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- track.hpp 22 Feb 2007 20:47:20 -0000 1.12 +++ track.hpp 27 Feb 2007 21:19:25 -0000 1.13 @@ -26,17 +26,18 @@ class tracked { public: - typedef typename unwrap_reference<T>::type value_type; + typedef T value_type; + typedef typename unwrap_reference<T>::type unwrapped_value_type; tracked(const shared_ptr<void>& tracked_ptr, const T &value): _value(value), _tracked_ptr(tracked_ptr) {} // implicit conversions so tracked objects can be bound with bind - operator value_type & () + operator unwrapped_value_type & () { return _value; } - operator const value_type & () const + operator const unwrapped_value_type & () const { return _value; } @@ -83,7 +84,7 @@ T* get_pointer(const signalslib::tracked<weak_ptr<T> > &tracked) {return shared_ptr<T>(static_cast<weak_ptr<T> >(tracked)).get();} // handles T=shared_ptr or similar case template<typename T> - typename T::pointer get_pointer(const signalslib::tracked<T> &tracked) {return static_cast<const T&>(tracked).get();} + typename T::element_type* get_pointer(const signalslib::tracked<T> &tracked) {return get_pointer(static_cast<const T&>(tracked));} } // end namespace BOOST_SIGNALS_NAMESPACE } // end namespace boost --- NEW FILE: slot_base.hpp --- // Boost.Signals library // Copyright Frank Mori Hess 2007. // 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_TSS_SIGNALS_SLOT_BASE_HEADER #define BOOST_TSS_SIGNALS_SLOT_BASE_HEADER #include <boost/shared_ptr.hpp> #include <boost/weak_ptr.hpp> #include <boost/thread_safe_signals/detail/signal_base.hpp> #include <vector> #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif namespace boost { namespace signalslib { namespace detail { class slot_base { public: typedef std::vector<boost::weak_ptr<void> > tracked_container_type; typedef std::vector<boost::shared_ptr<void> > locked_container_type; const tracked_container_type& tracked_objects() const {return _trackedObjects;} locked_container_type lock() const { locked_container_type locked_objects; tracked_container_type::const_iterator it; for(it = tracked_objects().begin(); it != tracked_objects().end(); ++it) { locked_objects.push_back(shared_ptr<void>(*it)); } return locked_objects; } bool expired() const { try { lock(); } catch(const bad_weak_ptr &err) { return true; } return false; } protected: tracked_container_type _trackedObjects; }; } } } // end namespace boost #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX #endif #endif // BOOST_SIGNALS_SLOT_BASE_HEADER Index: connection.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/connection.hpp,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- connection.hpp 21 Feb 2007 20:28:14 -0000 1.18 +++ connection.hpp 27 Feb 2007 21:19:25 -0000 1.19 @@ -41,11 +41,8 @@ class ConnectionBodyBase { public: - typedef std::vector<boost::shared_ptr<void> > shared_ptrs_type; - typedef std::vector<boost::weak_ptr<void> > tracked_objects_container; - - ConnectionBodyBase(const tracked_objects_container &tracked_objects): - _tracked_objects(tracked_objects), _connected(true), _blocked(false) + ConnectionBodyBase(): + _connected(true), _blocked(false) { } virtual ~ConnectionBodyBase() {} @@ -65,35 +62,18 @@ return _blocked || (nolock_nograb_connected() == false); } bool nolock_nograb_connected() const {return _connected;} - // mutex should be locked when calling grabTrackedObjects - shared_ptrs_type nolock_grab_tracked_objects() const - { - shared_ptrs_type sharedPtrs; - tracked_objects_container::const_iterator it; - for(it = _tracked_objects.begin(); it != _tracked_objects.end(); ++it) - { - sharedPtrs.push_back(it->lock()); - if(sharedPtrs.back() == 0) - { - _connected = false; - return shared_ptrs_type(); - } - } - return sharedPtrs; - } protected: - tracked_objects_container _tracked_objects; mutable bool _connected; bool _blocked; }; - template<typename GroupKey, typename SlotFunction, typename ThreadingModel> + template<typename GroupKey, typename SlotType, typename ThreadingModel> class ConnectionBody: public ConnectionBodyBase { public: 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()) + ConnectionBody(const SlotType &slot_in): + slot(slot_in) { } virtual ~ConnectionBody() {} @@ -121,8 +101,30 @@ } const GroupKey& group_key() const {return _group_key;} void set_group_key(const GroupKey &key) {_group_key = key;} - - const SlotFunction slot; + bool nolock_slot_expired() const + { + bool expired = slot.expired(); + if(expired == true) + { + _connected = false; + } + return expired; + } + typename slot_base::locked_container_type nolock_grab_tracked_objects() const + { + slot_base::locked_container_type locked_objects; + try + { + locked_objects = slot.lock(); + } + catch(const bad_weak_ptr &err) + { + _connected = false; + return locked_objects; + } + return locked_objects; + } + SlotType slot; mutable mutex_type mutex; private: GroupKey _group_key; Index: slot.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/slot.hpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- slot.hpp 22 Feb 2007 16:57:12 -0000 1.13 +++ slot.hpp 27 Feb 2007 21:19:25 -0000 1.14 @@ -12,9 +12,12 @@ #ifndef BOOST_TSS_SIGNALS_SLOT_HEADER #define BOOST_TSS_SIGNALS_SLOT_HEADER +#include <boost/bind.hpp> #include <boost/mpl/bool.hpp> #include <boost/ref.hpp> #include <boost/thread_safe_signals/detail/signals_common.hpp> +#include <boost/thread_safe_signals/detail/signals_common_macros.hpp> +#include <boost/thread_safe_signals/slot_base.hpp> #include <boost/thread_safe_signals/track.hpp> #include <boost/thread_safe_signals/trackable.hpp> #include <boost/type_traits.hpp> @@ -32,84 +35,6 @@ { namespace detail { - class slot_base; - template<typename GroupKey, typename SlotFunction, typename ThreadingModel> - class ConnectionBody; - - // Visitor to collect tracked objects from a bound function. - class tracked_objects_visitor - { - public: - tracked_objects_visitor(slot_base *slot) : slot_(slot) - {} - template<typename T> - void operator()(const T& t) const - { - m_visit_reference_wrapper(t, mpl::bool_<is_reference_wrapper<T>::value>()); - } - private: - template<typename T> - void m_visit_reference_wrapper(const reference_wrapper<T> &t, const mpl::bool_<true> &) const - { - m_visit_pointer(t.get_pointer(), mpl::bool_<true>()); - } - template<typename T> - void m_visit_reference_wrapper(const T &t, const mpl::bool_<false> &) const - { - m_visit_pointer(t, mpl::bool_<is_pointer<T>::value>()); - } - template<typename T> - void m_visit_pointer(const T &t, const mpl::bool_<true> &) const - { - m_visit_not_function_pointer(t, mpl::bool_<is_convertible<T, const void*>::value>()); - } - template<typename T> - void m_visit_pointer(const T &t, const mpl::bool_<false> &) const - { - m_visit_pointer(addressof(t), mpl::bool_<true>()); - } - template<typename T> - void m_visit_not_function_pointer(const T *t, const mpl::bool_<true> &) const - { - m_visit_signal(t, mpl::bool_<is_signal<T>::value>()); - } - template<typename T> - void m_visit_not_function_pointer(const T &t, const mpl::bool_<false> &) const - {} - template<typename T> - void m_visit_signal(const T *t, const mpl::bool_<true> &) const; - template<typename T> - void m_visit_signal(const T &t, const mpl::bool_<false> &) const - { - add_if_trackable(t); - } - template<typename T> - void add_if_trackable(const tracked<T> *t) const; - void add_if_trackable(const trackable *trackable) const; - void add_if_trackable(const void *trackable) const {} - - mutable slot_base * slot_; - }; - - class slot_base - { - public: - 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 weak_ptr<void> &tracked) - { - _trackedObjects.push_back(tracked); - } - const tracked_objects_container& get_all_tracked() const {return _trackedObjects;} - - tracked_objects_container _trackedObjects; - }; - // Get the slot so that it can be copied template<typename F> typename F::weak_signal_type @@ -139,50 +64,43 @@ } } } - // slot class template. - template<typename SlotFunction> - class slot: public signalslib::detail::slot_base +} // end namespace boost + +#define BOOST_PP_ITERATION_LIMITS (0, BOOST_SIGNALS_MAX_ARGS) +#define BOOST_PP_FILENAME_1 <boost/thread_safe_signals/detail/slot_template.hpp> +#include BOOST_PP_ITERATE() + +namespace boost +{ + template<typename Signature, + typename SlotFunction = boost::function<Signature> > + class slot: public signalslib::detail::slotN<function_traits<Signature>::arity, + Signature, SlotFunction>::type { + private: + typedef typename signalslib::detail::slotN<boost::function_traits<Signature>::arity, + Signature, SlotFunction>::type base_type; public: template<typename F> - slot(const F& f): slot_function(signalslib::detail::get_invocable_slot(f, signalslib::detail::tag_type(f))) - { - signalslib::detail::tracked_objects_visitor visitor(this); - boost::visit_each(visitor, f); - } - // We would have to enumerate all of the signalN classes here as friends - // to make this private (as it otherwise should be). We can't name all of - // them because we don't know how many there are. - public: - // Get the slot function to call the actual slot - const SlotFunction& get_slot_function() const { return slot_function; } - private: - - slot(); // no default constructor - slot& operator=(const slot&); // no assignment operator - - SlotFunction slot_function; + slot(const F& f): base_type(f) + {} + // bind syntactic sugar +// AN aN +#define BOOST_SLOT_BINDING_ARG_DECL(z, n, data) \ + BOOST_PP_CAT(A, n) BOOST_PP_CAT(a, n) +// template<typename F, typename A0, typename A1, ..., typename An-1> slotN(... +#define BOOST_SLOT_BINDING_CONSTRUCTOR(z, n, data) \ + template<typename F, BOOST_PP_ENUM_PARAMS(n, typename A)> \ + slot(F f, BOOST_PP_ENUM(n, BOOST_SLOT_BINDING_ARG_DECL, ~)): \ + base_type(f, BOOST_PP_ENUM_PARAMS(n, a)) \ + {} +#define BOOST_SLOT_MAX_BINDING_ARGS 10 + BOOST_PP_REPEAT_FROM_TO(1, BOOST_SLOT_MAX_BINDING_ARGS, BOOST_SLOT_BINDING_CONSTRUCTOR, ~) +#undef BOOST_SLOT_MAX_BINDING_ARGS +#undef BOOST_SLOT_BINDING_ARG_DECL +#undef BOOST_SLOT_BINDING_CONSTRUCTOR }; -} // end namespace boost - -template<typename T> -void boost::signalslib::detail::tracked_objects_visitor::m_visit_signal( - const T *signal, const mpl::bool_<true> &) const -{ - if(signal) - slot_->add_tracked(signal->lock_pimpl()); -}; -template<typename T> -void boost::signalslib::detail::tracked_objects_visitor::add_if_trackable(const tracked<T> *t) const -{ - if(t) - slot_->add_tracked(t->get_tracked_ptr()); } -void boost::signalslib::detail::tracked_objects_visitor::add_if_trackable(const trackable *trackable) const -{ - if(trackable) - slot_->add_tracked(trackable->get_shared_ptr()); -}; #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX |
|
From: Frank M. H. <fm...@us...> - 2007-02-27 21:19:26
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/thread_safe_signals/test In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22644/libs/thread_safe_signals/test Added Files: track_test.cpp Log Message: Added Signature template parameter to slot class, so that an operator() could be added. Bind can be used to bind together slots with different signatures now. Added some syntactic sugar to slot constructors, so a bind() call is inserted automatically for the constructors that take more than one argument. All tracking for automatic connection management is now done through slot::track(). Added track_test.cpp test program, which tests some of the new functionality. --- NEW FILE: track_test.cpp --- // Boost.Signals library // Copyright Frank Mori Hess 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 #include <boost/shared_ptr.hpp> #include <boost/test/minimal.hpp> #include <boost/thread_safe_signal.hpp> #include <boost/bind.hpp> struct swallow { typedef int result_type; template<typename T> result_type operator()(const T*, int i) { return i; } }; template<typename T> struct max_or_default { typedef T result_type; template<typename InputIterator> T operator()(InputIterator first, InputIterator last) const { if (first == last) return T(); T max = *first++; for (; first != last; ++first) max = (*first > max)? *first : max; return max; } }; static int myfunc(int i, double z) { std::cout << __FUNCTION__ << ": z is " << z << std::endl; return i; } int test_main(int, char*[]) { typedef boost::signal1<int, int, max_or_default<int> > sig_type; sig_type s1; // Test auto-disconnection BOOST_CHECK(s1(5) == 0); { boost::shared_ptr<int> shorty(new int()); s1.connect(sig_type::slot_type(swallow(), shorty.get(), _1).track(shorty)); BOOST_CHECK(s1(5) == 5); } BOOST_CHECK(s1(5) == 0); // Test auto-disconnection of slot before signal connection { boost::shared_ptr<int> shorty(new int()); //works sig_type::slot_type slot(boost::bind(swallow(), shorty.get(), _1)); // also works // sig_type::slot_type slot = sig_type::slot_type(swallow(), shorty.get(), _1); // doesn't work? gcc says: error: type specifier omitted for parameter `shorty' // sig_type::slot_type slot(swallow(), shorty.get(), _1); slot.track(shorty); shorty.reset(); s1.connect(slot); BOOST_CHECK(s1(5) == 0); } // Test binding of a slot to another slot { boost::shared_ptr<int> shorty(new int(2)); boost::slot<int (double)> other_slot(&myfunc, *shorty.get(), _1); other_slot.track(shorty); s1.connect(sig_type::slot_type(other_slot, 0.5).track(other_slot)); BOOST_CHECK(s1(3) == 2); shorty.reset(); BOOST_CHECK(s1(3) == 0); } return 0; } |
|
From: Frank M. H. <fm...@us...> - 2007-02-27 21:19:26
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22644/boost Modified Files: thread_safe_signal.hpp Log Message: Added Signature template parameter to slot class, so that an operator() could be added. Bind can be used to bind together slots with different signatures now. Added some syntactic sugar to slot constructors, so a bind() call is inserted automatically for the constructors that take more than one argument. All tracking for automatic connection management is now done through slot::track(). Added track_test.cpp test program, which tests some of the new functionality. Index: thread_safe_signal.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signal.hpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- thread_safe_signal.hpp 22 Feb 2007 16:57:12 -0000 1.14 +++ thread_safe_signal.hpp 27 Feb 2007 21:19:25 -0000 1.15 @@ -21,8 +21,14 @@ // For more information, see http://www.boost.org -#ifndef _EPG_SIGNALS_H -#define _EPG_SIGNALS_H +#ifndef _THREAD_SAFE_SIGNAL_HPP +#define _THREAD_SAFE_SIGNAL_HPP + +#ifndef BOOST_SIGNALS_MAX_ARGS +#define BOOST_SIGNALS_MAX_ARGS 10 +#endif + +#define BOOST_SIGNALS_NAMESPACE signalslib #include <algorithm> #include <boost/function.hpp> @@ -34,20 +40,16 @@ #include <boost/shared_ptr.hpp> #include <boost/type_traits.hpp> #include <boost/thread_safe_signals/detail/signals_common.hpp> +#include <boost/thread_safe_signals/detail/signals_common_macros.hpp> #include <boost/thread_safe_signals/detail/slot_groups.hpp> #include <boost/thread_safe_signals/detail/slot_call_iterator.hpp> -#include <boost/thread_safe_signals/single_threaded.hpp> #include <boost/thread_safe_signals/connection.hpp> +#include <boost/thread_safe_signals/single_threaded.hpp> +#include <boost/thread_safe_signals/slot.hpp> #include <boost/thread_safe_signals/track.hpp> #include <functional> -#define BOOST_SIGNALS_NAMESPACE signalslib - -#ifndef EPG_SIGNALS_MAX_ARGS -#define EPG_SIGNALS_MAX_ARGS 10 -#endif - -#define BOOST_PP_ITERATION_LIMITS (0, EPG_SIGNALS_MAX_ARGS) +#define BOOST_PP_ITERATION_LIMITS (0, BOOST_SIGNALS_MAX_ARGS) #define BOOST_PP_FILENAME_1 <boost/thread_safe_signals/detail/signal_template.hpp> #include BOOST_PP_ITERATE() @@ -57,13 +59,13 @@ // for backward compatibility namespace signals = signalslib; #endif - template<typename Signature, + template<typename Signature, typename Combiner = boost::last_value<typename boost::function_traits<Signature>::result_type >, typename Group = int, typename GroupCompare = std::less<Group>, typename SlotFunction = boost::function<Signature>, typename ThreadingModel = signalslib::single_threaded > - class signal: public signalslib::detail::signalN<boost::function_traits<Signature>::arity, + class signal: public signalslib::detail::signalN<function_traits<Signature>::arity, Signature, Combiner, Group, GroupCompare, SlotFunction, ThreadingModel>::type { private: @@ -76,4 +78,4 @@ }; } -#endif // _EPG_SIGNALS_H +#endif // _THREAD_SAFE_SIGNAL_HPP |
|
From: Frank M. H. <fm...@us...> - 2007-02-27 15:27:02
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/thread_safe_signals/test In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9672/test Log Message: Directory /cvsroot/boost-sandbox/boost-sandbox/libs/thread_safe_signals/test added to the repository |
|
From: Frank M. H. <fm...@us...> - 2007-02-27 15:26:46
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/thread_safe_signals In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9646/thread_safe_signals Log Message: Directory /cvsroot/boost-sandbox/boost-sandbox/libs/thread_safe_signals added to the repository |
|
From: Jan G. <jan...@us...> - 2007-02-26 22:37:14
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/test In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4706/libs/circular_buffer/test Modified Files: base_test.cpp common.ipp Log Message: Fixed and improved debug support. Index: base_test.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/test/base_test.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- base_test.cpp 18 Dec 2006 01:30:29 -0000 1.17 +++ base_test.cpp 26 Feb 2007 22:37:09 -0000 1.18 @@ -192,59 +192,64 @@ // TODO add insert, linearize etc. void iterator_invalidation_test() { -#if BOOST_CB_ENABLE_DEBUG +#if !defined(NDEBUG) && !defined(BOOST_CB_DISABLE_DEBUG) circular_buffer<MyInteger>::iterator it1; circular_buffer<MyInteger>::const_iterator it2; circular_buffer<MyInteger>::iterator it3; circular_buffer<MyInteger>::const_iterator it4; circular_buffer<MyInteger>::const_iterator it5; + circular_buffer<MyInteger>::const_iterator it6; - BOOST_CHECK(!it1.is_valid()); - BOOST_CHECK(!it2.is_valid()); - BOOST_CHECK(!it3.is_valid()); - BOOST_CHECK(!it4.is_valid()); - BOOST_CHECK(!it5.is_valid()); + BOOST_CHECK(it1.is_valid(0)); + BOOST_CHECK(it2.is_valid(0)); + BOOST_CHECK(it3.is_valid(0)); + BOOST_CHECK(it4.is_valid(0)); + BOOST_CHECK(it5.is_valid(0)); + BOOST_CHECK(it6.is_valid(0)); { circular_buffer<MyInteger> cb(5, 0); const circular_buffer<MyInteger> ccb(5, 0); it1 = cb.begin(); - it2 = ccb.end(); - it3 = it1; + it2 = ccb.begin(); + it3 = cb.end(); it4 = it1; it5 = it2; + it6 = it1; - BOOST_CHECK(it1.is_valid()); - BOOST_CHECK(it2.is_valid()); - BOOST_CHECK(it3.is_valid()); - BOOST_CHECK(it4.is_valid()); - BOOST_CHECK(it5.is_valid()); + BOOST_CHECK(it1.is_valid(&cb)); + BOOST_CHECK(it2.is_valid(&ccb)); + BOOST_CHECK(it3.is_valid(&cb)); + BOOST_CHECK(it4.is_valid(&cb)); + BOOST_CHECK(it5.is_valid(&ccb)); + BOOST_CHECK(it6.is_valid(&cb)); } - BOOST_CHECK(!it1.is_valid()); - BOOST_CHECK(!it2.is_valid()); - BOOST_CHECK(!it3.is_valid()); - BOOST_CHECK(!it4.is_valid()); - BOOST_CHECK(!it5.is_valid()); + BOOST_CHECK(it1.is_valid(0)); + BOOST_CHECK(it2.is_valid(0)); + BOOST_CHECK(it3.is_valid(0)); + BOOST_CHECK(it4.is_valid(0)); + BOOST_CHECK(it5.is_valid(0)); + BOOST_CHECK(it6.is_valid(0)); circular_buffer<MyInteger> cb1(10, 0); circular_buffer<MyInteger> cb2(20, 0); it1 = cb1.end(); it2 = cb2.begin(); - BOOST_CHECK(it1.is_valid()); - BOOST_CHECK(it2.is_valid()); + BOOST_CHECK(it1.is_valid(&cb1)); + BOOST_CHECK(it2.is_valid(&cb2)); cb1.swap(cb2); - BOOST_CHECK(!it1.is_valid()); - BOOST_CHECK(!it2.is_valid()); + BOOST_CHECK(!it1.is_valid(&cb1)); + BOOST_CHECK(!it2.is_valid(&cb2)); it1 = cb1.begin() + 3; it2 = cb1.begin(); cb1.push_back(1); - BOOST_CHECK(it1.is_valid()); - BOOST_CHECK(!it2.is_valid()); + BOOST_CHECK(it1.is_valid(&cb1)); + BOOST_CHECK(!it2.is_valid(&cb1)); BOOST_CHECK(*it2.m_it == 1); circular_buffer<MyInteger> cb3(5); @@ -256,15 +261,15 @@ it1 = cb3.begin() + 2; it2 = cb3.begin(); cb3.insert(cb3.begin() + 3, 6); - BOOST_CHECK(it1.is_valid()); - BOOST_CHECK(!it2.is_valid()); + BOOST_CHECK(it1.is_valid(&cb3)); + BOOST_CHECK(!it2.is_valid(&cb3)); BOOST_CHECK(*it2.m_it == 5); it1 = cb3.begin() + 3; it2 = cb3.end() - 1; cb3.push_front(7); - BOOST_CHECK(it1.is_valid()); - BOOST_CHECK(!it2.is_valid()); + BOOST_CHECK(it1.is_valid(&cb3)); + BOOST_CHECK(!it2.is_valid(&cb3)); BOOST_CHECK(*it2.m_it == 7); circular_buffer<MyInteger> cb4(5); @@ -276,53 +281,53 @@ it1 = cb4.begin() + 3; it2 = cb4.begin(); cb4.rinsert(cb4.begin() + 2, 6); - BOOST_CHECK(it1.is_valid()); - BOOST_CHECK(!it2.is_valid()); + BOOST_CHECK(it1.is_valid(&cb4)); + BOOST_CHECK(!it2.is_valid(&cb4)); BOOST_CHECK(*it2.m_it == 2); it1 = cb1.begin() + 5; it2 = cb1.end() - 1; cb1.pop_back(); - BOOST_CHECK(it1.is_valid()); - BOOST_CHECK(!it2.is_valid()); + BOOST_CHECK(it1.is_valid(&cb1)); + BOOST_CHECK(!it2.is_valid(&cb1)); it1 = cb1.begin() + 5; it2 = cb1.begin(); cb1.pop_front(); - BOOST_CHECK(it1.is_valid()); - BOOST_CHECK(!it2.is_valid()); + BOOST_CHECK(it1.is_valid(&cb1)); + BOOST_CHECK(!it2.is_valid(&cb1)); circular_buffer<MyInteger> cb5(20, 0); it1 = cb5.begin() + 5; it2 = it3 = cb5.begin() + 15; cb5.erase(cb5.begin() + 10); - BOOST_CHECK(it1.is_valid()); - BOOST_CHECK(!it2.is_valid()); - BOOST_CHECK(!it3.is_valid()); + BOOST_CHECK(it1.is_valid(&cb5)); + BOOST_CHECK(!it2.is_valid(&cb5)); + BOOST_CHECK(!it3.is_valid(&cb5)); it1 = cb5.begin() + 1; it2 = it3 = cb5.begin() + 8; cb5.erase(cb5.begin() + 3, cb5.begin() + 7); - BOOST_CHECK(it1.is_valid()); - BOOST_CHECK(!it2.is_valid()); - BOOST_CHECK(!it3.is_valid()); + BOOST_CHECK(it1.is_valid(&cb5)); + BOOST_CHECK(!it2.is_valid(&cb5)); + BOOST_CHECK(!it3.is_valid(&cb5)); circular_buffer<MyInteger> cb6(20, 0); it4 = it1 = cb6.begin() + 5; it2 = cb6.begin() + 15; cb6.rerase(cb6.begin() + 10); - BOOST_CHECK(!it1.is_valid()); - BOOST_CHECK(!it4.is_valid()); - BOOST_CHECK(it2.is_valid()); + BOOST_CHECK(!it1.is_valid(&cb6)); + BOOST_CHECK(!it4.is_valid(&cb6)); + BOOST_CHECK(it2.is_valid(&cb6)); it4 = it1 = cb6.begin() + 1; it2 = cb6.begin() + 8; cb6.rerase(cb6.begin() + 3, cb6.begin() + 7); - BOOST_CHECK(!it1.is_valid()); - BOOST_CHECK(!it4.is_valid()); - BOOST_CHECK(it2.is_valid()); + BOOST_CHECK(!it1.is_valid(&cb6)); + BOOST_CHECK(!it4.is_valid(&cb6)); + BOOST_CHECK(it2.is_valid(&cb6)); -#endif // #if BOOST_CB_ENABLE_DEBUG +#endif // #if !defined(NDEBUG) && !defined(BOOST_CB_DISABLE_DEBUG) } // basic exception safety test (it is useful to use any memory-leak detection tool) Index: common.ipp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/test/common.ipp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- common.ipp 18 Feb 2007 23:03:27 -0000 1.13 +++ common.ipp 26 Feb 2007 22:37:09 -0000 1.14 @@ -230,12 +230,12 @@ cb.push_back(2); cb.insert(cb.begin(), 3); cb.push_back(4); - const CB_CONTAINER<MyInteger> ccb(3, 2); + const CB_CONTAINER<MyInteger> ccb = cb; BOOST_CHECK(cb[0] == 1); BOOST_CHECK(cb[1] == 2); BOOST_CHECK(cb[2] == 4); - BOOST_CHECK(ccb[2] == 2); + BOOST_CHECK(ccb[2] == 4); generic_test(cb); } |
|
From: Jan G. <jan...@us...> - 2007-02-26 22:37:11
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4706/boost/circular_buffer Modified Files: base.hpp debug.hpp details.hpp Log Message: Fixed and improved debug support. Index: base.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer/base.hpp,v retrieving revision 1.80 retrieving revision 1.81 diff -u -d -r1.80 -r1.81 --- base.hpp 19 Feb 2007 23:18:10 -0000 1.80 +++ base.hpp 26 Feb 2007 22:37:08 -0000 1.81 @@ -60,7 +60,7 @@ http://www.boost.org/libs/circular_buffer/doc/circular_buffer.html */ template <class T, class Alloc> -class circular_buffer : cb_details::iterator_registry { +class circular_buffer : public cb_details::iterator_registry { // Requirements BOOST_CLASS_REQUIRE(T, boost, SGIAssignableConcept); @@ -378,7 +378,7 @@ //! Get the element at the <code>index</code> position. /*! \param index The position of the element. - \return A const reference to the element at the <code>index</code> position. + \return A reference to the element at the <code>index</code> position. \throws <code>std::out_of_range</code> when the <code>index</code> is invalid (when <code>index >= size()</code>). \par Complexity @@ -653,6 +653,9 @@ destroy_item(src); m_first = m_buff; m_last = add(m_buff, size()); +#if BOOST_CB_ENABLE_DEBUG + invalidate_all_iterators(); +#endif return m_buff; } @@ -760,7 +763,8 @@ \par Exception Safety Strong. \par Iterator Invalidation - Invalidates all iterators pointing to the <code>circular_buffer</code>. + Invalidates all iterators pointing to the <code>circular_buffer</code> if the new capacity is different + from the original. \sa <code>rset_capacity()</code>, <code>resize()</code> */ void set_capacity(capacity_type new_capacity) { @@ -768,7 +772,9 @@ return; pointer buff = allocate(new_capacity); BOOST_TRY { - reset(buff, cb_details::uninitialized_copy(begin(), begin() + std::min(new_capacity, size()), buff, m_alloc), new_capacity); + reset(buff, + cb_details::uninitialized_copy(begin(), begin() + std::min(new_capacity, size()), buff, m_alloc), + new_capacity); } BOOST_CATCH(...) { deallocate(buff, new_capacity); BOOST_RETHROW @@ -796,7 +802,8 @@ \par Exception Safety Basic. \par Iterator Invalidation - Invalidates all iterators pointing to the <code>circular_buffer</code>. + Invalidates all iterators pointing to the <code>circular_buffer</code> if the new size is different from + the original. \sa <code>rresize()</code>, <code>set_capacity()</code> */ void resize(size_type new_size, param_value_type item = value_type()) { @@ -823,7 +830,8 @@ \par Exception Safety Strong. \par Iterator Invalidation - Invalidates all iterators pointing to the <code>circular_buffer</code>. + Invalidates all iterators pointing to the <code>circular_buffer</code> if the new capacity is different + from the original. \sa <code>set_capacity()</code>, <code>rresize()</code> */ void rset_capacity(capacity_type new_capacity) { @@ -831,7 +839,8 @@ return; pointer buff = allocate(new_capacity); BOOST_TRY { - reset(buff, cb_details::uninitialized_copy(end() - std::min(new_capacity, size()), end(), buff, m_alloc), new_capacity); + reset(buff, cb_details::uninitialized_copy(end() - std::min(new_capacity, size()), end(), buff, m_alloc), + new_capacity); } BOOST_CATCH(...) { deallocate(buff, new_capacity); BOOST_RETHROW @@ -851,14 +860,16 @@ \param new_size The new size. \param item The element the <code>circular_buffer</code> will be filled with in order to gain the requested size. (See the postcondition.) - \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is used). + \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is + used). \throws Whatever <code>T::T(const T&)</code> throws. \par Complexity Linear (in the new size of the <code>circular_buffer</code>). \par Exception Safety Basic. \par Iterator Invalidation - Invalidates all iterators pointing to the <code>circular_buffer</code>. + Invalidates all iterators pointing to the <code>circular_buffer</code> if the new size is different from + the original. \sa <code>rresize()</code>, <code>set_capacity()</code> */ void rresize(size_type new_size, param_value_type item = value_type()) { @@ -884,8 +895,7 @@ \note This constructor has been defined only due to compatibility with the STL container definition. Avoid using it because it allocates very large amount of memory. */ - explicit circular_buffer( - const allocator_type& alloc = allocator_type()) + explicit circular_buffer(const allocator_type& alloc = allocator_type()) : m_size(0), m_alloc(alloc) { initialize(max_size()); } @@ -900,9 +910,7 @@ \par Complexity Constant. */ - explicit circular_buffer( - capacity_type capacity, - const allocator_type& alloc = allocator_type()) + explicit circular_buffer(capacity_type capacity, const allocator_type& alloc = allocator_type()) : m_size(0), m_alloc(alloc) { initialize(capacity); } @@ -920,10 +928,7 @@ \par Complexity Linear (in the <code>n</code>). */ - circular_buffer( - size_type n, - param_value_type item, - const allocator_type& alloc = allocator_type()) + circular_buffer(size_type n, param_value_type item, const allocator_type& alloc = allocator_type()) : m_size(n), m_alloc(alloc) { initialize(n, item); } @@ -943,10 +948,7 @@ \par Complexity Linear (in the <code>n</code>). */ - circular_buffer( - capacity_type capacity, - size_type n, - param_value_type item, + circular_buffer(capacity_type capacity, size_type n, param_value_type item, const allocator_type& alloc = allocator_type()) : m_size(n), m_alloc(alloc) { BOOST_CB_ASSERT(capacity >= size()); // check for capacity lower than size @@ -980,18 +982,13 @@ /*! \cond */ template <class InputIterator> - circular_buffer( - InputIterator first, - InputIterator last) + circular_buffer(InputIterator first, InputIterator last) : m_alloc(allocator_type()) { initialize(first, last, is_integral<InputIterator>()); } template <class InputIterator> - circular_buffer( - capacity_type capacity, - InputIterator first, - InputIterator last) + circular_buffer(capacity_type capacity, InputIterator first, InputIterator last) : m_alloc(allocator_type()) { initialize(capacity, first, last, is_integral<InputIterator>()); } @@ -1017,10 +1014,7 @@ Linear (in the <code>std::distance(first, last)</code>). */ template <class InputIterator> - circular_buffer( - InputIterator first, - InputIterator last, - const allocator_type& alloc = allocator_type()) + circular_buffer(InputIterator first, InputIterator last, const allocator_type& alloc = allocator_type()) : m_alloc(alloc) { initialize(first, last, is_integral<InputIterator>()); } @@ -1047,10 +1041,7 @@ Linear (in the <code>capacity</code>/<code>std::distance(first, last)</code>). */ template <class InputIterator> - circular_buffer( - capacity_type capacity, - InputIterator first, - InputIterator last, + circular_buffer(capacity_type capacity, InputIterator first, InputIterator last, const allocator_type& alloc = allocator_type()) : m_alloc(alloc) { initialize(capacity, first, last, is_integral<InputIterator>()); @@ -1140,8 +1131,8 @@ The capacity of the <code>circular_buffer</code> will be set to the specified value and the content of the <code>circular_buffer</code> will be removed and replaced with <code>n</code> copies of the <code>item</code>. \pre <code>capacity >= n</code> - \post <code>capacity() == capacity \&\& size() == n \&\& (*this)[0] == item \&\& (*this)[1] == item \&\& ... \&\& - (*this) [n - 1] == item </code> + \post <code>capacity() == capacity \&\& size() == n \&\& (*this)[0] == item \&\& (*this)[1] == item + \&\& ... \&\& (*this) [n - 1] == item </code> \param capacity The new capacity of the <code>circular_buffer</code>. \param n The number of elements the <code>circular_buffer</code> will be filled with. \param item The element the <code>circular_buffer</code> will be filled with. @@ -1396,7 +1387,7 @@ <code>rinsert(iterator, InputIterator, InputIterator)</code> */ iterator insert(iterator pos, param_value_type item = value_type()) { - BOOST_CB_ASSERT(pos.is_valid()); // check for uninitialized or invalidated iterator + BOOST_CB_ASSERT(pos.is_valid(this)); // check for uninitialized or invalidated iterator if (full() && pos == begin()) return begin(); return insert_item(pos, item); @@ -1436,7 +1427,7 @@ <code>rinsert(iterator, InputIterator, InputIterator)</code> */ void insert(iterator pos, size_type n, param_value_type item) { - BOOST_CB_ASSERT(pos.is_valid()); // check for uninitialized or invalidated iterator + BOOST_CB_ASSERT(pos.is_valid(this)); // check for uninitialized or invalidated iterator if (n == 0) return; size_type copy = capacity() - (end() - pos); @@ -1486,7 +1477,7 @@ */ template <class InputIterator> void insert(iterator pos, InputIterator first, InputIterator last) { - BOOST_CB_ASSERT(pos.is_valid()); // check for uninitialized or invalidated iterator + BOOST_CB_ASSERT(pos.is_valid(this)); // check for uninitialized or invalidated iterator insert(pos, first, last, is_integral<InputIterator>()); } @@ -1515,7 +1506,7 @@ <code>insert(iterator, InputIterator, InputIterator)</code> */ iterator rinsert(iterator pos, param_value_type item = value_type()) { - BOOST_CB_ASSERT(pos.is_valid()); // check for uninitialized or invalidated iterator + BOOST_CB_ASSERT(pos.is_valid(this)); // check for uninitialized or invalidated iterator if (full() && pos.m_it == 0) return end(); if (pos == begin()) { @@ -1592,7 +1583,7 @@ <code>insert(iterator, InputIterator, InputIterator)</code> */ void rinsert(iterator pos, size_type n, param_value_type item) { - BOOST_CB_ASSERT(pos.is_valid()); // check for uninitialized or invalidated iterator + BOOST_CB_ASSERT(pos.is_valid(this)); // check for uninitialized or invalidated iterator rinsert_n(pos, n, cb_details::item_wrapper<const_pointer, param_value_type>(item)); } @@ -1634,7 +1625,7 @@ */ template <class InputIterator> void rinsert(iterator pos, InputIterator first, InputIterator last) { - BOOST_CB_ASSERT(pos.is_valid()); // check for uninitialized or invalidated iterator + BOOST_CB_ASSERT(pos.is_valid(this)); // check for uninitialized or invalidated iterator rinsert(pos, first, last, is_integral<InputIterator>()); } @@ -1659,8 +1650,8 @@ <code>rerase(iterator, iterator)</code>, <code>clear()</code> */ iterator erase(iterator pos) { - BOOST_CB_ASSERT(pos.is_valid()); // check for uninitialized or invalidated iterator - BOOST_CB_ASSERT(pos.m_it != 0); // check for iterator pointing to end() + BOOST_CB_ASSERT(pos.is_valid(this)); // check for uninitialized or invalidated iterator + BOOST_CB_ASSERT(pos.m_it != 0); // check for iterator pointing to end() pointer next = pos.m_it; increment(next); for (pointer p = pos.m_it; next != m_last; p = next, increment(next)) @@ -1678,7 +1669,8 @@ //! Erase the range <code>[first, last)</code>. /*! \pre Valid range <code>[first, last)</code>. - \post The elements from the range <code>[first, last)</code> are removed. + \post The elements from the range <code>[first, last)</code> are removed. (If <code>first == last</code> + nothing is removed.) \return Iterator to the first element remaining beyond the removed elements or <code>end()</code> if no such element exists. \throws Whatever <code>T::operator = (const T&)</code> throws. @@ -1693,10 +1685,9 @@ <code>clear()</code> */ iterator erase(iterator first, iterator last) { - BOOST_CB_ASSERT(first.is_valid()); // check for uninitialized or invalidated iterator - BOOST_CB_ASSERT(last.is_valid()); // check for uninitialized or invalidated iterator - BOOST_CB_ASSERT(first.m_buff == last.m_buff); // check for iterators of different containers - BOOST_CB_ASSERT(first <= last); // check for wrong range + BOOST_CB_ASSERT(first.is_valid(this)); // check for uninitialized or invalidated iterator + BOOST_CB_ASSERT(last.is_valid(this)); // check for uninitialized or invalidated iterator + BOOST_CB_ASSERT(first <= last); // check for wrong range if (first == last) return first; pointer p = first.m_it; @@ -1728,8 +1719,8 @@ <code>rerase(iterator, iterator)</code>, <code>clear()</code> */ iterator rerase(iterator pos) { - BOOST_CB_ASSERT(pos.is_valid()); // check for uninitialized or invalidated iterator - BOOST_CB_ASSERT(pos.m_it != 0); // check for iterator pointing to end() + BOOST_CB_ASSERT(pos.is_valid(this)); // check for uninitialized or invalidated iterator + BOOST_CB_ASSERT(pos.m_it != 0); // check for iterator pointing to end() pointer prev = pos.m_it; pointer p = prev; for (decrement(prev); p != m_first; p = prev, decrement(prev)) @@ -1762,10 +1753,9 @@ <code>clear()</code> */ iterator rerase(iterator first, iterator last) { - BOOST_CB_ASSERT(first.is_valid()); // check for uninitialized or invalidated iterator - BOOST_CB_ASSERT(last.is_valid()); // check for uninitialized or invalidated iterator - BOOST_CB_ASSERT(first.m_buff == last.m_buff); // check for iterators of different containers - BOOST_CB_ASSERT(first <= last); // check for wrong range + BOOST_CB_ASSERT(first.is_valid(this)); // check for uninitialized or invalidated iterator + BOOST_CB_ASSERT(last.is_valid(this)); // check for uninitialized or invalidated iterator + BOOST_CB_ASSERT(first <= last); // check for wrong range if (first == last) return first; pointer p = map_pointer(last.m_it); @@ -1906,6 +1896,9 @@ void destroy_content() { for (size_type ii = 0; ii < size(); ++ii, increment(m_first)) destroy_item(m_first); +#if BOOST_CB_ENABLE_DEBUG + invalidate_iterators(end()); +#endif } //! Destroy content and free allocated memory. @@ -1955,7 +1948,8 @@ //! Specialized initialize method. template <class InputIterator> void initialize(InputIterator first, InputIterator last, const std::input_iterator_tag&) { - BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS // check if the STL provides templated iterator constructors for containers + BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS // check if the STL provides templated iterator constructors + // for containers std::deque<value_type, allocator_type> tmp(first, last, m_alloc); size_type distance = tmp.size(); initialize(distance, tmp.begin(), tmp.end(), distance); @@ -2075,10 +2069,13 @@ //! Specialized assign method. template <class InputIterator> void assign(InputIterator first, InputIterator last, const std::input_iterator_tag&) { - BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS // check if the STL provides templated iterator constructors for containers + BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS // check if the STL provides templated iterator constructors + // for containers std::deque<value_type, allocator_type> tmp(first, last, m_alloc); size_type distance = tmp.size(); - assign_n(distance, distance, cb_details::assign_range<BOOST_DEDUCED_TYPENAME std::deque<value_type, allocator_type>::iterator, allocator_type>(tmp.begin(), tmp.end(), m_alloc)); + assign_n(distance, distance, + cb_details::assign_range<BOOST_DEDUCED_TYPENAME std::deque<value_type, allocator_type>::iterator, + allocator_type>(tmp.begin(), tmp.end(), m_alloc)); } //! Specialized assign method. @@ -2121,14 +2118,16 @@ //! Specialized assign method. template <class ForwardIterator> - void assign(capacity_type new_capacity, ForwardIterator first, ForwardIterator last, const std::forward_iterator_tag&) { + void assign(capacity_type new_capacity, ForwardIterator first, ForwardIterator last, + const std::forward_iterator_tag&) { BOOST_CB_ASSERT(std::distance(first, last) >= 0); // check for wrong range size_type distance = std::distance(first, last); if (distance > new_capacity) { std::advance(first, distance - capacity); distance = new_capacity; } - assign_n(new_capacity, distance, cb_details::assign_range<ForwardIterator, allocator_type>(first, last, m_alloc)); + assign_n(new_capacity, distance, + cb_details::assign_range<ForwardIterator, allocator_type>(first, last, m_alloc)); } //! Helper assign method. Index: debug.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer/debug.hpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- debug.hpp 13 Feb 2006 01:01:17 -0000 1.9 +++ debug.hpp 26 Feb 2007 22:37:09 -0000 1.10 @@ -62,7 +62,7 @@ iterator_base& operator = (const iterator_base& rhs); //! Is the iterator valid? - bool is_valid() const; + bool is_valid(const iterator_registry* registry) const; //! Invalidate the iterator. /*! @@ -184,7 +184,7 @@ return *this; } -inline bool iterator_base::is_valid() const { return m_registry != 0; } +inline bool iterator_base::is_valid(const iterator_registry* registry) const { return m_registry == registry; } inline void iterator_base::invalidate() const { m_registry = 0; } Index: details.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer/details.hpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- details.hpp 19 Feb 2007 23:18:10 -0000 1.22 +++ details.hpp 26 Feb 2007 22:37:09 -0000 1.23 @@ -264,8 +264,8 @@ //! Dereferencing operator. reference operator * () const { - BOOST_CB_ASSERT(is_valid()); // check for uninitialized or invalidated iterator - BOOST_CB_ASSERT(m_it != 0); // check for iterator pointing to end() + BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator + BOOST_CB_ASSERT(m_it != 0); // check for iterator pointing to end() return *m_it; } @@ -274,9 +274,8 @@ //! Difference operator. difference_type operator - (const iterator& it) const { - BOOST_CB_ASSERT(is_valid()); // check for uninitialized or invalidated iterator - BOOST_CB_ASSERT(it.is_valid()); // check for uninitialized or invalidated iterator - BOOST_CB_ASSERT(m_buff == it.m_buff); // check for iterators of different containers + BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator + BOOST_CB_ASSERT(it.is_valid(m_buff)); // check for uninitialized or invalidated iterator helper_pointer<Traits> lhs = create_helper_pointer(*this); helper_pointer<Traits> rhs = create_helper_pointer(it); if (less(rhs, lhs) && lhs.m_it <= rhs.m_it) @@ -288,8 +287,8 @@ //! Increment operator (prefix). iterator& operator ++ () { - BOOST_CB_ASSERT(is_valid()); // check for uninitialized or invalidated iterator - BOOST_CB_ASSERT(m_it != 0); // check for iterator pointing to end() + BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator + BOOST_CB_ASSERT(m_it != 0); // check for iterator pointing to end() m_buff->increment(m_it); if (m_it == m_buff->m_last) m_it = 0; @@ -305,7 +304,7 @@ //! Decrement operator (prefix). iterator& operator -- () { - BOOST_CB_ASSERT(is_valid()); // check for uninitialized or invalidated iterator + BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator BOOST_CB_ASSERT(m_it != m_buff->m_first); // check for iterator pointing to begin() if (m_it == 0) m_it = m_buff->m_last; @@ -322,7 +321,7 @@ //! Iterator addition. iterator& operator += (difference_type n) { - BOOST_CB_ASSERT(is_valid()); // check for uninitialized or invalidated iterator + BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator if (n > 0) { BOOST_CB_ASSERT(m_buff->end() - *this >= n); // check for too large n m_it = m_buff->add(m_it, n); @@ -339,7 +338,7 @@ //! Iterator subtraction. iterator& operator -= (difference_type n) { - BOOST_CB_ASSERT(is_valid()); // check for uninitialized or invalidated iterator + BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator if (n > 0) { BOOST_CB_ASSERT(m_buff->begin() - *this <= -n); // check for too large n m_it = m_buff->sub(m_it == 0 ? m_buff->m_last : m_it, n); @@ -360,27 +359,24 @@ //! Equality. template <class Traits0> bool operator == (const iterator<Buff, Traits0>& it) const { - BOOST_CB_ASSERT(is_valid()); // check for uninitialized or invalidated iterator - BOOST_CB_ASSERT(it.is_valid()); // check for uninitialized or invalidated iterator - BOOST_CB_ASSERT(m_buff == it.m_buff); // check for iterators of different containers + BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator + BOOST_CB_ASSERT(it.is_valid(m_buff)); // check for uninitialized or invalidated iterator return m_it == it.m_it; } //! Inequality. template <class Traits0> bool operator != (const iterator<Buff, Traits0>& it) const { - BOOST_CB_ASSERT(is_valid()); // check for uninitialized or invalidated iterator - BOOST_CB_ASSERT(it.is_valid()); // check for uninitialized or invalidated iterator - BOOST_CB_ASSERT(m_buff == it.m_buff); // check for iterators of different containers + BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator + BOOST_CB_ASSERT(it.is_valid(m_buff)); // check for uninitialized or invalidated iterator return m_it != it.m_it; } //! Less. template <class Traits0> bool operator < (const iterator<Buff, Traits0>& it) const { - BOOST_CB_ASSERT(is_valid()); // check for uninitialized or invalidated iterator - BOOST_CB_ASSERT(it.is_valid()); // check for uninitialized or invalidated iterator - BOOST_CB_ASSERT(m_buff == it.m_buff); // check for iterators of different containers + BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator + BOOST_CB_ASSERT(it.is_valid(m_buff)); // check for uninitialized or invalidated iterator return less(create_helper_pointer(*this), create_helper_pointer(it)); } |
|
From: Jan G. <jan...@us...> - 2007-02-26 22:37:11
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4706/libs/circular_buffer/doc Modified Files: circular_buffer.html Log Message: Fixed and improved debug support. Index: circular_buffer.html =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc/circular_buffer.html,v retrieving revision 1.61 retrieving revision 1.62 diff -u -d -r1.61 -r1.62 --- circular_buffer.html 18 Feb 2007 23:03:26 -0000 1.61 +++ circular_buffer.html 26 Feb 2007 22:37:09 -0000 1.62 @@ -2367,7 +2367,7 @@ <b>Returns:</b> </dt> <dd> - A const reference to the element at the <code>index</code> position. + A reference to the element at the <code>index</code> position. </dd> </dl> <dl> @@ -3607,7 +3607,8 @@ <b>Iterator Invalidation:</b> </dt> <dd> - Invalidates all iterators pointing to the <code>circular_buffer</code>. + Invalidates all iterators pointing to the <code>circular_buffer</code> if the new capacity is different + from the original. </dd> </dl> <dl> @@ -3710,7 +3711,8 @@ <b>Iterator Invalidation:</b> </dt> <dd> - Invalidates all iterators pointing to the <code>circular_buffer</code>. + Invalidates all iterators pointing to the <code>circular_buffer</code> if the new size is different + from the original. </dd> </dl> <dl> @@ -3795,7 +3797,8 @@ <b>Iterator Invalidation:</b> </dt> <dd> - Invalidates all iterators pointing to the <code>circular_buffer</code>. + Invalidates all iterators pointing to the <code>circular_buffer</code> if the new capacity is different + from the original. </dd> </dl> <dl> @@ -3898,7 +3901,8 @@ <b>Iterator Invalidation:</b> </dt> <dd> - Invalidates all iterators pointing to the <code>circular_buffer</code>. + Invalidates all iterators pointing to the <code>circular_buffer</code> if the new size is different + from the original. </dd> </dl> <dl> @@ -5697,7 +5701,8 @@ <b>Effect:</b> </dt> <dd> - The elements from the range <code>[first, last)</code> are removed. + The elements from the range <code>[first, last)</code> are removed. (If <code>first == last</code> + nothing is removed.) </dd> </dl> <dl> |
|
From: Daniel J. <dan...@us...> - 2007-02-25 21:09:41
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/unordered/detail In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2593/detail Modified Files: hash_table_impl.hpp Log Message: Fixed for intel strict mode. Index: hash_table_impl.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/unordered/detail/hash_table_impl.hpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- hash_table_impl.hpp 10 Jan 2007 00:04:00 -0000 1.10 +++ hash_table_impl.hpp 25 Feb 2007 21:09:38 -0000 1.11 @@ -1644,9 +1644,9 @@ local_iterator_base position = find_iterator(bucket, k); if(position.not_finished()) - link_node(a.release(), position); + this->link_node(a.release(), position); else - link_node(a.release(), bucket); + this->link_node(a.release(), bucket); } } } @@ -1856,7 +1856,7 @@ size_type count(key_type const& k) const { local_iterator_base it = find_iterator(k); // throws, strong - return it.not_finished() ? group_count(it) : 0; + return it.not_finished() ? this->group_count(it) : 0; } // find @@ -1882,7 +1882,7 @@ local_iterator_base it = find_iterator(bucket, k); if (it.not_finished()) { iterator_base first(iterator_base(bucket, it)); - iterator_base second(iterator_base(bucket, last_in_group(it.node_))); + iterator_base second(iterator_base(bucket, this->last_in_group(it.node_))); second.increment(); return std::pair<iterator_base, iterator_base>(first, second); } |
|
From: Frank M. H. <fm...@us...> - 2007-02-23 14:38:18
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9324 Modified Files: deconstruct_ptr.hpp Log Message: Use checked_delete(). Index: deconstruct_ptr.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/deconstruct_ptr.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- deconstruct_ptr.hpp 20 Feb 2007 00:40:44 -0000 1.3 +++ deconstruct_ptr.hpp 23 Feb 2007 14:38:13 -0000 1.4 @@ -11,6 +11,7 @@ #ifndef BOOST_DECONSTRUCT_PTR_HEADER #define BOOST_DECONSTRUCT_PTR_HEADER +#include <boost/checked_delete.hpp> #include <boost/postconstructible.hpp> #include <boost/predestructible.hpp> #include <boost/shared_ptr.hpp> @@ -34,7 +35,7 @@ void operator()(T *ptr) { m_predestruct(ptr); - delete ptr; + checked_delete(ptr); } private: void m_predestruct(...) |
|
From: Frank M. H. <fm...@us...> - 2007-02-22 20:47:26
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29265/thread_safe_signals Modified Files: track.hpp Log Message: Handle reference-wrapped values gracefully for the sake of the 2 parameter version of track(). Index: track.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/track.hpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- track.hpp 22 Feb 2007 20:23:48 -0000 1.11 +++ track.hpp 22 Feb 2007 20:47:20 -0000 1.12 @@ -12,6 +12,7 @@ #ifndef BOOST_SIGNALS_TRACK_HEADER #define BOOST_SIGNALS_TRACK_HEADER +#include <boost/ref.hpp> #include <boost/smart_ptr.hpp> #ifdef BOOST_HAS_ABI_HEADERS @@ -25,17 +26,17 @@ class tracked { public: - typedef T value_type; + typedef typename unwrap_reference<T>::type value_type; tracked(const shared_ptr<void>& tracked_ptr, const T &value): _value(value), _tracked_ptr(tracked_ptr) {} // implicit conversions so tracked objects can be bound with bind - operator T& () + operator value_type & () { return _value; } - operator const T& () const + operator const value_type & () const { return _value; } |
|
From: Frank M. H. <fm...@us...> - 2007-02-22 20:23:50
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20127/thread_safe_signals Modified Files: track.hpp Log Message: Changed order of parameters in signals::track(). Index: track.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/track.hpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- track.hpp 22 Feb 2007 19:51:20 -0000 1.10 +++ track.hpp 22 Feb 2007 20:23:48 -0000 1.11 @@ -27,7 +27,7 @@ public: typedef T value_type; - tracked(const T &value, const shared_ptr<void>& tracked_ptr): + tracked(const shared_ptr<void>& tracked_ptr, const T &value): _value(value), _tracked_ptr(tracked_ptr) {} // implicit conversions so tracked objects can be bound with bind @@ -54,7 +54,7 @@ { public: tracked_shared_ptr(const weak_ptr<T>& ptr): - tracked<weak_ptr<T> >(ptr, ptr.lock()) + tracked<weak_ptr<T> >(ptr.lock(), ptr) {} operator shared_ptr<T> () const { @@ -72,8 +72,8 @@ return tracked_shared_ptr<T>(ptr); } template<typename T> - tracked<T> track(const T &value, const shared_ptr<void> &tracked_ptr) { - return tracked<T>(value, tracked_ptr); + tracked<T> track(const shared_ptr<void> &tracked_ptr, const T &value) { + return tracked<T>(tracked_ptr, value); } // get_pointer lets mem_fn bind a tracked template<typename T> |
|
From: Frank M. H. <fm...@us...> - 2007-02-22 19:51:22
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6845/thread_safe_signals Modified Files: track.hpp Log Message: tracked object returned by single argument track() should at least support conversion back into a shared_ptr. Index: track.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/track.hpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- track.hpp 22 Feb 2007 18:54:58 -0000 1.9 +++ track.hpp 22 Feb 2007 19:51:20 -0000 1.10 @@ -48,14 +48,28 @@ T _value; weak_ptr<void> _tracked_ptr; }; - // Convenience functions for binders. + template<typename T> - tracked<weak_ptr<T> > track(const shared_ptr<T>& ptr) { - return tracked<weak_ptr<T> >(weak_ptr<T>(ptr), ptr); + class tracked_shared_ptr: public tracked<weak_ptr<T> > + { + public: + tracked_shared_ptr(const weak_ptr<T>& ptr): + tracked<weak_ptr<T> >(ptr, ptr.lock()) + {} + operator shared_ptr<T> () const + { + return shared_ptr<T>(static_cast<const weak_ptr<T> &>(*this)); + } + }; + + // Convenience functions for binders. + template<typename T> + tracked_shared_ptr<T> track(const shared_ptr<T>& ptr) { + return tracked_shared_ptr<T>(ptr); } template<typename T> - tracked<weak_ptr<T> > track(const weak_ptr<T>& ptr) { - return tracked<weak_ptr<T> >(ptr, ptr.lock()); + tracked_shared_ptr<T> track(const weak_ptr<T>& ptr) { + return tracked_shared_ptr<T>(ptr); } template<typename T> tracked<T> track(const T &value, const shared_ptr<void> &tracked_ptr) { |
|
From: Frank M. H. <fm...@us...> - 2007-02-22 18:55:02
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16854/thread_safe_signals Modified Files: track.hpp Log Message: Forget about trying to support implicit conversions for the sake of easy binding. The user can use the two argument form of track if they need to. Index: track.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/track.hpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- track.hpp 22 Feb 2007 16:57:12 -0000 1.8 +++ track.hpp 22 Feb 2007 18:54:58 -0000 1.9 @@ -20,46 +20,13 @@ namespace boost { namespace signalslib { - /* a weak_ptr that supports various implicit conversions, so it - binds to more types of parameters with boost::bind */ - template<typename T> - class convertible_weak_ptr: public weak_ptr<T> - { - public: - convertible_weak_ptr(const weak_ptr<T> &ptr): weak_ptr<T>(ptr) - {} - convertible_weak_ptr(const shared_ptr<T> &ptr): weak_ptr<T>(ptr) - {} - operator T* () - { - return shared_ptr<T>(*this).get(); - } - operator const T* () const - { - return shared_ptr<const T>(*this).get(); - } - operator shared_ptr<T> () - { - return shared_ptr<T>(*this); - } - operator shared_ptr<const T> () const - { - return shared_ptr<const T>(*this); - } - operator T& () - { - return *shared_ptr<T>(*this).get(); - } - operator const T& () - { - return *shared_ptr<const T>(*this).get(); - } - }; // The actual wrapper for tracked shared_ptr-managed objects. template<typename T> class tracked { public: + typedef T value_type; + tracked(const T &value, const shared_ptr<void>& tracked_ptr): _value(value), _tracked_ptr(tracked_ptr) {} @@ -83,12 +50,12 @@ }; // Convenience functions for binders. template<typename T> - tracked<convertible_weak_ptr<T> > track(const shared_ptr<T>& ptr) { - return tracked<convertible_weak_ptr<T> >(weak_ptr<T>(ptr), ptr); + tracked<weak_ptr<T> > track(const shared_ptr<T>& ptr) { + return tracked<weak_ptr<T> >(weak_ptr<T>(ptr), ptr); } template<typename T> - tracked<convertible_weak_ptr<T> > track(const weak_ptr<T>& ptr) { - return tracked<convertible_weak_ptr<T> >(ptr, ptr.lock()); + tracked<weak_ptr<T> > track(const weak_ptr<T>& ptr) { + return tracked<weak_ptr<T> >(ptr, ptr.lock()); } template<typename T> tracked<T> track(const T &value, const shared_ptr<void> &tracked_ptr) { @@ -99,8 +66,9 @@ T* get_pointer(const signalslib::tracked<T*> &tracked) {return tracked;} template<typename T> T* get_pointer(const signalslib::tracked<weak_ptr<T> > &tracked) {return shared_ptr<T>(static_cast<weak_ptr<T> >(tracked)).get();} + // handles T=shared_ptr or similar case template<typename T> - T* get_pointer(const signalslib::tracked<convertible_weak_ptr<T> > &tracked) {return shared_ptr<T>(static_cast<weak_ptr<T> >(tracked)).get();} + typename T::pointer get_pointer(const signalslib::tracked<T> &tracked) {return static_cast<const T&>(tracked).get();} } // end namespace BOOST_SIGNALS_NAMESPACE } // end namespace boost |
|
From: Frank M. H. <fm...@us...> - 2007-02-22 16:57:27
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30607/thread_safe_signals Modified Files: slot.hpp track.hpp Log Message: Added support for 2-argument form of signalslib::track(), which allows value and shared_ptr to be specified independantly. Index: track.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/track.hpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- track.hpp 21 Feb 2007 15:15:23 -0000 1.7 +++ track.hpp 22 Feb 2007 16:57:12 -0000 1.8 @@ -12,10 +12,7 @@ #ifndef BOOST_SIGNALS_TRACK_HEADER #define BOOST_SIGNALS_TRACK_HEADER -#include <boost/ref.hpp> -#include <boost/signals/detail/config.hpp> #include <boost/smart_ptr.hpp> -#include <boost/noncopyable.hpp> #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX @@ -23,12 +20,15 @@ namespace boost { namespace signalslib { - // The actual wrapper for tracked shared_ptr-referenced objects. - template<class T> - class tracked : public weak_ptr<T> + /* a weak_ptr that supports various implicit conversions, so it + binds to more types of parameters with boost::bind */ + template<typename T> + class convertible_weak_ptr: public weak_ptr<T> { public: - tracked(const weak_ptr<T>& ptr): weak_ptr<T>(ptr) + convertible_weak_ptr(const weak_ptr<T> &ptr): weak_ptr<T>(ptr) + {} + convertible_weak_ptr(const shared_ptr<T> &ptr): weak_ptr<T>(ptr) {} operator T* () { @@ -54,23 +54,53 @@ { return *shared_ptr<const T>(*this).get(); } - operator shared_ptr<void> () const + }; + // The actual wrapper for tracked shared_ptr-managed objects. + template<typename T> + class tracked + { + public: + tracked(const T &value, const shared_ptr<void>& tracked_ptr): + _value(value), _tracked_ptr(tracked_ptr) + {} + // implicit conversions so tracked objects can be bound with bind + operator T& () { - return shared_ptr<void>(*this); + return _value; + } + operator const T& () const + { + return _value; + } + + const weak_ptr<void>& get_tracked_ptr() const + { + return _tracked_ptr; } + private: + T _value; + weak_ptr<void> _tracked_ptr; }; // Convenience functions for binders. - template<class T> - tracked<T> track(const boost::shared_ptr<T>& ptr) { - return tracked<T>(ptr); + template<typename T> + tracked<convertible_weak_ptr<T> > track(const shared_ptr<T>& ptr) { + return tracked<convertible_weak_ptr<T> >(weak_ptr<T>(ptr), ptr); } - template<class T> - tracked<T> track(const boost::weak_ptr<T>& ptr) { - return tracked<T>(ptr); + template<typename T> + tracked<convertible_weak_ptr<T> > track(const weak_ptr<T>& ptr) { + return tracked<convertible_weak_ptr<T> >(ptr, ptr.lock()); + } + template<typename T> + tracked<T> track(const T &value, const shared_ptr<void> &tracked_ptr) { + return tracked<T>(value, tracked_ptr); } // 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();} + T* get_pointer(const signalslib::tracked<T*> &tracked) {return tracked;} + template<typename T> + T* get_pointer(const signalslib::tracked<weak_ptr<T> > &tracked) {return shared_ptr<T>(static_cast<weak_ptr<T> >(tracked)).get();} + template<typename T> + T* get_pointer(const signalslib::tracked<convertible_weak_ptr<T> > &tracked) {return shared_ptr<T>(static_cast<weak_ptr<T> >(tracked)).get();} } // end namespace BOOST_SIGNALS_NAMESPACE } // end namespace boost Index: slot.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/slot.hpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- slot.hpp 21 Feb 2007 20:28:14 -0000 1.12 +++ slot.hpp 22 Feb 2007 16:57:12 -0000 1.13 @@ -98,13 +98,13 @@ template<typename GroupKey, typename SlotFunction> friend class ConnectionBody; - void add_tracked(const shared_ptr<void> &tracked) - { - _trackedObjects.push_back(tracked); - } private: typedef std::vector<boost::weak_ptr<void> > tracked_objects_container; + void add_tracked(const weak_ptr<void> &tracked) + { + _trackedObjects.push_back(tracked); + } const tracked_objects_container& get_all_tracked() const {return _trackedObjects;} tracked_objects_container _trackedObjects; @@ -176,7 +176,7 @@ void boost::signalslib::detail::tracked_objects_visitor::add_if_trackable(const tracked<T> *t) const { if(t) - slot_->add_tracked(*t); + slot_->add_tracked(t->get_tracked_ptr()); } void boost::signalslib::detail::tracked_objects_visitor::add_if_trackable(const trackable *trackable) const { |
|
From: Frank M. H. <fm...@us...> - 2007-02-22 16:57:17
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30607 Modified Files: thread_safe_signal.hpp Log Message: Added support for 2-argument form of signalslib::track(), which allows value and shared_ptr to be specified independantly. Index: thread_safe_signal.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signal.hpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- thread_safe_signal.hpp 17 Feb 2007 03:12:21 -0000 1.13 +++ thread_safe_signal.hpp 22 Feb 2007 16:57:12 -0000 1.14 @@ -41,9 +41,7 @@ #include <boost/thread_safe_signals/track.hpp> #include <functional> -#ifndef BOOST_SIGNALS_NAMESPACE #define BOOST_SIGNALS_NAMESPACE signalslib -#endif #ifndef EPG_SIGNALS_MAX_ARGS #define EPG_SIGNALS_MAX_ARGS 10 @@ -57,9 +55,9 @@ { #ifndef signals // for backward compatibility - namespace signals = signalslib; + namespace signals = signalslib; #endif - template<typename Signature, + template<typename Signature, typename Combiner = boost::last_value<typename boost::function_traits<Signature>::result_type >, typename Group = int, typename GroupCompare = std::less<Group>, |
|
From: John M. <joh...@us...> - 2007-02-22 16:53:08
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/math/distributions/detail In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28905/boost/math/distributions/detail Modified Files: Tag: math_toolkit derived_accessors.hpp Log Message: A couple of minor using declaration adjustments. Updated docs: adjusted titles and added more information on the kurtosis. Index: derived_accessors.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/math/distributions/detail/Attic/derived_accessors.hpp,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -u -d -r1.1.2.7 -r1.1.2.8 --- derived_accessors.hpp 7 Feb 2007 16:17:37 -0000 1.1.2.7 +++ derived_accessors.hpp 22 Feb 2007 16:52:36 -0000 1.1.2.8 @@ -85,6 +85,9 @@ typename Distribution::value_type coefficient_of_variation(const Distribution& dist) { typedef typename Distribution::value_type value_type; + + using std::abs; + value_type m = mean(dist); value_type d = standard_deviation(dist); if((abs(m) < 1) && (d > abs(m) * tools::max_value<value_type>())) |
|
From: John M. <joh...@us...> - 2007-02-22 16:52:50
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/math_functions/doc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28905/libs/math_functions/doc Modified Files: Tag: math_toolkit internals_overview.qbk math.qbk structure.qbk Log Message: A couple of minor using declaration adjustments. Updated docs: adjusted titles and added more information on the kurtosis. Index: structure.qbk =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/math_functions/doc/Attic/structure.qbk,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -u -d -r1.1.2.3 -r1.1.2.4 --- structure.qbk 4 Dec 2006 18:09:20 -0000 1.1.2.3 +++ structure.qbk 22 Feb 2007 16:52:37 -0000 1.1.2.4 @@ -1,5 +1,18 @@ [section:structure Getting About - Directory, Files, Namespaces & Configuration Macros] +[h4 Navigation] + +Used in combination with the configured browser key (usually Alt), the +following keys act as handy shortcuts for common navigation tasks. + +[h5 Shortcuts] +[: +[^[*p]] - Previous page \n +[^[*n]] - Next page \n +[^[*h]] - home \n +[^[*u]] - Up +] + [h4 Directory File Structure for Boost Math Functions, Math Constants, & Statistics Distributions] [h4 boost\/math] Index: math.qbk =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/math_functions/doc/Attic/math.qbk,v retrieving revision 1.1.2.55 retrieving revision 1.1.2.56 diff -u -d -r1.1.2.55 -r1.1.2.56 --- math.qbk 6 Feb 2007 17:15:53 -0000 1.1.2.55 +++ math.qbk 22 Feb 2007 16:52:37 -0000 1.1.2.56 @@ -327,21 +327,26 @@ [include result_type_calc.qbk] [endsect][/section:special Special Functions] -[section:toolkit Toolkit] +[section:toolkit Internal Details and Tools (Experimental)] + +[include internals_overview.qbk] + +[section:internals1 Reused Utilities] [include series.qbk] [include fraction.qbk] [include rational.qbk] [include roots.qbk] [include roots_without_derivatives.qbk] [include minima.qbk] +[endsect][/section: internal tools] -[section:internals Tools for Internal Testing and Development Use (Experimental)] -[include internals_overview.qbk] +[section:internals2 Testing and Development] [include polynomial.qbk] [include minimax.qbk] [include relative_error.qbk] [include test_data.qbk] [endsect][/section: internal tools] + [endsect][/section:toolkit Toolkit] [section:Using_UDT Use with User Defined Floating-Point Types] Index: internals_overview.qbk =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/math_functions/doc/Attic/internals_overview.qbk,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -d -r1.1.2.1 -r1.1.2.2 --- internals_overview.qbk 26 Sep 2006 18:24:13 -0000 1.1.2.1 +++ internals_overview.qbk 22 Feb 2007 16:52:37 -0000 1.1.2.2 @@ -1,7 +1,8 @@ [section:internals_overview Overview] -This section contains tools that are used in the development and testing -of this library. These tools have only minimal documentation, and crucially +This section contains internal utilities used by the library's implementation +along with tools used in development and testing. These tools have +only minimal documentation, and crucially ['do not have stable interfaces]. There is no doubt that these components can be improved, but they are also |
|
From: John M. <joh...@us...> - 2007-02-22 16:52:42
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/math_functions/doc/distributions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28905/libs/math_functions/doc/distributions Modified Files: Tag: math_toolkit binomial.qbk non_members.qbk Log Message: A couple of minor using declaration adjustments. Updated docs: adjusted titles and added more information on the kurtosis. Index: non_members.qbk =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/math_functions/doc/distributions/Attic/non_members.qbk,v retrieving revision 1.1.2.8 retrieving revision 1.1.2.9 diff -u -d -r1.1.2.8 -r1.1.2.9 --- non_members.qbk 23 Dec 2006 13:35:45 -0000 1.1.2.8 +++ non_members.qbk 22 Feb 2007 16:52:36 -0000 1.1.2.9 @@ -291,17 +291,24 @@ Returns the 'proper' kurtosis (normalized fourth moment) of the distribution /dist/. +kertosis = [beta][sub 2][space]= [mu][sub 4][space] / [mu][sub 2][super 2] + +Where [mu][sub i][space] is the i'th central moment of the distribution, and +in particular [mu][sub 2][space] is the variance of the distribution. + +The kurtosis is a measure of the "peakedness" of a distribution. + Note that the literature definition of kurtosis is confusing. -The definition used here is that used by +The definition used here is that used by for example [@http://mathworld.wolfram.com/Kurtosis.html Wolfram MathWorld] (that includes a table of formulae for kurtosis excess for various distributions) but NOT the definition of [@http://en.wikipedia.org/wiki/Kurtosis kurtosis used by Wikipedia] -whose tables of distributions all show the (same) formulae labelled kurtosis. +which treats "kurtosis" and "kurtosis excess" as the same quantity. kurtosis_excess = 'proper' kurtosis - 3 -This subtraction of 3 is convenient so that the kurtosis excess +This subtraction of 3 is convenient so that the ['kurtosis excess] of a normal distribution is zero. This function may return a __domain_error if the distribution does not have @@ -316,6 +323,15 @@ Returns the kurtosis excess of the distribution /dist/. +kurtosis excess = [gamma][sub 2][space]= [mu][sub 4][space] / [mu][sub 2][super 2][space]- 3 = kurtosis - 3 + +Where [mu][sub i][space] is the i'th central moment of the distribution, and +in particular [mu][sub 2][space] is the variance of the distribution. + +The kurtosis excess is a measure of the "peakedness" of a distribution, and +is more widely used than the "kurtosis proper". It is defined so that +the kurtosis excess of a normal distribution is zero. + This function may return a __domain_error if the distribution does not have a defined kurtosis excess. Index: binomial.qbk =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/math_functions/doc/distributions/Attic/binomial.qbk,v retrieving revision 1.1.2.14 retrieving revision 1.1.2.15 diff -u -d -r1.1.2.14 -r1.1.2.15 --- binomial.qbk 4 Dec 2006 18:09:20 -0000 1.1.2.14 +++ binomial.qbk 22 Feb 2007 16:52:36 -0000 1.1.2.15 @@ -349,7 +349,7 @@ [[quantile][Since the cdf is non-linear in variate /k/ none of the inverse incomplete beta functions can be used here. Instead the quantile is found numerically using a derivative free method - ([link math_toolkit.toolkit.roots2 TOMS Algorithm 748]).]] + ([link math_toolkit.toolkit.internals1.roots2 TOMS Algorithm 748]).]] [[quantile from the complement][Found numerically as above.]] [[mean][ `p * n` ]] [[variance][ `p * n * (1-p)` ]] |
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/math_functions/dot_net_example/distribution_explorer In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28905/libs/math_functions/dot_net_example/distribution_explorer Modified Files: Tag: math_toolkit distribution_explorer.csproj.user distribution_explorer.sln.lnk distribution_explorer.suo Log Message: A couple of minor using declaration adjustments. Updated docs: adjusted titles and added more information on the kurtosis. Index: distribution_explorer.sln.lnk =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/math_functions/dot_net_example/distribution_explorer/Attic/distribution_explorer.sln.lnk,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -d -r1.1.2.1 -r1.1.2.2 Binary files /tmp/cvsneRIyB and /tmp/cvsIlz7eZ differ Index: distribution_explorer.suo =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/math_functions/dot_net_example/distribution_explorer/Attic/distribution_explorer.suo,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -d -r1.1.2.2 -r1.1.2.3 Binary files /tmp/cvs7lJiyK and /tmp/cvsCaX6C8 differ Index: distribution_explorer.csproj.user =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/math_functions/dot_net_example/distribution_explorer/Attic/distribution_explorer.csproj.user,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -d -r1.1.2.2 -r1.1.2.3 --- distribution_explorer.csproj.user 15 Feb 2007 16:44:32 -0000 1.1.2.2 +++ distribution_explorer.csproj.user 22 Feb 2007 16:52:37 -0000 1.1.2.3 @@ -10,7 +10,7 @@ </UpdateUrlHistory> <BootstrapperUrlHistory> </BootstrapperUrlHistory> - <ApplicationRevision>0</ApplicationRevision> + <ApplicationRevision>1</ApplicationRevision> <FallbackCulture>en-US</FallbackCulture> <VerifyUploadedFiles>false</VerifyUploadedFiles> <EnableSecurityDebugging>false</EnableSecurityDebugging> |
|
From: John M. <joh...@us...> - 2007-02-22 16:52:39
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/math_functions/dot_net_example/boost_math In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28905/libs/math_functions/dot_net_example/boost_math Modified Files: Tag: math_toolkit boost_math.suo Log Message: A couple of minor using declaration adjustments. Updated docs: adjusted titles and added more information on the kurtosis. Index: boost_math.suo =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/math_functions/dot_net_example/boost_math/Attic/boost_math.suo,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -d -r1.1.2.2 -r1.1.2.3 Binary files /tmp/cvswEy2TL and /tmp/cvskV0Di8 differ |
|
From: John M. <joh...@us...> - 2007-02-22 16:52:39
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/math/special_functions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28905/boost/math/special_functions Modified Files: Tag: math_toolkit hypot.hpp Log Message: A couple of minor using declaration adjustments. Updated docs: adjusted titles and added more information on the kurtosis. Index: hypot.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/math/special_functions/Attic/hypot.hpp,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -u -d -r1.1.2.7 -r1.1.2.8 --- hypot.hpp 6 Feb 2007 13:32:59 -0000 1.1.2.7 +++ hypot.hpp 22 Feb 2007 16:52:36 -0000 1.1.2.8 @@ -24,7 +24,7 @@ // // Normalize x and y, so that both are positive and x >= y: // - using namespace std; // ADL of std names + using std::fabs; using std::sqrt; // ADL of std names x = fabs(x); y = fabs(y); |