Boost logo

Boost-Commit :

From: fmhess_at_[hidden]
Date: 2007-09-21 14:59:44


Author: fmhess
Date: 2007-09-21 14:59:41 EDT (Fri, 21 Sep 2007)
New Revision: 39454
URL: http://svn.boost.org/trac/boost/changeset/39454

Log:
Indent with spaces instead of tabs, as specified by boost coding guidelines.

Text files modified:
   sandbox/thread_safe_signals/boost/last_value.hpp | 2
   sandbox/thread_safe_signals/boost/thread_safe_signal.hpp | 38
   sandbox/thread_safe_signals/boost/thread_safe_signals/auto_threaded.hpp | 14
   sandbox/thread_safe_signals/boost/thread_safe_signals/connection.hpp | 352 +++++++-------
   sandbox/thread_safe_signals/boost/thread_safe_signals/detail/signal_base.hpp | 26
   sandbox/thread_safe_signals/boost/thread_safe_signals/detail/signal_template.hpp | 968 ++++++++++++++++++++--------------------
   sandbox/thread_safe_signals/boost/thread_safe_signals/detail/slot_call_iterator.hpp | 190 +++---
   sandbox/thread_safe_signals/boost/thread_safe_signals/detail/slot_groups.hpp | 340 +++++++-------
   sandbox/thread_safe_signals/boost/thread_safe_signals/detail/slot_template.hpp | 178 +++---
   sandbox/thread_safe_signals/boost/thread_safe_signals/multi_threaded.hpp | 14
   sandbox/thread_safe_signals/boost/thread_safe_signals/shared_connection_block.hpp | 60 +-
   sandbox/thread_safe_signals/boost/thread_safe_signals/single_threaded.hpp | 48
   sandbox/thread_safe_signals/boost/thread_safe_signals/slot.hpp | 106 ++--
   sandbox/thread_safe_signals/boost/thread_safe_signals/slot_base.hpp | 112 ++--
   14 files changed, 1224 insertions(+), 1224 deletions(-)

