Added boost header

This commit is contained in:
Christophe Riccio
2012-01-08 01:26:07 +00:00
parent 9c3faaca40
commit c7d752cdf8
8946 changed files with 1732316 additions and 0 deletions

View File

@@ -0,0 +1,213 @@
// Boost.Signals library
// Copyright Douglas Gregor 2001-2004. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// For more information, see http://www.boost.org
#ifndef BOOST_SIGNALS_CONNECTION_HPP
#define BOOST_SIGNALS_CONNECTION_HPP
#include <boost/signals/detail/signals_common.hpp>
#include <boost/smart_ptr.hpp>
#include <boost/operators.hpp>
#include <boost/any.hpp>
#include <list>
#include <cassert>
#include <utility>
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
#endif
namespace boost {
namespace BOOST_SIGNALS_NAMESPACE {
class trackable;
namespace detail {
// Represents an object that has been bound as part of a slot, and how
// to notify that object of a disconnect
struct bound_object {
void* obj;
void* data;
void (*disconnect)(void*, void*);
bool operator==(const bound_object& other) const
{ return obj == other.obj && data == other.data; }
bool operator<(const bound_object& other) const
{ return obj < other.obj; }
// To support intel 80 compiler, 2004/03/18 (Mark Rodgers)
bool operator!=(const bound_object& other) const
{ return !(*this==other); }
bool operator>(const bound_object& other) const
{ return !(*this < other); }
};
// Describes the connection between a signal and the objects that are
// bound for a specific slot. Enables notification of the signal and the
// slots when a disconnect is requested.
struct basic_connection {
void* signal;
void* signal_data;
void (*signal_disconnect)(void*, void*);
bool blocked_;
std::list<bound_object> bound_objects;
};
} // end namespace detail
// The user may freely pass around the "connection" object and terminate
// the connection at any time using disconnect().
class BOOST_SIGNALS_DECL connection :
private less_than_comparable1<connection>,
private equality_comparable1<connection>
{
public:
connection() : con(), controlling_connection(false) {}
connection(const connection&);
~connection();
// Block he connection: if the connection is still active, there
// will be no notification
void block(bool should_block = true) { con->blocked_ = should_block; }
void unblock() { con->blocked_ = false; }
bool blocked() const { return !connected() || con->blocked_; }
// Disconnect the signal and slot, if they are connected
void disconnect() const;
// Returns true if the signal and slot are connected
bool connected() const { return con.get() && con->signal_disconnect; }
// Comparison of connections
bool operator==(const connection& other) const;
bool operator<(const connection& other) const;
// Connection assignment
connection& operator=(const connection& other) ;
// Swap connections
void swap(connection& other);
public: // TBD: CHANGE THIS
// Set whether this connection object is controlling or not
void set_controlling(bool control = true)
{ controlling_connection = control; }
shared_ptr<BOOST_SIGNALS_NAMESPACE::detail::basic_connection>
get_connection() const
{ return con; }
private:
friend class detail::signal_base_impl;
friend class detail::slot_base;
friend class trackable;
// Reset this connection to refer to a different actual connection
void reset(BOOST_SIGNALS_NAMESPACE::detail::basic_connection*);
// Add a bound object to this connection (not for users)
void add_bound_object(const BOOST_SIGNALS_NAMESPACE::detail::bound_object& b);
friend class BOOST_SIGNALS_NAMESPACE::detail::bound_objects_visitor;
// Pointer to the actual contents of the connection
shared_ptr<BOOST_SIGNALS_NAMESPACE::detail::basic_connection> con;
// True if the destruction of this connection object should disconnect
bool controlling_connection;
};
// Similar to connection, but will disconnect the connection when it is
// destroyed unless release() has been called.
class BOOST_SIGNALS_DECL scoped_connection : public connection {
public:
scoped_connection() : connection(), released(false) {}
scoped_connection(const connection&);
scoped_connection(const scoped_connection&);
~scoped_connection();
connection release();
inline void swap(scoped_connection&);
scoped_connection& operator=(const connection&);
scoped_connection& operator=(const scoped_connection&);
private:
bool released;
};
namespace detail {
struct connection_slot_pair {
connection first;
any second;
connection_slot_pair() {}
connection_slot_pair(const connection& c, const any& a)
: first(c), second(a)
{
}
// Dummys to allow explicit instantiation to work
bool operator==(const connection_slot_pair&) const { return false; }
bool operator<(const connection_slot_pair&) const { return false;}
};
// Determines if the underlying connection is disconnected
struct is_disconnected {
typedef connection_slot_pair argument_type;
typedef bool result_type;
inline bool operator()(const argument_type& c) const
{
return !c.first.connected();
}
};
// Determines if the underlying connection is callable, ie if
// it is connected and not blocked
struct is_callable {
typedef connection_slot_pair argument_type;
typedef bool result_type;
inline bool operator()(const argument_type& c) const
{
return c.first.connected() && !c.first.blocked() ;
}
};
// Autodisconnects the bound object when it is destroyed unless the
// release method is invoked.
class auto_disconnect_bound_object {
public:
auto_disconnect_bound_object(const bound_object& b) :
binding(b), auto_disconnect(true)
{
}
~auto_disconnect_bound_object()
{
if (auto_disconnect)
binding.disconnect(binding.obj, binding.data);
}
void release() { auto_disconnect = false; }
private:
bound_object binding;
bool auto_disconnect;
};
} // end namespace detail
} // end namespace BOOST_SIGNALS_NAMESPACE
} // end namespace boost
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
#endif
#endif // BOOST_SIGNALS_CONNECTION_HPP

View File

@@ -0,0 +1,54 @@
/*
*
* Copyright (c) 1998-2002
* John Maddock
*
* Copyright (c) 2003-2004
* Douglas Gregor
*
* 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)
*
*/
#ifndef BOOST_SIGNALS_CONFIG_HPP
#define BOOST_SIGNALS_CONFIG_HPP
#include <boost/config.hpp>
#ifdef BOOST_HAS_DECLSPEC
# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SIGNALS_DYN_LINK)
# ifdef BOOST_SIGNALS_SOURCE
# define BOOST_SIGNALS_DECL __declspec(dllexport)
# else
# define BOOST_SIGNALS_DECL __declspec(dllimport)
# endif // BOOST_SIGNALS_SOURCE
# endif // DYN_LINK
#endif // BOOST_HAS_DECLSPEC
#ifndef BOOST_SIGNALS_DECL
# define BOOST_SIGNALS_DECL
#endif
// Setup autolinking
#if !defined(BOOST_SIGNALS_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SIGNALS_NO_LIB)
# define BOOST_LIB_NAME boost_signals
# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SIGNALS_DYN_LINK)
# define BOOST_DYN_LINK
# endif
# include <boost/config/auto_link.hpp>
#endif // autolinking on
#endif // BOOST_SIGNALS_CONFIG_HPP

View File

