Changed some names to better conform to boost coding guidelines.
[SVN r48942]
This commit is contained in:
parent
7c2e42b5ce
commit
ac38694500
@ -1,15 +1,16 @@
|
||||
/*
|
||||
boost::signals2::connection provides a handle to a signal/slot connection.
|
||||
|
||||
Author: Frank Mori Hess <fmhess@users.sourceforge.net>
|
||||
Begin: 2007-01-23
|
||||
*/
|
||||
// Copyright Frank Mori Hess 2007-2008.
|
||||
//
|
||||
// Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// Distributed under 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)
|
||||
|
||||
// See http://www.boost.org/libs/signals2 for library home page.
|
||||
|
||||
#ifndef BOOST_TSS_CONNECTION_HEADER
|
||||
#define BOOST_TSS_CONNECTION_HEADER
|
||||
|
||||
@ -30,14 +31,14 @@ namespace boost
|
||||
extern inline void null_deleter(const void*) {}
|
||||
namespace detail
|
||||
{
|
||||
class ConnectionBodyBase
|
||||
class connection_body_base
|
||||
{
|
||||
public:
|
||||
ConnectionBodyBase():
|
||||
connection_body_base():
|
||||
_connected(true)
|
||||
{
|
||||
}
|
||||
virtual ~ConnectionBodyBase() {}
|
||||
virtual ~connection_body_base() {}
|
||||
virtual void disconnect() = 0;
|
||||
void nolock_disconnect()
|
||||
{
|
||||
@ -61,15 +62,15 @@ namespace boost
|
||||
};
|
||||
|
||||
template<typename GroupKey, typename SlotType, typename ThreadingModel>
|
||||
class ConnectionBody: public ConnectionBodyBase
|
||||
class connection_body: public connection_body_base
|
||||
{
|
||||
public:
|
||||
typedef typename ThreadingModel::mutex_type mutex_type;
|
||||
ConnectionBody(const SlotType &slot_in):
|
||||
connection_body(const SlotType &slot_in):
|
||||
slot(slot_in)
|
||||
{
|
||||
}
|
||||
virtual ~ConnectionBody() {}
|
||||
virtual ~connection_body() {}
|
||||
virtual void disconnect()
|
||||
{
|
||||
typename mutex_type::scoped_lock lock(mutex);
|
||||
@ -132,50 +133,50 @@ namespace boost
|
||||
friend class shared_connection_block;
|
||||
|
||||
connection() {}
|
||||
connection(const connection &other): _weakConnectionBody(other._weakConnectionBody)
|
||||
connection(const connection &other): _weak_connection_body(other._weak_connection_body)
|
||||
{}
|
||||
connection(boost::weak_ptr<detail::ConnectionBodyBase> connectionBody):
|
||||
_weakConnectionBody(connectionBody)
|
||||
connection(boost::weak_ptr<detail::connection_body_base> connectionBody):
|
||||
_weak_connection_body(connectionBody)
|
||||
{}
|
||||
~connection() {}
|
||||
void disconnect() const
|
||||
{
|
||||
boost::shared_ptr<detail::ConnectionBodyBase> connectionBody(_weakConnectionBody.lock());
|
||||
boost::shared_ptr<detail::connection_body_base> connectionBody(_weak_connection_body.lock());
|
||||
if(connectionBody == 0) return;
|
||||
connectionBody->disconnect();
|
||||
}
|
||||
bool connected() const
|
||||
{
|
||||
boost::shared_ptr<detail::ConnectionBodyBase> connectionBody(_weakConnectionBody.lock());
|
||||
boost::shared_ptr<detail::connection_body_base> connectionBody(_weak_connection_body.lock());
|
||||
if(connectionBody == 0) return false;
|
||||
return connectionBody->connected();
|
||||
}
|
||||
bool blocked() const
|
||||
{
|
||||
boost::shared_ptr<detail::ConnectionBodyBase> connectionBody(_weakConnectionBody.lock());
|
||||
boost::shared_ptr<detail::connection_body_base> connectionBody(_weak_connection_body.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());
|
||||
boost::shared_ptr<detail::connection_body_base> connectionBody(_weak_connection_body.lock());
|
||||
boost::shared_ptr<detail::connection_body_base> otherConnectionBody(other._weak_connection_body.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());
|
||||
boost::shared_ptr<detail::connection_body_base> connectionBody(_weak_connection_body.lock());
|
||||
boost::shared_ptr<detail::connection_body_base> otherConnectionBody(other._weak_connection_body.lock());
|
||||
return connectionBody < otherConnectionBody;
|
||||
}
|
||||
void swap(connection &other)
|
||||
{
|
||||
using std::swap;
|
||||
swap(_weakConnectionBody, other._weakConnectionBody);
|
||||
swap(_weak_connection_body, other._weak_connection_body);
|
||||
}
|
||||
private:
|
||||
|
||||
boost::weak_ptr<detail::ConnectionBodyBase> _weakConnectionBody;
|
||||
boost::weak_ptr<detail::connection_body_base> _weak_connection_body;
|
||||
};
|
||||
|
||||
class scoped_connection: public connection
|
||||
|
@ -56,7 +56,7 @@ namespace boost
|
||||
private:
|
||||
class slot_invoker;
|
||||
typedef typename group_key<Group>::type group_key_type;
|
||||
typedef shared_ptr<ConnectionBody<group_key_type, slot_type, ThreadingModel> > connection_body_type;
|
||||
typedef shared_ptr<connection_body<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;
|
||||
@ -65,7 +65,7 @@ namespace boost
|
||||
typedef Group group_type;
|
||||
typedef GroupCompare group_compare_type;
|
||||
typedef typename detail::slot_call_iterator_t<slot_invoker,
|
||||
typename connection_list_type::iterator, ConnectionBody<group_key_type, slot_type, ThreadingModel> > slot_call_iterator;
|
||||
typename connection_list_type::iterator, connection_body<group_key_type, slot_type, ThreadingModel> > slot_call_iterator;
|
||||
|
||||
BOOST_SIGNAL_IMPL_CLASS_NAME(const combiner_type &combiner,
|
||||
const group_compare_type &group_compare):
|
||||
@ -288,7 +288,7 @@ namespace boost
|
||||
{
|
||||
bool connected;
|
||||
{
|
||||
typename ConnectionBody<group_key_type, slot_type, ThreadingModel>::mutex_type::scoped_lock lock((*it)->mutex);
|
||||
typename connection_body<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();
|
||||
@ -339,7 +339,7 @@ namespace boost
|
||||
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));
|
||||
return connection_body_type(new connection_body<group_key_type, slot_type, ThreadingModel>(slot));
|
||||
}
|
||||
void do_disconnect(const group_type &group, mpl::bool_<true> is_group)
|
||||
{
|
||||
@ -354,7 +354,7 @@ namespace boost
|
||||
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);
|
||||
typename connection_body<group_key_type, slot_type, ThreadingModel>::mutex_type::scoped_lock lock((*it)->mutex);
|
||||
if((*it)->slot.slot_function() == slot)
|
||||
{
|
||||
(*it)->nolock_disconnect();
|
||||
|
@ -52,7 +52,7 @@ namespace boost {
|
||||
iter(iter_in), end(end_in), f(f),
|
||||
cache(&c), callable_iter(end_in)
|
||||
{
|
||||
lockNextCallable();
|
||||
lock_next_callable();
|
||||
}
|
||||
|
||||
typename inherited::reference
|
||||
@ -75,7 +75,7 @@ namespace boost {
|
||||
void increment()
|
||||
{
|
||||
++iter;
|
||||
lockNextCallable();
|
||||
lock_next_callable();
|
||||
cache->reset();
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ namespace boost {
|
||||
private:
|
||||
typedef typename ConnectionBody::mutex_type::scoped_lock lock_type;
|
||||
|
||||
void lockNextCallable() const
|
||||
void lock_next_callable() const
|
||||
{
|
||||
if(iter == callable_iter)
|
||||
{
|
||||
|
@ -91,7 +91,7 @@ namespace boost
|
||||
// tracking
|
||||
BOOST_SLOT_CLASS_NAME(BOOST_SIGNALS_NUM_ARGS)& track(const weak_ptr<void> &tracked)
|
||||
{
|
||||
_trackedObjects.push_back(tracked);
|
||||
_tracked_objects.push_back(tracked);
|
||||
return *this;
|
||||
}
|
||||
BOOST_SLOT_CLASS_NAME(BOOST_SIGNALS_NUM_ARGS)& track(const signal_base &signal)
|
||||
|
@ -23,14 +23,14 @@ namespace boost
|
||||
{
|
||||
public:
|
||||
shared_connection_block(connection &conn):
|
||||
_weakConnectionBody(conn._weakConnectionBody)
|
||||
_weak_connection_body(conn._weak_connection_body)
|
||||
{
|
||||
block();
|
||||
}
|
||||
void block()
|
||||
{
|
||||
if(_blocker) return;
|
||||
boost::shared_ptr<detail::ConnectionBodyBase> connectionBody(_weakConnectionBody.lock());
|
||||
boost::shared_ptr<detail::connection_body_base> connectionBody(_weak_connection_body.lock());
|
||||
if(connectionBody == 0) return;
|
||||
_blocker = connectionBody->get_blocker();
|
||||
}
|
||||
@ -43,7 +43,7 @@ namespace boost
|
||||
return _blocker != 0;
|
||||
}
|
||||
private:
|
||||
boost::weak_ptr<detail::ConnectionBodyBase> _weakConnectionBody;
|
||||
boost::weak_ptr<detail::connection_body_base> _weak_connection_body;
|
||||
shared_ptr<void> _blocker;
|
||||
};
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace boost
|
||||
public:
|
||||
virtual char const * what() const throw()
|
||||
{
|
||||
return "boost::expired_slot";
|
||||
return "boost::signals2::expired_slot";
|
||||
}
|
||||
};
|
||||
|
||||
@ -36,7 +36,7 @@ namespace boost
|
||||
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;}
|
||||
const tracked_container_type& tracked_objects() const {return _tracked_objects;}
|
||||
locked_container_type lock() const
|
||||
{
|
||||
locked_container_type locked_objects;
|
||||
@ -66,10 +66,10 @@ namespace boost
|
||||
protected:
|
||||
void track_signal(const signal_base &signal)
|
||||
{
|
||||
_trackedObjects.push_back(signal.lock_pimpl());
|
||||
_tracked_objects.push_back(signal.lock_pimpl());
|
||||
}
|
||||
|
||||
tracked_container_type _trackedObjects;
|
||||
tracked_container_type _tracked_objects;
|
||||
};
|
||||
}
|
||||
} // end namespace boost
|
||||
|
Loading…
Reference in New Issue
Block a user