Modified: sandbox/thread_safe_signals/boost/last_value.hpp
==============================================================================
--- sandbox/thread_safe_signals/boost/last_value.hpp (original)
+++ sandbox/thread_safe_signals/boost/last_value.hpp 2007-09-21 14:59:41 EDT (Fri, 21 Sep 2007)
@@ -22,7 +22,7 @@
   class no_slots_error: public std::exception
   {
   public:
- virtual const char* what() {return "boost::no_slots_error";}
+ virtual const char* what() {return "boost::no_slots_error";}
   };
   namespace last_value_detail {
     template<typename T>

Modified: sandbox/thread_safe_signals/boost/thread_safe_signal.hpp
==============================================================================
--- sandbox/thread_safe_signals/boost/thread_safe_signal.hpp (original)
+++ sandbox/thread_safe_signals/boost/thread_safe_signal.hpp 2007-09-21 14:59:41 EDT (Fri, 21 Sep 2007)
@@ -59,26 +59,26 @@
 namespace boost
 {
 #ifndef signals
- // for backward compatibility
- namespace signals = signalslib;
+ // for backward compatibility
+ namespace signals = signalslib;
 #endif
- template<typename Signature,
- typename Combiner = last_value<typename boost::function_traits<Signature>::result_type>,
- typename Group = int,
- typename GroupCompare = std::less<Group>,
- typename SlotFunction = function<Signature>,
- typename ThreadingModel = signalslib::auto_threaded >
- class signal: public signalslib::detail::signalN<function_traits<Signature>::arity,
- Signature, Combiner, Group, GroupCompare, SlotFunction, ThreadingModel>::type
- {
- private:
- typedef typename signalslib::detail::signalN<boost::function_traits<Signature>::arity,
- Signature, Combiner, Group, GroupCompare, SlotFunction, ThreadingModel>::type base_type;
- public:
- signal(const Combiner &combiner = Combiner(), const GroupCompare &group_compare = GroupCompare()):
- base_type(combiner, group_compare)
- {}
- };
+ template<typename Signature,
+ typename Combiner = last_value<typename boost::function_traits<Signature>::result_type>,
+ typename Group = int,
+ typename GroupCompare = std::less<Group>,
+ typename SlotFunction = function<Signature>,
+ typename ThreadingModel = signalslib::auto_threaded >
+ class signal: public signalslib::detail::signalN<function_traits<Signature>::arity,
+ Signature, Combiner, Group, GroupCompare, SlotFunction, ThreadingModel>::type
+ {
+ private:
+ typedef typename signalslib::detail::signalN<boost::function_traits<Signature>::arity,
+ Signature, Combiner, Group, GroupCompare, SlotFunction, ThreadingModel>::type base_type;
+ public:
+ signal(const Combiner &combiner = Combiner(), const GroupCompare &group_compare = GroupCompare()):
+ base_type(combiner, group_compare)
+ {}
+ };
 }
 
 #ifdef BOOST_HAS_ABI_HEADERS

Modified: sandbox/thread_safe_signals/boost/thread_safe_signals/auto_threaded.hpp
==============================================================================
--- sandbox/thread_safe_signals/boost/thread_safe_signals/auto_threaded.hpp (original)
+++ sandbox/thread_safe_signals/boost/thread_safe_signals/auto_threaded.hpp 2007-09-21 14:59:41 EDT (Fri, 21 Sep 2007)
@@ -17,13 +17,13 @@
 #endif
 
 namespace boost {
- namespace signalslib {
- class auto_threaded
- {
- public:
- typedef boost::detail::lightweight_mutex mutex_type;
- };
- } // end namespace signalslib
+ namespace signalslib {
+ class auto_threaded
+ {
+ public:
+ typedef boost::detail::lightweight_mutex mutex_type;
+ };
+ } // end namespace signalslib
 } // end namespace boost
 
 #ifdef BOOST_HAS_ABI_HEADERS

Modified: sandbox/thread_safe_signals/boost/thread_safe_signals/connection.hpp
==============================================================================
--- sandbox/thread_safe_signals/boost/thread_safe_signals/connection.hpp (original)
+++ sandbox/thread_safe_signals/boost/thread_safe_signals/connection.hpp 2007-09-21 14:59:41 EDT (Fri, 21 Sep 2007)
@@ -1,7 +1,7 @@
 /*
 
- Author: Frank Hess <frank.hess_at_[hidden]>
- Begin: 2007-01-23
+ Author: Frank Hess <frank.hess_at_[hidden]>
+ 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
@@ -37,183 +37,183 @@
 
 namespace boost
 {
- namespace signalslib
- {
- extern inline void null_deleter(const void*) {}
- namespace detail
- {
- class ConnectionBodyBase
- {
- public:
- ConnectionBodyBase():
- _connected(true)
- {
- }
- virtual ~ConnectionBodyBase() {}
- virtual void disconnect() = 0;
- void nolock_disconnect()
- {
- _connected = false;
- }
- virtual bool connected() const = 0;
- virtual shared_ptr<void> get_blocker() = 0;
- bool blocked() const
- {
- return !_weak_blocker.expired();
- }
- bool nolock_nograb_blocked() const
- {
- return nolock_nograb_connected() == false || blocked();
- }
- bool nolock_nograb_connected() const {return _connected;}
- protected:
-
- mutable bool _connected;
- weak_ptr<void> _weak_blocker;
- };
-
- template<typename GroupKey, typename SlotType, typename ThreadingModel>
- class ConnectionBody: public ConnectionBodyBase
- {
- public:
- typedef typename ThreadingModel::mutex_type mutex_type;
- ConnectionBody(const SlotType &slot_in):
- slot(slot_in)
- {
- }
- virtual ~ConnectionBody() {}
- virtual void disconnect()
- {
- typename mutex_type::scoped_lock lock(mutex);
- nolock_disconnect();
- }
- virtual bool connected() const
- {
- typename mutex_type::scoped_lock lock(mutex);
- nolock_grab_tracked_objects();
- return nolock_nograb_connected();
- }
- virtual shared_ptr<void> get_blocker()
- {
- typename mutex_type::scoped_lock lock(mutex);
- shared_ptr<void> blocker = _weak_blocker.lock();
- if(blocker == 0)
- {
- blocker.reset(this, &null_deleter);
- _weak_blocker = blocker;
- }
- return blocker;
- }
- const GroupKey& group_key() const {return _group_key;}
- void set_group_key(const GroupKey &key) {_group_key = key;}
- 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 expired_slot &)
- {
- _connected = false;
- return locked_objects;
- }
- return locked_objects;
- }
- SlotType slot;
- mutable mutex_type mutex;
- private:
- GroupKey _group_key;
- };
- }
-
- class shared_connection_block;
-
- class connection
- {
- public:
- friend class shared_connection_block;
-
- connection() {}
- connection(const connection &other): _weakConnectionBody(other._weakConnectionBody)
- {}
- connection(boost::weak_ptr<detail::ConnectionBodyBase> connectionBody):
- _weakConnectionBody(connectionBody)
- {}
- ~connection() {}
- void disconnect() const
- {
- boost::shared_ptr<detail::ConnectionBodyBase> connectionBody(_weakConnectionBody.lock());
- if(connectionBody == 0) return;
- connectionBody->disconnect();
- }
- bool connected() const
- {
- boost::shared_ptr<detail::ConnectionBodyBase> connectionBody(_weakConnectionBody.lock());
- if(connectionBody == 0) return false;
- return connectionBody->connected();
- }
- bool blocked() const
- {
- boost::shared_ptr<detail::ConnectionBodyBase> connectionBody(_weakConnectionBody.lock());
- if(connectionBody == 0) return true;
- return connectionBody->blocked();
- }
- bool operator==(const connection& other) const
- {
- boost::shared_ptr<detail::ConnectionBodyBase> connectionBody(_weakConnectionBody.lock());
- boost::shared_ptr<detail::ConnectionBodyBase> otherConnectionBody(other._weakConnectionBody.lock());
- return connectionBody == otherConnectionBody;
- }
- bool operator<(const connection& other) const
- {
- boost::shared_ptr<detail::ConnectionBodyBase> connectionBody(_weakConnectionBody.lock());
- boost::shared_ptr<detail::ConnectionBodyBase> otherConnectionBody(other._weakConnectionBody.lock());
- return connectionBody < otherConnectionBody;
- }
- void swap(connection &other)
- {
- std::swap(_weakConnectionBody, other._weakConnectionBody);
- }
- private:
-
- boost::weak_ptr<detail::ConnectionBodyBase> _weakConnectionBody;
- };
-
- class scoped_connection: public connection
- {
- public:
- scoped_connection() {}
- scoped_connection(const connection &other): connection(other)
- {}
- ~scoped_connection()
- {
- disconnect();
- }
- const scoped_connection& operator=(const connection &rhs)
- {
- boost::signalslib::connection::operator=(rhs);
- return *this;
- }
- void swap(scoped_connection &other)
- {
- connection::swap(other);
- }
- };
- }
+ namespace signalslib
+ {
+ extern inline void null_deleter(const void*) {}
+ namespace detail
+ {
+ class ConnectionBodyBase
+ {
+ public:
+ ConnectionBodyBase():
+ _connected(true)
+ {
+ }
+ virtual ~ConnectionBodyBase() {}
+ virtual void disconnect() = 0;
+ void nolock_disconnect()
+ {
+ _connected = false;
+ }
+ virtual bool connected() const = 0;
+ virtual shared_ptr<void> get_blocker() = 0;
+ bool blocked() const
+ {
+ return !_weak_blocker.expired();
+ }
+ bool nolock_nograb_blocked() const
+ {
+ return nolock_nograb_connected() == false || blocked();
+ }
+ bool nolock_nograb_connected() const {return _connected;}
+ protected:
+
+ mutable bool _connected;
+ weak_ptr<void> _weak_blocker;
+ };
+
+ template<typename GroupKey, typename SlotType, typename ThreadingModel>
+ class ConnectionBody: public ConnectionBodyBase
+ {
+ public:
+ typedef typename ThreadingModel::mutex_type mutex_type;
+ ConnectionBody(const SlotType &slot_in):
+ slot(slot_in)
+ {
+ }
+ virtual ~ConnectionBody() {}
+ virtual void disconnect()
+ {
+ typename mutex_type::scoped_lock lock(mutex);
+ nolock_disconnect();
+ }
+ virtual bool connected() const
+ {
+ typename mutex_type::scoped_lock lock(mutex);
+ nolock_grab_tracked_objects();
+ return nolock_nograb_connected();
+ }
+ virtual shared_ptr<void> get_blocker()
+ {
+ typename mutex_type::scoped_lock lock(mutex);
+ shared_ptr<void> blocker = _weak_blocker.lock();
+ if(blocker == 0)
+ {
+ blocker.reset(this, &null_deleter);
+ _weak_blocker = blocker;
+ }
+ return blocker;
+ }
+ const GroupKey& group_key() const {return _group_key;}
+ void set_group_key(const GroupKey &key) {_group_key = key;}
+ 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 expired_slot &)
+ {
+ _connected = false;
+ return locked_objects;
+ }
+ return locked_objects;
+ }
+ SlotType slot;
+ mutable mutex_type mutex;
+ private:
+ GroupKey _group_key;
+ };
+ }
+
+ class shared_connection_block;
+
+ class connection
+ {
+ public:
+ friend class shared_connection_block;
+
+ connection() {}
+ connection(const connection &other): _weakConnectionBody(other._weakConnectionBody)
+ {}
+ connection(boost::weak_ptr<detail::ConnectionBodyBase> connectionBody):
+ _weakConnectionBody(connectionBody)
+ {}
+ ~connection() {}
+ void disconnect() const
+ {
+ boost::shared_ptr<detail::ConnectionBodyBase> connectionBody(_weakConnectionBody.lock());
+ if(connectionBody == 0) return;
+ connectionBody->disconnect();
+ }
+ bool connected() const
+ {
+ boost::shared_ptr<detail::ConnectionBodyBase> connectionBody(_weakConnectionBody.lock());
+ if(connectionBody == 0) return false;
+ return connectionBody->connected();
+ }
+ bool blocked() const
+ {
+ boost::shared_ptr<detail::ConnectionBodyBase> connectionBody(_weakConnectionBody.lock());
+ if(connectionBody == 0) return true;
+ return connectionBody->blocked();
+ }
+ bool operator==(const connection& other) const
+ {
+ boost::shared_ptr<detail::ConnectionBodyBase> connectionBody(_weakConnectionBody.lock());
+ boost::shared_ptr<detail::ConnectionBodyBase> otherConnectionBody(other._weakConnectionBody.lock());
+ return connectionBody == otherConnectionBody;
+ }
+ bool operator<(const connection& other) const
+ {
+ boost::shared_ptr<detail::ConnectionBodyBase> connectionBody(_weakConnectionBody.lock());
+ boost::shared_ptr<detail::ConnectionBodyBase> otherConnectionBody(other._weakConnectionBody.lock());
+ return connectionBody < otherConnectionBody;
+ }
+ void swap(connection &other)
+ {
+ std::swap(_weakConnectionBody, other._weakConnectionBody);
+ }
+ private:
+
+ boost::weak_ptr<detail::ConnectionBodyBase> _weakConnectionBody;
+ };
+
+ class scoped_connection: public connection
+ {
+ public:
+ scoped_connection() {}
+ scoped_connection(const connection &other): connection(other)
+ {}
+ ~scoped_connection()
+ {
+ disconnect();
+ }
+ const scoped_connection& operator=(const connection &rhs)
+ {
+ boost::signalslib::connection::operator=(rhs);
+ return *this;
+ }
+ void swap(scoped_connection &other)
+ {
+ connection::swap(other);
+ }
+ };
+ }
 }
 
 #ifdef BOOST_HAS_ABI_HEADERS
 # include BOOST_ABI_SUFFIX
 #endif
 
-#endif // _EPG_SIGNALS_CONNECTION_H
+#endif // _EPG_SIGNALS_CONNECTION_H

Modified: sandbox/thread_safe_signals/boost/thread_safe_signals/detail/signal_base.hpp
==============================================================================
--- sandbox/thread_safe_signals/boost/thread_safe_signals/detail/signal_base.hpp (original)
+++ sandbox/thread_safe_signals/boost/thread_safe_signals/detail/signal_base.hpp 2007-09-21 14:59:41 EDT (Fri, 21 Sep 2007)
@@ -17,21 +17,21 @@
 #endif
 
 namespace boost {
- namespace signalslib {
- namespace detail {
- class slot_base;
+ namespace signalslib {
+ namespace detail {
+ class slot_base;
 
- class signal_base : public noncopyable
- {
- public:
- friend 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
+ 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

Modified: sandbox/thread_safe_signals/boost/thread_safe_signals/detail/signal_template.hpp
==============================================================================
--- sandbox/thread_safe_signals/boost/thread_safe_signals/detail/signal_template.hpp (original)
+++ sandbox/thread_safe_signals/boost/thread_safe_signals/detail/signal_template.hpp 2007-09-21 14:59:41 EDT (Fri, 21 Sep 2007)
@@ -1,9 +1,9 @@
 /*
- Template for Signa1, Signal2, ... classes that support signals
- with 1, 2, ... parameters
+ Template for Signa1, Signal2, ... classes that support signals
+ with 1, 2, ... parameters
 
- Author: Frank Hess <frank.hess_at_[hidden]>
- Begin: 2007-01-23
+ Author: Frank Hess <frank.hess_at_[hidden]>
+ 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
@@ -30,508 +30,508 @@
 
 // typename R, typename T1, typename T2, ..., typename TN, typename Combiner = boost::last_value<R>, ...
 #define BOOST_SIGNAL_TEMPLATE_DEFAULTED_DECL \
- BOOST_SIGNAL_SIGNATURE_TEMPLATE_DECL(BOOST_SIGNALS_NUM_ARGS), \
- typename Combiner = last_value<R>, \
- typename Group = int, \
- typename GroupCompare = std::less<Group>, \
- typename SlotFunction = BOOST_FUNCTION_N_DECL(BOOST_SIGNALS_NUM_ARGS), \
- typename ThreadingModel = signalslib::auto_threaded
+ BOOST_SIGNAL_SIGNATURE_TEMPLATE_DECL(BOOST_SIGNALS_NUM_ARGS), \
+ typename Combiner = last_value<R>, \
+ typename Group = int, \
+ typename GroupCompare = std::less<Group>, \
+ typename SlotFunction = BOOST_FUNCTION_N_DECL(BOOST_SIGNALS_NUM_ARGS), \
+ typename ThreadingModel = signalslib::auto_threaded
 // typename R, typename T1, typename T2, ..., typename TN, typename Combiner, ...
 #define BOOST_SIGNAL_TEMPLATE_DECL \
- BOOST_SIGNAL_SIGNATURE_TEMPLATE_DECL(BOOST_SIGNALS_NUM_ARGS), \
- typename Combiner, \
- typename Group, \
- typename GroupCompare, \
- typename SlotFunction, \
- typename ThreadingModel
+ 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 BOOST_SIGNAL_TEMPLATE_INSTANTIATION \
- BOOST_SIGNAL_SIGNATURE_TEMPLATE_INSTANTIATION(BOOST_SIGNALS_NUM_ARGS), \
- Combiner, Group, GroupCompare, SlotFunction, ThreadingModel
+ BOOST_SIGNAL_SIGNATURE_TEMPLATE_INSTANTIATION(BOOST_SIGNALS_NUM_ARGS), \
+ Combiner, Group, GroupCompare, SlotFunction, ThreadingModel
 
 namespace boost
 {
- namespace signalslib
- {
- namespace detail
- {
- template<BOOST_SIGNAL_TEMPLATE_DECL>
- class BOOST_SIGNAL_IMPL_CLASS_NAME
- {
- public:
- typedef SlotFunction slot_function_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;
- private:
- class slot_invoker;
- typedef typename signalslib::detail::group_key<Group>::type group_key_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 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 typename signalslib::detail::slot_call_iterator_t<slot_invoker,
- typename connection_list_type::iterator, ConnectionBody<group_key_type, slot_type, ThreadingModel> > slot_call_iterator;
-
- 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())
- {}
- // connect slot
- signalslib::connection connect(const slot_type &slot, signalslib::connect_position position = signalslib::at_back)
- {
- typename mutex_type::scoped_lock lock(_mutex);
- connection_body_type newConnectionBody =
- create_new_connection(slot);
- group_key_type group_key;
- if(position == signalslib::at_back)
- {
- group_key.first = signalslib::detail::back_ungrouped_slots;
- _shared_state->connection_bodies.push_back(group_key, newConnectionBody);
- }else
- {
- group_key.first = signalslib::detail::front_ungrouped_slots;
- _shared_state->connection_bodies.push_front(group_key, newConnectionBody);
- }
- newConnectionBody->set_group_key(group_key);
- return signalslib::connection(newConnectionBody);
- }
- signalslib::connection connect(const group_type &group,
- const slot_type &slot, signalslib::connect_position position = signalslib::at_back)
- {
- typename mutex_type::scoped_lock lock(_mutex);
- connection_body_type newConnectionBody =
- create_new_connection(slot);
- // update map to first connection body in group if needed
- group_key_type group_key(signalslib::detail::grouped_slots, group);
- newConnectionBody->set_group_key(group_key);
- if(position == signalslib::at_back)
- {
- _shared_state->connection_bodies.push_back(group_key, newConnectionBody);
- }else // at_front
- {
- _shared_state->connection_bodies.push_front(group_key, newConnectionBody);
- }
- return signalslib::connection(newConnectionBody);
- }
- // disconnect slot(s)
- void disconnect_all_slots()
- {
- shared_ptr<invocation_state> local_state =
- get_readable_state();
- typename connection_list_type::iterator it;
- for(it = local_state->connection_bodies.begin();
- it != local_state->connection_bodies.end(); ++it)
- {
- (*it)->disconnect();
- }
- }
- void disconnect(const group_type &group)
- {
- shared_ptr<invocation_state> local_state =
- get_readable_state();
- group_key_type group_key(signalslib::detail::grouped_slots, group);
- typename connection_list_type::iterator it;
- typename connection_list_type::iterator end_it =
- local_state->connection_bodies.upper_bound(group_key);
- for(it = local_state->connection_bodies.lower_bound(group_key);
- it != end_it; ++it)
- {
- (*it)->disconnect();
- }
- }
- template <typename T>
- void disconnect(const T &slot)
- {
- typedef mpl::bool_<(is_convertible<T, group_type>::value)> is_group;
- do_disconnect(slot, is_group());
- }
- // emit signal
- result_type operator ()(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS))
- {
- shared_ptr<invocation_state> local_state;
- typename connection_list_type::iterator it;
- {
- typename mutex_type::scoped_lock listLock(_mutex);
- // only clean up if it is safe to do so
- if(_shared_state.unique())
- nolock_cleanup_connections(false);
- /* Make a local copy of _shared_state while holding mutex, so we are
- thread safe against the combiner or connection list getting modified
- during invocation. */
- local_state = _shared_state;
- }
- 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 ()(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS)) const
- {
- shared_ptr<invocation_state> local_state;
- typename connection_list_type::iterator it;
- {
- typename mutex_type::scoped_lock listLock(_mutex);
- // only clean up if it is safe to do so
- if(_shared_state.unique())
- nolock_cleanup_connections(false);
- /* Make a local copy of _shared_state while holding mutex, so we are
- thread safe against the combiner or connection list getting modified
- during invocation. */
- local_state = _shared_state;
- }
- 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),
- slot_call_iterator(local_state->connection_bodies.end(), local_state->connection_bodies.end(), invoker, cache));
- }
- std::size_t num_slots() const
- {
- shared_ptr<invocation_state> local_state =
- get_readable_state();
- typename connection_list_type::iterator it;
- std::size_t count = 0;
- for(it = local_state->connection_bodies.begin();
- it != local_state->connection_bodies.end(); ++it)
- {
- if((*it)->connected()) ++count;
- }
- return count;
- }
- bool empty() const
- {
- shared_ptr<invocation_state> local_state =
- get_readable_state();
- typename connection_list_type::iterator it;
- for(it = local_state->connection_bodies.begin();
- it != local_state->connection_bodies.end(); ++it)
- {
- if((*it)->connected()) return false;
- }
- return true;
- }
- combiner_type combiner() const
- {
- typename mutex_type::scoped_lock lock(_mutex);
- return _shared_state->combiner;
- }
- void set_combiner(const combiner_type &combiner)
- {
- typename mutex_type::scoped_lock lock(_mutex);
- if(_shared_state.unique())
- _shared_state->combiner = combiner;
- else
- _shared_state.reset(new invocation_state(_shared_state->connection_bodies, combiner));
- }
- 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;
+ namespace signalslib
+ {
+ namespace detail
+ {
+ template<BOOST_SIGNAL_TEMPLATE_DECL>
+ class BOOST_SIGNAL_IMPL_CLASS_NAME
+ {
+ public:
+ typedef SlotFunction slot_function_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;
+ private:
+ class slot_invoker;
+ typedef typename signalslib::detail::group_key<Group>::type group_key_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 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 typename signalslib::detail::slot_call_iterator_t<slot_invoker,
+ typename connection_list_type::iterator, ConnectionBody<group_key_type, slot_type, ThreadingModel> > slot_call_iterator;
+
+ 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())
+ {}
+ // connect slot
+ signalslib::connection connect(const slot_type &slot, signalslib::connect_position position = signalslib::at_back)
+ {
+ typename mutex_type::scoped_lock lock(_mutex);
+ connection_body_type newConnectionBody =
+ create_new_connection(slot);
+ group_key_type group_key;
+ if(position == signalslib::at_back)
+ {
+ group_key.first = signalslib::detail::back_ungrouped_slots;
+ _shared_state->connection_bodies.push_back(group_key, newConnectionBody);
+ }else
+ {
+ group_key.first = signalslib::detail::front_ungrouped_slots;
+ _shared_state->connection_bodies.push_front(group_key, newConnectionBody);
+ }
+ newConnectionBody->set_group_key(group_key);
+ return signalslib::connection(newConnectionBody);
+ }
+ signalslib::connection connect(const group_type &group,
+ const slot_type &slot, signalslib::connect_position position = signalslib::at_back)
+ {
+ typename mutex_type::scoped_lock lock(_mutex);
+ connection_body_type newConnectionBody =
+ create_new_connection(slot);
+ // update map to first connection body in group if needed
+ group_key_type group_key(signalslib::detail::grouped_slots, group);
+ newConnectionBody->set_group_key(group_key);
+ if(position == signalslib::at_back)
+ {
+ _shared_state->connection_bodies.push_back(group_key, newConnectionBody);
+ }else // at_front
+ {
+ _shared_state->connection_bodies.push_front(group_key, newConnectionBody);
+ }
+ return signalslib::connection(newConnectionBody);
+ }
+ // disconnect slot(s)
+ void disconnect_all_slots()
+ {
+ shared_ptr<invocation_state> local_state =
+ get_readable_state();
+ typename connection_list_type::iterator it;
+ for(it = local_state->connection_bodies.begin();
+ it != local_state->connection_bodies.end(); ++it)
+ {
+ (*it)->disconnect();
+ }
+ }
+ void disconnect(const group_type &group)
+ {
+ shared_ptr<invocation_state> local_state =
+ get_readable_state();
+ group_key_type group_key(signalslib::detail::grouped_slots, group);
+ typename connection_list_type::iterator it;
+ typename connection_list_type::iterator end_it =
+ local_state->connection_bodies.upper_bound(group_key);
+ for(it = local_state->connection_bodies.lower_bound(group_key);
+ it != end_it; ++it)
+ {
+ (*it)->disconnect();
+ }
+ }
+ template <typename T>
+ void disconnect(const T &slot)
+ {
+ typedef mpl::bool_<(is_convertible<T, group_type>::value)> is_group;
+ do_disconnect(slot, is_group());
+ }
+ // emit signal
+ result_type operator ()(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS))
+ {
+ shared_ptr<invocation_state> local_state;
+ typename connection_list_type::iterator it;
+ {
+ typename mutex_type::scoped_lock listLock(_mutex);
+ // only clean up if it is safe to do so
+ if(_shared_state.unique())
+ nolock_cleanup_connections(false);
+ /* Make a local copy of _shared_state while holding mutex, so we are
+ thread safe against the combiner or connection list getting modified
+ during invocation. */
+ local_state = _shared_state;
+ }
+ 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 ()(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS)) const
+ {
+ shared_ptr<invocation_state> local_state;
+ typename connection_list_type::iterator it;
+ {
+ typename mutex_type::scoped_lock listLock(_mutex);
+ // only clean up if it is safe to do so
+ if(_shared_state.unique())
+ nolock_cleanup_connections(false);
+ /* Make a local copy of _shared_state while holding mutex, so we are
+ thread safe against the combiner or connection list getting modified
+ during invocation. */
+ local_state = _shared_state;
+ }
+ 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),
+ slot_call_iterator(local_state->connection_bodies.end(), local_state->connection_bodies.end(), invoker, cache));
+ }
+ std::size_t num_slots() const
+ {
+ shared_ptr<invocation_state> local_state =
+ get_readable_state();
+ typename connection_list_type::iterator it;
+ std::size_t count = 0;
+ for(it = local_state->connection_bodies.begin();
+ it != local_state->connection_bodies.end(); ++it)
+ {
+ if((*it)->connected()) ++count;
+ }
+ return count;
+ }
+ bool empty() const
+ {
+ shared_ptr<invocation_state> local_state =
+ get_readable_state();
+ typename connection_list_type::iterator it;
+ for(it = local_state->connection_bodies.begin();
+ it != local_state->connection_bodies.end(); ++it)
+ {
+ if((*it)->connected()) return false;
+ }
+ return true;
+ }
+ combiner_type combiner() const
+ {
+ typename mutex_type::scoped_lock lock(_mutex);
+ return _shared_state->combiner;
+ }
+ void set_combiner(const combiner_type &combiner)
+ {
+ typename mutex_type::scoped_lock lock(_mutex);
+ if(_shared_state.unique())
+ _shared_state->combiner = combiner;
+ else
+ _shared_state.reset(new invocation_state(_shared_state->connection_bodies, combiner));
+ }
+ 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(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS)) BOOST_PP_IF(BOOST_SIGNALS_NUM_ARGS, :, )
+ slot_invoker(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS)) BOOST_PP_IF(BOOST_SIGNALS_NUM_ARGS, :, )
 // argn ( argn ) ,
 #define BOOST_SIGNAL_MISC_STATEMENT(z, n, data) \