@@ -0,0 +1,132 @@
#!/usr/bin/perl -w
#
# Boost.Signals library
# Copyright Douglas Gregor 2001-2003. Use, modification and
# distribution is subject to the Boost Software License, Version
# 1.0. (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# For more information, see http://www.boost.org
use English;
if ($#ARGV < 0) {
print "Usage: perl gen_signal_N <number of arguments>\n";
exit;
}
$totalNumArgs = $ARGV[0];
for ($numArgs = 0; $numArgs <= $totalNumArgs; ++$numArgs) {
open OUT, ">signal$numArgs.hpp";
print OUT "// Boost.Signals library\n";
print OUT "//\n";
print OUT "// Copyright (C) 2001 Doug Gregor (gregod\@cs.rpi.edu)\n";
print OUT "//\n";
print OUT "// Permission to copy, use, sell and distribute this software is granted\n";
print OUT "// provided this copyright notice appears in all copies.\n";
print OUT "// Permission to modify the code and to distribute modified code is granted\n";
print OUT "// provided this copyright notice appears in all copies, and a notice\n";
print OUT "// that the code was modified is included with the copyright notice.\n";
print OUT "//\n";
print OUT "// This software is provided \"as is\" without express or implied warranty,\n";
print OUT "// and with no claim as to its suitability for any purpose.\n";
print OUT " \n";
print OUT "// For more information, see http://www.boost.org\n";
print OUT "\n";
print OUT "#ifndef BOOST_SIGNALS_SIGNAL" . $numArgs . "_HEADER\n";
print OUT "#define BOOST_SIGNALS_SIGNAL" , $numArgs . "_HEADER\n";
print OUT "\n";
print OUT "#define BOOST_SIGNALS_NUM_ARGS $numArgs\n";
$templateParms = "";
for ($i = 1; $i <= $numArgs; ++$i) {
if ($i > 1) {
$templateParms .= ", ";
}
$templateParms .= "typename T$i";
}
print OUT "#define BOOST_SIGNALS_TEMPLATE_PARMS $templateParms\n";
$_ = $templateParms;
s/typename //g;
$templateArgs = $_;
print OUT "#define BOOST_SIGNALS_TEMPLATE_ARGS $templateArgs\n";
$parms = "";
for ($i = 1; $i <= $numArgs; ++$i) {
if ($i > 1) {
$parms .= ", ";
}
$parms .= "T$i a$i";
}
print OUT "#define BOOST_SIGNALS_PARMS $parms\n";
$args = "";
for ($i = 1; $i <= $numArgs; ++$i) {
if ($i > 1) {
$args .= ", ";
}
$args .= "a$i";
}
print OUT "#define BOOST_SIGNALS_ARGS $args\n";
$boundArgs = "";
for ($i = 1; $i <= $numArgs; ++$i) {
if ($i > 1) {
$boundArgs .= ", ";
}
$boundArgs .= "args->a$i";
}
print OUT "#define BOOST_SIGNALS_BOUND_ARGS $boundArgs\n";
$argsAsMembers = "";
for ($i = 1; $i <= $numArgs; ++$i) {
$argsAsMembers .= "T$i a$i;";
}
print OUT "#define BOOST_SIGNALS_ARGS_AS_MEMBERS $argsAsMembers\n";
$copyParms = "";
for ($i = 1; $i <= $numArgs; ++$i) {
if ($i > 1) {
$copyParms .= ", ";
}
$copyParms .= "T$i ia$i";
}
print OUT "#define BOOST_SIGNALS_COPY_PARMS $copyParms\n";
$initArgs = "";
if ($numArgs > 0) {
$initArgs = ":";
}
for ($i = 1; $i <= $numArgs; ++$i) {
if ($i > 1) {
$initArgs .= ", ";
}
$initArgs .= "a$i(ia$i)";
}
print OUT "#define BOOST_SIGNALS_INIT_ARGS $initArgs\n";
$argTypes = "";
for ($i = 1; $i <= $numArgs; ++$i) {
$argTypes .= "typedef T$i arg". ($i+1) . "_type; ";
}
print OUT "#define BOOST_SIGNALS_ARG_TYPES $argTypes\n";
print OUT "\n";
print OUT "#include <boost/signals/signal_template.hpp>\n";
print OUT "\n";
print OUT "#undef BOOST_SIGNALS_ARG_TYPES\n";
print OUT "#undef BOOST_SIGNALS_INIT_ARGS\n";
print OUT "#undef BOOST_SIGNALS_COPY_PARMS\n";
print OUT "#undef BOOST_SIGNALS_ARGS_AS_MEMBERS\n";
print OUT "#undef BOOST_SIGNALS_BOUND_ARGS\n";
print OUT "#undef BOOST_SIGNALS_ARGS\n";
print OUT "#undef BOOST_SIGNALS_PARMS\n";
print OUT "#undef BOOST_SIGNALS_TEMPLATE_ARGS\n";
print OUT "#undef BOOST_SIGNALS_TEMPLATE_PARMS\n";
print OUT "#undef BOOST_SIGNALS_NUM_ARGS\n";
print OUT "\n";
print OUT "#endif // BOOST_SIGNALS_SIGNAL" . $numArgs . "_HEADER\n";
close OUT;
}

View File

@@ -0,0 +1,193 @@
// Boost.Signals library
// Copyright Douglas Gregor 2001-2004. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// For more information, see http://www.boost.org
#ifndef BOOST_SIGNALS_NAMED_SLOT_MAP_HPP
#define BOOST_SIGNALS_NAMED_SLOT_MAP_HPP
#include <boost/signals/detail/config.hpp>
#include <boost/signals/detail/signals_common.hpp>
#include <boost/signals/connection.hpp>
#include <boost/utility.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/function/function2.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <map>
#include <memory>
#include <utility>
namespace boost { namespace BOOST_SIGNALS_NAMESPACE {
enum connect_position { at_back, at_front };
namespace detail {
class stored_group
{
public:
enum storage_kind { sk_empty, sk_front, sk_back, sk_group };
stored_group(storage_kind p_kind = sk_empty) : kind(p_kind), group() { }
template<typename T>
stored_group(const T& p_group) : kind(sk_group), group(new T(p_group)) { }
bool is_front() const { return kind == sk_front; }
bool is_back() const { return kind == sk_back; }
bool empty() const { return kind == sk_empty; }
void* get() const { return group.get(); }
private:
storage_kind kind;
shared_ptr<void> group;
};
typedef function2<bool, stored_group, stored_group> compare_type;
// This function object bridges from a pair of any objects that hold
// values of type Key to the underlying function object that compares
// values of type Key.
template<typename Compare, typename Key>
class group_bridge_compare {
public:
typedef bool result_type;
typedef const stored_group& first_argument_type;
typedef const stored_group& second_argument_type;
group_bridge_compare(const Compare& c) : comp(c)
{ }
bool operator()(const stored_group& k1, const stored_group& k2) const
{
if (k1.is_front()) return !k2.is_front();
if (k1.is_back()) return false;
if (k2.is_front()) return false;
if (k2.is_back()) return true;
// Neither is empty, so compare their values to order them
return comp(*static_cast<Key*>(k1.get()), *static_cast<Key*>(k2.get()));
}
private:
Compare comp;
};
class BOOST_SIGNALS_DECL named_slot_map_iterator :
public iterator_facade<named_slot_map_iterator,
connection_slot_pair,
forward_traversal_tag>
{
typedef std::list<connection_slot_pair> group_list;
typedef group_list::iterator slot_pair_iterator;
typedef std::map<stored_group, group_list, compare_type> slot_container_type;
typedef slot_container_type::iterator group_iterator;
typedef slot_container_type::const_iterator const_group_iterator;
typedef iterator_facade<named_slot_map_iterator,
connection_slot_pair,
forward_traversal_tag> inherited;
public:
named_slot_map_iterator() : slot_assigned(false)
{ }
named_slot_map_iterator(const named_slot_map_iterator& other)
: group(other.group), last_group(other.last_group),
slot_assigned(other.slot_assigned)
{
if (slot_assigned) slot_ = other.slot_;
}
named_slot_map_iterator& operator=(const named_slot_map_iterator& other)
{
slot_assigned = other.slot_assigned;
group = other.group;
last_group = other.last_group;
if (slot_assigned) slot_ = other.slot_;
return *this;
}
connection_slot_pair& dereference() const
{
return *slot_;
}
void increment()
{
++slot_;
if (slot_ == group->second.end()) {
++group;
init_next_group();
}
}
bool equal(const named_slot_map_iterator& other) const {
return (group == other.group
&& (group == last_group
|| slot_ == other.slot_));
}
#if BOOST_WORKAROUND(_MSC_VER, <= 1600)
void decrement();
void advance(difference_type);
#endif
private:
named_slot_map_iterator(group_iterator giter, group_iterator last) :
group(giter), last_group(last), slot_assigned(false)
{ init_next_group(); }
named_slot_map_iterator(group_iterator giter, group_iterator last,
slot_pair_iterator slot) :
group(giter), last_group(last), slot_(slot), slot_assigned(true)
{ }
void init_next_group()
{
while (group != last_group && group->second.empty()) ++group;
if (group != last_group) {
slot_ = group->second.begin();
slot_assigned = true;
}
}
group_iterator group;
group_iterator last_group;
slot_pair_iterator slot_;
bool slot_assigned;
friend class named_slot_map;
};
class BOOST_SIGNALS_DECL named_slot_map
{
public:
typedef named_slot_map_iterator iterator;
named_slot_map(const compare_type& compare);
void clear();
iterator begin();
iterator end();
iterator insert(const stored_group& name, const connection& con,
const any& slot, connect_position at);
void disconnect(const stored_group& name);
void erase(iterator pos);
void remove_disconnected_slots();
private:
typedef std::list<connection_slot_pair> group_list;
typedef std::map<stored_group, group_list, compare_type> slot_container_type;
typedef slot_container_type::iterator group_iterator;
typedef slot_container_type::const_iterator const_group_iterator;
bool empty(const_group_iterator group) const
{
return (group->second.empty() && group != groups.begin() && group != back);
}
slot_container_type groups;
group_iterator back;
};
} } }
#endif // BOOST_SIGNALS_NAMED_SLOT_MAP_HPP

View File