- BOOST_PP_CAT(arg, n) ( BOOST_PP_CAT(arg, n) )
+ BOOST_PP_CAT(arg, n) ( BOOST_PP_CAT(arg, n) )
 // arg1(arg1), arg2(arg2), ..., argn(argn)
- BOOST_PP_ENUM_SHIFTED(BOOST_PP_INC(BOOST_SIGNALS_NUM_ARGS), BOOST_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
- {
- result_type *resolver = 0;
- return m_invoke(connectionBody,
- resolver);
- }
+ {}
+ result_type operator ()(const connection_body_type &connectionBody) const
+ {
+ result_type *resolver = 0;
+ return m_invoke(connectionBody,
+ resolver);
+ }
 // Tn argn;
 #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, ~)
+ 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 *) const
- {
- connectionBody->slot.slot_function()(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.slot_function()(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
- // inside operator()
- struct invocation_state
- {
- invocation_state(const connection_list_type &connections,
- const combiner_type &combiner): connection_bodies(connections),
- combiner(combiner)
- {}
- invocation_state(const invocation_state &other):
- connection_bodies(other.connection_bodies),
- combiner(other.combiner)
- {}
- connection_list_type connection_bodies;
- combiner_type combiner;
- };
-
- // clean up disconnected connections
- void nolock_cleanup_connections(bool grab_tracked,
- const typename connection_list_type::iterator &begin, bool break_on_connected = false) const
- {
- BOOST_ASSERT(_shared_state.unique());
- typename connection_list_type::iterator it;
- for(it = begin; it != _shared_state->connection_bodies.end();)
- {
- bool connected;
- {
- typename ConnectionBody<group_key_type, slot_type, ThreadingModel>::mutex_type::scoped_lock lock((*it)->mutex);
- if(grab_tracked)
- (*it)->nolock_slot_expired();
- connected = (*it)->nolock_nograb_connected();
- }// scoped lock destructs here, safe to erase now
- if(connected == false)
- {
- it = _shared_state->connection_bodies.erase((*it)->group_key(), it);
- }else
- {
- ++it;
- if(break_on_connected) break;
- }
- }
- _garbage_collector_it = it;
- }
- // clean up a few connections in constant time
- void nolock_cleanup_connections(bool grab_tracked) const
- {
- BOOST_ASSERT(_shared_state.unique());
- typename connection_list_type::iterator begin;
- if(_garbage_collector_it == _shared_state->connection_bodies.end())
- {
- begin = _shared_state->connection_bodies.begin();
- }else
- {
- begin = _garbage_collector_it;
- }
- nolock_cleanup_connections(grab_tracked, begin, true);
- }
- /* Make a new copy of the slot list if it is currently being read somewhere else
- */
- void nolock_force_unique_connection_list()
- {
- if(_shared_state.unique() == false)
- {
- shared_ptr<invocation_state> newState(new invocation_state(*_shared_state));
- _shared_state = newState;
- nolock_cleanup_connections(true, _shared_state->connection_bodies.begin());
- }else
- {
- nolock_cleanup_connections(true);
- }
- }
- shared_ptr<invocation_state> get_readable_state() const
- {
- typename mutex_type::scoped_lock listLock(_mutex);
- return _shared_state;
- }
- 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_type, ThreadingModel>(slot));
- }
- void do_disconnect(const group_type &group, mpl::bool_<true> is_group)
- {
- disconnect(group);
- }
- template<typename T>
- void do_disconnect(const T &slot, mpl::bool_<false> is_group)
- {
- shared_ptr<invocation_state> local_state =
- get_readable_state();
- typename connection_list_type::iterator it;
- for(it = local_state->connection_bodies.begin();
- it != local_state->connection_bodies.end(); ++it)
- {
- typename ConnectionBody<group_key_type, slot_type, ThreadingModel>::mutex_type::scoped_lock lock((*it)->mutex);
- if((*it)->slot.slot_function() == slot)
- {
- (*it)->nolock_disconnect();
- }
- }
- }
-
- shared_ptr<invocation_state> _shared_state;
- mutable typename connection_list_type::iterator _garbage_collector_it;
- // connection list mutex must never be locked when attempting a blocking lock on a slot,
- // or you could deadlock.
- mutable mutex_type _mutex;
- };
-
- template<BOOST_SIGNAL_TEMPLATE_DECL>
- class BOOST_WEAK_SIGNAL_CLASS_NAME;
- }
- }
-
- template<BOOST_SIGNAL_TEMPLATE_DEFAULTED_DECL>
- class BOOST_SIGNAL_CLASS_NAME: public signalslib::detail::signal_base
- {
- public:
- typedef signalslib::detail::BOOST_WEAK_SIGNAL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION> weak_signal_type;
- friend class signalslib::detail::BOOST_WEAK_SIGNAL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION>;
-
- typedef SlotFunction slot_function_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 typename signalslib::detail::BOOST_SIGNAL_IMPL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION>::slot_call_iterator
- slot_call_iterator;
+ private:
+ result_type m_invoke(const connection_body_type &connectionBody,
+ const signalslib::detail::unusable *) const
+ {
+ connectionBody->slot.slot_function()(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.slot_function()(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
+ // inside operator()
+ struct invocation_state
+ {
+ invocation_state(const connection_list_type &connections,
+ const combiner_type &combiner): connection_bodies(connections),
+ combiner(combiner)
+ {}
+ invocation_state(const invocation_state &other):
+ connection_bodies(other.connection_bodies),
+ combiner(other.combiner)
+ {}
+ connection_list_type connection_bodies;
+ combiner_type combiner;
+ };
+
+ // clean up disconnected connections
+ void nolock_cleanup_connections(bool grab_tracked,
+ const typename connection_list_type::iterator &begin, bool break_on_connected = false) const
+ {
+ BOOST_ASSERT(_shared_state.unique());
+ typename connection_list_type::iterator it;
+ for(it = begin; it != _shared_state->connection_bodies.end();)
+ {
+ bool connected;
+ {
+ typename ConnectionBody<group_key_type, slot_type, ThreadingModel>::mutex_type::scoped_lock lock((*it)->mutex);
+ if(grab_tracked)
+ (*it)->nolock_slot_expired();
+ connected = (*it)->nolock_nograb_connected();
+ }// scoped lock destructs here, safe to erase now
+ if(connected == false)
+ {
+ it = _shared_state->connection_bodies.erase((*it)->group_key(), it);
+ }else
+ {
+ ++it;
+ if(break_on_connected) break;
+ }
+ }
+ _garbage_collector_it = it;
+ }
+ // clean up a few connections in constant time
+ void nolock_cleanup_connections(bool grab_tracked) const
+ {
+ BOOST_ASSERT(_shared_state.unique());
+ typename connection_list_type::iterator begin;
+ if(_garbage_collector_it == _shared_state->connection_bodies.end())
+ {
+ begin = _shared_state->connection_bodies.begin();
+ }else
+ {
+ begin = _garbage_collector_it;
+ }
+ nolock_cleanup_connections(grab_tracked, begin, true);
+ }
+ /* Make a new copy of the slot list if it is currently being read somewhere else
+ */
+ void nolock_force_unique_connection_list()
+ {
+ if(_shared_state.unique() == false)
+ {
+ shared_ptr<invocation_state> newState(new invocation_state(*_shared_state));
+ _shared_state = newState;
+ nolock_cleanup_connections(true, _shared_state->connection_bodies.begin());
+ }else
+ {
+ nolock_cleanup_connections(true);
+ }
+ }
+ shared_ptr<invocation_state> get_readable_state() const
+ {
+ typename mutex_type::scoped_lock listLock(_mutex);
+ return _shared_state;
+ }
+ 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_type, ThreadingModel>(slot));
+ }
+ void do_disconnect(const group_type &group, mpl::bool_<true> is_group)
+ {
+ disconnect(group);
+ }
+ template<typename T>
+ void do_disconnect(const T &slot, mpl::bool_<false> is_group)
+ {
+ shared_ptr<invocation_state> local_state =
+ get_readable_state();
+ typename connection_list_type::iterator it;
+ for(it = local_state->connection_bodies.begin();
+ it != local_state->connection_bodies.end(); ++it)
+ {
+ typename ConnectionBody<group_key_type, slot_type, ThreadingModel>::mutex_type::scoped_lock lock((*it)->mutex);
+ if((*it)->slot.slot_function() == slot)
+ {
+ (*it)->nolock_disconnect();
+ }
+ }
+ }
+
+ shared_ptr<invocation_state> _shared_state;
+ mutable typename connection_list_type::iterator _garbage_collector_it;
+ // connection list mutex must never be locked when attempting a blocking lock on a slot,
+ // or you could deadlock.
+ mutable mutex_type _mutex;
+ };
+
+ template<BOOST_SIGNAL_TEMPLATE_DECL>
+ class BOOST_WEAK_SIGNAL_CLASS_NAME;
+ }
+ }
+
+ template<BOOST_SIGNAL_TEMPLATE_DEFAULTED_DECL>
+ class BOOST_SIGNAL_CLASS_NAME: public signalslib::detail::signal_base
+ {
+ public:
+ typedef signalslib::detail::BOOST_WEAK_SIGNAL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION> weak_signal_type;
+ friend class signalslib::detail::BOOST_WEAK_SIGNAL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION>;
+
+ typedef SlotFunction slot_function_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 typename signalslib::detail::BOOST_SIGNAL_IMPL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION>::slot_call_iterator
+ slot_call_iterator;
 // typedef Tn argn_type;
 #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(BOOST_SIGNALS_NUM_ARGS, BOOST_SIGNAL_MISC_STATEMENT, ~)
+ typedef BOOST_PP_CAT(T, BOOST_PP_INC(n)) BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(n)), _type);
+ 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;
+ typedef arg1_type argument_type;
 #elif BOOST_SIGNALS_NUM_ARGS == 2
- typedef arg1_type first_argument_type;
- typedef arg2_type second_argument_type;
+ typedef arg1_type first_argument_type;
+ typedef arg2_type second_argument_type;
 #endif
- BOOST_STATIC_CONSTANT(int, arity = BOOST_SIGNALS_NUM_ARGS);
+ BOOST_STATIC_CONSTANT(int, arity = BOOST_SIGNALS_NUM_ARGS);
 
- BOOST_SIGNAL_CLASS_NAME(const combiner_type &combiner = combiner_type(),
- const group_compare_type &group_compare = group_compare_type()):
- _pimpl(new signalslib::detail::BOOST_SIGNAL_IMPL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION>(combiner, group_compare))
- {};
- virtual ~BOOST_SIGNAL_CLASS_NAME()
- {
- disconnect_all_slots();
- }
- signalslib::connection connect(const slot_type &slot, signalslib::connect_position position = signalslib::at_back)
- {
- return (*_pimpl).connect(slot, position);
- }
- signalslib::connection connect(const group_type &group,
- const slot_type &slot, signalslib::connect_position position = signalslib::at_back)
- {
- return (*_pimpl).connect(group, slot, position);
- }
- void disconnect_all_slots()
- {
- (*_pimpl).disconnect_all_slots();
- }
- void disconnect(const group_type &group)
- {
- (*_pimpl).disconnect(group);
- }
- template <typename T>
- void disconnect(const T &slot)
- {
- (*_pimpl).disconnect(slot);
- }
- result_type operator ()(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS))
- {
- return (*_pimpl)(BOOST_SIGNAL_SIGNATURE_ARG_NAMES(BOOST_SIGNALS_NUM_ARGS));
- }
- result_type operator ()(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS)) const
- {
- return (*_pimpl)(BOOST_SIGNAL_SIGNATURE_ARG_NAMES(BOOST_SIGNALS_NUM_ARGS));
- }
- std::size_t num_slots() const
- {
- return (*_pimpl).num_slots();
- }
- bool empty() const
- {
- return (*_pimpl).empty();
- }
- combiner_type combiner() const
- {
- return (*_pimpl).combiner();
- }
- void set_combiner(const combiner_type &combiner)
- {
- return (*_pimpl).set_combiner(combiner);
- }
- protected:
- virtual shared_ptr<void> lock_pimpl() const
- {
- return _pimpl;
- }
- private:
- shared_ptr<signalslib::detail::BOOST_SIGNAL_IMPL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION> >
- _pimpl;
- };
-
- namespace signalslib
- {
- namespace detail
- {
- // wrapper class for storing other signals as slots with automatic lifetime tracking
- 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 typename BOOST_SIGNAL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION>::result_type
- result_type;
-
- BOOST_WEAK_SIGNAL_CLASS_NAME(const BOOST_SIGNAL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION>
- &signal):
- _weak_pimpl(signal._pimpl)
- {}
- result_type operator ()(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS))
- {
- shared_ptr<signalslib::detail::BOOST_SIGNAL_IMPL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION> >
- shared_pimpl(_weak_pimpl);
- return (*shared_pimpl)(BOOST_SIGNAL_SIGNATURE_ARG_NAMES(BOOST_SIGNALS_NUM_ARGS));
- }
- result_type operator ()(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS)) const
- {
- shared_ptr<signalslib::detail::BOOST_SIGNAL_IMPL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION> >
- shared_pimpl(_weak_pimpl);
- return (*shared_pimpl)(BOOST_SIGNAL_SIGNATURE_ARG_NAMES(BOOST_SIGNALS_NUM_ARGS));
- }
- private:
- boost::weak_ptr<signalslib::detail::BOOST_SIGNAL_IMPL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION> >
- _weak_pimpl;
- };
-
- template<unsigned arity, typename Signature, typename Combiner,
- typename Group, typename GroupCompare, typename SlotFunction, typename ThreadingModel>
- class signalN;
- // partial template specialization
- template<typename Signature, typename Combiner, typename Group,
- typename GroupCompare, typename SlotFunction, typename ThreadingModel>
- class signalN<BOOST_SIGNALS_NUM_ARGS, Signature, Combiner, Group,
- GroupCompare, SlotFunction, ThreadingModel>
- {
- public:
- typedef BOOST_SIGNAL_CLASS_NAME<
- BOOST_SIGNAL_PORTABLE_SIGNATURE(BOOST_SIGNALS_NUM_ARGS, Signature),
- Combiner, Group,
- GroupCompare, SlotFunction, ThreadingModel> type;
- };
- }
- }
+ BOOST_SIGNAL_CLASS_NAME(const combiner_type &combiner = combiner_type(),
+ const group_compare_type &group_compare = group_compare_type()):
+ _pimpl(new signalslib::detail::BOOST_SIGNAL_IMPL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION>(combiner, group_compare))
+ {};
+ virtual ~BOOST_SIGNAL_CLASS_NAME()
+ {
+ disconnect_all_slots();
+ }
+ signalslib::connection connect(const slot_type &slot, signalslib::connect_position position = signalslib::at_back)
+ {
+ return (*_pimpl).connect(slot, position);
+ }
+ signalslib::connection connect(const group_type &group,
+ const slot_type &slot, signalslib::connect_position position = signalslib::at_back)
+ {
+ return (*_pimpl).connect(group, slot, position);
+ }
+ void disconnect_all_slots()
+ {
+ (*_pimpl).disconnect_all_slots();
+ }
+ void disconnect(const group_type &group)
+ {
+ (*_pimpl).disconnect(group);
+ }
+ template <typename T>
+ void disconnect(const T &slot)
+ {
+ (*_pimpl).disconnect(slot);
+ }
+ result_type operator ()(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS))
+ {
+ return (*_pimpl)(BOOST_SIGNAL_SIGNATURE_ARG_NAMES(BOOST_SIGNALS_NUM_ARGS));
+ }
+ result_type operator ()(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS)) const
+ {
+ return (*_pimpl)(BOOST_SIGNAL_SIGNATURE_ARG_NAMES(BOOST_SIGNALS_NUM_ARGS));
+ }
+ std::size_t num_slots() const
+ {
+ return (*_pimpl).num_slots();
+ }
+ bool empty() const
+ {
+ return (*_pimpl).empty();
+ }
+ combiner_type combiner() const
+ {
+ return (*_pimpl).combiner();
+ }
+ void set_combiner(const combiner_type &combiner)
+ {
+ return (*_pimpl).set_combiner(combiner);
+ }
+ protected:
+ virtual shared_ptr<void> lock_pimpl() const
+ {
+ return _pimpl;
+ }
+ private:
+ shared_ptr<signalslib::detail::BOOST_SIGNAL_IMPL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION> >
+ _pimpl;
+ };
+
+ namespace signalslib
+ {
+ namespace detail
+ {
+ // wrapper class for storing other signals as slots with automatic lifetime tracking
+ 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 typename BOOST_SIGNAL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION>::result_type
+ result_type;
+
+ BOOST_WEAK_SIGNAL_CLASS_NAME(const BOOST_SIGNAL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION>
+ &signal):
+ _weak_pimpl(signal._pimpl)
+ {}
+ result_type operator ()(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS))
+ {
+ shared_ptr<signalslib::detail::BOOST_SIGNAL_IMPL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION> >
+ shared_pimpl(_weak_pimpl);
+ return (*shared_pimpl)(BOOST_SIGNAL_SIGNATURE_ARG_NAMES(BOOST_SIGNALS_NUM_ARGS));
+ }
+ result_type operator ()(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS)) const
+ {
+ shared_ptr<signalslib::detail::BOOST_SIGNAL_IMPL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION> >
+ shared_pimpl(_weak_pimpl);
+ return (*shared_pimpl)(BOOST_SIGNAL_SIGNATURE_ARG_NAMES(BOOST_SIGNALS_NUM_ARGS));
+ }
+ private:
+ boost::weak_ptr<signalslib::detail::BOOST_SIGNAL_IMPL_CLASS_NAME<BOOST_SIGNAL_TEMPLATE_INSTANTIATION> >
+ _weak_pimpl;
+ };
+
+ template<unsigned arity, typename Signature, typename Combiner,
+ typename Group, typename GroupCompare, typename SlotFunction, typename ThreadingModel>
+ class signalN;
+ // partial template specialization
+ template<typename Signature, typename Combiner, typename Group,
+ typename GroupCompare, typename SlotFunction, typename ThreadingModel>
+ class signalN<BOOST_SIGNALS_NUM_ARGS, Signature, Combiner, Group,
+ GroupCompare, SlotFunction, ThreadingModel>
+ {
+ public:
+ typedef BOOST_SIGNAL_CLASS_NAME<
+ BOOST_SIGNAL_PORTABLE_SIGNATURE(BOOST_SIGNALS_NUM_ARGS, Signature),
+ Combiner, Group,
+ GroupCompare, SlotFunction, ThreadingModel> type;
+ };
+ }
+ }
 }
 
 #undef BOOST_SIGNALS_NUM_ARGS