@@ -0,0 +1,159 @@
// Boost.Signals library
// Copyright Douglas Gregor 2001-2004. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// For more information, see http://www.boost.org
#ifndef BOOST_SIGNALS_SIGNAL_BASE_HEADER
#define BOOST_SIGNALS_SIGNAL_BASE_HEADER
#include <boost/signals/detail/config.hpp>
#include <boost/signals/detail/signals_common.hpp>
#include <boost/signals/detail/named_slot_map.hpp>
#include <boost/signals/connection.hpp>
#include <boost/signals/trackable.hpp>
#include <boost/signals/slot.hpp>
#include <boost/smart_ptr.hpp>
#include <boost/utility.hpp>
#include <boost/function/function2.hpp>
#include <utility>
#include <vector>
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
#endif
namespace boost {
namespace BOOST_SIGNALS_NAMESPACE {
namespace detail {
// Must be constructed before calling the slots, because it safely
// manages call depth
class BOOST_SIGNALS_DECL call_notification {
public:
call_notification(const shared_ptr<signal_base_impl>&);
~call_notification();
shared_ptr<signal_base_impl> impl;
};
// Implementation of base class for all signals. It handles the
// management of the underlying slot lists.
class BOOST_SIGNALS_DECL signal_base_impl {
public:
friend class call_notification;
typedef function2<bool, stored_group, stored_group> compare_type;
// Make sure that an exception does not cause the "clearing" flag to
// remain set
class temporarily_set_clearing {
public:
temporarily_set_clearing(signal_base_impl* b) : base(b)
{
base->flags.clearing = true;
}
~temporarily_set_clearing()
{
base->flags.clearing = false;
}
private:
signal_base_impl* base;
};
friend class temporarily_set_clearing;
signal_base_impl(const compare_type&, const any&);
~signal_base_impl();
// Disconnect all slots connected to this signal
void disconnect_all_slots();
// Are there any connected slots?
bool empty() const;
// The number of connected slots
std::size_t num_slots() const;
// Disconnect all slots in the given group
void disconnect(const stored_group&);
// We're being notified that a slot has disconnected
static void slot_disconnected(void* obj, void* data);
connection connect_slot(const any& slot,
const stored_group& name,
shared_ptr<slot_base::data_t> data,
connect_position at);
private:
// Remove all of the slots that have been marked "disconnected"
void remove_disconnected_slots() const;
public:
// Our call depth when invoking slots (> 1 when we have a loop)
mutable int call_depth;
struct {
// True if some slots have disconnected, but we were not able to
// remove them from the list of slots because there are valid
// iterators into the slot list
mutable bool delayed_disconnect:1;
// True if we are disconnecting all disconnected slots
bool clearing:1;
} flags;
// Slots
mutable named_slot_map slots_;
any combiner_;
// Types
typedef named_slot_map::iterator iterator;
};
class BOOST_SIGNALS_DECL signal_base : public noncopyable {
public:
typedef signal_base_impl::compare_type compare_type;
friend class call_notification;
signal_base(const compare_type& comp, const any& combiner);
~signal_base();
public:
// Disconnect all slots connected to this signal
void disconnect_all_slots() { impl->disconnect_all_slots(); }
// Are there any connected slots?
bool empty() const { return impl->empty(); }
// How many slots are connected?
std::size_t num_slots() const { return impl->num_slots(); }
protected:
connection connect_slot(const any& slot,
const stored_group& name,
shared_ptr<slot_base::data_t> data,
connect_position at)
{
return impl->connect_slot(slot, name, data, at);
}
typedef named_slot_map::iterator iterator;
shared_ptr<signal_base_impl> impl;
};
} // end namespace detail
} // end namespace BOOST_SIGNALS_NAMESPACE
} // end namespace boost
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
#endif
#endif // BOOST_SIGNALS_SIGNAL_BASE_HEADER

View File

@@ -0,0 +1,162 @@
// Boost.Signals library
// Copyright Douglas Gregor 2001-2004. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// For more information, see http://www.boost.org
#ifndef BOOST_SIGNALS_COMMON_HEADER
#define BOOST_SIGNALS_COMMON_HEADER
#ifndef BOOST_SIGNALS_NAMESPACE
# define BOOST_SIGNALS_NAMESPACE signals
#endif
#include <boost/type_traits/conversion_traits.hpp>
#include <boost/ref.hpp>
#include <boost/signals/detail/config.hpp>
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
#endif
namespace boost {
namespace BOOST_SIGNALS_NAMESPACE {
namespace detail {
// The unusable class is a placeholder for unused function arguments
// It is also completely unusable except that it constructable from
// anything. This helps compilers without partial specialization
// handle slots returning void.
struct unusable {
unusable() {}
};
// Determine the result type of a slot call
template<typename R>
struct slot_result_type {
typedef R type;
};
template<>
struct slot_result_type<void> {
typedef unusable type;
};
// Determine if the given type T is a signal
class signal_base;
template<typename T>
struct is_signal {
BOOST_STATIC_CONSTANT(bool,
value = (is_convertible<T*, signal_base*>::value));
};
/*
* The IF implementation is temporary code. When a Boost metaprogramming
* library is introduced, Boost.Signals will use it instead.
*/
namespace intimate {
struct SelectThen
{
template<typename Then, typename Else>
struct Result
{
typedef Then type;
};
};
struct SelectElse
{
template<typename Then, typename Else>
struct Result
{
typedef Else type;
};
};
template<bool Condition>
struct Selector
{
typedef SelectThen type;
};
template<>
struct Selector<false>
{
typedef SelectElse type;
};
} // end namespace intimate
template<bool Condition, typename Then, typename Else>
struct IF
{
typedef typename intimate::Selector<Condition>::type select;
typedef typename select::template Result<Then,Else>::type type;
};
// Determine if the incoming argument is a reference_wrapper
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template<typename T>
struct is_ref
{
BOOST_STATIC_CONSTANT(bool, value = false);
};
template<typename T>
struct is_ref<reference_wrapper<T> >
{
BOOST_STATIC_CONSTANT(bool, value = true);
};
#else // no partial specialization
typedef char yes_type;
typedef double no_type;
no_type is_ref_tester(...);
template<typename T>
yes_type is_ref_tester(reference_wrapper<T>*);
template<typename T>
struct is_ref
{
static T* t;
BOOST_STATIC_CONSTANT(bool,
value = (sizeof(is_ref_tester(t)) == sizeof(yes_type)));
};
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
// A slot can be a signal, a reference to a function object, or a
// function object.
struct signal_tag {};
struct reference_tag {};
struct value_tag {};
// Classify the given slot as a signal, a reference-to-slot, or a
// standard slot
template<typename S>
class get_slot_tag {
typedef typename IF<(is_signal<S>::value),
signal_tag,
value_tag>::type signal_or_value;
public:
typedef typename IF<(is_ref<S>::value),
reference_tag,
signal_or_value>::type type;
};
// Forward declaration needed in lots of places
class signal_base_impl;
class bound_objects_visitor;
class slot_base;
} // end namespace detail
} // end namespace BOOST_SIGNALS_NAMESPACE
} // end namespace boost
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
#endif
#endif // BOOST_SIGNALS_COMMON_HEADER

View File

@@ -0,0 +1,95 @@
// Boost.Signals library
// Copyright Douglas Gregor 2001-2004. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// For more information, see http://www.boost.org
#ifndef BOOST_SIGNALS_SLOT_CALL_ITERATOR
#define BOOST_SIGNALS_SLOT_CALL_ITERATOR
#include <memory>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/smart_ptr.hpp>
#include <boost/signals/detail/config.hpp>
#include <boost/signals/connection.hpp>
#include <boost/optional.hpp>
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
#endif
namespace boost {
namespace BOOST_SIGNALS_NAMESPACE {
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>
class slot_call_iterator
: public iterator_facade<slot_call_iterator<Function, Iterator>,
typename Function::result_type,
single_pass_traversal_tag,
typename Function::result_type const&>
{
typedef iterator_facade<slot_call_iterator<Function, Iterator>,
typename Function::result_type,
single_pass_traversal_tag,
typename Function::result_type const&>
inherited;
typedef typename Function::result_type result_type;
friend class iterator_core_access;
public:
slot_call_iterator(Iterator iter_in, Iterator end_in, Function func,
optional<result_type> &c)
: iter(iter_in), end(end_in), f(func), cache(&c)
{
iter = std::find_if(iter, end, is_callable());
}
typename inherited::reference
dereference() const
{
if (!cache->is_initialized()) {
cache->reset(f(*iter));
}
return cache->get();
}
void increment()
{
iter = std::find_if(++iter, end, is_callable());
cache->reset();
}
bool equal(const slot_call_iterator& other) const
{
iter = std::find_if(iter, end, is_callable());
other.iter = std::find_if(other.iter, other.end,
is_callable());
return iter == other.iter;
}
private:
mutable Iterator iter;
Iterator end;
Function f;
optional<result_type>* cache;
};
} // end namespace detail
} // end namespace BOOST_SIGNALS_NAMESPACE
} // end namespace boost
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
#endif
#endif // BOOST_SIGNALS_SLOT_CALL_ITERATOR

37
test/external/boost/signals/signal0.hpp vendored Normal file
View File

@@ -0,0 +1,37 @@
// Boost.Signals library
// Copyright Douglas Gregor 2001-2003. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// For more information, see http://www.boost.org
#ifndef BOOST_SIGNALS_SIGNAL0_HEADER
#define BOOST_SIGNALS_SIGNAL0_HEADER
#define BOOST_SIGNALS_NUM_ARGS 0
#define BOOST_SIGNALS_TEMPLATE_PARMS
#define BOOST_SIGNALS_TEMPLATE_ARGS
#define BOOST_SIGNALS_PARMS
#define BOOST_SIGNALS_ARGS
#define BOOST_SIGNALS_BOUND_ARGS
#define BOOST_SIGNALS_ARGS_AS_MEMBERS
#define BOOST_SIGNALS_COPY_PARMS
#define BOOST_SIGNALS_INIT_ARGS
#define BOOST_SIGNALS_ARG_TYPES
#include <boost/signals/signal_template.hpp>
#undef BOOST_SIGNALS_ARG_TYPES
#undef BOOST_SIGNALS_INIT_ARGS
#undef BOOST_SIGNALS_COPY_PARMS
#undef BOOST_SIGNALS_ARGS_AS_MEMBERS
#undef BOOST_SIGNALS_BOUND_ARGS
#undef BOOST_SIGNALS_ARGS
#undef BOOST_SIGNALS_PARMS
#undef BOOST_SIGNALS_TEMPLATE_ARGS
#undef BOOST_SIGNALS_TEMPLATE_PARMS
#undef BOOST_SIGNALS_NUM_ARGS
#endif // BOOST_SIGNALS_SIGNAL0_HEADER

37
test/external/boost/signals/signal1.hpp vendored Normal file
View File

@@ -0,0 +1,37 @@
// Boost.Signals library
// Copyright Douglas Gregor 2001-2003. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// For more information, see http://www.boost.org
#ifndef BOOST_SIGNALS_SIGNAL1_HEADER
#define BOOST_SIGNALS_SIGNAL1_HEADER
#define BOOST_SIGNALS_NUM_ARGS 1
#define BOOST_SIGNALS_TEMPLATE_PARMS typename T1
#define BOOST_SIGNALS_TEMPLATE_ARGS T1
#define BOOST_SIGNALS_PARMS T1 a1
#define BOOST_SIGNALS_ARGS a1
#define BOOST_SIGNALS_BOUND_ARGS args->a1
#define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;
#define BOOST_SIGNALS_COPY_PARMS T1 ia1
#define BOOST_SIGNALS_INIT_ARGS :a1(ia1)
#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type;
#include <boost/signals/signal_template.hpp>
#undef BOOST_SIGNALS_ARG_TYPES
#undef BOOST_SIGNALS_INIT_ARGS
#undef BOOST_SIGNALS_COPY_PARMS
#undef BOOST_SIGNALS_ARGS_AS_MEMBERS
#undef BOOST_SIGNALS_BOUND_ARGS
#undef BOOST_SIGNALS_ARGS
#undef BOOST_SIGNALS_PARMS
#undef BOOST_SIGNALS_TEMPLATE_ARGS
#undef BOOST_SIGNALS_TEMPLATE_PARMS
#undef BOOST_SIGNALS_NUM_ARGS
#endif // BOOST_SIGNALS_SIGNAL1_HEADER

View File

@@ -0,0 +1,37 @@
// Boost.Signals library
// Copyright Douglas Gregor 2001-2003. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// For more information, see http://www.boost.org
#ifndef BOOST_SIGNALS_SIGNAL10_HEADER
#define BOOST_SIGNALS_SIGNAL10_HEADER
#define BOOST_SIGNALS_NUM_ARGS 10
#define BOOST_SIGNALS_TEMPLATE_PARMS typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10
#define BOOST_SIGNALS_TEMPLATE_ARGS T1, T2, T3, T4, T5, T6, T7, T8, T9, T10
#define BOOST_SIGNALS_PARMS T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10
#define BOOST_SIGNALS_ARGS a1, a2, a3, a4, a5, a6, a7, a8, a9, a10
#define BOOST_SIGNALS_BOUND_ARGS args->a1, args->a2, args->a3, args->a4, args->a5, args->a6, args->a7, args->a8, args->a9, args->a10
#define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3;T4 a4;T5 a5;T6 a6;T7 a7;T8 a8;T9 a9;T10 a10;
#define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2, T3 ia3, T4 ia4, T5 ia5, T6 ia6, T7 ia7, T8 ia8, T9 ia9, T10 ia10
#define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3), a4(ia4), a5(ia5), a6(ia6), a7(ia7), a8(ia8), a9(ia9), a10(ia10)
#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type; typedef T2 arg2_type; typedef T3 arg3_type; typedef T4 arg4_type; typedef T5 arg5_type; typedef T6 arg6_type; typedef T7 arg7_type; typedef T8 arg8_type; typedef T9 arg9_type; typedef T10 arg10_type;
#include <boost/signals/signal_template.hpp>
#undef BOOST_SIGNALS_ARG_TYPES
#undef BOOST_SIGNALS_INIT_ARGS
#undef BOOST_SIGNALS_COPY_PARMS
#undef BOOST_SIGNALS_ARGS_AS_MEMBERS
#undef BOOST_SIGNALS_BOUND_ARGS
#undef BOOST_SIGNALS_ARGS
#undef BOOST_SIGNALS_PARMS
#undef BOOST_SIGNALS_TEMPLATE_ARGS
#undef BOOST_SIGNALS_TEMPLATE_PARMS
#undef BOOST_SIGNALS_NUM_ARGS
#endif // BOOST_SIGNALS_SIGNAL10_HEADER

37
test/external/boost/signals/signal2.hpp vendored Normal file
View File

@@ -0,0 +1,37 @@
// Boost.Signals library
// Copyright Douglas Gregor 2001-2003. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// For more information, see http://www.boost.org
#ifndef BOOST_SIGNALS_SIGNAL2_HEADER
#define BOOST_SIGNALS_SIGNAL2_HEADER
#define BOOST_SIGNALS_NUM_ARGS 2
#define BOOST_SIGNALS_TEMPLATE_PARMS typename T1, typename T2
#define BOOST_SIGNALS_TEMPLATE_ARGS T1, T2
#define BOOST_SIGNALS_PARMS T1 a1, T2 a2
#define BOOST_SIGNALS_ARGS a1, a2
#define BOOST_SIGNALS_BOUND_ARGS args->a1, args->a2
#define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;
#define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2
#define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2)
#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type; typedef T2 arg2_type;
#include <boost/signals/signal_template.hpp>
#undef BOOST_SIGNALS_ARG_TYPES
#undef BOOST_SIGNALS_INIT_ARGS
#undef BOOST_SIGNALS_COPY_PARMS
#undef BOOST_SIGNALS_ARGS_AS_MEMBERS
#undef BOOST_SIGNALS_BOUND_ARGS
#undef BOOST_SIGNALS_ARGS
#undef BOOST_SIGNALS_PARMS
#undef BOOST_SIGNALS_TEMPLATE_ARGS
#undef BOOST_SIGNALS_TEMPLATE_PARMS
#undef BOOST_SIGNALS_NUM_ARGS
#endif // BOOST_SIGNALS_SIGNAL2_HEADER

37
test/external/boost/signals/signal3.hpp vendored Normal file
View File

@@ -0,0 +1,37 @@
// Boost.Signals library
// Copyright Douglas Gregor 2001-2003. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// For more information, see http://www.boost.org
#ifndef BOOST_SIGNALS_SIGNAL3_HEADER
#define BOOST_SIGNALS_SIGNAL3_HEADER
#define BOOST_SIGNALS_NUM_ARGS 3
#define BOOST_SIGNALS_TEMPLATE_PARMS typename T1, typename T2, typename T3
#define BOOST_SIGNALS_TEMPLATE_ARGS T1, T2, T3
#define BOOST_SIGNALS_PARMS T1 a1, T2 a2, T3 a3
#define BOOST_SIGNALS_ARGS a1, a2, a3
#define BOOST_SIGNALS_BOUND_ARGS args->a1, args->a2, args->a3
#define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3;
#define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2, T3 ia3
#define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3)
#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type; typedef T2 arg2_type; typedef T3 arg3_type;
#include <boost/signals/signal_template.hpp>
#undef BOOST_SIGNALS_ARG_TYPES
#undef BOOST_SIGNALS_INIT_ARGS
#undef BOOST_SIGNALS_COPY_PARMS
#undef BOOST_SIGNALS_ARGS_AS_MEMBERS
#undef BOOST_SIGNALS_BOUND_ARGS
#undef BOOST_SIGNALS_ARGS
#undef BOOST_SIGNALS_PARMS
#undef BOOST_SIGNALS_TEMPLATE_ARGS
#undef BOOST_SIGNALS_TEMPLATE_PARMS
#undef BOOST_SIGNALS_NUM_ARGS
#endif // BOOST_SIGNALS_SIGNAL3_HEADER

37
test/external/boost/signals/signal4.hpp vendored Normal file
View File