Modified: sandbox/thread_safe_signals/boost/thread_safe_signals/detail/slot_call_iterator.hpp
==============================================================================
--- sandbox/thread_safe_signals/boost/thread_safe_signals/detail/slot_call_iterator.hpp (original)
+++ sandbox/thread_safe_signals/boost/thread_safe_signals/detail/slot_call_iterator.hpp 2007-09-21 14:59:41 EDT (Fri, 21 Sep 2007)
@@ -27,101 +27,101 @@
 #endif
 
 namespace boost {
- namespace signalslib {
- namespace detail {
- // Generates a slot call iterator. Essentially, this is an iterator that:
- // - skips over disconnected slots in the underlying list
- // - calls the connected slots when dereferenced
- // - caches the result of calling the slots
- template<typename Function, typename Iterator, typename ConnectionBody>
- class slot_call_iterator_t
- : public boost::iterator_facade<slot_call_iterator_t<Function, Iterator, ConnectionBody>,
- typename Function::result_type,
- boost::single_pass_traversal_tag,
- typename Function::result_type const&>
- {
- typedef boost::iterator_facade<slot_call_iterator_t<Function, Iterator, ConnectionBody>,
- typename Function::result_type,
- 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):
- iter(iter_in), end(end_in), f(f),
- cache(&c), callable_iter(end_in)
- {
- lockNextCallable();
- }
-
- typename inherited::reference
- dereference() const
- {
- if (!(*cache)) {
- try
- {
- cache->reset(f(*iter));
- }
- catch(const expired_slot &)
- {
- (*iter)->disconnect();
- throw;
- }
- }
- 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)
- {
- return;
- }
- for(;iter != end; ++iter)
- {
- lock_type lock((*iter)->mutex);
- tracked_ptrs = (*iter)->nolock_grab_tracked_objects();
- if((*iter)->nolock_nograb_blocked() == false)
- {
- callable_iter = iter;
- break;
- }
- }
- if(iter == end)
- {
- callable_iter = end;
- }
- }
-
- mutable Iterator iter;
- Iterator end;
- Function f;
- optional<result_type>* cache;
- mutable Iterator callable_iter;
- mutable typename slot_base::locked_container_type tracked_ptrs;
- };
- } // end namespace detail
- } // end namespace BOOST_SIGNALS_NAMESPACE
+ namespace signalslib {
+ namespace detail {
+ // Generates a slot call iterator. Essentially, this is an iterator that:
+ // - skips over disconnected slots in the underlying list
+ // - calls the connected slots when dereferenced
+ // - caches the result of calling the slots
+ template<typename Function, typename Iterator, typename ConnectionBody>
+ class slot_call_iterator_t
+ : public boost::iterator_facade<slot_call_iterator_t<Function, Iterator, ConnectionBody>,
+ typename Function::result_type,
+ boost::single_pass_traversal_tag,
+ typename Function::result_type const&>
+ {
+ typedef boost::iterator_facade<slot_call_iterator_t<Function, Iterator, ConnectionBody>,
+ typename Function::result_type,
+ 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):
+ iter(iter_in), end(end_in), f(f),
+ cache(&c), callable_iter(end_in)
+ {
+ lockNextCallable();
+ }
+
+ typename inherited::reference
+ dereference() const
+ {
+ if (!(*cache)) {
+ try
+ {
+ cache->reset(f(*iter));
+ }
+ catch(const expired_slot &)
+ {
+ (*iter)->disconnect();
+ throw;
+ }
+ }
+ 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)
+ {
+ return;
+ }
+ for(;iter != end; ++iter)
+ {
+ lock_type lock((*iter)->mutex);
+ tracked_ptrs = (*iter)->nolock_grab_tracked_objects();
+ if((*iter)->nolock_nograb_blocked() == false)
+ {
+ callable_iter = iter;
+ break;
+ }
+ }
+ if(iter == end)
+ {
+ callable_iter = end;
+ }
+ }
+
+ mutable Iterator iter;
+ Iterator end;
+ Function f;
+ optional<result_type>* cache;
+ mutable Iterator callable_iter;
+ mutable typename slot_base::locked_container_type tracked_ptrs;
+ };
+ } // end namespace detail
+ } // end namespace BOOST_SIGNALS_NAMESPACE
 } // end namespace boost
 
 #ifdef BOOST_HAS_ABI_HEADERS