@@ -0,0 +1,37 @@
// Boost.Signals library
// Copyright Douglas Gregor 2001-2003. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// For more information, see http://www.boost.org
#ifndef BOOST_SIGNALS_SIGNAL4_HEADER
#define BOOST_SIGNALS_SIGNAL4_HEADER
#define BOOST_SIGNALS_NUM_ARGS 4
#define BOOST_SIGNALS_TEMPLATE_PARMS typename T1, typename T2, typename T3, typename T4
#define BOOST_SIGNALS_TEMPLATE_ARGS T1, T2, T3, T4
#define BOOST_SIGNALS_PARMS T1 a1, T2 a2, T3 a3, T4 a4
#define BOOST_SIGNALS_ARGS a1, a2, a3, a4
#define BOOST_SIGNALS_BOUND_ARGS args->a1, args->a2, args->a3, args->a4
#define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3;T4 a4;
#define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2, T3 ia3, T4 ia4
#define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3), a4(ia4)
#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type; typedef T2 arg2_type; typedef T3 arg3_type; typedef T4 arg4_type;
#include <boost/signals/signal_template.hpp>
#undef BOOST_SIGNALS_ARG_TYPES
#undef BOOST_SIGNALS_INIT_ARGS
#undef BOOST_SIGNALS_COPY_PARMS
#undef BOOST_SIGNALS_ARGS_AS_MEMBERS
#undef BOOST_SIGNALS_BOUND_ARGS
#undef BOOST_SIGNALS_ARGS
#undef BOOST_SIGNALS_PARMS
#undef BOOST_SIGNALS_TEMPLATE_ARGS
#undef BOOST_SIGNALS_TEMPLATE_PARMS
#undef BOOST_SIGNALS_NUM_ARGS
#endif // BOOST_SIGNALS_SIGNAL4_HEADER

37
test/external/boost/signals/signal5.hpp vendored Normal file
View File

@@ -0,0 +1,37 @@
// Boost.Signals library
// Copyright Douglas Gregor 2001-2003. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// For more information, see http://www.boost.org
#ifndef BOOST_SIGNALS_SIGNAL5_HEADER
#define BOOST_SIGNALS_SIGNAL5_HEADER
#define BOOST_SIGNALS_NUM_ARGS 5
#define BOOST_SIGNALS_TEMPLATE_PARMS typename T1, typename T2, typename T3, typename T4, typename T5
#define BOOST_SIGNALS_TEMPLATE_ARGS T1, T2, T3, T4, T5
#define BOOST_SIGNALS_PARMS T1 a1, T2 a2, T3 a3, T4 a4, T5 a5
#define BOOST_SIGNALS_ARGS a1, a2, a3, a4, a5
#define BOOST_SIGNALS_BOUND_ARGS args->a1, args->a2, args->a3, args->a4, args->a5
#define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3;T4 a4;T5 a5;
#define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2, T3 ia3, T4 ia4, T5 ia5
#define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3), a4(ia4), a5(ia5)
#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type; typedef T2 arg2_type; typedef T3 arg3_type; typedef T4 arg4_type; typedef T5 arg5_type;
#include <boost/signals/signal_template.hpp>
#undef BOOST_SIGNALS_ARG_TYPES
#undef BOOST_SIGNALS_INIT_ARGS
#undef BOOST_SIGNALS_COPY_PARMS
#undef BOOST_SIGNALS_ARGS_AS_MEMBERS
#undef BOOST_SIGNALS_BOUND_ARGS
#undef BOOST_SIGNALS_ARGS
#undef BOOST_SIGNALS_PARMS
#undef BOOST_SIGNALS_TEMPLATE_ARGS
#undef BOOST_SIGNALS_TEMPLATE_PARMS
#undef BOOST_SIGNALS_NUM_ARGS
#endif // BOOST_SIGNALS_SIGNAL5_HEADER

37
test/external/boost/signals/signal6.hpp vendored Normal file
View File

@@ -0,0 +1,37 @@
// Boost.Signals library
// Copyright Douglas Gregor 2001-2003. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// For more information, see http://www.boost.org
#ifndef BOOST_SIGNALS_SIGNAL6_HEADER
#define BOOST_SIGNALS_SIGNAL6_HEADER
#define BOOST_SIGNALS_NUM_ARGS 6
#define BOOST_SIGNALS_TEMPLATE_PARMS typename T1, typename T2, typename T3, typename T4, typename T5, typename T6
#define BOOST_SIGNALS_TEMPLATE_ARGS T1, T2, T3, T4, T5, T6
#define BOOST_SIGNALS_PARMS T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6
#define BOOST_SIGNALS_ARGS a1, a2, a3, a4, a5, a6
#define BOOST_SIGNALS_BOUND_ARGS args->a1, args->a2, args->a3, args->a4, args->a5, args->a6
#define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3;T4 a4;T5 a5;T6 a6;
#define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2, T3 ia3, T4 ia4, T5 ia5, T6 ia6
#define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3), a4(ia4), a5(ia5), a6(ia6)
#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type; typedef T2 arg2_type; typedef T3 arg3_type; typedef T4 arg4_type; typedef T5 arg5_type; typedef T6 arg6_type;
#include <boost/signals/signal_template.hpp>
#undef BOOST_SIGNALS_ARG_TYPES
#undef BOOST_SIGNALS_INIT_ARGS
#undef BOOST_SIGNALS_COPY_PARMS
#undef BOOST_SIGNALS_ARGS_AS_MEMBERS
#undef BOOST_SIGNALS_BOUND_ARGS
#undef BOOST_SIGNALS_ARGS
#undef BOOST_SIGNALS_PARMS
#undef BOOST_SIGNALS_TEMPLATE_ARGS
#undef BOOST_SIGNALS_TEMPLATE_PARMS
#undef BOOST_SIGNALS_NUM_ARGS
#endif // BOOST_SIGNALS_SIGNAL6_HEADER

37
test/external/boost/signals/signal7.hpp vendored Normal file
View File

@@ -0,0 +1,37 @@
// Boost.Signals library
// Copyright Douglas Gregor 2001-2003. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// For more information, see http://www.boost.org
#ifndef BOOST_SIGNALS_SIGNAL7_HEADER
#define BOOST_SIGNALS_SIGNAL7_HEADER
#define BOOST_SIGNALS_NUM_ARGS 7
#define BOOST_SIGNALS_TEMPLATE_PARMS typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7
#define BOOST_SIGNALS_TEMPLATE_ARGS T1, T2, T3, T4, T5, T6, T7
#define BOOST_SIGNALS_PARMS T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7
#define BOOST_SIGNALS_ARGS a1, a2, a3, a4, a5, a6, a7
#define BOOST_SIGNALS_BOUND_ARGS args->a1, args->a2, args->a3, args->a4, args->a5, args->a6, args->a7
#define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3;T4 a4;T5 a5;T6 a6;T7 a7;
#define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2, T3 ia3, T4 ia4, T5 ia5, T6 ia6, T7 ia7
#define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3), a4(ia4), a5(ia5), a6(ia6), a7(ia7)
#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type; typedef T2 arg2_type; typedef T3 arg3_type; typedef T4 arg4_type; typedef T5 arg5_type; typedef T6 arg6_type; typedef T7 arg7_type;
#include <boost/signals/signal_template.hpp>
#undef BOOST_SIGNALS_ARG_TYPES
#undef BOOST_SIGNALS_INIT_ARGS
#undef BOOST_SIGNALS_COPY_PARMS
#undef BOOST_SIGNALS_ARGS_AS_MEMBERS
#undef BOOST_SIGNALS_BOUND_ARGS
#undef BOOST_SIGNALS_ARGS
#undef BOOST_SIGNALS_PARMS
#undef BOOST_SIGNALS_TEMPLATE_ARGS
#undef BOOST_SIGNALS_TEMPLATE_PARMS
#undef BOOST_SIGNALS_NUM_ARGS
#endif // BOOST_SIGNALS_SIGNAL7_HEADER

37
test/external/boost/signals/signal8.hpp vendored Normal file
View File

@@ -0,0 +1,37 @@
// Boost.Signals library
// Copyright Douglas Gregor 2001-2003. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// For more information, see http://www.boost.org
#ifndef BOOST_SIGNALS_SIGNAL8_HEADER
#define BOOST_SIGNALS_SIGNAL8_HEADER
#define BOOST_SIGNALS_NUM_ARGS 8
#define BOOST_SIGNALS_TEMPLATE_PARMS typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8
#define BOOST_SIGNALS_TEMPLATE_ARGS T1, T2, T3, T4, T5, T6, T7, T8
#define BOOST_SIGNALS_PARMS T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8
#define BOOST_SIGNALS_ARGS a1, a2, a3, a4, a5, a6, a7, a8
#define BOOST_SIGNALS_BOUND_ARGS args->a1, args->a2, args->a3, args->a4, args->a5, args->a6, args->a7, args->a8
#define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3;T4 a4;T5 a5;T6 a6;T7 a7;T8 a8;
#define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2, T3 ia3, T4 ia4, T5 ia5, T6 ia6, T7 ia7, T8 ia8
#define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3), a4(ia4), a5(ia5), a6(ia6), a7(ia7), a8(ia8)
#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type; typedef T2 arg2_type; typedef T3 arg3_type; typedef T4 arg4_type; typedef T5 arg5_type; typedef T6 arg6_type; typedef T7 arg7_type; typedef T8 arg8_type;
#include <boost/signals/signal_template.hpp>
#undef BOOST_SIGNALS_ARG_TYPES
#undef BOOST_SIGNALS_INIT_ARGS
#undef BOOST_SIGNALS_COPY_PARMS
#undef BOOST_SIGNALS_ARGS_AS_MEMBERS
#undef BOOST_SIGNALS_BOUND_ARGS
#undef BOOST_SIGNALS_ARGS
#undef BOOST_SIGNALS_PARMS
#undef BOOST_SIGNALS_TEMPLATE_ARGS
#undef BOOST_SIGNALS_TEMPLATE_PARMS
#undef BOOST_SIGNALS_NUM_ARGS
#endif // BOOST_SIGNALS_SIGNAL8_HEADER

37
test/external/boost/signals/signal9.hpp vendored Normal file
View File

@@ -0,0 +1,37 @@
// Boost.Signals library
// Copyright Douglas Gregor 2001-2003. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// For more information, see http://www.boost.org
#ifndef BOOST_SIGNALS_SIGNAL9_HEADER
#define BOOST_SIGNALS_SIGNAL9_HEADER
#define BOOST_SIGNALS_NUM_ARGS 9
#define BOOST_SIGNALS_TEMPLATE_PARMS typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9
#define BOOST_SIGNALS_TEMPLATE_ARGS T1, T2, T3, T4, T5, T6, T7, T8, T9
#define BOOST_SIGNALS_PARMS T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9
#define BOOST_SIGNALS_ARGS a1, a2, a3, a4, a5, a6, a7, a8, a9
#define BOOST_SIGNALS_BOUND_ARGS args->a1, args->a2, args->a3, args->a4, args->a5, args->a6, args->a7, args->a8, args->a9
#define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3;T4 a4;T5 a5;T6 a6;T7 a7;T8 a8;T9 a9;
#define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2, T3 ia3, T4 ia4, T5 ia5, T6 ia6, T7 ia7, T8 ia8, T9 ia9
#define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3), a4(ia4), a5(ia5), a6(ia6), a7(ia7), a8(ia8), a9(ia9)
#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type; typedef T2 arg2_type; typedef T3 arg3_type; typedef T4 arg4_type; typedef T5 arg5_type; typedef T6 arg6_type; typedef T7 arg7_type; typedef T8 arg8_type; typedef T9 arg9_type;
#include <boost/signals/signal_template.hpp>
#undef BOOST_SIGNALS_ARG_TYPES
#undef BOOST_SIGNALS_INIT_ARGS
#undef BOOST_SIGNALS_COPY_PARMS
#undef BOOST_SIGNALS_ARGS_AS_MEMBERS
#undef BOOST_SIGNALS_BOUND_ARGS
#undef BOOST_SIGNALS_ARGS
#undef BOOST_SIGNALS_PARMS
#undef BOOST_SIGNALS_TEMPLATE_ARGS
#undef BOOST_SIGNALS_TEMPLATE_PARMS
#undef BOOST_SIGNALS_NUM_ARGS
#endif // BOOST_SIGNALS_SIGNAL9_HEADER

View File