Modified: sandbox/thread_safe_signals/boost/thread_safe_signals/detail/slot_groups.hpp
==============================================================================
--- sandbox/thread_safe_signals/boost/thread_safe_signals/detail/slot_groups.hpp (original)
+++ sandbox/thread_safe_signals/boost/thread_safe_signals/detail/slot_groups.hpp 2007-09-21 14:59:41 EDT (Fri, 21 Sep 2007)
@@ -21,180 +21,180 @@
 #endif
 
 namespace boost {
- namespace signalslib {
- namespace detail {
- enum slot_meta_group {front_ungrouped_slots, grouped_slots, back_ungrouped_slots};
- template<typename Group>
- struct group_key
- {
- typedef std::pair<enum slot_meta_group, boost::optional<Group> > type;
- };
+ namespace signalslib {
+ namespace detail {
+ enum slot_meta_group {front_ungrouped_slots, grouped_slots, back_ungrouped_slots};
+ template<typename Group>
+ struct group_key
+ {
+ typedef std::pair<enum slot_meta_group, boost::optional<Group> > type;
+ };
 #if 0
- template <typename T>
- void print_key(const T &key)
- {
- std::cerr << "key: " << key.first << " ";
- if(key.second)
- std::cerr << key.second.get();
- else
- std::cerr << "uninitialized";
- std::cerr << std::endl;
- }
+ template <typename T>
+ void print_key(const T &key)
+ {
+ std::cerr << "key: " << key.first << " ";
+ if(key.second)
+ std::cerr << key.second.get();
+ else
+ std::cerr << "uninitialized";
+ std::cerr << std::endl;
+ }
 #endif
- template<typename Group, typename GroupCompare>
- class group_key_less
- {
- public:
- group_key_less()
- {}
- group_key_less(const GroupCompare &group_compare): _group_compare(group_compare)
- {}
- bool operator ()(const typename group_key<Group>::type &key1, const typename group_key<Group>::type &key2) const
- {
- if(key1.first != key2.first) return key1.first < key2.first;
- if(key1.first != grouped_slots) return false;
- return _group_compare(key1.second.get(), key2.second.get());
- }
- private:
- GroupCompare _group_compare;
- };
- template<typename Group, typename GroupCompare, typename ValueType>
- class grouped_list
- {
- private:
- typedef std::list<ValueType> list_type;
- typedef std::map<typename group_key<Group>::type, typename list_type::iterator> map_type;
- typedef typename map_type::iterator map_iterator;
- public:
- typedef typename list_type::iterator iterator;
- typedef typename group_key<Group>::type group_key_type;
- typedef group_key_less<Group, GroupCompare> group_key_compare_type;
+ template<typename Group, typename GroupCompare>
+ class group_key_less
+ {
+ public:
+ group_key_less()
+ {}
+ group_key_less(const GroupCompare &group_compare): _group_compare(group_compare)
+ {}
+ bool operator ()(const typename group_key<Group>::type &key1, const typename group_key<Group>::type &key2) const
+ {
+ if(key1.first != key2.first) return key1.first < key2.first;
+ if(key1.first != grouped_slots) return false;
+ return _group_compare(key1.second.get(), key2.second.get());
+ }
+ private:
+ GroupCompare _group_compare;
+ };
+ template<typename Group, typename GroupCompare, typename ValueType>
+ class grouped_list
+ {
+ private:
+ typedef std::list<ValueType> list_type;
+ typedef std::map<typename group_key<Group>::type, typename list_type::iterator> map_type;
+ typedef typename map_type::iterator map_iterator;
+ public:
+ typedef typename list_type::iterator iterator;
+ typedef typename group_key<Group>::type group_key_type;
+ typedef group_key_less<Group, GroupCompare> group_key_compare_type;
 
- grouped_list(const group_key_compare_type &group_key_compare):
- _group_key_compare(group_key_compare)
- {}
- iterator begin()
- {
- return _list.begin();
- }
- iterator end()
- {
- return _list.end();
- }
- iterator lower_bound(const group_key_type &key)
- {
- map_iterator map_it = _group_map.lower_bound(key);
- return get_list_iterator(map_it);
- }
- iterator upper_bound(const group_key_type &key)
- {
- map_iterator map_it = _group_map.upper_bound(key);
- return get_list_iterator(map_it);
- }
- void push_front(const group_key_type &key, const ValueType &value)
- {
- map_iterator map_it;
- if(key.first == front_ungrouped_slots)
- {// optimization
- map_it = _group_map.begin();
- }else
- {
- map_it = _group_map.lower_bound(key);
- }
- m_insert(map_it, key, value);
- }
- void push_back(const group_key_type &key, const ValueType &value)
- {
- map_iterator map_it;
- if(key.first == back_ungrouped_slots)
- {// optimization
- map_it = _group_map.end();
- }else
- {
- map_it = _group_map.upper_bound(key);
- }
- m_insert(map_it, key, value);
- }
- void erase(const group_key_type &key)
- {
- map_iterator map_it = _group_map.lower_bound(key);
- iterator begin_list_it = get_list_iterator(map_it);
- iterator end_list_it = upper_bound(key);
- if(begin_list_it != end_list_it)
- {
- _list.erase(begin_list_it, end_list_it);
- _group_map.erase(map_it);
- }
- }
- iterator erase(const group_key_type &key, const iterator &it)
- {
- BOOST_ASSERT(it != _list.end());
- map_iterator map_it = _group_map.lower_bound(key);
- BOOST_ASSERT(map_it != _group_map.end());
- BOOST_ASSERT(weakly_equivalent(map_it->first, key));
- if(map_it->second == it)
- {
- iterator next = it;
- ++next;
- // if next is in same group
- if(next != upper_bound(key))
- {
- _group_map[key] = next;
- }else
- {
- _group_map.erase(map_it);
- }
- }
- return _list.erase(it);
- }
- void clear()
- {
- _list.clear();
- _group_map.clear();
- }
- private:
- bool weakly_equivalent(const group_key_type &arg1, const group_key_type &arg2)
- {
- if(_group_key_compare(arg1, arg2)) return false;
- if(_group_key_compare(arg2, arg1)) return false;
- return true;
- }
- void m_insert(map_iterator map_it, const group_key_type &key, const ValueType &value)
- {
- iterator list_it = get_list_iterator(map_it);
- iterator new_it = _list.insert(list_it, value);
- if(map_it != _group_map.end() && weakly_equivalent(key, map_it->first))
- {
- _group_map.erase(map_it);
- }
- map_iterator lower_bound_it = _group_map.lower_bound(key);
- if(lower_bound_it == _group_map.end() ||
- weakly_equivalent(lower_bound_it->first, key) == false)
- {
- _group_map[key] = new_it;
- }
- }
- iterator get_list_iterator(const map_iterator &map_it)
- {
- iterator list_it;
- if(map_it == _group_map.end())
- {
- list_it = _list.end();
- }else
- {
- list_it = map_it->second;
- }
- return list_it;
- }
+ grouped_list(const group_key_compare_type &group_key_compare):
+ _group_key_compare(group_key_compare)
+ {}
+ iterator begin()
+ {
+ return _list.begin();
+ }
+ iterator end()
+ {
+ return _list.end();
+ }
+ iterator lower_bound(const group_key_type &key)
+ {
+ map_iterator map_it = _group_map.lower_bound(key);
+ return get_list_iterator(map_it);
+ }
+ iterator upper_bound(const group_key_type &key)
+ {
+ map_iterator map_it = _group_map.upper_bound(key);
+ return get_list_iterator(map_it);
+ }
+ void push_front(const group_key_type &key, const ValueType &value)
+ {
+ map_iterator map_it;
+ if(key.first == front_ungrouped_slots)
+ {// optimization
+ map_it = _group_map.begin();
+ }else
+ {
+ map_it = _group_map.lower_bound(key);
+ }
+ m_insert(map_it, key, value);
+ }
+ void push_back(const group_key_type &key, const ValueType &value)
+ {
+ map_iterator map_it;
+ if(key.first == back_ungrouped_slots)
+ {// optimization
+ map_it = _group_map.end();
+ }else
+ {
+ map_it = _group_map.upper_bound(key);
+ }
+ m_insert(map_it, key, value);
+ }
+ void erase(const group_key_type &key)
+ {
+ map_iterator map_it = _group_map.lower_bound(key);
+ iterator begin_list_it = get_list_iterator(map_it);
+ iterator end_list_it = upper_bound(key);
+ if(begin_list_it != end_list_it)
+ {
+ _list.erase(begin_list_it, end_list_it);
+ _group_map.erase(map_it);
+ }
+ }
+ iterator erase(const group_key_type &key, const iterator &it)
+ {
+ BOOST_ASSERT(it != _list.end());
+ map_iterator map_it = _group_map.lower_bound(key);
+ BOOST_ASSERT(map_it != _group_map.end());
+ BOOST_ASSERT(weakly_equivalent(map_it->first, key));
+ if(map_it->second == it)
+ {
+ iterator next = it;
+ ++next;
+ // if next is in same group
+ if(next != upper_bound(key))
+ {
+ _group_map[key] = next;
+ }else
+ {
+ _group_map.erase(map_it);
+ }
+ }
+ return _list.erase(it);
+ }
+ void clear()
+ {
+ _list.clear();
+ _group_map.clear();
+ }
+ private:
+ bool weakly_equivalent(const group_key_type &arg1, const group_key_type &arg2)
+ {
+ if(_group_key_compare(arg1, arg2)) return false;
+ if(_group_key_compare(arg2, arg1)) return false;
+ return true;
+ }
+ void m_insert(map_iterator map_it, const group_key_type &key, const ValueType &value)
+ {
+ iterator list_it = get_list_iterator(map_it);
+ iterator new_it = _list.insert(list_it, value);
+ if(map_it != _group_map.end() && weakly_equivalent(key, map_it->first))
+ {
+ _group_map.erase(map_it);
+ }
+ map_iterator lower_bound_it = _group_map.lower_bound(key);
+ if(lower_bound_it == _group_map.end() ||
+ weakly_equivalent(lower_bound_it->first, key) == false)
+ {
+ _group_map[key] = new_it;
+ }
+ }
+ iterator get_list_iterator(const map_iterator &map_it)
+ {
+ iterator list_it;
+ if(map_it == _group_map.end())
+ {
+ list_it = _list.end();
+ }else
+ {
+ list_it = map_it->second;
+ }
+ return list_it;
+ }
 
- list_type _list;
- // holds iterators to first list item in each group
- map_type _group_map;
- group_key_compare_type _group_key_compare;
- };
- } // end namespace detail
- enum connect_position { at_back, at_front };
- } // end namespace signalslib
+ list_type _list;
+ // holds iterators to first list item in each group
+ map_type _group_map;
+ group_key_compare_type _group_key_compare;
+ };
+ } // end namespace detail
+ enum connect_position { at_back, at_front };
+ } // end namespace signalslib
 } // end namespace EPG
 
 #ifdef BOOST_HAS_ABI_HEADERS