@@ -0,0 +1,410 @@
// Boost.Signals library
// Copyright Douglas Gregor 2001-2004. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// For more information, see http://www.boost.org
// This file intentionally does not have include guards, because it is meant
// to be included multiple times (one for each signalN class). The
// BOOST_SIGNALS_SIGNAL_TEMPLATE_HEADER_INCLUDED macro merely serves to
// suppress reinclusion of the files that this header depends on.
#ifndef BOOST_SIGNALS_SIGNAL_TEMPLATE_HEADER_INCLUDED
#define BOOST_SIGNALS_SIGNAL_TEMPLATE_HEADER_INCLUDED
# include <boost/config.hpp>
# include <boost/signals/connection.hpp>
# include <boost/utility.hpp>
# include <boost/ref.hpp>
# include <boost/signals/slot.hpp>
# include <boost/last_value.hpp>
# include <boost/signals/detail/signal_base.hpp>
# include <boost/signals/detail/slot_call_iterator.hpp>
# include <boost/mpl/bool.hpp>
# include <boost/type_traits/is_convertible.hpp>
# include <cassert>
# include <functional>
# include <memory>
#endif // !BOOST_SIGNALS_SIGNAL_TEMPLATE_HEADER_INCLUDED
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
#endif
// Include the appropriate functionN header
#define BOOST_SIGNAL_FUNCTION_N_HEADER BOOST_JOIN(<boost/function/function,BOOST_SIGNALS_NUM_ARGS.hpp>)
#include BOOST_SIGNAL_FUNCTION_N_HEADER
// Determine if a comma should follow a listing of the arguments/parameters
#if BOOST_SIGNALS_NUM_ARGS == 0
# define BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
#else
# define BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS ,
#endif // BOOST_SIGNALS_NUM_ARGS > 0
// Define class names used
#define BOOST_SIGNALS_SIGNAL BOOST_JOIN(signal,BOOST_SIGNALS_NUM_ARGS)
#define BOOST_SIGNALS_FUNCTION BOOST_JOIN(function,BOOST_SIGNALS_NUM_ARGS)
#define BOOST_SIGNALS_ARGS_STRUCT BOOST_JOIN(args,BOOST_SIGNALS_NUM_ARGS)
#define BOOST_SIGNALS_CALL_BOUND BOOST_JOIN(call_bound,BOOST_SIGNALS_NUM_ARGS)
// Define commonly-used instantiations
#define BOOST_SIGNALS_ARGS_STRUCT_INST \
BOOST_SIGNALS_NAMESPACE::detail::BOOST_SIGNALS_ARGS_STRUCT<BOOST_SIGNALS_TEMPLATE_ARGS>
namespace boost {
namespace BOOST_SIGNALS_NAMESPACE {
namespace detail {
// Holds the arguments for a bound slot call in a single place
template<BOOST_SIGNALS_TEMPLATE_PARMS
BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
typename Dummy = int>
struct BOOST_SIGNALS_ARGS_STRUCT {
BOOST_SIGNALS_ARGS_STRUCT(BOOST_SIGNALS_COPY_PARMS)
BOOST_SIGNALS_INIT_ARGS
{
}
BOOST_SIGNALS_ARGS_AS_MEMBERS
};
// Function object that calls the function object given to it, passing
// the bound arguments along to that underlying function object
template<typename R>
struct BOOST_SIGNALS_CALL_BOUND {
template<BOOST_SIGNALS_TEMPLATE_PARMS
BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
typename F>
struct caller {
typedef BOOST_SIGNALS_ARGS_STRUCT<BOOST_SIGNALS_TEMPLATE_ARGS>*
args_type;
args_type args;
typedef R result_type;
caller() {}
caller(args_type a) : args(a) {}
template<typename Pair>
R operator()(const Pair& slot) const
{
F* target = const_cast<F*>(unsafe_any_cast<F>(&slot.second));
return (*target)(BOOST_SIGNALS_BOUND_ARGS);
}
};
};
template<>
struct BOOST_SIGNALS_CALL_BOUND<void> {
template<BOOST_SIGNALS_TEMPLATE_PARMS
BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
typename F>
struct caller {
typedef BOOST_SIGNALS_ARGS_STRUCT<BOOST_SIGNALS_TEMPLATE_ARGS>*
args_type;
args_type args;
typedef unusable result_type;
caller(args_type a) : args(a) {}
template<typename Pair>
unusable operator()(const Pair& slot) const
{
F* target = const_cast<F*>(unsafe_any_cast<F>(&slot.second));
(*target)(BOOST_SIGNALS_BOUND_ARGS);
return unusable();
}
};
};
} // namespace detail
} // namespace BOOST_SIGNALS_NAMESPACE
// The actual signalN class
template<
typename R,
BOOST_SIGNALS_TEMPLATE_PARMS
BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
typename Combiner = last_value<R>,
typename Group = int,
typename GroupCompare = std::less<Group>,
typename SlotFunction = BOOST_SIGNALS_FUNCTION<
R BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
BOOST_SIGNALS_TEMPLATE_ARGS>
>
class BOOST_SIGNALS_SIGNAL :
public BOOST_SIGNALS_NAMESPACE::detail::signal_base, // management of slot list
public BOOST_SIGNALS_NAMESPACE::trackable // signals are trackable
{
public:
// The slot function type
typedef SlotFunction slot_function_type;
// Result type of a slot
typedef typename BOOST_SIGNALS_NAMESPACE::detail::slot_result_type<R>::type
slot_result_type;
// Argument types
BOOST_SIGNALS_ARG_TYPES
#if BOOST_SIGNALS_NUM_ARGS == 1
typedef T1 argument_type;
#elif BOOST_SIGNALS_NUM_ARGS == 2
typedef T1 first_argument_type;
typedef T2 second_argument_type;
#endif
private:
// The real slot name comparison object type
typedef BOOST_SIGNALS_NAMESPACE::detail::group_bridge_compare<GroupCompare, Group>
real_group_compare_type;
// The function object passed to the slot call iterator that will call
// the underlying slot function with its arguments bound
typedef BOOST_SIGNALS_NAMESPACE::detail::BOOST_SIGNALS_CALL_BOUND<R>
outer_bound_slot_caller;
typedef typename outer_bound_slot_caller::template
caller<BOOST_SIGNALS_TEMPLATE_ARGS
BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
slot_function_type>
call_bound_slot;
public:
// Combiner's result type
typedef typename Combiner::result_type result_type;
// Combiner type
typedef Combiner combiner_type;
// Slot type
typedef slot<slot_function_type> slot_type;
// Slot name type and comparison
typedef Group group_type;
typedef GroupCompare group_compare_type;
typedef BOOST_SIGNALS_NAMESPACE::detail::slot_call_iterator<
call_bound_slot, iterator> slot_call_iterator;
explicit
BOOST_SIGNALS_SIGNAL(const Combiner& c = Combiner(),
const GroupCompare& comp = GroupCompare()) :
BOOST_SIGNALS_NAMESPACE::detail::signal_base(real_group_compare_type(comp),
c)
{
}
// Connect a slot to this signal
BOOST_SIGNALS_NAMESPACE::connection
connect(const slot_type&,
BOOST_SIGNALS_NAMESPACE::connect_position at
= BOOST_SIGNALS_NAMESPACE::at_back);
BOOST_SIGNALS_NAMESPACE::connection
connect(const group_type&, const slot_type&,
BOOST_SIGNALS_NAMESPACE::connect_position at
= BOOST_SIGNALS_NAMESPACE::at_back);
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
// MSVC 6.0 and 7.0 don't handle the is_convertible test well
void disconnect(const group_type& group)
{
impl->disconnect(group);
}
#else
template<typename T>
void disconnect(const T& t)
{
typedef mpl::bool_<(is_convertible<T, group_type>::value)> is_group;
this->do_disconnect(t, is_group());
}
private:
// Disconnect a named slot
void do_disconnect(const group_type& group, mpl::bool_<true>)
{
impl->disconnect(group);
}
template<typename Function>
void do_disconnect(const Function& f, mpl::bool_<false>)
{
// Notify the slot handling code that we are iterating through the slots
BOOST_SIGNALS_NAMESPACE::detail::call_notification notification(this->impl);
for (iterator i = impl->slots_.begin(); i != impl->slots_.end(); ++i) {
slot_function_type& s = *unsafe_any_cast<slot_function_type>(&i->second);
if (s == f) i->first.disconnect();
}
}
#endif
public:
// Emit the signal
result_type operator()(BOOST_SIGNALS_PARMS);
result_type operator()(BOOST_SIGNALS_PARMS) const;
Combiner& combiner()
{ return *unsafe_any_cast<Combiner>(&impl->combiner_); }
const Combiner& combiner() const
{ return *unsafe_any_cast<const Combiner>(&impl->combiner_); }
};
template<
typename R,
BOOST_SIGNALS_TEMPLATE_PARMS
BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
typename Combiner,
typename Group,
typename GroupCompare,
typename SlotFunction
>
BOOST_SIGNALS_NAMESPACE::connection
BOOST_SIGNALS_SIGNAL<
R, BOOST_SIGNALS_TEMPLATE_ARGS
BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
Combiner, Group, GroupCompare, SlotFunction
>::connect(const slot_type& in_slot,
BOOST_SIGNALS_NAMESPACE::connect_position at)
{
using boost::BOOST_SIGNALS_NAMESPACE::detail::stored_group;
// If the slot has been disconnected, just return a disconnected
// connection
if (!in_slot.is_active()) {
return BOOST_SIGNALS_NAMESPACE::connection();
}
return impl->connect_slot(in_slot.get_slot_function(), stored_group(),
in_slot.get_data(), at);
}
template<
typename R,
BOOST_SIGNALS_TEMPLATE_PARMS
BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
typename Combiner,
typename Group,
typename GroupCompare,
typename SlotFunction
>
BOOST_SIGNALS_NAMESPACE::connection
BOOST_SIGNALS_SIGNAL<
R, BOOST_SIGNALS_TEMPLATE_ARGS
BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
Combiner, Group, GroupCompare, SlotFunction
>::connect(const group_type& group,
const slot_type& in_slot,
BOOST_SIGNALS_NAMESPACE::connect_position at)
{
// If the slot has been disconnected, just return a disconnected
// connection
if (!in_slot.is_active()) {
return BOOST_SIGNALS_NAMESPACE::connection();
}
return impl->connect_slot(in_slot.get_slot_function(), group,
in_slot.get_data(), at);
}
template<
typename R,
BOOST_SIGNALS_TEMPLATE_PARMS
BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
typename Combiner,
typename Group,
typename GroupCompare,
typename SlotFunction
>
typename BOOST_SIGNALS_SIGNAL<
R, BOOST_SIGNALS_TEMPLATE_ARGS
BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
Combiner, Group, GroupCompare, SlotFunction>::result_type
BOOST_SIGNALS_SIGNAL<
R, BOOST_SIGNALS_TEMPLATE_ARGS
BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
Combiner, Group, GroupCompare, SlotFunction
>::operator()(BOOST_SIGNALS_PARMS)
{
// Notify the slot handling code that we are making a call
BOOST_SIGNALS_NAMESPACE::detail::call_notification notification(this->impl);
// Construct a function object that will call the underlying slots
// with the given arguments.
#if BOOST_SIGNALS_NUM_ARGS == 0
BOOST_SIGNALS_ARGS_STRUCT_INST args;
#else
BOOST_SIGNALS_ARGS_STRUCT_INST args(BOOST_SIGNALS_ARGS);
#endif // BOOST_SIGNALS_NUM_ARGS > 0
call_bound_slot f(&args);
typedef typename call_bound_slot::result_type call_result_type;
optional<call_result_type> cache;
// Let the combiner call the slots via a pair of input iterators
return combiner()(slot_call_iterator(notification.impl->slots_.begin(),
impl->slots_.end(), f, cache),
slot_call_iterator(notification.impl->slots_.end(),
impl->slots_.end(), f, cache));
}
template<
typename R,
BOOST_SIGNALS_TEMPLATE_PARMS
BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
typename Combiner,
typename Group,
typename GroupCompare,
typename SlotFunction
>
typename BOOST_SIGNALS_SIGNAL<
R, BOOST_SIGNALS_TEMPLATE_ARGS
BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
Combiner, Group, GroupCompare, SlotFunction>::result_type
BOOST_SIGNALS_SIGNAL<
R, BOOST_SIGNALS_TEMPLATE_ARGS
BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
Combiner, Group, GroupCompare, SlotFunction
>::operator()(BOOST_SIGNALS_PARMS) const
{
// Notify the slot handling code that we are making a call
BOOST_SIGNALS_NAMESPACE::detail::call_notification notification(this->impl);
// Construct a function object that will call the underlying slots
// with the given arguments.
#if BOOST_SIGNALS_NUM_ARGS == 0
BOOST_SIGNALS_ARGS_STRUCT_INST args;
#else
BOOST_SIGNALS_ARGS_STRUCT_INST args(BOOST_SIGNALS_ARGS);
#endif // BOOST_SIGNALS_NUM_ARGS > 0
call_bound_slot f(&args);
typedef typename call_bound_slot::result_type call_result_type;
optional<call_result_type> cache;
// Let the combiner call the slots via a pair of input iterators
return combiner()(slot_call_iterator(notification.impl->slots_.begin(),
impl->slots_.end(), f, cache),
slot_call_iterator(notification.impl->slots_.end(),
impl->slots_.end(), f, cache));
}
} // namespace boost
#undef BOOST_SIGNAL_FUNCTION_N_HEADER
#undef BOOST_SIGNALS_ARGS_STRUCT_INST
#undef BOOST_SIGNALS_CALL_BOUND
#undef BOOST_SIGNALS_ARGS_STRUCT
#undef BOOST_SIGNALS_FUNCTION
#undef BOOST_SIGNALS_SIGNAL
#undef BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
#endif

157
test/external/boost/signals/slot.hpp vendored Normal file
View File