Modified: sandbox/thread_safe_signals/boost/thread_safe_signals/detail/slot_template.hpp
==============================================================================
--- sandbox/thread_safe_signals/boost/thread_safe_signals/detail/slot_template.hpp (original)
+++ sandbox/thread_safe_signals/boost/thread_safe_signals/detail/slot_template.hpp 2007-09-21 14:59:41 EDT (Fri, 21 Sep 2007)
@@ -18,112 +18,112 @@
 
 namespace boost
 {
- template<typename Signature, typename SlotFunction> class slot;
+ template<typename Signature, typename SlotFunction> class slot;
 
- // 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:
- template<BOOST_SIGNAL_PREFIXED_SIGNATURE_TEMPLATE_DECL(BOOST_SIGNALS_NUM_ARGS, Other), typename OtherSlotFunction>
- friend class BOOST_SLOT_CLASS_NAME(BOOST_SIGNALS_NUM_ARGS);
+ // 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:
+ template<BOOST_SIGNAL_PREFIXED_SIGNATURE_TEMPLATE_DECL(BOOST_SIGNALS_NUM_ARGS, Other), typename OtherSlotFunction>
+ friend class BOOST_SLOT_CLASS_NAME(BOOST_SIGNALS_NUM_ARGS);
 
- typedef SlotFunction slot_function_type;
- typedef R result_type;
+ typedef SlotFunction slot_function_type;
+ typedef R result_type;
 // typedef Tn argn_type;
 #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(BOOST_SIGNALS_NUM_ARGS, BOOST_SIGNAL_MISC_STATEMENT, ~)
+ typedef BOOST_PP_CAT(T, BOOST_PP_INC(n)) BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(n)), _type);
+ 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;
+ typedef arg1_type argument_type;
 #elif BOOST_SIGNALS_NUM_ARGS == 2
- typedef arg1_type first_argument_type;
- typedef arg2_type second_argument_type;
+ typedef arg1_type first_argument_type;
+ typedef arg2_type second_argument_type;
 #endif
- BOOST_STATIC_CONSTANT(int, arity = BOOST_SIGNALS_NUM_ARGS);
+ BOOST_STATIC_CONSTANT(int, arity = BOOST_SIGNALS_NUM_ARGS);
 
- 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)))
- {
- }
- // copy constructors
- template<BOOST_SIGNAL_PREFIXED_SIGNATURE_TEMPLATE_DECL(BOOST_SIGNALS_NUM_ARGS, Other), typename OtherSlotFunction>
- BOOST_SLOT_CLASS_NAME(BOOST_SIGNALS_NUM_ARGS)(const BOOST_SLOT_CLASS_NAME(BOOST_SIGNALS_NUM_ARGS)
- <BOOST_SIGNAL_PREFIXED_SIGNATURE_TEMPLATE_INSTANTIATION(BOOST_SIGNALS_NUM_ARGS, Other), OtherSlotFunction> &other_slot):
- signalslib::detail::slot_base(other_slot), _slot_function(other_slot._slot_function)
- {
- }
- template<typename Signature, typename OtherSlotFunction>
- BOOST_SLOT_CLASS_NAME(BOOST_SIGNALS_NUM_ARGS)(const slot<Signature, OtherSlotFunction> &other_slot):
- signalslib::detail::slot_base(other_slot), _slot_function(other_slot._slot_function)
- {
- }
- // bind syntactic sugar
+ 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)))
+ {
+ }
+ // copy constructors
+ template<BOOST_SIGNAL_PREFIXED_SIGNATURE_TEMPLATE_DECL(BOOST_SIGNALS_NUM_ARGS, Other), typename OtherSlotFunction>
+ BOOST_SLOT_CLASS_NAME(BOOST_SIGNALS_NUM_ARGS)(const BOOST_SLOT_CLASS_NAME(BOOST_SIGNALS_NUM_ARGS)
+ <BOOST_SIGNAL_PREFIXED_SIGNATURE_TEMPLATE_INSTANTIATION(BOOST_SIGNALS_NUM_ARGS, Other), OtherSlotFunction> &other_slot):
+ signalslib::detail::slot_base(other_slot), _slot_function(other_slot._slot_function)
+ {
+ }
+ template<typename Signature, typename OtherSlotFunction>
+ BOOST_SLOT_CLASS_NAME(BOOST_SIGNALS_NUM_ARGS)(const slot<Signature, OtherSlotFunction> &other_slot):
+ signalslib::detail::slot_base(other_slot), _slot_function(other_slot._slot_function)
+ {
+ }
+ // bind syntactic sugar
 // ArgTypeN argN
 #define BOOST_SLOT_BINDING_ARG_DECL(z, n, data) \
- BOOST_PP_CAT(ArgType, n) BOOST_PP_CAT(arg, n)
+ 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))) \
- {}
+ 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, ~)
+ 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
- // invocation
- R operator()(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS))
- {
- locked_container_type locked_objects = lock();
- return _slot_function(BOOST_SIGNAL_SIGNATURE_ARG_NAMES(BOOST_SIGNALS_NUM_ARGS));
- }
- R operator()(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS)) const
- {
- locked_container_type locked_objects = lock();
- return _slot_function(BOOST_SIGNAL_SIGNATURE_ARG_NAMES(BOOST_SIGNALS_NUM_ARGS));
- }
- // tracking
- 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 signalslib::detail::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;
- }
-
- const slot_function_type& slot_function() const {return _slot_function;}
- slot_function_type& slot_function() {return _slot_function;}
- 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;
- };
- }
- }
+ // invocation
+ R operator()(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS))
+ {
+ locked_container_type locked_objects = lock();
+ return _slot_function(BOOST_SIGNAL_SIGNATURE_ARG_NAMES(BOOST_SIGNALS_NUM_ARGS));
+ }
+ R operator()(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS)) const
+ {
+ locked_container_type locked_objects = lock();
+ return _slot_function(BOOST_SIGNAL_SIGNATURE_ARG_NAMES(BOOST_SIGNALS_NUM_ARGS));
+ }
+ // tracking
+ 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 signalslib::detail::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;
+ }
+
+ const slot_function_type& slot_function() const {return _slot_function;}
+ slot_function_type& slot_function() {return _slot_function;}
+ 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

Modified: sandbox/thread_safe_signals/boost/thread_safe_signals/multi_threaded.hpp
==============================================================================
--- sandbox/thread_safe_signals/boost/thread_safe_signals/multi_threaded.hpp (original)
+++ sandbox/thread_safe_signals/boost/thread_safe_signals/multi_threaded.hpp 2007-09-21 14:59:41 EDT (Fri, 21 Sep 2007)
@@ -18,13 +18,13 @@
 #endif
 
 namespace boost {
- namespace signalslib {
- class multi_threaded
- {
- public:
- typedef mutex mutex_type;
- };
- } // end namespace signalslib
+ namespace signalslib {
+ class multi_threaded
+ {
+ public:
+ typedef mutex mutex_type;
+ };
+ } // end namespace signalslib
 } // end namespace boost
 
 #ifdef BOOST_HAS_ABI_HEADERS

Modified: sandbox/thread_safe_signals/boost/thread_safe_signals/shared_connection_block.hpp
==============================================================================
--- sandbox/thread_safe_signals/boost/thread_safe_signals/shared_connection_block.hpp (original)
+++ sandbox/thread_safe_signals/boost/thread_safe_signals/shared_connection_block.hpp 2007-09-21 14:59:41 EDT (Fri, 21 Sep 2007)
@@ -21,36 +21,36 @@
 
 namespace boost
 {
- namespace signalslib
- {
- class shared_connection_block
- {
- public:
- shared_connection_block(connection &conn):
- _weakConnectionBody(conn._weakConnectionBody)
- {
- block();
- }
- void block()
- {
- if(_blocker) return;
- boost::shared_ptr<detail::ConnectionBodyBase> connectionBody(_weakConnectionBody.lock());
- if(connectionBody == 0) return;
- _blocker = connectionBody->get_blocker();
- }
- void unblock()
- {
- _blocker.reset();
- }
- bool blocking() const
- {
- return _blocker != 0;
- }
- private:
- boost::weak_ptr<detail::ConnectionBodyBase> _weakConnectionBody;
- shared_ptr<void> _blocker;
- };
- }
+ namespace signalslib
+ {
+ class shared_connection_block
+ {
+ public:
+ shared_connection_block(connection &conn):
+ _weakConnectionBody(conn._weakConnectionBody)
+ {
+ block();
+ }
+ void block()
+ {
+ if(_blocker) return;
+ boost::shared_ptr<detail::ConnectionBodyBase> connectionBody(_weakConnectionBody.lock());
+ if(connectionBody == 0) return;
+ _blocker = connectionBody->get_blocker();
+ }
+ void unblock()
+ {
+ _blocker.reset();
+ }
+ bool blocking() const
+ {
+ return _blocker != 0;
+ }
+ private:
+ boost::weak_ptr<detail::ConnectionBodyBase> _weakConnectionBody;
+ shared_ptr<void> _blocker;
+ };
+ }
 } // end namespace boost
 
 #ifdef BOOST_HAS_ABI_HEADERS

Modified: sandbox/thread_safe_signals/boost/thread_safe_signals/single_threaded.hpp
==============================================================================
--- sandbox/thread_safe_signals/boost/thread_safe_signals/single_threaded.hpp (original)
+++ sandbox/thread_safe_signals/boost/thread_safe_signals/single_threaded.hpp 2007-09-21 14:59:41 EDT (Fri, 21 Sep 2007)
@@ -17,32 +17,32 @@
 #endif
 
 namespace boost {
- namespace signalslib {
- namespace detail
- {
- class null_mutex;
+ namespace signalslib {
+ namespace detail
+ {
+ class null_mutex;
 
- class null_scoped_lock
- {
- public:
- null_scoped_lock(null_mutex &mutex)
- {
- boost::ignore_unused_variable_warning(mutex);
- }
- };
- class null_mutex
- {
- public:
- typedef null_scoped_lock scoped_lock;
- };
- }
+ class null_scoped_lock
+ {
+ public:
+ null_scoped_lock(null_mutex &mutex)
+ {
+ boost::ignore_unused_variable_warning(mutex);
+ }
+ };
+ class null_mutex
+ {
+ public:
+ typedef null_scoped_lock scoped_lock;
+ };
+ }
 
- class single_threaded
- {
- public:
- typedef detail::null_mutex mutex_type;
- };
- } // end namespace signalslib
+ class single_threaded
+ {
+ public:
+ typedef detail::null_mutex mutex_type;
+ };
+ } // end namespace signalslib
 } // end namespace boost
 
 #ifdef BOOST_HAS_ABI_HEADERS

Modified: sandbox/thread_safe_signals/boost/thread_safe_signals/slot.hpp
==============================================================================
--- sandbox/thread_safe_signals/boost/thread_safe_signals/slot.hpp (original)
+++ sandbox/thread_safe_signals/boost/thread_safe_signals/slot.hpp 2007-09-21 14:59:41 EDT (Fri, 21 Sep 2007)
@@ -30,39 +30,39 @@
 
 namespace boost
 {
- namespace signalslib
- {
- namespace detail
- {
- // Get the slot so that it can be copied
- template<typename F>
- typename F::weak_signal_type
- get_invocable_slot(const F &signal, signalslib::detail::signal_tag)
- { return typename F::weak_signal_type(signal); }
-
- template<typename F>
- const F&
- get_invocable_slot(const F& f, signalslib::detail::reference_tag)
- { return f; }
-
- template<typename F>
- const F&
- get_invocable_slot(const F& f, signalslib::detail::value_tag)
- { return f; }
-
- // Determines the type of the slot - is it a signal, a reference to a
- // slot or just a normal slot.
- template<typename F>
- typename signalslib::detail::get_slot_tag<F>::type
- tag_type(const F&)
- {
- typedef typename signalslib::detail::get_slot_tag<F>::type
- the_tag_type;
- the_tag_type tag = the_tag_type();
- return tag;
- }
- }
- }
+ namespace signalslib
+ {
+ namespace detail
+ {
+ // Get the slot so that it can be copied
+ template<typename F>
+ typename F::weak_signal_type
+ get_invocable_slot(const F &signal, signalslib::detail::signal_tag)
+ { return typename F::weak_signal_type(signal); }
+
+ template<typename F>
+ const F&
+ get_invocable_slot(const F& f, signalslib::detail::reference_tag)
+ { return f; }
+
+ template<typename F>
+ const F&
+ get_invocable_slot(const F& f, signalslib::detail::value_tag)
+ { return f; }
+
+ // Determines the type of the slot - is it a signal, a reference to a
+ // slot or just a normal slot.
+ template<typename F>
+ typename signalslib::detail::get_slot_tag<F>::type
+ tag_type(const F&)
+ {
+ typedef typename signalslib::detail::get_slot_tag<F>::type
+ the_tag_type;
+ the_tag_type tag = the_tag_type();
+ return tag;
+ }
+ }
+ }
 } // end namespace boost
 
 #define BOOST_PP_ITERATION_LIMITS (0, BOOST_SIGNALS_MAX_ARGS)
@@ -71,34 +71,34 @@
 
 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): base_type(f)
- {}
- // bind syntactic sugar
+ 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): 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)
+ 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)) \
- {}
+ 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, ~)
+ 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
- };
+ };
 }
 
 #ifdef BOOST_HAS_ABI_HEADERS

Modified: sandbox/thread_safe_signals/boost/thread_safe_signals/slot_base.hpp
==============================================================================
--- sandbox/thread_safe_signals/boost/thread_safe_signals/slot_base.hpp (original)
+++ sandbox/thread_safe_signals/boost/thread_safe_signals/slot_base.hpp 2007-09-21 14:59:41 EDT (Fri, 21 Sep 2007)
@@ -23,62 +23,62 @@
 
 namespace boost
 {
- class expired_slot: public bad_weak_ptr
- {
- public:
- virtual char const * what() const throw()
- {
- return "boost::expired_slot";
- }
- };
-
- 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)
- {
- try
- {
- locked_objects.push_back(shared_ptr<void>(*it));
- }
- catch(const bad_weak_ptr &)
- {
- throw expired_slot();
- }
- }
- return locked_objects;
- }
- bool expired() const
- {
- tracked_container_type::const_iterator it;
- for(it = tracked_objects().begin(); it != tracked_objects().end(); ++it)
- {
- if(it->expired()) return true;
- }
- return false;
- }
- protected:
- void track_signal(const signalslib::detail::signal_base &signal)
- {
- _trackedObjects.push_back(signal.lock_pimpl());
- }
-
- tracked_container_type _trackedObjects;
- };
- }
- }
+ class expired_slot: public bad_weak_ptr
+ {
+ public:
+ virtual char const * what() const throw()
+ {
+ return "boost::expired_slot";
+ }
+ };
+
+ 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)
+ {
+ try
+ {
+ locked_objects.push_back(shared_ptr<void>(*it));
+ }
+ catch(const bad_weak_ptr &)
+ {
+ throw expired_slot();
+ }
+ }
+ return locked_objects;
+ }
+ bool expired() const
+ {
+ tracked_container_type::const_iterator it;
+ for(it = tracked_objects().begin(); it != tracked_objects().end(); ++it)
+ {
+ if(it->expired()) return true;
+ }
+ return false;
+ }
+ protected:
+ void track_signal(const signalslib::detail::signal_base &signal)
+ {
+ _trackedObjects.push_back(signal.lock_pimpl());
+ }
+
+ tracked_container_type _trackedObjects;
+ };
+ }
+ }
 } // end namespace boost
 
 #ifdef BOOST_HAS_ABI_HEADERS


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