@@ -0,0 +1,157 @@
// Boost.Signals library
// Copyright Douglas Gregor 2001-2004. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// For more information, see http://www.boost.org
#ifndef BOOST_SIGNALS_SLOT_HEADER
#define BOOST_SIGNALS_SLOT_HEADER
#include <boost/signals/detail/signals_common.hpp>
#include <boost/signals/connection.hpp>
#include <boost/signals/trackable.hpp>
#include <boost/visit_each.hpp>
#include <boost/shared_ptr.hpp>
#include <cassert>
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
#endif
namespace boost {
namespace BOOST_SIGNALS_NAMESPACE {
namespace detail {
class BOOST_SIGNALS_DECL slot_base {
// We would have to enumerate all of the signalN classes here as
// friends to make this private (as it otherwise should be). We can't
// name all of them because we don't know how many there are.
public:
struct data_t {
std::vector<const trackable*> bound_objects;
connection watch_bound_objects;
};
shared_ptr<data_t> get_data() const { return data; }
// Get the set of bound objects
std::vector<const trackable*>& get_bound_objects() const
{ return data->bound_objects; }
// Determine if this slot is still "active", i.e., all of the bound
// objects still exist
bool is_active() const
{ return data->watch_bound_objects.connected(); }
protected:
// Create a connection for this slot
void create_connection();
shared_ptr<data_t> data;
private:
static void bound_object_destructed(void*, void*) {}
};
} // end namespace detail
// Get the slot so that it can be copied
template<typename F>
reference_wrapper<const F>
get_invocable_slot(const F& f, BOOST_SIGNALS_NAMESPACE::detail::signal_tag)
{ return reference_wrapper<const F>(f); }
template<typename F>
const F&
get_invocable_slot(const F& f, BOOST_SIGNALS_NAMESPACE::detail::reference_tag)
{ return f; }
template<typename F>
const F&
get_invocable_slot(const F& f, BOOST_SIGNALS_NAMESPACE::detail::value_tag)
{ return f; }
// Get the slot so that it can be inspected for trackable objects
template<typename F>
const F&
get_inspectable_slot(const F& f, BOOST_SIGNALS_NAMESPACE::detail::signal_tag)
{ return f; }
template<typename F>
const F&
get_inspectable_slot(const reference_wrapper<F>& f, BOOST_SIGNALS_NAMESPACE::detail::reference_tag)
{ return f.get(); }
template<typename F>
const F&
get_inspectable_slot(const F& f, BOOST_SIGNALS_NAMESPACE::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 BOOST_SIGNALS_NAMESPACE::detail::get_slot_tag<F>::type
tag_type(const F&)
{
typedef typename BOOST_SIGNALS_NAMESPACE::detail::get_slot_tag<F>::type
the_tag_type;
the_tag_type tag = the_tag_type();
return tag;
}
} // end namespace BOOST_SIGNALS_NAMESPACE
template<typename SlotFunction>
class slot : public BOOST_SIGNALS_NAMESPACE::detail::slot_base {
typedef BOOST_SIGNALS_NAMESPACE::detail::slot_base inherited;
typedef typename inherited::data_t data_t;
public:
template<typename F>
slot(const F& f) : slot_function(BOOST_SIGNALS_NAMESPACE::get_invocable_slot(f, BOOST_SIGNALS_NAMESPACE::tag_type(f)))
{
this->data.reset(new data_t);
// Visit each of the bound objects and store them for later use
// An exception thrown here will allow the basic_connection to be
// destroyed when this goes out of scope, and no other connections
// have been made.
BOOST_SIGNALS_NAMESPACE::detail::bound_objects_visitor
do_bind(this->data->bound_objects);
visit_each(do_bind,
BOOST_SIGNALS_NAMESPACE::get_inspectable_slot
(f, BOOST_SIGNALS_NAMESPACE::tag_type(f)));
create_connection();
}
#ifdef __BORLANDC__
template<typename F>
slot(F* f) : slot_function(f)
{
this->data.reset(new data_t);
create_connection();
}
#endif // __BORLANDC__
// We would have to enumerate all of the signalN classes here as friends
// to make this private (as it otherwise should be). We can't name all of
// them because we don't know how many there are.
public:
// Get the slot function to call the actual slot
const SlotFunction& get_slot_function() const { return slot_function; }
void release() const { data->watch_bound_objects.set_controlling(false); }
private:
slot(); // no default constructor
slot& operator=(const slot&); // no assignment operator
SlotFunction slot_function;
};
} // end namespace boost
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
#endif
#endif // BOOST_SIGNALS_SLOT_HEADER

View File

@@ -0,0 +1,173 @@
// Boost.Signals library
// Copyright Douglas Gregor 2001-2004. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// For more information, see http://www.boost.org
#ifndef BOOST_SIGNALS_TRACKABLE_HPP
#define BOOST_SIGNALS_TRACKABLE_HPP
#include <boost/type_traits.hpp>
#include <boost/signals/connection.hpp>
#include <boost/ref.hpp>
#include <boost/utility/addressof.hpp>
#include <list>
#include <vector>
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
#endif
namespace boost {
namespace BOOST_SIGNALS_NAMESPACE {
// Base class for "trackable" objects that can be tracked when they are
// bound in slot target functions. When a trackable object is destroyed,
// the signal/slot connections are disconnected automatically.
class BOOST_SIGNALS_DECL trackable {
private:
static void signal_disconnected(void* obj, void* data);
friend class detail::signal_base_impl;
friend class detail::slot_base;
void signal_connected(connection, BOOST_SIGNALS_NAMESPACE::detail::bound_object&) const;
protected:
trackable() : connected_signals(), dying(false) {}
trackable(const trackable&) : connected_signals(), dying(false) {}
~trackable();
trackable& operator=(const trackable&)
{
dying = true;
connected_signals.clear();
dying = false;
return *this;
}
private:
typedef std::list<connection> connection_list;
typedef connection_list::iterator connection_iterator;
// List of connections that this object is part of
mutable connection_list connected_signals;
// True when the object is being destroyed
mutable bool dying;
};
namespace detail {
template<bool Cond> struct truth {};
// A visitor that adds each trackable object to a vector
class bound_objects_visitor {
public:
bound_objects_visitor(std::vector<const trackable*>& v) :
bound_objects(v)
{
}
template<typename T>
void operator()(const T& t) const
{
decode(t, 0);
}
private:
// decode() decides between a reference wrapper and anything else
template<typename T>
void decode(const reference_wrapper<T>& t, int) const
{
add_if_trackable(t.get_pointer());
}
template<typename T>
void decode(const T& t, long) const
{
typedef truth<(is_pointer<T>::value)> is_a_pointer;
maybe_get_pointer(t, is_a_pointer());
}
// maybe_get_pointer() decides between a pointer and a non-pointer
template<typename T>
void maybe_get_pointer(const T& t, truth<true>) const
{
add_if_trackable(t);
}
template<typename T>
void maybe_get_pointer(const T& t, truth<false>) const
{
// Take the address of this object, because the object itself may be
// trackable
add_if_trackable(boost::addressof(t));
}
// add_if_trackable() adds trackable objects to the list of bound objects
inline void add_if_trackable(const trackable* b) const
{
if (b) {
bound_objects.push_back(b);
}
}
inline void add_if_trackable(const void*) const { }
template<typename R>
inline void add_if_trackable(R (*)()) const { }
template<typename R, typename T1>
inline void add_if_trackable(R (*)(T1)) const { }
template<typename R, typename T1, typename T2>
inline void add_if_trackable(R (*)(T1, T2)) const { }
template<typename R, typename T1, typename T2, typename T3>
inline void add_if_trackable(R (*)(T1, T2, T3)) const { }
template<typename R, typename T1, typename T2, typename T3, typename T4>
inline void add_if_trackable(R (*)(T1, T2, T3, T4)) const { }
template<typename R, typename T1, typename T2, typename T3, typename T4,
typename T5>
inline void add_if_trackable(R (*)(T1, T2, T3, T4, T5)) const { }
template<typename R, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6>
inline void add_if_trackable(R (*)(T1, T2, T3, T4, T5, T6)) const { }
template<typename R, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7>
inline void add_if_trackable(R (*)(T1, T2, T3, T4, T5, T6, T7)) const { }
template<typename R, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7, typename T8>
inline void
add_if_trackable(R (*)(T1, T2, T3, T4, T5, T6, T7, T8)) const { }
template<typename R, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7, typename T8, typename T9>
inline void
add_if_trackable(R (*)(T1, T2, T3, T4, T5, T6, T7, T8, T9)) const { }
template<typename R, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7, typename T8, typename T9,
typename T10>
inline void
add_if_trackable(R (*)(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)) const { }
std::vector<const trackable*>& bound_objects;
};
} // end namespace detail
} // end namespace BOOST_SIGNALS_NAMESPACE
} // end namespace boost
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
#endif
#endif // BOOST_SIGNALS_TRACKABLE_HPP