|
Boost-Commit : |
From: srajko_at_[hidden]
Date: 2007-07-05 16:37:22
Author: srajko
Date: 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
New Revision: 7367
URL: http://svn.boost.org/trac/boost/changeset/7367
Log:
put everything in boost::signals namespace, restructure directories, make fused/unfused a template parameter, connection mechanism is more easily extensible and modular, all components can accept both fused and unfused signals, storage is implemented through a generic component, separate send signal from operator().
Added:
sandbox/SOC/2007/signals/boost/signal_network/component/
sandbox/SOC/2007/signals/boost/signal_network/component/applicator.hpp
- copied, changed from r7020, /sandbox/SOC/2007/signals/boost/signal_network/applicator.hpp
sandbox/SOC/2007/signals/boost/signal_network/component/chain.hpp
- copied, changed from r7020, /sandbox/SOC/2007/signals/boost/signal_network/chain.hpp
sandbox/SOC/2007/signals/boost/signal_network/component/conditional.hpp
- copied, changed from r7020, /sandbox/SOC/2007/signals/boost/signal_network/conditional.hpp
sandbox/SOC/2007/signals/boost/signal_network/component/conditional_modifier.hpp (contents, props changed)
sandbox/SOC/2007/signals/boost/signal_network/component/counter.hpp
- copied, changed from r7020, /sandbox/SOC/2007/signals/boost/signal_network/counter.hpp
sandbox/SOC/2007/signals/boost/signal_network/component/detail/
sandbox/SOC/2007/signals/boost/signal_network/component/detail/generic_template.hpp (contents, props changed)
sandbox/SOC/2007/signals/boost/signal_network/component/detail/serialize_fusion_vector.hpp
- copied unchanged from r7020, /sandbox/SOC/2007/signals/boost/signal_network/detail/serialize_fusion_vector.hpp
sandbox/SOC/2007/signals/boost/signal_network/component/detail/storable.hpp
- copied, changed from r7020, /sandbox/SOC/2007/signals/boost/signal_network/detail/storable.hpp
sandbox/SOC/2007/signals/boost/signal_network/component/detail/unfused_inherited.hpp
- copied, changed from r7020, /sandbox/SOC/2007/signals/boost/signal_network/detail/unfused_inherited.hpp
sandbox/SOC/2007/signals/boost/signal_network/component/filter.hpp
- copied, changed from r7020, /sandbox/SOC/2007/signals/boost/signal_network/filter.hpp
sandbox/SOC/2007/signals/boost/signal_network/component/filter_base.hpp (contents, props changed)
sandbox/SOC/2007/signals/boost/signal_network/component/function.hpp
- copied, changed from r7020, /sandbox/SOC/2007/signals/boost/signal_network/function.hpp
sandbox/SOC/2007/signals/boost/signal_network/component/instantiator.hpp
- copied, changed from r7020, /sandbox/SOC/2007/signals/boost/signal_network/instantiator.hpp
sandbox/SOC/2007/signals/boost/signal_network/component/junction.hpp
- copied, changed from r7020, /sandbox/SOC/2007/signals/boost/signal_network/junction.hpp
sandbox/SOC/2007/signals/boost/signal_network/component/modifier.hpp
- copied, changed from r7020, /sandbox/SOC/2007/signals/boost/signal_network/modifier.hpp
sandbox/SOC/2007/signals/boost/signal_network/component/mutex.hpp
- copied, changed from r7020, /sandbox/SOC/2007/signals/boost/signal_network/mutex.hpp
sandbox/SOC/2007/signals/boost/signal_network/component/selector.hpp
- copied unchanged from r7020, /sandbox/SOC/2007/signals/boost/signal_network/selector.hpp
sandbox/SOC/2007/signals/boost/signal_network/component/socket_receiver.hpp
- copied, changed from r7020, /sandbox/SOC/2007/signals/boost/signal_network/socket_receiver.hpp
sandbox/SOC/2007/signals/boost/signal_network/component/socket_sender.hpp
- copied, changed from r7020, /sandbox/SOC/2007/signals/boost/signal_network/socket_sender.hpp
sandbox/SOC/2007/signals/boost/signal_network/component/storage.hpp
- copied, changed from r7043, /sandbox/SOC/2007/signals/boost/signal_network/storage.hpp
sandbox/SOC/2007/signals/boost/signal_network/component/timed_generator.hpp
- copied, changed from r7020, /sandbox/SOC/2007/signals/boost/signal_network/timed_generator.hpp
sandbox/SOC/2007/signals/boost/signal_network/component/traits.hpp (contents, props changed)
sandbox/SOC/2007/signals/boost/signal_network/connection/
sandbox/SOC/2007/signals/boost/signal_network/connection.hpp (contents, props changed)
sandbox/SOC/2007/signals/boost/signal_network/connection/connect.hpp
- copied, changed from r7020, /sandbox/SOC/2007/signals/boost/signal_network/detail/connect.hpp
sandbox/SOC/2007/signals/boost/signal_network/connection/detail/
sandbox/SOC/2007/signals/boost/signal_network/connection/detail/bind_object.hpp (contents, props changed)
sandbox/SOC/2007/signals/boost/signal_network/connection/detail/result_of_defined.hpp (contents, props changed)
sandbox/SOC/2007/signals/boost/signal_network/connection/detail/slot_type.hpp (contents, props changed)
sandbox/SOC/2007/signals/boost/signal_network/connection/operators.hpp (contents, props changed)
sandbox/SOC/2007/signals/boost/signal_network/connection/signal.hpp (contents, props changed)
sandbox/SOC/2007/signals/boost/signal_network/connection/slot_selector.hpp (contents, props changed)
sandbox/SOC/2007/signals/boost/signal_network/connection/slot_selector_map.hpp (contents, props changed)
Removed:
sandbox/SOC/2007/signals/boost/fusion/
sandbox/SOC/2007/signals/boost/last_value.hpp
sandbox/SOC/2007/signals/boost/signal_network/applicator.hpp
sandbox/SOC/2007/signals/boost/signal_network/base.hpp
sandbox/SOC/2007/signals/boost/signal_network/chain.hpp
sandbox/SOC/2007/signals/boost/signal_network/conditional.hpp
sandbox/SOC/2007/signals/boost/signal_network/counter.hpp
sandbox/SOC/2007/signals/boost/signal_network/detail/connect.hpp
sandbox/SOC/2007/signals/boost/signal_network/detail/connect_slot.hpp
sandbox/SOC/2007/signals/boost/signal_network/detail/connect_slot_template.hpp
sandbox/SOC/2007/signals/boost/signal_network/detail/connect_template.hpp
sandbox/SOC/2007/signals/boost/signal_network/detail/serialize_fusion_vector.hpp
sandbox/SOC/2007/signals/boost/signal_network/detail/storable.hpp
sandbox/SOC/2007/signals/boost/signal_network/detail/unfused_inherited.hpp
sandbox/SOC/2007/signals/boost/signal_network/filter.hpp
sandbox/SOC/2007/signals/boost/signal_network/function.hpp
sandbox/SOC/2007/signals/boost/signal_network/instantiator.hpp
sandbox/SOC/2007/signals/boost/signal_network/junction.hpp
sandbox/SOC/2007/signals/boost/signal_network/modifier.hpp
sandbox/SOC/2007/signals/boost/signal_network/mutex.hpp
sandbox/SOC/2007/signals/boost/signal_network/selector.hpp
sandbox/SOC/2007/signals/boost/signal_network/socket_receiver.hpp
sandbox/SOC/2007/signals/boost/signal_network/socket_sender.hpp
sandbox/SOC/2007/signals/boost/signal_network/storage.hpp
sandbox/SOC/2007/signals/boost/signal_network/timed_generator.hpp
Text files modified:
sandbox/SOC/2007/signals/boost/signal_network/component/applicator.hpp | 64 ++++---------
sandbox/SOC/2007/signals/boost/signal_network/component/chain.hpp | 120 ++++++++++++++-----------
sandbox/SOC/2007/signals/boost/signal_network/component/conditional.hpp | 62 ++++--------
sandbox/SOC/2007/signals/boost/signal_network/component/counter.hpp | 25 ++--
sandbox/SOC/2007/signals/boost/signal_network/component/detail/storable.hpp | 8 -
sandbox/SOC/2007/signals/boost/signal_network/component/detail/unfused_inherited.hpp | 84 ++++++++++-------
sandbox/SOC/2007/signals/boost/signal_network/component/filter.hpp | 59 +++++------
sandbox/SOC/2007/signals/boost/signal_network/component/function.hpp | 26 ++--
sandbox/SOC/2007/signals/boost/signal_network/component/instantiator.hpp | 55 ++--------
sandbox/SOC/2007/signals/boost/signal_network/component/junction.hpp | 20 ++--
sandbox/SOC/2007/signals/boost/signal_network/component/modifier.hpp | 61 +++---------
sandbox/SOC/2007/signals/boost/signal_network/component/mutex.hpp | 21 ++--
sandbox/SOC/2007/signals/boost/signal_network/component/socket_receiver.hpp | 20 +--
sandbox/SOC/2007/signals/boost/signal_network/component/socket_sender.hpp | 93 +++++++++----------
sandbox/SOC/2007/signals/boost/signal_network/component/storage.hpp | 191 +++++++++++++++++++++++----------------
sandbox/SOC/2007/signals/boost/signal_network/component/timed_generator.hpp | 21 ++-
sandbox/SOC/2007/signals/boost/signal_network/connection/connect.hpp | 72 +++++++-------
17 files changed, 475 insertions(+), 527 deletions(-)
Deleted: sandbox/SOC/2007/signals/boost/last_value.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/last_value.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
+++ (empty file)
@@ -1,53 +0,0 @@
-// last_value function object (documented as part of Boost.Signals)
-
-// 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/libs/signals
-
-#ifndef BOOST_LAST_VALUE_HPP
-#define BOOST_LAST_VALUE_HPP
-
-#include <cassert>
-
-namespace boost {
- template<typename T>
- struct last_value {
- typedef T result_type;
-
- template<typename InputIterator>
- T operator()(InputIterator first, InputIterator last) const
- {
- assert(first != last);
- T value = *first++;
- while (first != last)
- value = *first++;
- return value;
- }
- };
-
- template<>
- struct last_value<void> {
-#ifdef BOOST_NO_VOID_RETURNS
- struct unusable {};
-
- public:
- typedef unusable result_type;
-#else
- public:
- typedef void result_type;
-#endif // BOOST_NO_VOID_RETURNS
-
- template<typename InputIterator>
- result_type
- operator()(InputIterator first, InputIterator last) const
- {
- while (first != last)
- *first++;
- return result_type();
- }
- };
-}
-#endif // BOOST_SIGNALS_LAST_VALUE_HPP
Deleted: sandbox/SOC/2007/signals/boost/signal_network/applicator.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/applicator.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
+++ (empty file)
@@ -1,64 +0,0 @@
-// Copyright Stjepan Rajko 2007. Use, modification and
-// distribution is subject to the Boost Software License, Version
-// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef SIGNAL_NETWORK_APPLICATOR_HPP
-#define SIGNAL_NETWORK_APPLICATOR_HPP
-
-#include <boost/signal_network/filter.hpp>
-#include <boost/mpl/vector.hpp>
-#include <boost/fusion/sequence/adapted/mpl.hpp>
-#include <boost/signal_network/detail/unfused_inherited.hpp>
-#include <boost/fusion/support/is_sequence.hpp>
-
-
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
-
-
-template<
-typename Application,
-typename Member,
-typename Signature,
-typename OutSignal=default_out_signal,
-typename Combiner = boost::last_value<typename boost::function_types::result_type<Signature>::type>,
-typename Group = int,
-typename GroupCompare = std::less<Group> >
-class applicator : public filter<Signature, typename OutSignal::default_normal_type, Combiner, Group, GroupCompare>
-{
- typedef filter<Signature, typename OutSignal::default_normal_type, Combiner, Group, GroupCompare> base_type;
-
-public:
-#ifndef DOXYGEN_DOCS_ONLY
- typedef boost::fusion::unfused_inherited<applicator<Application, Member, Signature,
- typename OutSignal::default_unfused_type, Combiner, Group, GroupCompare>,
- typename mpl::vector<>::type,
- typename base_type::parameter_types > unfused;
-
- template <class Seq>
- struct result : public boost::enable_if<boost::fusion::traits::is_sequence<Seq>,
- typename base_type::signal_type::result_type> {};
-#endif
-
- /** Applies an instance of Application to the Member object.
- */
- template <class Seq>
-#ifndef DOXYGEN_DOCS_ONLY
- typename boost::enable_if<boost::fusion::traits::is_sequence<Seq>,
-#endif
- typename base_type::signal_type::result_type
-#ifndef DOXYGEN_DOCS_ONLY
- >::type
-#endif
- operator()(const Seq &seq)
- {
- Application()(member);
- return fused_out(seq);
- }
-protected:
- Member member;
-};
-
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
-
-#endif // SIGNAL_NETWORK_INSTANTIATOR_HPP
Deleted: sandbox/SOC/2007/signals/boost/signal_network/base.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/base.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
+++ (empty file)
@@ -1,153 +0,0 @@
-#ifndef SIGNAL_NETWORK_BASE_HPP
-#define SIGNAL_NETWORK_BASE_HPP
-
-#include <boost/signal.hpp>
-#ifdef _THREAD_SAFE_SIGNAL_HPP
-#define SIGNAL_NETWORK_THREAD_SAFE
-#else
-#define SIGNAL_NETWORK_TRACKABLE
-#endif
-#include <boost/function_types/member_function_pointer.hpp>
-#include <boost/function_types/parameter_types.hpp>
-#include <boost/function_types/result_type.hpp>
-
-#define SIGNAL_NETWORK_OPEN_SIGNAL_NETWORK_NAMESPACE namespace boost { namespace signal_network {
-#define SIGNAL_NETWORK_CLOSE_SIGNAL_NETWORK_NAMESPACE } }
-#define SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE namespace boost { namespace signal_network { namespace signet {
-#define SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE } } }
-
-// Constructs a type corresponding to pointer to member of T with signature Signature.
-// e.g. slot_type<some_class, void(float)>::type is void (some_class::*) (float)
-
-/*#define SIGNAL_NETWORK_TEMPLATE_CLASS slot_type
-#define SIGNAL_NETWORK_TEMPLATE_NO_RETURNS
-#define SIGNAL_NETWORK_TEMPLATE_TYPENAME_T
-#define SIGNAL_NETWORK_TEMPLATE_DETAIL
-#include <boost/signal_network/detail/loader.hpp>*/
-
-namespace boost {
- namespace signal_network {
- namespace signet {
- namespace detail {
-
-template <typename T, typename Signature>
-struct slot_type
-{
- typedef
- typename boost::function_types::member_function_pointer<
- typename boost::mpl::push_front<
- typename boost::mpl::push_front<
- typename boost::function_types::parameter_types<Signature>::type, T
- >::type, typename boost::function_types::result_type<Signature>::type
- >::type
- >::type type;
-};
-
- } // namespace detail
- } // namespace signet
- } // namespace signal_network
-} // namespace boost
-
-/// \namespace boost::signal_network \brief Connection operators
-/// \namespace boost::signal_network::signet \brief Signal Network components
-/// \namespace boost::signal_network::signet::detail \brief Detail
-SIGNAL_NETWORK_OPEN_SIGNAL_NETWORK_NAMESPACE
-
-template<typename T, typename Signature>
-struct slot_selector_t
-{
- T &link;
- typename signet::detail::slot_type<T, Signature>::type func;
-
- slot_selector_t<T, Signature>(T &link, typename signet::detail::slot_type<T, Signature>::type func)
- : link(link), func(func) {}
- operator T &() {return link;}
-};
-
-/// Allows functions other than operator() to serve as signet::filter slots.
-template<typename Signature, typename T>
-slot_selector_t<T, Signature> slot_selector(T &link, typename signet::detail::slot_type<T, Signature>::type func)
-{
- return slot_selector_t<T, Signature>(link, func);
-}
-
-SIGNAL_NETWORK_CLOSE_SIGNAL_NETWORK_NAMESPACE
-
-#include <boost/signal_network/detail/connect.hpp>
-#include <boost/signal_network/detail/connect_slot.hpp>
-
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
-
-namespace detail {
-
-template<typename T, typename Signature, typename Combiner, typename Group, typename GroupCompare>
- void connect(boost::signal<Signature, Combiner, Group, GroupCompare> &signal, T &link)
-{
- connect_impl<T, Signature, Combiner, Group, GroupCompare,boost::function_traits<Signature>::arity>
- ::connect(signal, link);
-}
-
-template<typename T, typename Signature, typename Combiner, typename Group, typename GroupCompare>
- void connect_slot(boost::signal<Signature, Combiner, Group, GroupCompare> &signal, const slot_selector_t<T, Signature> &link)
-{
- connect_slot_impl<T, Signature, Combiner, Group, GroupCompare, boost::function_traits<Signature>::arity>
- ::connect_slot(signal, link);
-}
-
-} // namespace detail
-
-class filter_base
-#ifdef SIGNAL_NETWORK_TRACKABLE
- : public boost::signals::trackable
-#endif
-{};
-
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
-
-SIGNAL_NETWORK_OPEN_SIGNAL_NETWORK_NAMESPACE
-
-/// Connects a sequence of components using signals.
-/** This operator is identical to signet::filter::operator| (it connects the
-left component to the right component, and returns a reference to the left component),
-except it is evaluated right to left. This makes it semantics more suitable for
-connecting a chain of connections.
-*/
-template<typename Filter, typename T>
-typename boost::enable_if<boost::is_base_of<signet::filter_base, Filter>, Filter & >::type
-operator >>= (Filter &filter, T &link) { signet::detail::connect(filter.default_signal(), link); return filter;}
-
-/// Allows branching in a component connection sequence.
-/** This operator is identical to signet::filter::operator>>=, (it connects the
-left component to the right component, and returns a reference to the left component)
-except it is evaluated left to right. This makes its semantics more suitable for
-branching connections.
-*/
-template<typename Filter, typename T>
-typename boost::enable_if<boost::is_base_of<signet::filter_base, Filter>, Filter & >::type
-operator | (Filter &filter, T &link) { signet::detail::connect(filter.default_signal(), link); return filter;}
-
-/// Allows slot functions other than operator() to be used in a sequence of components.
-/** \sa slot_selector()
-*/
-template<typename Filter, typename T, typename Signature>
-typename boost::enable_if<boost::is_base_of<signet::filter_base, Filter>, Filter & >::type
-operator >>= (Filter &filter, slot_selector_t<T, Signature> link) {signet::detail::connect_slot(filter.default_signal(), link); return filter;}
-
-/// Allows slot functions other than operator() to be used with branching.
-/** \sa slot_selector()
-*/
-template<typename Filter, typename T, typename Signature>
-typename boost::enable_if<boost::is_base_of<signet::filter_base, Filter>, Filter & >::type
-operator | (Filter &filter, slot_selector_t<T, Signature> link) {signet::detail::connect_slot(filter.default_signal(), link); return filter;}
-
-template<typename Signature, typename Combiner, typename Group, typename GroupCompare, typename T>
-boost::signal<Signature> &operator >>= (boost::signal<Signature, Combiner, Group, GroupCompare> &signal, T &link)
-{signet::detail::connect(signal, link); return signal;}
-
-template<typename Signature, typename Combiner, typename Group, typename GroupCompare, typename T>
-boost::signal<Signature> &operator | (boost::signal<Signature, Combiner, Group, GroupCompare> &signal, T &link)
-{signet::detail::connect(signal, link); return signal;}
-
-SIGNAL_NETWORK_CLOSE_SIGNAL_NETWORK_NAMESPACE
-
-#endif // SIGNAL_NETWORK_BASE_HPP
\ No newline at end of file
Deleted: sandbox/SOC/2007/signals/boost/signal_network/chain.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/chain.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
+++ (empty file)
@@ -1,78 +0,0 @@
-// Copyright Stjepan Rajko 2007. Use, modification and
-// distribution is subject to the Boost Software License, Version
-// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef SIGNAL_NETWORK_CHAIN_HPP
-#define SIGNAL_NETWORK_CHAIN_HPP
-
-#include <boost/signal_network/filter.hpp>
-#include <boost/mpl/vector.hpp>
-#include <boost/fusion/sequence/adapted/mpl.hpp>
-#include <boost/signal_network/detail/unfused_inherited.hpp>
-
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
-
-/** \brief Connects a number of components of the same type in a chain.
-\param T Type of the component.
-\param Signature Signature of the signal sent and received.
-
-*/
-template<typename T, typename Signature>
-class chain : public filter_base
-{
-public:
- typedef boost::function_types::parameter_types<Signature> parameter_types;
-
- typedef typename boost::fusion::result_of::as_vector<parameter_types >::type parameter_vector;
-
- typedef boost::fusion::unfused_inherited<chain<T, Signature>,
- typename mpl::vector<size_t, T *>::type,
- typename boost::function_types::parameter_types<Signature> > unfused;
-
- /// Constructs a chain composed of instances of T.
- /// Constructs a chain composed of copies of component.
- chain(size_t copies, T *component=NULL)
- {
- initialize(copies, component);
- }
- ~chain()
- {
- delete[] components;
- }
- template <class Seq>
- struct result
- {
- typedef typename boost::function_traits<Signature>::result_type type;
- };
- /// Sending a signal to the chain will forward it to the first component in the chain.
- typename boost::function_traits<Signature>::result_type
- operator()(const parameter_vector &vec_par)
- {
- return boost::fusion::fused<T &>(components[0])(vec_par);
- }
- /// The default signal coming out of the chain is the default signal of the last component in the chain.
- typename T::signal_type &default_signal()
- {
- return components[size-1].default_signal();
- }
-private:
- void initialize(size_t copies, T *component=NULL)
- {
- size = copies;
- components = new T[copies];
- for (size_t i=0; i<copies-1; i++)
- {
- if (component) components[i] = *component;
- components[i] >>= components[i+1];
- }
- if (component) components[size-1] = *component;
- }
- T *components;
- size_t size;
-
-};
-
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
-
-#endif // SIGNAL_NETWORK_CHAIN_HPP
Copied: sandbox/SOC/2007/signals/boost/signal_network/component/applicator.hpp (from r7020, /sandbox/SOC/2007/signals/boost/signal_network/applicator.hpp)
==============================================================================
--- /sandbox/SOC/2007/signals/boost/signal_network/applicator.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/applicator.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -4,61 +4,39 @@
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef SIGNAL_NETWORK_APPLICATOR_HPP
+
+#ifndef SIGNAL_NETWORK_GENERIC_CLASS
+
+#define SIGNAL_NETWORK_GENERIC_CLASS applicator
+#define SIGNAL_NETWORK_GENERIC_FILE <boost/signal_network/component/applicator.hpp>
+#define SIGNAL_NETWORK_GENERIC_TYPENAME Member
+#define SIGNAL_NETWORK_GENERIC_MEMBERNAME member
+#define SIGNAL_NETWORK_GENERIC_TYPENAME2 Application
+
+#include <boost/signal_network/component/detail/generic_template.hpp>
+
#define SIGNAL_NETWORK_APPLICATOR_HPP
-#include <boost/signal_network/filter.hpp>
-#include <boost/mpl/vector.hpp>
-#include <boost/fusion/sequence/adapted/mpl.hpp>
-#include <boost/signal_network/detail/unfused_inherited.hpp>
-#include <boost/fusion/support/is_sequence.hpp>
-
-
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
-
-
-template<
-typename Application,
-typename Member,
-typename Signature,
-typename OutSignal=default_out_signal,
-typename Combiner = boost::last_value<typename boost::function_types::result_type<Signature>::type>,
-typename Group = int,
-typename GroupCompare = std::less<Group> >
-class applicator : public filter<Signature, typename OutSignal::default_normal_type, Combiner, Group, GroupCompare>
-{
- typedef filter<Signature, typename OutSignal::default_normal_type, Combiner, Group, GroupCompare> base_type;
-
-public:
-#ifndef DOXYGEN_DOCS_ONLY
- typedef boost::fusion::unfused_inherited<applicator<Application, Member, Signature,
- typename OutSignal::default_unfused_type, Combiner, Group, GroupCompare>,
- typename mpl::vector<>::type,
- typename base_type::parameter_types > unfused;
-
- template <class Seq>
- struct result : public boost::enable_if<boost::fusion::traits::is_sequence<Seq>,
+#else // SIGNAL_NETWORK_GENERIC_CLASS
+
+ template <typename FArgs>
+ struct result;
+
+ template<typename T, typename Seq>
+ struct result<T(const Seq &)> : public boost::enable_if<boost::fusion::traits::is_sequence<Seq>,
typename base_type::signal_type::result_type> {};
-#endif
/** Applies an instance of Application to the Member object.
*/
+
template <class Seq>
-#ifndef DOXYGEN_DOCS_ONLY
- typename boost::enable_if<boost::fusion::traits::is_sequence<Seq>,
-#endif
- typename base_type::signal_type::result_type
-#ifndef DOXYGEN_DOCS_ONLY
- >::type
-#endif
+ typename result<applicator_impl(const Seq &)>::type
operator()(const Seq &seq)
{
Application()(member);
return fused_out(seq);
}
-protected:
- Member member;
-};
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
+#endif // SIGNAL_NETWORK_GENERIC_CLASS
#endif // SIGNAL_NETWORK_INSTANTIATOR_HPP
Copied: sandbox/SOC/2007/signals/boost/signal_network/component/chain.hpp (from r7020, /sandbox/SOC/2007/signals/boost/signal_network/chain.hpp)
==============================================================================
--- /sandbox/SOC/2007/signals/boost/signal_network/chain.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/chain.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -6,73 +6,87 @@
#ifndef SIGNAL_NETWORK_CHAIN_HPP
#define SIGNAL_NETWORK_CHAIN_HPP
-#include <boost/signal_network/filter.hpp>
+#include <boost/signal_network/component/filter_base.hpp>
+#include <boost/signal_network/component/detail/unfused_inherited.hpp>
+
#include <boost/mpl/vector.hpp>
+#include <boost/fusion/functional/adapter/fused.hpp>
#include <boost/fusion/sequence/adapted/mpl.hpp>
-#include <boost/signal_network/detail/unfused_inherited.hpp>
+#include <boost/function_types/parameter_types.hpp>
+
+namespace boost { namespace signals {
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
+namespace detail
+{
+ template<typename Signature, typename T>
+ class chain_impl : public filter_base
+ {
+ protected:
+ typedef typename boost::function_types::parameter_types<Signature>::type parameter_types;
+ typedef typename boost::fusion::result_of::as_vector<parameter_types >::type parameter_vector;
+public:
+ typedef typename T::signal_type signal_type;
+ typedef typename T::signature_type signature_type;
+
+ chain_impl(size_t copies, T *component=NULL)
+ {
+ initialize(copies, component);
+ }
+ ~chain_impl()
+ {
+ delete[] components;
+ }
+ template <class Seq>
+ struct result
+ {
+ typedef typename boost::function_traits<Signature>::result_type type;
+ };
+ /// Sending a signal to the chain will forward it to the first component in the chain.
+ typename boost::function_traits<Signature>::result_type
+ operator()(const parameter_vector &vec_par)
+ {
+ return boost::fusion::fused<T &>(components[0])(vec_par);
+ }
+ /// The default signal coming out of the chain is the default signal of the last component in the chain.
+ typename T::signal_type &default_signal() const
+ {
+ return components[size-1].default_signal();
+ }
+ private:
+ void initialize(size_t copies, T *component=NULL)
+ {
+ size = copies;
+ components = new T[copies];
+ for (size_t i=0; i<copies-1; i++)
+ {
+ if (component) components[i] = *component;
+ components[i] >>= components[i+1];
+ }
+ if (component) components[size-1] = *component;
+ }
+ T *components;
+ size_t size;
+ };
+}
/** \brief Connects a number of components of the same type in a chain.
\param T Type of the component.
\param Signature Signature of the signal sent and received.
*/
-template<typename T, typename Signature>
-class chain : public filter_base
+template<typename Signature, typename T>
+class chain : public boost::fusion::unfused_inherited<detail::chain_impl<Signature, T>,
+typename boost::function_types::parameter_types<Signature>::type >
{
+protected:
+ typedef boost::fusion::unfused_inherited<detail::chain_impl<Signature, T>,
+ typename boost::function_types::parameter_types<Signature>::type > base_type;
public:
- typedef boost::function_types::parameter_types<Signature> parameter_types;
-
- typedef typename boost::fusion::result_of::as_vector<parameter_types >::type parameter_vector;
-
- typedef boost::fusion::unfused_inherited<chain<T, Signature>,
- typename mpl::vector<size_t, T *>::type,
- typename boost::function_types::parameter_types<Signature> > unfused;
-
/// Constructs a chain composed of instances of T.
/// Constructs a chain composed of copies of component.
- chain(size_t copies, T *component=NULL)
- {
- initialize(copies, component);
- }
- ~chain()
- {
- delete[] components;
- }
- template <class Seq>
- struct result
- {
- typedef typename boost::function_traits<Signature>::result_type type;
- };
- /// Sending a signal to the chain will forward it to the first component in the chain.
- typename boost::function_traits<Signature>::result_type
- operator()(const parameter_vector &vec_par)
- {
- return boost::fusion::fused<T &>(components[0])(vec_par);
- }
- /// The default signal coming out of the chain is the default signal of the last component in the chain.
- typename T::signal_type &default_signal()
- {
- return components[size-1].default_signal();
- }
-private:
- void initialize(size_t copies, T *component=NULL)
- {
- size = copies;
- components = new T[copies];
- for (size_t i=0; i<copies-1; i++)
- {
- if (component) components[i] = *component;
- components[i] >>= components[i+1];
- }
- if (component) components[size-1] = *component;
- }
- T *components;
- size_t size;
-
+ chain(size_t copies, T *component=NULL) : base_type(copies, component) {}
};
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
+} } // namespace boost::signals
#endif // SIGNAL_NETWORK_CHAIN_HPP
Copied: sandbox/SOC/2007/signals/boost/signal_network/component/conditional.hpp (from r7020, /sandbox/SOC/2007/signals/boost/signal_network/conditional.hpp)
==============================================================================
--- /sandbox/SOC/2007/signals/boost/signal_network/conditional.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/conditional.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -4,40 +4,29 @@
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef SIGNAL_NETWORK_CONDITIONAL_HPP
-#define SIGNAL_NETWORK_CONDITIONAL_HPP
+#ifndef SIGNAL_NETWORK_GENERIC_CLASS
+
+#define SIGNAL_NETWORK_GENERIC_CLASS conditional
+#define SIGNAL_NETWORK_GENERIC_FILE <boost/signal_network/component/conditional.hpp>
+#define SIGNAL_NETWORK_GENERIC_TYPENAME Member
+#define SIGNAL_NETWORK_GENERIC_MEMBERNAME member
+#define SIGNAL_NETWORK_GENERIC_TYPENAME2 Condition
-#include <boost/signal_network/filter.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/function_types/result_type.hpp>
-#include <boost/signal_network/detail/unfused_inherited.hpp>
-#include <boost/mpl/vector.hpp>
-#include <boost/fusion/sequence/adapted/mpl.hpp>
-#include <boost/fusion/support/is_sequence.hpp>
+#include <boost/signal_network/component/detail/generic_template.hpp>
+#define SIGNAL_NETWORK_CONDITIONAL_HPP
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
+#else // SIGNAL_NETWORK_GENERIC_CLASS
/** \brief Forwards an incoming signal if an specified condition evaluates to true.
*/
-template<
-typename Condition,
-typename Member,
-typename Signature,
-typename OutSignal=default_out_signal,
-typename Combiner = boost::last_value<typename boost::function_types::result_type<Signature>::type>,
-typename Group = int,
-typename GroupCompare = std::less<Group> >
-class conditional : public filter<Signature, typename OutSignal::default_normal_type, Combiner, Group, GroupCompare>
-{
- typedef filter<Signature, typename OutSignal::default_normal_type, Combiner, Group, GroupCompare> base_type;
-
-public:
- typedef boost::fusion::unfused_inherited<conditional<Condition, Member, Signature, OutSignal, Combiner, Group, GroupCompare>,
- typename mpl::vector<>::type,
- typename boost::function_types::parameter_types<Signature> > unfused;
-
- template <class Seq>
- struct result : public boost::enable_if<boost::fusion::traits::is_sequence<Seq>,
+//typedef typename base_type::signal_type::result_type result_type;
+
+ template <typename FArgs>
+ struct result;
+
+ template<typename T, typename Seq>
+ struct result<T(const Seq &)> : public boost::enable_if<boost::fusion::traits::is_sequence<Seq>,
typename base_type::signal_type::result_type> {};
/** Forwards the signal if the condition evaluates the true.
@@ -45,24 +34,15 @@
default constructed instance otherwise.
*/
template <class Seq>
-#ifndef DOXYGEN_DOCS_ONLY
- typename boost::enable_if<boost::fusion::traits::is_sequence<Seq>,
-#endif
- typename base_type::signal_type::result_type
-#ifndef DOXYGEN_DOCS_ONLY
- >::type
-#endif
- operator()(const Seq &vec_par)
+ typename result<conditional_impl(const Seq &)>::type
+ operator()(const Seq &seq)
{
if (Condition()(member))
- return fused_out(vec_par);
+ return fused_out(seq);
else
return typename base_type::signal_type::result_type();
}
-protected:
- Member member;
-};
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
+#endif // SIGNAL_NETWORK_GENERIC_CLASS
#endif // SIGNAL_NETWORK_CONDITIONAL_HPP
\ No newline at end of file
Added: sandbox/SOC/2007/signals/boost/signal_network/component/conditional_modifier.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/conditional_modifier.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -0,0 +1,44 @@
+// Copyright Stjepan Rajko 2007. Use, modification and
+// distribution is subject to the Boost Software License, Version
+// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef SIGNAL_NETWORK_CONDITIONAL_MODIFIER_HPP
+
+#ifndef SIGNAL_NETWORK_GENERIC_CLASS
+
+#define SIGNAL_NETWORK_GENERIC_CLASS conditional_modifier
+#define SIGNAL_NETWORK_GENERIC_FILE <boost/signal_network/component/conditional_modifier.hpp>
+#define SIGNAL_NETWORK_GENERIC_TYPENAME Modification
+#define SIGNAL_NETWORK_GENERIC_MEMBERNAME modification
+
+#include <boost/signal_network/component/detail/generic_template.hpp>
+
+#define SIGNAL_NETWORK_CONDITIONAL_MODIFIER_HPP
+
+#else // SIGNAL_NETWORK_GENERIC_CLASS
+
+ /** Applies the Modification object to the received signal parameters.
+ */
+ template <typename Args>
+ struct result;
+
+ template <typename F, typename Seq>
+ struct result<F(const Seq &seq)> : public boost::enable_if<
+ boost::fusion::traits::is_sequence<Seq>,
+ typename base_type::signal_type::result_type>
+ {};
+
+ template <class Seq>
+ typename result<conditional_modifier_impl(const Seq &)>::type
+ operator()(const Seq &seq)
+ {
+ typename boost::result_of<Modification(const Seq &)>::type optional
+ = modification.operator()<Seq>(seq);
+ if (optional)
+ return fused_out(*optional);
+ }
+
+#endif // SIGNAL_NETWORK_GENERIC_CLASS
+
+#endif // SIGNAL_NETWORK_CONDITIONAL_MODIFIER_HPP
Copied: sandbox/SOC/2007/signals/boost/signal_network/component/counter.hpp (from r7020, /sandbox/SOC/2007/signals/boost/signal_network/counter.hpp)
==============================================================================
--- /sandbox/SOC/2007/signals/boost/signal_network/counter.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/counter.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -6,10 +6,10 @@
#ifndef SIGNAL_NETWORK_COUNTER_HPP
#define SIGNAL_NETWORK_COUNTER_HPP
-#include <boost/signal_network/applicator.hpp>
+#include <boost/signal_network/component/applicator.hpp>
#include <boost/type_traits/remove_volatile.hpp>
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
+namespace boost { namespace signals {
namespace detail
{
@@ -21,24 +21,23 @@
t++;
}
};
-}
+} // namespace detail
+
/** \brief Counts the number of signals passing through the component.
counter is an applicator with a postincrement application and default member of type volatile int.
\param T Type of the internal counter variable.
*/
template<typename Signature,
+typename OutSignal=SIGNAL_NETWORK_DEFAULT_OUT,
typename T=volatile int,
-typename OutSignal=default_out_signal,
typename Combiner = boost::last_value<typename boost::function_types::result_type<Signature>::type>,
typename Group = int,
-typename GroupCompare = std::less<Group>,
-typename Base = applicator<detail::postincrement<T>, T, Signature, OutSignal, Combiner, Group, GroupCompare> >
-class counter : public Base
+typename GroupCompare = std::less<Group> >
+class counter : public applicator<T, detail::postincrement<T>, Signature, OutSignal, Combiner, Group, GroupCompare>
{
+protected:
+ typedef applicator<T, detail::postincrement<T>, Signature, OutSignal, Combiner, Group, GroupCompare> base_type;
public:
- typedef counter<Signature, T, OutSignal, Combiner, Group, GroupCompare,
- typename applicator<detail::postincrement<T>, T, Signature, OutSignal, Combiner, Group, GroupCompare>::unfused >
- unfused;
/** Initializes the internal counter to 0.
*/
@@ -48,14 +47,14 @@
/** Sets the internal counter to 0.
*/
void reset()
- { Base::member = 0; }
+ { base_type::member = 0; }
/** \return The internal signal counter.
*/
typename boost::remove_volatile<T>::type count() const
- { return Base::member; }
+ { return base_type::member; }
};
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
+} } // namespace boost::signals
#endif // SIGNAL_NETWORK_COUNT_HPP
\ No newline at end of file
Added: sandbox/SOC/2007/signals/boost/signal_network/component/detail/generic_template.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/detail/generic_template.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -0,0 +1,106 @@
+// Copyright Stjepan Rajko 2007. Use, modification and
+// distribution is subject to the Boost Software License, Version
+// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifdef SIGNAL_NETWORK_GENERIC_CLASS
+
+#include <boost/signal_network/component/filter.hpp>
+#include <boost/signal_network/component/detail/unfused_inherited.hpp>
+
+#include <boost/mpl/vector.hpp>
+#include <boost/fusion/sequence/adapted/mpl.hpp>
+#include <boost/fusion/support/is_sequence.hpp>
+
+#define SIGNAL_NETWORK_GENERIC_CLASS_IMPL BOOST_PP_CAT(SIGNAL_NETWORK_GENERIC_CLASS,_impl)
+
+namespace boost { namespace signals {
+
+namespace detail
+{
+ /** \brief fused implementation of conditional modifier
+ */
+ template<
+ typename SIGNAL_NETWORK_GENERIC_TYPENAME,
+#ifdef SIGNAL_NETWORK_GENERIC_TYPENAME2
+ typename SIGNAL_NETWORK_GENERIC_TYPENAME2,
+#endif
+ typename Signature,
+ typename OutSignal=combined,
+ typename Combiner = boost::last_value<typename boost::function_types::result_type<Signature>::type>,
+ typename Group = int,
+ typename GroupCompare = std::less<Group> >
+ class BOOST_PP_CAT(SIGNAL_NETWORK_GENERIC_CLASS,_impl) : public filter<Signature, typename OutSignal::combined_type, Combiner, Group, GroupCompare>
+{
+protected:
+ typedef filter<Signature, typename OutSignal::combined_type, Combiner, Group, GroupCompare> base_type;
+
+public:
+ SIGNAL_NETWORK_GENERIC_CLASS_IMPL() {}
+ template<typename T1>
+ SIGNAL_NETWORK_GENERIC_CLASS_IMPL(const T1 &t1) : SIGNAL_NETWORK_GENERIC_MEMBERNAME(t1) {}
+ template<typename T1, typename T2>
+ SIGNAL_NETWORK_GENERIC_CLASS_IMPL(const T1 &t1, const T2 &t2) : SIGNAL_NETWORK_GENERIC_MEMBERNAME(t1, t2) {}
+
+# ifdef SIGNAL_NETWORK_GENERIC_STANDARD_RESULT
+ template <class FArgs>
+ struct result;
+
+ template<typename T, typename Seq>
+ struct result<T(const Seq &)> : public boost::enable_if<boost::fusion::traits::is_sequence<Seq>,
+ typename base_type::signal_type::result_type> {};
+# endif // SIGNAL_NETWORK_GENERIC_STANDARD_RESULT
+
+# include SIGNAL_NETWORK_GENERIC_FILE
+
+protected:
+ SIGNAL_NETWORK_GENERIC_TYPENAME SIGNAL_NETWORK_GENERIC_MEMBERNAME;
+};
+}
+
+/** \brief Passes the incoming signal to a member modifier, and optionally forwards the returned result.
+*/
+template<
+typename SIGNAL_NETWORK_GENERIC_TYPENAME,
+#ifdef SIGNAL_NETWORK_GENERIC_TYPENAME2
+typename SIGNAL_NETWORK_GENERIC_TYPENAME2,
+#endif
+typename Signature,
+typename OutSignal=combined,
+typename Combiner = boost::last_value<typename boost::function_types::result_type<Signature>::type>,
+typename Group = int,
+typename GroupCompare = std::less<Group> >
+class SIGNAL_NETWORK_GENERIC_CLASS : public boost::fusion::unfused_inherited<detail::SIGNAL_NETWORK_GENERIC_CLASS_IMPL<
+SIGNAL_NETWORK_GENERIC_TYPENAME,
+#ifdef SIGNAL_NETWORK_GENERIC_TYPENAME2
+SIGNAL_NETWORK_GENERIC_TYPENAME2,
+#endif
+Signature, OutSignal, Combiner, Group, GroupCompare>,
+typename boost::function_types::parameter_types<Signature>::type >
+{
+ typedef boost::fusion::unfused_inherited<detail::SIGNAL_NETWORK_GENERIC_CLASS_IMPL<
+ SIGNAL_NETWORK_GENERIC_TYPENAME,
+#ifdef SIGNAL_NETWORK_GENERIC_TYPENAME2
+ SIGNAL_NETWORK_GENERIC_TYPENAME2,
+#endif
+ Signature, OutSignal, Combiner, Group, GroupCompare>,
+ typename boost::function_types::parameter_types<Signature>::type > base_type;
+public:
+ SIGNAL_NETWORK_GENERIC_CLASS() {}
+ template<typename T1>
+ SIGNAL_NETWORK_GENERIC_CLASS(const T1 &t1) : base_type(t1) {}
+ template<typename T1, typename T2>
+ SIGNAL_NETWORK_GENERIC_CLASS(const T1 &t1, const T2 &t2) : base_type(t1, t2) {}
+};
+
+} } // namespace boost::signals
+
+#undef SIGNAL_NETWORK_GENERIC_CLASS
+#undef SIGNAL_NETWORK_GENERIC_FILE
+#undef SIGNAL_NETWORK_GENERIC_TYPENAME
+#undef SIGNAL_NETWORK_GENERIC_TYPENAME2
+#undef SIGNAL_NETWORK_GENERIC_MEMBERNAME
+#undef SIGNAL_NETWORK_GENERIC_STANDARD_RESULT
+
+
+#endif
\ No newline at end of file
Copied: sandbox/SOC/2007/signals/boost/signal_network/component/detail/storable.hpp (from r7020, /sandbox/SOC/2007/signals/boost/signal_network/detail/storable.hpp)
==============================================================================
--- /sandbox/SOC/2007/signals/boost/signal_network/detail/storable.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/detail/storable.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -9,9 +9,8 @@
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/mpl/transform.hpp>
-#include <boost/signal_network/base.hpp>
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
+namespace boost { namespace signals {
namespace detail
{
@@ -27,9 +26,8 @@
boost::remove_reference<boost::mpl::_> >::type,
boost::remove_const<boost::mpl::_> >::type type;
};
-
-}
+} // namespace detail
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
+} } // namespace boost::signals
#endif // SIGNAL_NETWORK_STORABLE_HPP
\ No newline at end of file
Copied: sandbox/SOC/2007/signals/boost/signal_network/component/detail/unfused_inherited.hpp (from r7020, /sandbox/SOC/2007/signals/boost/signal_network/detail/unfused_inherited.hpp)
==============================================================================
--- /sandbox/SOC/2007/signals/boost/signal_network/detail/unfused_inherited.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/detail/unfused_inherited.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -16,6 +16,7 @@
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/facilities/intercept.hpp>
+#include <boost/preprocessor/punctuation/paren_if.hpp>
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
@@ -35,16 +36,16 @@
#include <boost/fusion/functional/adapter/detail/nullary_call_base.hpp>
#include <boost/mpl/size.hpp>
-
+#include <boost/utility/result_of.hpp>
namespace boost { namespace fusion
{
- template <class Function, class CSequence, class Sequence, typename Enable=void> class unfused_inherited;
+ template <class Function, class Sequence, typename Enable=void> class unfused_inherited;
//----- ---- --- -- - - - -
- #define BOOST_PP_ITERATION_PARAMS_1 (3, (0,BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY, <boost/signal_network/detail/unfused_inherited.hpp>))
+ #define BOOST_PP_ITERATION_PARAMS_1 (3, (0,BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY, <boost/signal_network/component/detail/unfused_inherited.hpp>))
#include BOOST_PP_ITERATE()
}}
@@ -56,41 +57,62 @@
//
///////////////////////////////////////////////////////////////////////////////
-# if BOOST_PP_ITERATION_DEPTH()== 2
-
-#define CONSTRUCTOR_ARGS BOOST_PP_FRAME_ITERATION(1)
-#define OPERATOR_ARGS BOOST_PP_FRAME_ITERATION(2)
+#define OPERATOR_ARGS BOOST_PP_ITERATION()
- template <class Function, class CSequence, class Sequence>
- class unfused_inherited<Function, CSequence, Sequence,
+ template <class Function, class Sequence>
+ class unfused_inherited<Function, Sequence,
typename boost::enable_if<
- boost::mpl::and_<
- boost::mpl::equal_to<
- boost::fusion::result_of::size<CSequence>,
- boost::mpl::int_<CONSTRUCTOR_ARGS> >,
boost::mpl::equal_to<
boost::fusion::result_of::size<Sequence>,
boost::mpl::int_<OPERATOR_ARGS> >
- > >::type >
+ >::type >
: public Function
{
- typedef typename result_of::as_vector<CSequence>::type carg_vector_t;
+ protected:
+ typedef Function base_type;
typedef typename result_of::as_vector<Sequence>::type arg_vector_t;
public:
using Function::operator();
#define M(z,i,s) \
- typename result_of::value_at_c<s,i>::type a##i
-#define ADAPTED_ARGS(z,i,s) \
- typename detail::call_param<typename result_of::value_at_c<s,i>::type>::type a##i
+ typename result_of::value_at_c<s,i>::type a##i
+#define MT(z,i,s) \
+ typename result_of::value_at_c<s,i>::type
+
+ unfused_inherited()
+ { }
+
+ template<typename T1>
+ unfused_inherited(const T1 &t1)
+ : Function(t1)
+ { }
+
+ template<typename T1>
+ unfused_inherited(T1 &t1)
+ : Function(t1)
+ { }
- unfused_inherited(BOOST_PP_ENUM(CONSTRUCTOR_ARGS,ADAPTED_ARGS,carg_vector_t))
- : Function(BOOST_PP_ENUM_PARAMS(CONSTRUCTOR_ARGS,a))
+ template<typename T1, typename T2>
+ unfused_inherited(const T1 &t1, const T2 &t2)
+ : Function(t1, t2)
{ }
+ template<typename F, typename Enable=void>
+ struct result;
+
+ template<typename F>
+ struct result<F>
+ : public Function::template result<F> {};
+
+ template<typename F>
+ struct result<F(BOOST_PP_ENUM(OPERATOR_ARGS,MT,arg_vector_t))>
+ {
+ typedef typename boost::result_of<Function(const arg_vector_t &)>::type type;
+ };
+
#if OPERATOR_ARGS>0
- inline typename Function::template result<arg_vector_t>::type
+ inline typename boost::result_of<Function(const arg_vector_t &)>::type
operator()(BOOST_PP_ENUM(OPERATOR_ARGS,M,arg_vector_t)) const
{
arg_vector_t arg(BOOST_PP_ENUM_PARAMS(OPERATOR_ARGS,a));
@@ -98,7 +120,7 @@
}
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1400)
- void//inline typename Function::template result<arg_vector_t>::type
+ inline typename boost::result_of<Function(const arg_vector_t &)>::type
operator()(BOOST_PP_ENUM(OPERATOR_ARGS,M,arg_vector_t))
{
arg_vector_t arg(BOOST_PP_ENUM_PARAMS(OPERATOR_ARGS,a));
@@ -106,8 +128,8 @@
}
#endif
-#else
- inline typename Function::template result<arg_vector_t>::type
+#else // OPERATOR_ARGS==0
+ inline typename boost::result_of<Function(const arg_vector_t &)>::type
operator()() const
{
arg_vector_t arg;
@@ -115,7 +137,7 @@
}
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1400)
- inline typename Function::template result<arg_vector_t>::type
+ inline typename boost::result_of<Function(const arg_vector_t &)>::type
operator()()
{
arg_vector_t arg;
@@ -123,23 +145,15 @@
}
#endif
-#endif
+#endif // OPERATOR_ARGS>0
#undef M
-#undef ADAPTED_ARGS
+#undef MT
};
-#undef CONSTRUCTOR_ARGS
#undef OPERATOR_ARGS
-#else
-
-#define BOOST_PP_ITERATION_PARAMS_2 (3, (0,BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY,<boost/signal_network/detail/unfused_inherited.hpp>))
-#include BOOST_PP_ITERATE()
-
-#endif
-
#endif // defined(BOOST_PP_IS_ITERATING)
#endif
Copied: sandbox/SOC/2007/signals/boost/signal_network/component/filter.hpp (from r7020, /sandbox/SOC/2007/signals/boost/signal_network/filter.hpp)
==============================================================================
--- /sandbox/SOC/2007/signals/boost/signal_network/filter.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/filter.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -8,13 +8,17 @@
#ifndef SIGNAL_NETWORK_FILTER_HPP
#define SIGNAL_NETWORK_FILTER_HPP
-#include <boost/bind.hpp>
-#include <boost/signal_network/base.hpp>
-#include <boost/type_traits/is_base_of.hpp>
+#include <boost/signal_network/component/filter_base.hpp>
+
#include <boost/fusion/functional/adapter/fused.hpp>
#include <boost/fusion/sequence/conversion/as_vector.hpp>
+#include <boost/fusion/sequence/adapted/mpl.hpp>
+
+#ifndef SIGNAL_NETWORK_DEFAULT_OUT
+#define SIGNAL_NETWORK_DEFAULT_OUT combined
+#endif
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
+namespace boost { namespace signals {
/// Provides a basis for filters (components that receive and send a signal).
/** \param Signature The signature of the signal being sent out.
@@ -22,30 +26,21 @@
Use this class as a base class for classes that produce a signal
of a particular signature.
*/
-struct combined_out_signal
+struct combined
{
- typedef combined_out_signal default_normal_type;
- typedef combined_out_signal default_unfused_type;
+ typedef combined combined_type;
};
-struct unfused_out_signal
+struct unfused
{
- typedef combined_out_signal default_normal_type;
- typedef combined_out_signal default_unfused_type;
+ typedef combined combined_type;
};
-struct fused_out_signal
-{
- typedef fused_out_signal default_normal_type;
- typedef fused_out_signal default_unfused_type;
-};
-
-struct default_out_signal
+struct fused
{
- typedef fused_out_signal default_normal_type;
- typedef combined_out_signal default_unfused_type;
+ typedef fused combined_type;
};
template<typename Signature,
-typename OutSignal=unfused_out_signal,
+typename OutSignal=fused,
typename Combiner = boost::last_value<typename boost::function_traits<Signature>::result_type>,
typename Group = int,
typename GroupCompare = std::less<Group>
@@ -55,7 +50,7 @@
/** \brief Unfused version of the filter class
*/
template<typename Signature, typename Combiner, typename Group, typename GroupCompare>
-class filter<Signature, unfused_out_signal, Combiner, Group, GroupCompare> : public filter_base
+class filter<Signature, unfused, Combiner, Group, GroupCompare> : public filter_base
{
public:
// the signature of the output signal
@@ -68,21 +63,21 @@
const filter &operator = (const filter &) {return *this;}
/// Returns the default out signal.
- signal_type &default_signal()
+ signal_type &default_signal() const
{ return out; }
- /// Disconnects all slots connected to the signet::filter.
+ /// Disconnects all slots connected to the signals::filter.
void disconnect_all_slots() {out.disconnect_all_slots();}
protected:
- signal_type out;
+ mutable signal_type out;
}; // class filter
/** \brief Combined version of the filter class
*/
template<typename Signature, typename Combiner, typename Group, typename GroupCompare>
-class filter<Signature, combined_out_signal, Combiner, Group, GroupCompare>
-: public filter<Signature, unfused_out_signal, Combiner, Group, GroupCompare>
+class filter<Signature, combined, Combiner, Group, GroupCompare>
+: public filter<Signature, unfused, Combiner, Group, GroupCompare>
{
- typedef filter<Signature, unfused_out_signal, Combiner, Group, GroupCompare> base_type;
+ typedef filter<Signature, unfused, Combiner, Group, GroupCompare> base_type;
public:
filter() : fused_out(base_type::out) {}
@@ -101,7 +96,7 @@
/** \brief Fused version of the filter class
*/
template<typename Signature, typename Combiner, typename Group, typename GroupCompare>
-class filter<Signature, fused_out_signal, Combiner, Group, GroupCompare>
+class filter<Signature, fused, Combiner, Group, GroupCompare>
: public filter_base
{
public:
@@ -116,15 +111,15 @@
typedef boost::signal<signature_type, Combiner, Group, GroupCompare> signal_type;
/// Returns the default out signal.
- signal_type &default_signal()
+ signal_type &default_signal() const
{ return fused_out; }
- /// Disconnects all slots connected to the signet::filter.
+ /// Disconnects all slots connected to the signals::filter.
void disconnect_all_slots() {fused_out.disconnect_all_slots();}
protected:
- signal_type fused_out;
+ mutable signal_type fused_out;
}; // class filter
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
+} } // namespace boost::signals
#endif // SIGNAL_NETWORK_FILTER_HPP
Added: sandbox/SOC/2007/signals/boost/signal_network/component/filter_base.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/filter_base.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -0,0 +1,54 @@
+// Copyright Stjepan Rajko 2007. Use, modification and
+// distribution is subject to the Boost Software License, Version
+// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef SIGNAL_NETWORK_FILTER_BASE_HPP
+#define SIGNAL_NETWORK_FILTER_BASE_HPP
+
+#include <boost/signal_network/component/traits.hpp>
+
+#include <boost/type_traits/integral_constant.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/signal.hpp>
+
+#ifdef _THREAD_SAFE_SIGNAL_HPP
+#define SIGNAL_NETWORK_THREAD_SAFE
+#else
+#define SIGNAL_NETWORK_TRACKABLE
+#endif
+
+namespace boost { namespace signals {
+
+class filter_base
+#ifdef SIGNAL_NETWORK_TRACKABLE
+: public boost::signals::trackable
+#endif
+{};
+
+template<class T, typename Enable=void>
+struct is_filter : public boost::false_type { };
+
+template<class T>
+struct is_filter<T, typename boost::enable_if<boost::is_base_of<filter_base, T> >::type >
+ : public boost::true_type { };
+
+template<class T>
+struct is_component<T, typename boost::enable_if<is_filter<T> >::type >
+ : public boost::true_type { };
+
+template<class T>
+struct get_signal<T, typename boost::enable_if<is_filter<T> >::type >
+{
+ typename T::signal_type &operator()(const T &t) {return t.default_signal();}
+};
+
+template<class T>
+struct get_signature<T, typename boost::enable_if<is_filter<T> >::type>
+{
+ typedef typename T::signature_type type;
+};
+
+} } // namespace boost::signals
+
+#endif // SIGNAL_NETWORK_FILTER_BASE_HPP
Copied: sandbox/SOC/2007/signals/boost/signal_network/component/function.hpp (from r7020, /sandbox/SOC/2007/signals/boost/signal_network/function.hpp)
==============================================================================
--- /sandbox/SOC/2007/signals/boost/signal_network/function.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/function.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -1,5 +1,3 @@
-// function.hpp
-
// Copyright Stjepan Rajko 2007. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -8,10 +6,11 @@
#ifndef SIGNAL_NETWORK_FUNCTION_HPP
#define SIGNAL_NETWORK_FUNCTION_HPP
-#include <boost/signal_network/modifier.hpp>
+#include <boost/signal_network/component/modifier.hpp>
+#include <boost/signal_network/component/storage.hpp>
#include <boost/function.hpp>
-#include <boost/signal_network/storage.hpp>
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
+
+namespace boost { namespace signals {
namespace detail
{
@@ -40,25 +39,24 @@
/** \brief Converts a function into a Signal Network filter.
\param Signature Signature of the function to be converted.
-The signet::function object will receive signals of signature void(<i>function arguments</i>),
+The signals::function object will receive signals of signature void(<i>function arguments</i>),
and send signals of signature void(<i>function return type</i>).
*/
template<typename Signature,
typename FunctionSignature,
- typename OutSignal=default_out_signal,
+ typename OutSignal=SIGNAL_NETWORK_DEFAULT_OUT,
typename Combiner = boost::last_value<void>,
typename Group = int,
- typename GroupCompare = std::less<Group>,
- typename Base = modifier<detail::function_adapter<FunctionSignature, Signature>, Signature, OutSignal, Combiner, Group, GroupCompare>
->
-class function : public Base
+ typename GroupCompare = std::less<Group>
+>
+class function : public modifier<detail::function_adapter<FunctionSignature, Signature>, Signature, OutSignal, Combiner, Group, GroupCompare>
{
public:
- typedef function<Signature, FunctionSignature, OutSignal, Combiner, Group, GroupCompare, typename Base::unfused > unfused;
+ typedef modifier<detail::function_adapter<FunctionSignature, Signature>, Signature, OutSignal, Combiner, Group, GroupCompare> base_type;
- function(const boost::function<FunctionSignature> &f) : Base(f) {}
+ function(const boost::function<FunctionSignature> &f) : base_type(f) {}
};
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
+} } // namespace boost::signals
#endif // SIGNAL_NETWORK_FUNCTION_HPP
\ No newline at end of file
Copied: sandbox/SOC/2007/signals/boost/signal_network/component/instantiator.hpp (from r7020, /sandbox/SOC/2007/signals/boost/signal_network/instantiator.hpp)
==============================================================================
--- /sandbox/SOC/2007/signals/boost/signal_network/instantiator.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/instantiator.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -4,63 +4,36 @@
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef SIGNAL_NETWORK_INSTANTIATOR_HPP
-#define SIGNAL_NETWORK_INSTANTIATOR_HPP
-#include <boost/signal_network/filter.hpp>
-#include <boost/mpl/vector.hpp>
-#include <boost/fusion/sequence/adapted/mpl.hpp>
-#include <boost/signal_network/detail/unfused_inherited.hpp>
-#include <boost/fusion/support/is_sequence.hpp>
+#ifndef SIGNAL_NETWORK_GENERIC_CLASS
+
+#define SIGNAL_NETWORK_GENERIC_CLASS instantiator
+#define SIGNAL_NETWORK_GENERIC_FILE <boost/signal_network/component/instantiator.hpp>
+#define SIGNAL_NETWORK_GENERIC_TYPENAME Member
+#define SIGNAL_NETWORK_GENERIC_MEMBERNAME member
+#define SIGNAL_NETWORK_GENERIC_TYPENAME2 Instantiation
+#define SIGNAL_NETWORK_GENERIC_STANDARD_RESULT
+
+#include <boost/signal_network/component/detail/generic_template.hpp>
+#define SIGNAL_NETWORK_INSTANTIATOR_HPP
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
+#else // SIGNAL_NETWORK_GENERIC_CLASS
/** \brief Generic component which, upon receiving a signal, instantiates an object of type Instantiation from a member object
of type Member.
*/
-template<
-typename Instantiation,
-typename Member,
-typename Signature,
-typename OutSignal=default_out_signal,
-typename Combiner = boost::last_value<typename boost::function_types::result_type<Signature>::type>,
-typename Group = int,
-typename GroupCompare = std::less<Group> >
-class instantiator : public filter<Signature, typename OutSignal::default_normal_type, Combiner, Group, GroupCompare>
-{
- typedef filter<Signature, typename OutSignal::default_normal_type, Combiner, Group, GroupCompare> base_type;
-
-public:
-#ifndef DOXYGEN_DOCS_ONLY
- typedef boost::fusion::unfused_inherited<instantiator<Instantiation, Member, Signature,
- typename OutSignal::default_unfused_type, Combiner, Group, GroupCompare>,
- typename mpl::vector<>::type,
- typename base_type::parameter_types > unfused;
-
- template <class Seq>
- struct result : public boost::enable_if<boost::fusion::traits::is_sequence<Seq>,
- typename base_type::signal_type::result_type> {};
-#endif
/** Instantiates an instance of Instantiation from the Member object.
*/
template <class Seq>
-#ifndef DOXYGEN_DOCS_ONLY
- typename boost::enable_if<boost::fusion::traits::is_sequence<Seq>,
-#endif
- typename base_type::signal_type::result_type
-#ifndef DOXYGEN_DOCS_ONLY
- >::type
-#endif
+ typename result<instantiator_impl(const Seq &)>::type
operator()(const Seq &seq)
{
Instantiation instance(member);
return fused_out(seq);
}
-protected:
- Member member;
-};
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
+#endif // SIGNAL_NETWORK_GENERIC_CLASS
#endif // SIGNAL_NETWORK_INSTANTIATOR_HPP
Copied: sandbox/SOC/2007/signals/boost/signal_network/component/junction.hpp (from r7020, /sandbox/SOC/2007/signals/boost/signal_network/junction.hpp)
==============================================================================
--- /sandbox/SOC/2007/signals/boost/signal_network/junction.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/junction.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -6,9 +6,9 @@
#ifndef SIGNAL_NETWORK_JUNCTION_HPP
#define SIGNAL_NETWORK_JUNCTION_HPP
-#include <boost/signal_network/conditional.hpp>
+#include <boost/signal_network/component/conditional.hpp>
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
+namespace boost { namespace signals {
namespace detail
{
@@ -27,16 +27,16 @@
junction is a conditional with Condition identity and Member volatile bool
*/
template<typename Signature,
- typename OutSignal=default_out_signal,
+ typename OutSignal=SIGNAL_NETWORK_DEFAULT_OUT,
typename Combiner = boost::last_value<typename boost::function_types::result_type<Signature>::type>,
typename Group = int,
- typename GroupCompare = std::less<Group>,
- typename Base = conditional<detail::identity<bool>, volatile bool, Signature, OutSignal, Combiner, Group, GroupCompare>
+ typename GroupCompare = std::less<Group>
>
-class junction : public Base
+class junction : public conditional<volatile bool, detail::identity<bool>, Signature, OutSignal, Combiner, Group, GroupCompare>
{
+protected:
+ typedef conditional<volatile bool, detail::identity<bool>, Signature, OutSignal, Combiner, Group, GroupCompare> base_type;
public:
- typedef junction<Signature, OutSignal, Combiner, Group, GroupCompare, typename Base::unfused > unfused;
/** Initializes the junction to be enabled.
*/
@@ -46,12 +46,12 @@
}
/** Enables the junction (signals will be forwarded).
*/
- void enable() {Base::member = true;}
+ void enable() {base_type::member = true;}
/** Disables the junction (signals will not be forwarded).
*/
- void disable() {Base::member = false;}
+ void disable() {base_type::member = false;}
};
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
+} } // namespace boost::signals
#endif
\ No newline at end of file
Copied: sandbox/SOC/2007/signals/boost/signal_network/component/modifier.hpp (from r7020, /sandbox/SOC/2007/signals/boost/signal_network/modifier.hpp)
==============================================================================
--- /sandbox/SOC/2007/signals/boost/signal_network/modifier.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/modifier.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -4,61 +4,30 @@
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef SIGNAL_NETWORK_MODIFIER_HPP
+
+#ifndef SIGNAL_NETWORK_GENERIC_CLASS
+
+#define SIGNAL_NETWORK_GENERIC_CLASS modifier
+#define SIGNAL_NETWORK_GENERIC_FILE <boost/signal_network/component/modifier.hpp>
+#define SIGNAL_NETWORK_GENERIC_TYPENAME Modification
+#define SIGNAL_NETWORK_GENERIC_MEMBERNAME modification
+#define SIGNAL_NETWORK_GENERIC_STANDARD_RESULT
+
+#include <boost/signal_network/component/detail/generic_template.hpp>
+
#define SIGNAL_NETWORK_MODIFIER_HPP
-#include <boost/signal_network/filter.hpp>
-#include <boost/mpl/vector.hpp>
-#include <boost/fusion/sequence/adapted/mpl.hpp>
-#include <boost/signal_network/detail/unfused_inherited.hpp>
-#include <boost/fusion/support/is_sequence.hpp>
-
-
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
-
-
-template<
-typename Modification,
-typename Signature,
-typename OutSignal=default_out_signal,
-typename Combiner = boost::last_value<typename boost::function_types::result_type<Signature>::type>,
-typename Group = int,
-typename GroupCompare = std::less<Group> >
-class modifier : public filter<Signature, typename OutSignal::default_normal_type, Combiner, Group, GroupCompare>
-{
- typedef filter<Signature, typename OutSignal::default_normal_type, Combiner, Group, GroupCompare> base_type;
-
-public:
-#ifndef DOXYGEN_DOCS_ONLY
- typedef boost::fusion::unfused_inherited<modifier<Modification, Signature,
- typename OutSignal::default_unfused_type, Combiner, Group, GroupCompare>,
- typename mpl::vector<const Modification &>::type,
- typename base_type::parameter_types > unfused;
-
- template <class Seq>
- struct result : public boost::enable_if<boost::fusion::traits::is_sequence<Seq>,
- typename base_type::signal_type::result_type> {};
-#endif
- modifier() {}
- modifier (const Modification &m) : modification(m) {}
-
+#else // SIGNAL_NETWORK_GENERIC_CLASS
+
/** Applies the Modification object to the received signal parameters.
*/
template <class Seq>
-#ifndef DOXYGEN_DOCS_ONLY
- typename boost::enable_if<boost::fusion::traits::is_sequence<Seq>,
-#endif
- typename base_type::signal_type::result_type
-#ifndef DOXYGEN_DOCS_ONLY
- >::type
-#endif
+ typename result<modifier_impl(const Seq &)>::type
operator()(const Seq &seq)
{
return fused_out(modification(seq));
}
-protected:
- Modification modification;
-};
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
+#endif // SIGNAL_NETWORK_GENERIC_CLASS
#endif // SIGNAL_NETWORK_MODIFIER_HPP
Copied: sandbox/SOC/2007/signals/boost/signal_network/component/mutex.hpp (from r7020, /sandbox/SOC/2007/signals/boost/signal_network/mutex.hpp)
==============================================================================
--- /sandbox/SOC/2007/signals/boost/signal_network/mutex.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/mutex.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -6,25 +6,24 @@
#ifndef SIGNAL_NETWORK_MUTEX_HPP
#define SIGNAL_NETWORK_MUTEX_HPP
-#include <boost/signal_network/instantiator.hpp>
+#include <boost/signal_network/component/instantiator.hpp>
#include <boost/thread/mutex.hpp>
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
+namespace boost { namespace signals {
/** \brief Ensures a component is processing only one signal at a time when using multiple threads.
*/
template<typename Signature,
-typename OutSignal=default_out_signal,
-typename Combiner = boost::last_value<typename boost::function_types::result_type<Signature>::type>,
-typename Group = int,
-typename GroupCompare = std::less<Group>,
-typename Base = instantiator<boost::mutex::scoped_lock, boost::mutex, Signature, OutSignal, Combiner, Group, GroupCompare> >
-class mutex : public Base
+ typename OutSignal=SIGNAL_NETWORK_DEFAULT_OUT,
+ typename Combiner = boost::last_value<typename boost::function_types::result_type<Signature>::type>,
+ typename Group = int,
+ typename GroupCompare = std::less<Group>
+>
+class mutex : public
+ instantiator<boost::mutex, boost::mutex::scoped_lock, Signature, OutSignal, Combiner, Group, GroupCompare>
{
-public:
- typedef mutex<Signature, OutSignal, Combiner, Group, GroupCompare, typename Base::unfused> unfused;
};
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
+} } // namespace boost::signals
#endif // SIGNAL_NETWORK_MUTEX_HPP
Copied: sandbox/SOC/2007/signals/boost/signal_network/component/socket_receiver.hpp (from r7020, /sandbox/SOC/2007/signals/boost/signal_network/socket_receiver.hpp)
==============================================================================
--- /sandbox/SOC/2007/signals/boost/signal_network/socket_receiver.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/socket_receiver.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -8,15 +8,15 @@
#ifndef SIGNAL_NETWORK_SOCKET_RECEIVER_HPP
#define SIGNAL_NETWORK_SOCKET_RECEIVER_HPP
-#include <boost/signal_network/storage.hpp>
+#include <boost/signal_network/component/storage.hpp>
+#include <boost/signal_network/component/detail/serialize_fusion_vector.hpp>
+
#include <sstream>
#include <boost/asio.hpp>
#include <boost/archive/binary_iarchive.hpp>
-#include <boost/lambda/lambda.hpp>
#include <boost/fusion/algorithm/iteration/for_each.hpp>
-#include <boost/signal_network/detail/serialize_fusion_vector.hpp>
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
+namespace boost { namespace signals {
/** \brief Receives serializable signals through a Boost.Asio socket.
\param Signature Signature of the signal sent (and received through the socket).
@@ -24,7 +24,7 @@
*/
template<typename Signature,
- typename OutSignal=default_out_signal,
+ typename OutSignal=SIGNAL_NETWORK_DEFAULT_OUT,
typename Combiner = boost::last_value<typename boost::function_types::result_type<Signature>::type>,
typename Group = int,
typename GroupCompare = std::less<Group> >
@@ -33,10 +33,6 @@
typedef storage<Signature, OutSignal, Combiner, Group, GroupCompare> base_type;
public:
- typedef boost::fusion::unfused_typed_class<socket_receiver<Signature,
- OutSignal, Combiner, Group, GroupCompare>,
- typename base_type::base_type::parameter_types> unfused;
-
/// Initializes the socket_sender to use the provided socket.
socket_receiver(asio::ip::tcp::socket &socket) :
socket_(socket),
@@ -48,8 +44,8 @@
stream.str(empty_string);
stream.write((char *)buffer, received_size);
boost::archive::binary_iarchive archive(stream);
- archive & storage<Signature>::stored;
- storage<Signature>::operator()();
+ archive & base_type::stored();
+ base_type::send();
}
private:
@@ -61,6 +57,6 @@
unsigned char buffer[bufferSize];
};
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
+} } // namespace boost::signals
#endif
\ No newline at end of file
Copied: sandbox/SOC/2007/signals/boost/signal_network/component/socket_sender.hpp (from r7020, /sandbox/SOC/2007/signals/boost/signal_network/socket_sender.hpp)
==============================================================================
--- /sandbox/SOC/2007/signals/boost/signal_network/socket_sender.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/socket_sender.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -8,67 +8,64 @@
#ifndef SIGNAL_NETWORK_SOCKET_SENDER_HPP
#define SIGNAL_NETWORK_SOCKET_SENDER_HPP
-#include <boost/mpl/vector.hpp>
-#include <boost/signal_network/filter.hpp>
-#include <boost/asio.hpp>
+#include <boost/signal_network/component/detail/unfused_inherited.hpp>
+#include <boost/signal_network/component/detail/serialize_fusion_vector.hpp>
+#include <boost/signal_network/component/filter.hpp>
+
#include <boost/archive/binary_oarchive.hpp>
+#include <boost/asio.hpp>
+#include <boost/mpl/vector.hpp>
#include <sstream>
-#include <boost/signal_network/detail/unfused_inherited.hpp>
-#include <boost/signal_network/detail/serialize_fusion_vector.hpp>
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
+namespace boost { namespace signals {
+namespace detail {
+
+ template<typename Signature>
+ class socket_sender_impl
+ {
+ public:
+ /// Initializes the socket_sender to use the provided socket.
+ socket_sender_impl(asio::ip::tcp::socket & socket) :
+ socket(socket),
+ stream(std::ios::in | std::ios::out | std::ios::binary)
+ { }
+
+ typedef void result_type;
+
+ /// Serializes each of the arguments and sends them in a single packet through the socket.
+ template <class Seq>
+ void operator()(const Seq &vec_par)
+ {
+ boost::archive::binary_oarchive archive (stream);
+ archive & vec_par;
+ boost::asio::write(socket, asio::buffer(stream.str()),
+ boost::asio::transfer_all());
+ stream.str(empty_string);
+ }
+ private:
+ asio::ip::tcp::socket &socket;
+ std::stringstream stream;
+ std::string empty_string;
+ };
+}
/** \brief Sends serializable signals through a Boost asio socket.
\param Signature Signature of the signal received (and sent through the socket).
\todo socket_sender only works for Signatures of return type void.
*/
template<typename Signature>
-class socket_sender
+class socket_sender : public boost::fusion::unfused_inherited<
+ detail::socket_sender_impl<Signature>, typename boost::function_types::parameter_types<Signature>::type >
{
+ typedef boost::fusion::unfused_inherited<
+ detail::socket_sender_impl<Signature>,
+ typename boost::function_types::parameter_types<Signature>::type>
+ base_type;
public:
- typedef boost::fusion::unfused_inherited<socket_sender<Signature>,
- typename mpl::vector<asio::ip::tcp::socket &>::type,
- typename boost::function_types::parameter_types<Signature> > unfused;
-
- typedef boost::function_types::parameter_types<Signature> ParTypes;
-
- /// Initializes the socket_sender to use the provided socket.
- socket_sender(asio::ip::tcp::socket & socket) :
- socket(& socket),
- stream(std::ios::in | std::ios::out | std::ios::binary)
- { }
- socket_sender() :
- socket(NULL),
- stream(std::ios::in | std::ios::out | std::ios::binary)
+ socket_sender(asio::ip::tcp::socket & socket) : base_type(socket)
{ }
- virtual ~socket_sender()
- {
- }
-
- template<class Seq>
- struct result
- {
- typedef void type;
- };
- /// Serializes each of the arguments and sends them in a single packet through the socket.
- template <class Seq>
- void operator()(const Seq &vec_par)
- {
- if (socket)
- {
- boost::archive::binary_oarchive archive (stream);
- archive & vec_par;
- boost::asio::write(*socket, asio::buffer(stream.str()),
- boost::asio::transfer_all());
- stream.str(empty_string);
- }
- }
-private:
- asio::ip::tcp::socket *socket;
- std::stringstream stream;
- std::string empty_string;
};
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
+} } // namespace boost::signals
#endif
Copied: sandbox/SOC/2007/signals/boost/signal_network/component/storage.hpp (from r7043, /sandbox/SOC/2007/signals/boost/signal_network/storage.hpp)
==============================================================================
--- /sandbox/SOC/2007/signals/boost/signal_network/storage.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/storage.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -6,154 +6,191 @@
#ifndef SIGNAL_NETWORK_GENERATOR_HPP
#define SIGNAL_NETWORK_GENERATOR_HPP
-#include <boost/signal_network/detail/storable.hpp>
-#include <boost/signal_network/filter.hpp>
-#include <boost/type_traits.hpp>
-#include <boost/call_traits.hpp>
-
-#include <boost/function_types/parameter_types.hpp>
-#include <boost/fusion/sequence/intrinsic/at.hpp>
-#include <boost/fusion/sequence/adapted/mpl.hpp>
-#include <boost/fusion/functional/adapter/fused.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/type_traits/same_traits.hpp>
-#include <boost/mpl/greater.hpp>
-#include <boost/fusion/support/is_sequence.hpp>
+#include <boost/signal_network/component/conditional_modifier.hpp>
+#include <boost/signal_network/component/detail/storable.hpp>
+#include <boost/signal_network/connection/slot_selector_map.hpp>
+
+#include <boost/fusion/sequence/container/vector.hpp>
+#include <boost/fusion/sequence/view/transform_view.hpp>
+#include <boost/fusion/sequence/container/map.hpp>
+#include <boost/type_traits/add_reference.hpp>
-#include <boost/signal_network/detail/unfused_typed_class.hpp>
+namespace boost { namespace signals {
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
+namespace detail
+{
+ struct make_ref
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename T>
+ struct result<make_ref(T&)>
+ : boost::add_reference<T>
+ {};
+
+ template<typename T>
+ typename boost::add_reference<T>::type operator()(T& t) const
+ {
+ return t;
+ }
+ };
+
+ template <typename Signature>
+ class storage_modifier
+ {
+ public:
+ typedef typename boost::function_types::parameter_types<Signature>::type parameter_types;
+ typedef typename detail::mpl_storable<parameter_types>::type storable_types;
+ typedef typename boost::fusion::result_of::as_vector<storable_types >::type storable_vector;
+
+ storage_modifier(bool opened=true) : opened(opened) {}
+ template<typename Seq>
+ storage_modifier(const Seq &seq, bool opened=true) : stored(seq), opened(opened) {}
+
+ template<typename Sig>
+ struct result;
+
+ template<typename S, typename T1>
+ struct result<storage_modifier<S>(const T1 &)>
+ {
+ typedef boost::optional<const T1 &> type;
+ };
+ template<typename T1>
+ typename result<storage_modifier(const T1 &)>::type operator()(const T1 &t1)
+ {
+ stored = t1;
+ if (opened)
+ return t1;
+ else
+ return typename result<storage_modifier(const T1 &)>::type ();
+ }
+ protected:
+ storable_vector stored;
+ volatile bool opened;
+
+ template<typename Sig, typename OutSignal, typename Combiner, typename Group, typename GroupCompare>
+ friend class storage;
+ };
+}
/** \brief Stores and transmits arguments received from a signal.
\param Signature Signature of the signal sent.
*/
template<typename Signature,
- typename OutSignal=default_out_signal,
+ typename OutSignal=SIGNAL_NETWORK_DEFAULT_OUT,
typename Combiner = boost::last_value<typename boost::function_traits<Signature>::result_type>,
typename Group = int,
- typename GroupCompare = std::less<Group> >
- class storage : public filter<Signature, typename OutSignal::default_normal_type, Combiner, Group, GroupCompare>
+ typename GroupCompare = std::less<Group>
+>
+class storage : public conditional_modifier<detail::storage_modifier<Signature>, Signature, OutSignal, Combiner, Group, GroupCompare>
{
#ifndef DOXYGEN_DOCS_ONLY
protected:
- typedef filter<Signature, typename OutSignal::default_normal_type, Combiner, Group, GroupCompare> base_type;
- typedef storage<Signature, OutSignal, Combiner, Group, GroupCompare> this_type;
+ typedef conditional_modifier<detail::storage_modifier<Signature>, Signature, OutSignal, Combiner, Group, GroupCompare> base_type;
public:
+ typedef typename detail::storage_modifier<Signature>::parameter_types parameter_types;
- typedef typename detail::mpl_storable<typename base_type::parameter_types>::type storable_types;
- typedef typename boost::fusion::result_of::as_vector<storable_types >::type storable_vector;
+ typedef typename detail::storage_modifier<Signature>::storable_types storable_types;
+ typedef typename detail::storage_modifier<Signature>::storable_vector storable_vector;
- typedef
- boost::fusion::unfused_typed_class<storage<
- Signature, typename OutSignal::default_unfused_type, Combiner, Group, GroupCompare>,
- typename base_type::parameter_types> unfused;
#endif
/** Initializes the stored parameter values using the provided sequence.
\param[in] seq Sequence from which the stored parameter sequence is initialized from.
*/
template<typename Seq>
- storage(const Seq &seq) : stored(seq) {}
+ storage(const Seq &seq) : base_type(seq) {}
/** Initializes the stored parameter values using its default constructor.
*/
storage() {}
+
+ void open() {base_type::member.opened = true;}
+ void close() {base_type::member.opened = false;}
/** Sends a signal containing the stored parameter values.
\return Return value of the sent signal.
*/
- typename base_type::signal_type::result_type operator()()
+ typename base_type::signal_type::result_type send()
{
- return base_type::fused_out(stored);
+ boost::fusion::transform_view<storable_vector, detail::make_ref>
+ view(base_type::modification.stored, detail::make_ref());
+ return base_type::fused_out(view);
}
/** Sends a signal containing the stored parameter values.
\return Return value of the sent signal.
*/
- typename base_type::signal_type::result_type operator()(const boost::fusion::vector<> &)
+ typename base_type::signal_type::result_type send(const boost::fusion::vector<> &)
{
- return base_type::fused_out(stored);
+ return send();
}
-
-#ifndef DOXYGEN_DOCS_ONLY
- template<class Seq>
- struct result : public boost::enable_if<typename boost::mpl::and_<
- boost::fusion::traits::is_sequence<Seq>,
- boost::mpl::greater<boost::fusion::result_of::size<Seq>, boost::mpl::int_<0> > >::type
- > {};
-#endif
-
- /** Sets the stored parameter values using the provided sequence.
- \param[in] seq Sequence to whose value the stored parameter sequence is assigned to.
-
- <b>Note:</b> Enabled only for fusion sequences of size >= 1.
- */
- template <class Seq>
-#ifndef DOXYGEN_DOCS_ONLY
- typename boost::enable_if<typename boost::mpl::and_<
- boost::fusion::traits::is_sequence<Seq>,
- boost::mpl::greater<boost::fusion::result_of::size<Seq>, boost::mpl::int_<0> > >::type
- >::type
-#else
- void
-#endif
- operator()(const Seq &seq)
- {
- stored = seq;
- }
-
/** \return A reference to the fusion vector of stored parameter values.
*/
const storable_vector &stored_vector()
{
- return stored;
+ return base_type::modification.stored;
}
/** \return The stored value of parameter N using an optimizing cast.
*/
template<int N>
typename boost::fusion::result_of::at_c<storable_vector, N>::type at()
{
- return boost::fusion::at_c<N>(stored);
+ return boost::fusion::at_c<N>(base_type::modification.stored);
}
/** \return The stored value of parameter N typed exactly as it appears in the Signature.
*/
template<int N>
- typename boost::mpl::at_c<typename base_type::parameter_types, N>::type value_at()
+ typename boost::mpl::at_c<parameter_types, N>::type value_at()
{
- return boost::fusion::at_c<N>(stored);
+ return boost::fusion::at_c<N>(base_type::modification.stored);
}
+ boost::fusion::map<
+ boost::fusion::pair<void(), slot_selector<void (), storage> >,
+ boost::fusion::pair<void(const boost::fusion::vector<> &),
+ slot_selector<void (const boost::fusion::vector<> &), storage> >
+ >
+ send_slot()
+ {
+ return boost::fusion::map<
+ boost::fusion::pair<void(), slot_selector<void (), storage> >,
+ boost::fusion::pair<void(const boost::fusion::vector<> &),
+ slot_selector<void (const boost::fusion::vector<> &), storage> >
+ >
+ (make_slot_selector<void ()> (&storage::send, *this),
+ make_slot_selector<void (const boost::fusion::vector<> &)> (&storage::send, *this));
+ }
/** \return The slot selector for the related at function.
*/
template<int N>
- slot_selector_t
+ slot_selector
#ifndef DOXYGEN_DOCS_ONLY
- <this_type,
- typename boost::fusion::result_of::at_c<storable_vector, N>::type ()>
+ <typename boost::fusion::result_of::at_c<storable_vector, N>::type (), storage>
#endif
at_slot()
{
- return boost::signal_network::slot_selector<
+ return make_slot_selector<
typename boost::fusion::result_of::at_c<storable_vector, N>::type ()>
- (*this, &this_type::template at<N>);
+ (&storage::template at<N>, *this);
}
/** \return The slot selector for the value_at function.
*/
template<int N>
- slot_selector_t
+ slot_selector
#ifndef DOXYGEN_DOCS_ONLY
- <this_type,
- typename boost::mpl::at_c<typename base_type::parameter_types, N>::type ()>
+ <typename boost::mpl::at_c<parameter_types, N>::type (), storage>
#endif
value_at_slot()
{
- return boost::signal_network::slot_selector<
- typename boost::mpl::at_c<typename base_type::parameter_types, N>::type ()>
- (*this, &this_type::template value_at<N>);
+ return make_slot_selector<
+ typename boost::mpl::at_c<parameter_types, N>::type ()>
+ (&storage::template value_at<N>, *this);
}
protected:
- storable_vector stored;
-};
+ storable_vector &stored() {return base_type::modification.stored;}
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
+};
+} } // namespace boost::signals
#endif // SIGNAL_NETWORK_GENERATOR_HPP
\ No newline at end of file
Copied: sandbox/SOC/2007/signals/boost/signal_network/component/timed_generator.hpp (from r7020, /sandbox/SOC/2007/signals/boost/signal_network/timed_generator.hpp)
==============================================================================
--- /sandbox/SOC/2007/signals/boost/signal_network/timed_generator.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/timed_generator.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -1,24 +1,27 @@
#ifndef SIGNAL_NETWORK_TIMED_GENERATOR_HPP
#define SIGNAL_NETWORK_TIMED_GENERATOR_HPP
-#include <boost/signal_network/storage.hpp>
+#include <boost/signal_network/component/storage.hpp>
+
#include <boost/thread/thread.hpp>
#include <boost/thread/condition.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/xtime.hpp>
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
+namespace boost { namespace signals {
/** \brief Creates its own thread and periodically sends a signal with the stored value.
\param Signature signature of the sent signal.
*/
-template<class Signature,
-typename Base=storage<Signature> >
-class timed_generator : public storage<Signature>
+template<typename Signature,
+ typename OutSignal=SIGNAL_NETWORK_DEFAULT_OUT,
+ typename Combiner = boost::last_value<typename boost::function_traits<Signature>::result_type>,
+ typename Group = int,
+ typename GroupCompare = std::less<Group>
+ >
+class timed_generator : public storage<Signature, OutSignal, Combiner, Group, GroupCompare>
{
-public:
- typedef timed_generator<Signature, typename Base::unfused> unfused;
-
+public:
/// Default constructor. Starts the thread, but signals won't be sent until the enable() function is called.
timed_generator() : terminating(false), enabled(false)
{
@@ -102,7 +105,7 @@
volatile bool enabled;
};
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
+} } // namespace boost::signals
#endif // SIGNAL_NETWORK_TIMED_GENERATOR_HPP
Added: sandbox/SOC/2007/signals/boost/signal_network/component/traits.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/traits.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -0,0 +1,27 @@
+// Copyright Stjepan Rajko 2007. Use, modification and
+// distribution is subject to the Boost Software License, Version
+// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef SIGNAL_NETWORK_COMPONENT_TRAITS_HPP
+#define SIGNAL_NETWORK_COMPONENT_TRAITS_HPP
+
+#include <boost/type_traits/integral_constant.hpp>
+
+namespace boost { namespace signals {
+
+template<class T, typename Enable=void>
+struct is_component : public boost::false_type {};
+
+template<class T, typename Enable=void>
+struct get_signal;
+
+template<typename T, typename Signature, typename Enable=void>
+struct get_slot;
+
+template<typename T, typename Enable=void>
+struct get_signature;
+
+} } // namespace boost::signals
+
+#endif // SIGNAL_NETWORK_COMPONENT_TRAITS_HPP
Deleted: sandbox/SOC/2007/signals/boost/signal_network/conditional.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/conditional.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
+++ (empty file)
@@ -1,68 +0,0 @@
-// Copyright Stjepan Rajko 2007. Use, modification and
-// distribution is subject to the Boost Software License, Version
-// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef SIGNAL_NETWORK_CONDITIONAL_HPP
-#define SIGNAL_NETWORK_CONDITIONAL_HPP
-
-#include <boost/signal_network/filter.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/function_types/result_type.hpp>
-#include <boost/signal_network/detail/unfused_inherited.hpp>
-#include <boost/mpl/vector.hpp>
-#include <boost/fusion/sequence/adapted/mpl.hpp>
-#include <boost/fusion/support/is_sequence.hpp>
-
-
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
-
-/** \brief Forwards an incoming signal if an specified condition evaluates to true.
-*/
-template<
-typename Condition,
-typename Member,
-typename Signature,
-typename OutSignal=default_out_signal,
-typename Combiner = boost::last_value<typename boost::function_types::result_type<Signature>::type>,
-typename Group = int,
-typename GroupCompare = std::less<Group> >
-class conditional : public filter<Signature, typename OutSignal::default_normal_type, Combiner, Group, GroupCompare>
-{
- typedef filter<Signature, typename OutSignal::default_normal_type, Combiner, Group, GroupCompare> base_type;
-
-public:
- typedef boost::fusion::unfused_inherited<conditional<Condition, Member, Signature, OutSignal, Combiner, Group, GroupCompare>,
- typename mpl::vector<>::type,
- typename boost::function_types::parameter_types<Signature> > unfused;
-
- template <class Seq>
- struct result : public boost::enable_if<boost::fusion::traits::is_sequence<Seq>,
- typename base_type::signal_type::result_type> {};
-
- /** Forwards the signal if the condition evaluates the true.
- \returns Return value of the sent signal if the condition evaluates to true,
- default constructed instance otherwise.
- */
- template <class Seq>
-#ifndef DOXYGEN_DOCS_ONLY
- typename boost::enable_if<boost::fusion::traits::is_sequence<Seq>,
-#endif
- typename base_type::signal_type::result_type
-#ifndef DOXYGEN_DOCS_ONLY
- >::type
-#endif
- operator()(const Seq &vec_par)
- {
- if (Condition()(member))
- return fused_out(vec_par);
- else
- return typename base_type::signal_type::result_type();
- }
-protected:
- Member member;
-};
-
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
-
-#endif // SIGNAL_NETWORK_CONDITIONAL_HPP
\ No newline at end of file
Added: sandbox/SOC/2007/signals/boost/signal_network/connection.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/signal_network/connection.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -0,0 +1,15 @@
+// Copyright Stjepan Rajko 2007. Use, modification and
+// distribution is subject to the Boost Software License, Version
+// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef SIGNAL_NETWORK_CONNECTION_HPP
+#define SIGNAL_NETWORK_CONNECTION_HPP
+
+#include <boost/signal_network/connection/connect.hpp>
+#include <boost/signal_network/connection/operators.hpp>
+#include <boost/signal_network/connection/signal.hpp>
+#include <boost/signal_network/connection/slot_selector.hpp>
+#include <boost/signal_network/connection/slot_selector_map.hpp>
+
+#endif
\ No newline at end of file
Copied: sandbox/SOC/2007/signals/boost/signal_network/connection/connect.hpp (from r7020, /sandbox/SOC/2007/signals/boost/signal_network/detail/connect.hpp)
==============================================================================
--- /sandbox/SOC/2007/signals/boost/signal_network/detail/connect.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/connection/connect.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -1,42 +1,40 @@
-#if !defined(SIGNAL_NETWORK_CONNECT_HPP)
-#if !defined(BOOST_PP_IS_ITERATING)
-
-#include <boost/preprocessor/iterate.hpp>
-#include <boost/preprocessor/enum_shifted_params.hpp>
-#include <boost/bind.hpp>
-
-#define SIGNAL_NETWORK_TEMPLATE_TYPENAMES typename T,
-#define SIGNAL_NETWORK_TEMPLATE_TYPENAMES_LIST T,
-
-namespace boost {
- namespace signal_network {
- namespace signet {
- namespace detail {
-
- template<typename T, typename Signature, typename Combiner, typename Group, typename GroupCompare, int Arity>
- struct connect_impl;
-
-#define BOOST_PP_ITERATION_PARAMS_1 (3,(0,3,<boost/signal_network/detail/connect.hpp>))
-#include BOOST_PP_ITERATE()
-
- } // namespace detail
- } // namespace signet
- } // namespace signal_network
-} // namespace boost
+// Copyright Stjepan Rajko 2007. Use, modification and
+// distribution is subject to the Boost Software License, Version
+// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+#ifndef SIGNAL_NETWORK_CONNECT_HPP
#define SIGNAL_NETWORK_CONNECT_HPP
-#else // defined(BOOST_PP_IS_ITERATING)
-template<typename T, typename Signature, typename Combiner, typename Group, typename GroupCompare>
-struct connect_impl<T, Signature, Combiner, Group, GroupCompare, BOOST_PP_ITERATION()>
+namespace boost { namespace signals {
+
+template<typename Input, typename Output, typename Enable=void>
+struct connect_impl;
+
+template<typename Input, typename Output>
+void connect(Input &input, Output &output)
+{
+ connect_impl<Input, Output>()(input, output);
+};
+
+template<typename Input, typename Output>
+void connect(Input &input, const Output &output)
+{
+ connect_impl<Input, Output>()(input, output);
+};
+
+template<typename Input, typename Output>
+void connect(const Input &input, Output &output)
+{
+ connect_impl<Input, Output>()(input, output);
+};
+
+template<typename Input, typename Output>
+void connect(const Input &input, const Output &output)
{
- static void connect(boost::signal<Signature, Combiner, Group, GroupCompare> &signal, T &link)
- {
- signal.connect(boost::bind
- (static_cast<typename slot_type<T, Signature>::type>( &T::operator() ),
- boost::ref(link) BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
- BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(BOOST_PP_ITERATION()),_)));
- }
+ connect_impl<Input, Output>()(input, output);
};
-#endif
-#endif
\ No newline at end of file
+
+} } // namespace boost::signals
+
+#endif // SIGNAL_NETWORK_CONNECT_HPP
\ No newline at end of file
Added: sandbox/SOC/2007/signals/boost/signal_network/connection/detail/bind_object.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/signal_network/connection/detail/bind_object.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -0,0 +1,60 @@
+// Copyright Stjepan Rajko 2007. Use, modification and
+// distribution is subject to the Boost Software License, Version
+// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#if !defined(SIGNAL_NETWORK_BIND_OBJECT_HPP)
+#if !defined(BOOST_PP_IS_ITERATING)
+
+#include <boost/signal_network/connection/detail/slot_type.hpp>
+
+#include <boost/function_types/function_arity.hpp>
+#include <boost/preprocessor/iterate.hpp>
+#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/arithmetic/inc.hpp>
+#include <boost/bind.hpp>
+#include <boost/function.hpp>
+
+namespace boost { namespace signals {
+
+namespace detail {
+
+ template<typename Signature, typename T, int Arity>
+ struct bind_object_impl;
+
+ template<typename Signature, typename T>
+ struct bind_object : public bind_object_impl<Signature, T, boost::function_types::function_arity<Signature>::value>
+ {};
+
+# define BOOST_PP_ITERATION_PARAMS_1 (3,(0,9,<boost/signal_network/connection/detail/bind_object.hpp>))
+# include BOOST_PP_ITERATE()
+
+ } // namespace detail
+
+} } // namespace boost::signals
+
+#define SIGNAL_NETWORK_BIND_OBJECT_HPP
+#else // defined(BOOST_PP_IS_ITERATING)
+
+template<typename Signature, typename T>
+struct bind_object_impl<Signature, T, BOOST_PP_ITERATION()>
+{
+ boost::function<Signature> operator()(typename boost::signals::detail::slot_type<Signature, T>::type mem_fn, T &object)
+ {
+ return boost::bind(mem_fn, boost::ref(object)
+ BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
+ BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(BOOST_PP_ITERATION()),_));
+ }
+ boost::function<Signature> operator()(typename boost::signals::detail::slot_type<Signature, T>::type mem_fn, const T &object)
+ {
+ return boost::bind(mem_fn, boost::ref(object)
+ BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
+ BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(BOOST_PP_ITERATION()),_));
+ }
+};
+
+#endif // defined(BOOST_PP_IS_ITERATING)
+#endif // SIGNAL_NETWORK_BIND_OBJECT_HPP
+
+
\ No newline at end of file
Added: sandbox/SOC/2007/signals/boost/signal_network/connection/detail/result_of_defined.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/signal_network/connection/detail/result_of_defined.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -0,0 +1,72 @@
+// Copyright Stjepan Rajko 2007. Use, modification and
+// distribution is subject to the Boost Software License, Version
+// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef SIGNAL_NETWORK_RESULT_OF_DEFINED_HPP
+#define SIGNAL_NETWORK_RESULT_OF_DEFINED_HPP
+
+#include <boost/function_types/function_type.hpp>
+#include <boost/function_types/parameter_types.hpp>
+#include <boost/function_types/result_type.hpp>
+#include <boost/mpl/has_xxx.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/mpl/pop_front.hpp>
+#include <boost/mpl/push_front.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/integral_constant.hpp>
+
+namespace boost { namespace signals {
+
+namespace detail {
+
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type)
+
+ template<typename T>
+ struct is_defined : public boost::true_type {};
+
+ template<typename Signature, typename T>
+ struct replace_return_type : public
+ boost::function_types::function_type<
+ typename boost::mpl::push_front<
+ typename boost::function_types::parameter_types<Signature>::type,
+ T
+ >::type
+ > {};
+
+ template<typename F, typename FArgs, typename Enable=void>
+ struct result_defined : public boost::false_type {};
+
+ template<typename F, typename FArgs>
+ struct result_defined<F, FArgs, typename enable_if<is_defined<typename F::template result<FArgs>::type > >::type>
+ : public boost::true_type {};
+
+ template<typename T, typename Enable=void>
+ struct result_of_defined : public boost::false_type {};
+
+/* template<typename T>
+ struct result_of_defined<T, typename boost::enable_if<has_result_type<
+ typename boost::function_types::result_type<T>::type> >::type>
+ : public boost::true_type {};
+
+ template<typename T>
+ struct result_of_defined<T, typename boost::enable_if<result_defined<
+ typename boost::function_types::result_type<T>::type, T> >::type >
+ : public boost::true_type {};*/
+
+ template<typename T>
+ struct result_of_defined<T, typename boost::enable_if<typename
+ boost::mpl::or_<
+ has_result_type<typename boost::function_types::result_type<T>::type>,
+ result_defined<typename boost::function_types::result_type<T>::type, T>
+ >::type
+ >::type>
+ : public boost::true_type {};
+
+
+
+} // namespace detail
+
+} } // namespace boost::signals
+
+#endif //
\ No newline at end of file
Added: sandbox/SOC/2007/signals/boost/signal_network/connection/detail/slot_type.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/signal_network/connection/detail/slot_type.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -0,0 +1,38 @@
+// Copyright Stjepan Rajko 2007. Use, modification and
+// distribution is subject to the Boost Software License, Version
+// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef SIGNAL_NETWORK_SLOT_TYPE_HPP
+#define SIGNAL_NETWORK_SLOT_TYPE_HPP
+
+// Constructs a type corresponding to pointer to member of T with signature Signature.
+// e.g. slot_type<some_class, void(float)>::type is void (some_class::*) (float)
+
+#include <boost/function_types/member_function_pointer.hpp>
+#include <boost/function_types/parameter_types.hpp>
+#include <boost/function_types/result_type.hpp>
+#include <boost/mpl/push_front.hpp>
+
+namespace boost { namespace signals {
+
+namespace detail {
+
+ template <typename Signature, typename T>
+ struct slot_type
+ {
+ typedef
+ typename boost::function_types::member_function_pointer<
+ typename boost::mpl::push_front<
+ typename boost::mpl::push_front<
+ typename boost::function_types::parameter_types<Signature>::type, T
+ >::type, typename boost::function_types::result_type<Signature>::type
+ >::type
+ >::type type;
+ };
+
+} // namespace detail
+
+} } // namespace boost::signals
+
+#endif // SIGNAL_NETWORK_SLOT_TYPE_HPP
Added: sandbox/SOC/2007/signals/boost/signal_network/connection/operators.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/signal_network/connection/operators.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -0,0 +1,61 @@
+// Copyright Stjepan Rajko 2007. Use, modification and
+// distribution is subject to the Boost Software License, Version
+// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef SIGNAL_NETWORK_CONNECTION_OPERATORS_HPP
+#define SIGNAL_NETWORK_CONNECTION_OPERATORS_HPP
+
+#include <boost/signal_network/connection/connect.hpp>
+
+namespace boost { namespace signals {
+
+/// Connects a sequence of components using signals.
+/** This operator is identical to signals::filter::operator| (it connects the
+left component to the right component, and returns a reference to the left component),
+except it is evaluated right to left. This makes it semantics more suitable for
+connecting a chain of connections.
+*/
+
+template<typename Input, typename Output>
+typename boost::enable_if<is_component<Input>, Input & >::type
+operator >>= (Input &input, Output &output) { connect(input, output); return input;}
+
+template<typename Input, typename Output>
+typename boost::enable_if<is_component<Input>, Input & >::type
+operator >>= (Input &input, const Output &output) { connect(input, output); return input;}
+
+template<typename Input, typename Output>
+typename boost::enable_if<is_component<Input>, const Input & >::type
+operator >>= (const Input &input, Output &output) { connect(input, output); return input;}
+
+template<typename Input, typename Output>
+typename boost::enable_if<is_component<Input>, const Input & >::type
+operator >>= (const Input &input, const Output &output) { connect(input, output); return input;}
+
+/// Allows branching in a component connection sequence.
+/** This operator is identical to signals::filter::operator>>=, (it connects the
+left component to the right component, and returns a reference to the left component)
+except it is evaluated left to right. This makes its semantics more suitable for
+branching connections.
+*/
+template<typename Input, typename Output>
+typename boost::enable_if<is_component<Input>, Input & >::type
+operator | (Input &input, Output &output) { connect(input, output); return input;}
+
+template<typename Input, typename Output>
+typename boost::enable_if<is_component<Input>, Input & >::type
+operator | (Input &input, const Output &output) { connect(input, output); return input;}
+
+template<typename Input, typename Output>
+typename boost::enable_if<is_component<Input>, const Input & >::type
+operator | (const Input &input, Output &output) { connect(input, output); return input;}
+
+template<typename Input, typename Output>
+typename boost::enable_if<is_component<Input>, const Input & >::type
+operator | (const Input &input, const Output &output) { connect(input, output); return input;}
+
+} } // namespace boost::signals
+
+#endif SIGNAL_NETWORK_CONNECTION_OPERATORS_HPP
+
Added: sandbox/SOC/2007/signals/boost/signal_network/connection/signal.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/signal_network/connection/signal.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -0,0 +1,79 @@
+/*
+ * signal.hpp
+ * signal_network
+ *
+ * Created by Stjepan Rajko on 7/3/07.
+ * Copyright 2007 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#ifndef SIGNAL_NETWORK_CONNECTION_SIGNAL_HPP
+#define SIGNAL_NETWORK_CONNECTION_SIGNAL_HPP
+
+#include <boost/signal_network/connection/connect.hpp>
+#include <boost/signal_network/connection/detail/bind_object.hpp>
+#include <boost/signal_network/connection/detail/result_of_defined.hpp>
+#include <boost/signal_network/component/traits.hpp>
+#include <boost/signal.hpp>
+
+#include <boost/mpl/aux_/has_type.hpp>
+#include <boost/utility/result_of.hpp>
+
+namespace boost { namespace signals {
+
+template<typename Input, typename Output>
+struct connect_impl<Input, Output>
+{
+ void operator()(Input &input, Output &output)
+ {
+ get_signal<Input>()(input).connect(get_slot<typename get_signature<Input>::type, Output>()(output));
+ }
+ void operator()(Input &input, const Output &output)
+ {
+ get_signal<Input>()(input).connect(get_slot<typename get_signature<Input>::type, Output>()(output));
+ }
+ void operator()(const Input &input, Output &output)
+ {
+ get_signal<Input>()(input).connect(get_slot<typename get_signature<Input>::type, Output>()(output));
+ }
+ void operator()(const Input &input, const Output &output)
+ {
+ get_signal<Input>()(input).connect(get_slot<typename get_signature<Input>::type, Output>()(output));
+ }
+};
+
+template<typename Signature, typename Combiner, typename Group, typename GroupCompare>
+struct get_signal<boost::signal<Signature, Combiner, Group, GroupCompare> >
+{
+ boost::signal<Signature, Combiner, Group, GroupCompare> & operator()
+ (boost::signal<Signature, Combiner, Group, GroupCompare> &s) {return s;}
+};
+
+template<typename Signature, typename Combiner, typename Group, typename GroupCompare>
+struct get_signature<boost::signal<Signature, Combiner, Group, GroupCompare> >
+{
+ typedef Signature type;
+};
+
+template<typename Signature, typename T>
+struct get_slot<Signature, T, typename boost::enable_if<detail::result_of_defined<
+typename detail::replace_return_type<Signature, T>::type > >::type>
+{
+ boost::function<Signature> operator()(T &object)
+ {
+ return detail::bind_object<Signature, T>()
+ (static_cast<typename detail::slot_type<Signature, T>::type>(&T::operator()), object);
+ }
+ boost::function<Signature> operator()(const T &object)
+ {
+ return detail::bind_object<Signature, T>()
+ (static_cast<typename detail::slot_type<Signature, T>::type>(&T::operator()), object);
+ }
+};
+
+template<typename Signature, typename Combiner, typename Group, typename GroupCompare>
+struct is_component<boost::signal<Signature, Combiner, Group, GroupCompare> >
+: public boost::true_type {};
+
+} } // namespace boost::signals
+#endif // SIGNAL_NETWORK_CONNECTION_SIGNAL_HPP
\ No newline at end of file
Added: sandbox/SOC/2007/signals/boost/signal_network/connection/slot_selector.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/signal_network/connection/slot_selector.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -0,0 +1,63 @@
+/*
+ * signal.hpp
+ * signal_network
+ *
+ * Created by Stjepan Rajko on 7/3/07.
+ * Copyright 2007 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#ifndef SIGNAL_NETWORK_SLOT_SELECTOR_HPP
+#define SIGNAL_NETWORK_SLOT_SELECTOR_HPP
+
+#include <boost/signal_network/connection/detail/bind_object.hpp>
+#include <boost/signal_network/component/traits.hpp>
+
+namespace boost { namespace signals {
+
+template<typename Signature, typename T>
+struct slot_selector
+{
+ typedef Signature signature_type;
+ typedef T class_type;
+
+ T &object;
+ typename detail::slot_type<Signature, T>::type func;
+
+ slot_selector(typename detail::slot_type<Signature, T>::type func, T &object)
+ : object(object), func(func) {}
+};
+
+/// Allows functions other than operator() to serve as signals::filter slots.
+template<typename Signature, typename T>
+slot_selector<Signature, T> make_slot_selector(typename detail::slot_type<Signature, T>::type func, T &object)
+{
+ return slot_selector<Signature, T>(func, object);
+}
+
+template<typename Signature, typename T>
+struct is_component<slot_selector<Signature, T> >
+: public boost::true_type {};
+
+template<typename Signature, typename T>
+struct get_signal<slot_selector<Signature, T> >
+{
+ typename T::signal_type &operator()(const slot_selector<Signature, T> &selector)
+ {
+ return selector.object.default_signal();
+ }
+};
+
+template<typename Signature, typename T>
+struct get_slot<Signature, slot_selector<Signature, T> >
+{
+ boost::function<Signature> operator()(const slot_selector<Signature, T> &selector)
+ {
+ return detail::bind_object<Signature, T>()
+ (static_cast<typename detail::slot_type<Signature, T>::type>(selector.func), selector.object);
+ }
+};
+
+} } // namespace boost::signals
+
+#endif // SIGNAL_NETWORK_SLOT_SELECTOR_HPP
\ No newline at end of file
Added: sandbox/SOC/2007/signals/boost/signal_network/connection/slot_selector_map.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/signal_network/connection/slot_selector_map.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
@@ -0,0 +1,33 @@
+/*
+ * slot_selector_map.hpp
+ * signal_network
+ *
+ * Created by Stjepan Rajko on 7/3/07.
+ * Copyright 2007 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#ifndef SIGNAL_NETWORK_SLOT_SELECTOR_MAP_HPP
+#define SIGNAL_NETWORK_SLOT_SELECTOR_MAP_HPP
+
+#include <boost/signal_network/connection/slot_selector.hpp>
+
+#include <boost/fusion/support/is_sequence.hpp>
+#include <boost/fusion/sequence/intrinsic/at_key.hpp>
+#include <boost/fusion/sequence/intrinsic/value_at_key.hpp>
+
+namespace boost { namespace signals {
+
+template<typename Signature, typename T>
+struct get_slot<Signature, T, typename boost::enable_if<boost::fusion::traits::is_sequence<T> >::type>
+{
+ boost::function<Signature> operator()(const T &seq)
+ {
+ return get_slot<Signature, typename boost::fusion::result_of::value_at_key<T, Signature>::type>()
+ (boost::fusion::at_key<Signature>(seq));
+ }
+};
+
+} } // namespace boost::signals
+
+#endif // SIGNAL_NETWORK_SLOT_SELECTOR_MAP_HPP
\ No newline at end of file
Deleted: sandbox/SOC/2007/signals/boost/signal_network/counter.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/counter.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
+++ (empty file)
@@ -1,61 +0,0 @@
-// Copyright Stjepan Rajko 2007. Use, modification and
-// distribution is subject to the Boost Software License, Version
-// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef SIGNAL_NETWORK_COUNTER_HPP
-#define SIGNAL_NETWORK_COUNTER_HPP
-
-#include <boost/signal_network/applicator.hpp>
-#include <boost/type_traits/remove_volatile.hpp>
-
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
-
-namespace detail
-{
- template<typename T>
- struct postincrement
- {
- void operator()(T &t)
- {
- t++;
- }
- };
-}
-/** \brief Counts the number of signals passing through the component.
- counter is an applicator with a postincrement application and default member of type volatile int.
- \param T Type of the internal counter variable.
-*/
-template<typename Signature,
-typename T=volatile int,
-typename OutSignal=default_out_signal,
-typename Combiner = boost::last_value<typename boost::function_types::result_type<Signature>::type>,
-typename Group = int,
-typename GroupCompare = std::less<Group>,
-typename Base = applicator<detail::postincrement<T>, T, Signature, OutSignal, Combiner, Group, GroupCompare> >
-class counter : public Base
-{
-public:
- typedef counter<Signature, T, OutSignal, Combiner, Group, GroupCompare,
- typename applicator<detail::postincrement<T>, T, Signature, OutSignal, Combiner, Group, GroupCompare>::unfused >
- unfused;
-
- /** Initializes the internal counter to 0.
- */
- counter()
- { reset(); }
-
- /** Sets the internal counter to 0.
- */
- void reset()
- { Base::member = 0; }
-
- /** \return The internal signal counter.
- */
- typename boost::remove_volatile<T>::type count() const
- { return Base::member; }
-};
-
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
-
-#endif // SIGNAL_NETWORK_COUNT_HPP
\ No newline at end of file
Deleted: sandbox/SOC/2007/signals/boost/signal_network/detail/connect.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/detail/connect.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
+++ (empty file)
@@ -1,42 +0,0 @@
-#if !defined(SIGNAL_NETWORK_CONNECT_HPP)
-#if !defined(BOOST_PP_IS_ITERATING)
-
-#include <boost/preprocessor/iterate.hpp>
-#include <boost/preprocessor/enum_shifted_params.hpp>
-#include <boost/bind.hpp>
-
-#define SIGNAL_NETWORK_TEMPLATE_TYPENAMES typename T,
-#define SIGNAL_NETWORK_TEMPLATE_TYPENAMES_LIST T,
-
-namespace boost {
- namespace signal_network {
- namespace signet {
- namespace detail {
-
- template<typename T, typename Signature, typename Combiner, typename Group, typename GroupCompare, int Arity>
- struct connect_impl;
-
-#define BOOST_PP_ITERATION_PARAMS_1 (3,(0,3,<boost/signal_network/detail/connect.hpp>))
-#include BOOST_PP_ITERATE()
-
- } // namespace detail
- } // namespace signet
- } // namespace signal_network
-} // namespace boost
-
-#define SIGNAL_NETWORK_CONNECT_HPP
-#else // defined(BOOST_PP_IS_ITERATING)
-
-template<typename T, typename Signature, typename Combiner, typename Group, typename GroupCompare>
-struct connect_impl<T, Signature, Combiner, Group, GroupCompare, BOOST_PP_ITERATION()>
-{
- static void connect(boost::signal<Signature, Combiner, Group, GroupCompare> &signal, T &link)
- {
- signal.connect(boost::bind
- (static_cast<typename slot_type<T, Signature>::type>( &T::operator() ),
- boost::ref(link) BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
- BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(BOOST_PP_ITERATION()),_)));
- }
-};
-#endif
-#endif
\ No newline at end of file
Deleted: sandbox/SOC/2007/signals/boost/signal_network/detail/connect_slot.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/detail/connect_slot.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
+++ (empty file)
@@ -1,40 +0,0 @@
-#if !defined(SIGNAL_NETWORK_CONNECT_SLOT_HPP)
-#if !defined(BOOST_PP_IS_ITERATING)
-
-#include <boost/preprocessor/iterate.hpp>
-
-#define SIGNAL_NETWORK_TEMPLATE_TYPENAMES typename T,
-#define SIGNAL_NETWORK_TEMPLATE_TYPENAMES_LIST T,
-
-namespace boost {
- namespace signal_network {
- namespace signet {
- namespace detail {
-
- template<typename T, typename Signature, typename Combiner, typename Group, typename GroupCompare, int Arity>
- struct connect_slot_impl;
-
-#define BOOST_PP_ITERATION_PARAMS_1 (3,(0,3,<boost/signal_network/detail/connect_slot.hpp>))
-#include BOOST_PP_ITERATE()
-
- } // namespace detail
- } // namespace signet
- } // namespace signal_network
-} // namespace boost
-
-#define SIGNAL_NETWORK_CONNECT_SLOT_HPP
-#else // defined(BOOST_PP_IS_ITERATING)
-
-template<typename T, typename Signature, typename Combiner, typename Group, typename GroupCompare>
-struct connect_slot_impl<T, Signature, Combiner, Group, GroupCompare, BOOST_PP_ITERATION()>
-{
- static void connect_slot(boost::signal<Signature, Combiner, Group, GroupCompare> &signal, const slot_selector_t<T, Signature> &slot)
- {
- signal.connect(boost::bind
- (static_cast<typename slot_type<T, Signature>::type>(slot.func),
- boost::ref(slot.link) BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
- BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(BOOST_PP_ITERATION()),_)));
- }
-};
-#endif
-#endif
\ No newline at end of file
Deleted: sandbox/SOC/2007/signals/boost/signal_network/detail/connect_slot_template.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/detail/connect_slot_template.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
+++ (empty file)
@@ -1,10 +0,0 @@
-#ifndef SIGNAL_NETWORK_TEMPLATE_BODY
- static void connect_slot(boost::signal<Signature> &signal, const slot_selector_t<T, Signature> &slot)
- {
- signal.connect(boost::bind(
- (typename slot_type<T, Signature>::type) slot.func,
- boost::ref(slot.link) SIGNAL_NETWORK_BIND_ARGS(SIGNAL_NETWORK_TEMPLATE_ARITY)));
- }
-#else
-
-#endif
Deleted: sandbox/SOC/2007/signals/boost/signal_network/detail/connect_template.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/detail/connect_template.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
+++ (empty file)
@@ -1,10 +0,0 @@
-#ifndef SIGNAL_NETWORK_TEMPLATE_BODY
- static void connect(boost::signal<Signature> &signal, T &link)
- {
- signal.connect(boost::bind(
- static_cast<typename slot_type<T, Signature>::type>( &T::operator() ),
- boost::ref(link) SIGNAL_NETWORK_BIND_ARGS(SIGNAL_NETWORK_TEMPLATE_ARITY)));
- }
-#else
-
-#endif
Deleted: sandbox/SOC/2007/signals/boost/signal_network/detail/serialize_fusion_vector.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/detail/serialize_fusion_vector.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
+++ (empty file)
@@ -1,83 +0,0 @@
-#ifndef BOOST_SERIALIZE_FUSION_VECTOR_HPP
-#define BOOST_SERIALIZE_FUSION_VECTOR_HPP
-
-/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
-// vector.hpp - non-intrusive serialization of boost::fusion::vector
-//
-// copyright (c) 2005
-// troy d. straszheim <troy_at_[hidden]>
-// http://www.resophonic.com
-//
-// copyright 2007 Stjepan Rajko
-//
-// 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)
-//
-// See http://www.boost.org for updates, documentation, and revision history.
-//
-
-#include <boost/fusion/sequence/container/vector/vector.hpp>
-
-namespace boost {
- namespace serialization {
- namespace detail {
- namespace vector {
-
- // primary template, serializes a vector in the
- // constructor. Class is called like a template function.
- template <class Archive, class Tuple, int i=0, bool stop=false>
- struct serialize_impl
- {
- serialize_impl(Archive &ar, Tuple& t)
- {
- char tag[3] = "T?";
- tag[1] = '0' + i;
- ar & make_nvp(tag, boost::fusion::at_c<i>(t));
- serialize_impl<Archive, Tuple, i+1,
- i+1 < boost::fusion::result_of::size<Tuple>::value ? false : true>(ar, t);
- }
- };
-
- // no-op called by the primary template when "i" is out of
- // bounds.
- template <class Archive, class Tuple, int i>
- struct serialize_impl<Archive, Tuple, i, true>
- {
- serialize_impl(Archive &ar, Tuple& t) { }
- };
-
- } // namespace vector
- } // namespace detail
-
- //
- // primary interface functions. Serialize a vector...
- //
- template <class Archive,
- typename T0, typename T1, typename T2, typename T3, typename T4,
- typename T5, typename T6, typename T7, typename T8, typename T9>
- void
- serialize (Archive & ar,
- boost::fusion::vector<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9> & t,
- unsigned int version)
- {
- detail::vector::serialize_impl<
- Archive,
- boost::fusion::vector<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9>
- >(ar, t);
- }
-
- //
- // Serialize a "null" vector is a no-op
- //
- template <class Archive>
- void
- serialize (Archive & ar,
- boost::fusion::vector<> & nullvector,
- unsigned int version)
- {
- }
- } // namespace serialization
-} // namespace boost
-
-#endif // BOOST_SERIALIZE_FUSION_VECTOR_HPP
\ No newline at end of file
Deleted: sandbox/SOC/2007/signals/boost/signal_network/detail/storable.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/detail/storable.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
+++ (empty file)
@@ -1,35 +0,0 @@
-// Copyright Stjepan Rajko 2007. Use, modification and
-// distribution is subject to the Boost Software License, Version
-// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef SIGNAL_NETWORK_STORABLE_HPP
-#define SIGNAL_NETWORK_STORABLE_HPP
-
-#include <boost/type_traits/remove_reference.hpp>
-#include <boost/type_traits/remove_const.hpp>
-#include <boost/mpl/transform.hpp>
-#include <boost/signal_network/base.hpp>
-
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
-
-namespace detail
-{
- /// Converts a type into a storable type by removing const qualifiers and references.
- template<typename T>
- struct storable : public boost::remove_const<typename boost::remove_reference<T>::type > {};
-
- template<typename T>
- struct mpl_storable
- {
- typedef typename boost::mpl::transform<
- typename boost::mpl::transform<T,
- boost::remove_reference<boost::mpl::_> >::type,
- boost::remove_const<boost::mpl::_> >::type type;
- };
-
-}
-
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
-
-#endif // SIGNAL_NETWORK_STORABLE_HPP
\ No newline at end of file
Deleted: sandbox/SOC/2007/signals/boost/signal_network/detail/unfused_inherited.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/detail/unfused_inherited.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
+++ (empty file)
@@ -1,145 +0,0 @@
-/*=============================================================================
- Copyright (c) 2006-2007 Tobias Schwinger
- Copyright (c) 2007 Stjepan Rajko
-
- Use modification and distribution are 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).
-==============================================================================*/
-
-#if !defined(BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_INHERITED_HPP_INCLUDED)
-#if !defined(BOOST_PP_IS_ITERATING)
-
-#include <boost/preprocessor/cat.hpp>
-#include <boost/preprocessor/iteration/iterate.hpp>
-#include <boost/preprocessor/repetition/enum.hpp>
-#include <boost/preprocessor/repetition/enum_params.hpp>
-#include <boost/preprocessor/repetition/enum_binary_params.hpp>
-#include <boost/preprocessor/facilities/intercept.hpp>
-
-#include <boost/config.hpp>
-#include <boost/detail/workaround.hpp>
-
-#include <boost/mpl/and.hpp>
-#include <boost/type_traits/remove_reference.hpp>
-
-#include <boost/fusion/support/detail/access.hpp>
-#include <boost/fusion/sequence/intrinsic/value_at.hpp>
-#include <boost/fusion/sequence/intrinsic/size.hpp>
-#include <boost/fusion/sequence/container/vector/vector.hpp>
-#include <boost/fusion/sequence/conversion/as_vector.hpp>
-#include <boost/fusion/algorithm/transformation/pop_back.hpp>
-
-#include <boost/fusion/functional/adapter/limits.hpp>
-#include <boost/fusion/functional/adapter/detail/has_type.hpp>
-#include <boost/fusion/functional/adapter/detail/nullary_call_base.hpp>
-
-#include <boost/mpl/size.hpp>
-
-
-namespace boost { namespace fusion
-{
-
- template <class Function, class CSequence, class Sequence, typename Enable=void> class unfused_inherited;
-
- //----- ---- --- -- - - - -
-
- #define BOOST_PP_ITERATION_PARAMS_1 (3, (0,BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY, <boost/signal_network/detail/unfused_inherited.hpp>))
- #include BOOST_PP_ITERATE()
-}}
-
-#define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_INHERITED_HPP_INCLUDED
-#else // defined(BOOST_PP_IS_ITERATING)
-///////////////////////////////////////////////////////////////////////////////
-//
-// Preprocessor vertical repetition code
-//
-///////////////////////////////////////////////////////////////////////////////
-
-# if BOOST_PP_ITERATION_DEPTH()== 2
-
-#define CONSTRUCTOR_ARGS BOOST_PP_FRAME_ITERATION(1)
-#define OPERATOR_ARGS BOOST_PP_FRAME_ITERATION(2)
-
- template <class Function, class CSequence, class Sequence>
- class unfused_inherited<Function, CSequence, Sequence,
- typename boost::enable_if<
- boost::mpl::and_<
- boost::mpl::equal_to<
- boost::fusion::result_of::size<CSequence>,
- boost::mpl::int_<CONSTRUCTOR_ARGS> >,
- boost::mpl::equal_to<
- boost::fusion::result_of::size<Sequence>,
- boost::mpl::int_<OPERATOR_ARGS> >
- > >::type >
- : public Function
- {
- typedef typename result_of::as_vector<CSequence>::type carg_vector_t;
- typedef typename result_of::as_vector<Sequence>::type arg_vector_t;
-
- public:
- using Function::operator();
-
-#define M(z,i,s) \
- typename result_of::value_at_c<s,i>::type a##i
-#define ADAPTED_ARGS(z,i,s) \
- typename detail::call_param<typename result_of::value_at_c<s,i>::type>::type a##i
-
- unfused_inherited(BOOST_PP_ENUM(CONSTRUCTOR_ARGS,ADAPTED_ARGS,carg_vector_t))
- : Function(BOOST_PP_ENUM_PARAMS(CONSTRUCTOR_ARGS,a))
- { }
-
-#if OPERATOR_ARGS>0
- inline typename Function::template result<arg_vector_t>::type
- operator()(BOOST_PP_ENUM(OPERATOR_ARGS,M,arg_vector_t)) const
- {
- arg_vector_t arg(BOOST_PP_ENUM_PARAMS(OPERATOR_ARGS,a));
- return Function::operator()(arg);
- }
-
-#if !BOOST_WORKAROUND(BOOST_MSVC, < 1400)
- void//inline typename Function::template result<arg_vector_t>::type
- operator()(BOOST_PP_ENUM(OPERATOR_ARGS,M,arg_vector_t))
- {
- arg_vector_t arg(BOOST_PP_ENUM_PARAMS(OPERATOR_ARGS,a));
- return Function::operator()(arg);
- }
-#endif
-
-#else
- inline typename Function::template result<arg_vector_t>::type
- operator()() const
- {
- arg_vector_t arg;
- return Function::operator()(arg);
- }
-
-#if !BOOST_WORKAROUND(BOOST_MSVC, < 1400)
- inline typename Function::template result<arg_vector_t>::type
- operator()()
- {
- arg_vector_t arg;
- return Function::operator()(arg);
- }
-#endif
-
-#endif
-
-#undef M
-#undef ADAPTED_ARGS
-
- };
-
-#undef CONSTRUCTOR_ARGS
-#undef OPERATOR_ARGS
-
-#else
-
-#define BOOST_PP_ITERATION_PARAMS_2 (3, (0,BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY,<boost/signal_network/detail/unfused_inherited.hpp>))
-#include BOOST_PP_ITERATE()
-
-#endif
-
-#endif // defined(BOOST_PP_IS_ITERATING)
-#endif
-
Deleted: sandbox/SOC/2007/signals/boost/signal_network/filter.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/filter.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
+++ (empty file)
@@ -1,130 +0,0 @@
-// filter.hpp
-
-// Copyright Stjepan Rajko 2007. Use, modification and
-// distribution is subject to the Boost Software License, Version
-// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef SIGNAL_NETWORK_FILTER_HPP
-#define SIGNAL_NETWORK_FILTER_HPP
-
-#include <boost/bind.hpp>
-#include <boost/signal_network/base.hpp>
-#include <boost/type_traits/is_base_of.hpp>
-#include <boost/fusion/functional/adapter/fused.hpp>
-#include <boost/fusion/sequence/conversion/as_vector.hpp>
-
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
-
-/// Provides a basis for filters (components that receive and send a signal).
-/** \param Signature The signature of the signal being sent out.
-
- Use this class as a base class for classes that produce a signal
- of a particular signature.
-*/
-struct combined_out_signal
-{
- typedef combined_out_signal default_normal_type;
- typedef combined_out_signal default_unfused_type;
-};
-struct unfused_out_signal
-{
- typedef combined_out_signal default_normal_type;
- typedef combined_out_signal default_unfused_type;
-};
-struct fused_out_signal
-{
- typedef fused_out_signal default_normal_type;
- typedef fused_out_signal default_unfused_type;
-};
-
-struct default_out_signal
-{
- typedef fused_out_signal default_normal_type;
- typedef combined_out_signal default_unfused_type;
-};
-
-template<typename Signature,
-typename OutSignal=unfused_out_signal,
-typename Combiner = boost::last_value<typename boost::function_traits<Signature>::result_type>,
-typename Group = int,
-typename GroupCompare = std::less<Group>
->
-class filter;
-
-/** \brief Unfused version of the filter class
-*/
-template<typename Signature, typename Combiner, typename Group, typename GroupCompare>
-class filter<Signature, unfused_out_signal, Combiner, Group, GroupCompare> : public filter_base
-{
-public:
- // the signature of the output signal
- typedef Signature signature_type;
- // the type of the signal
- typedef boost::signal<Signature, Combiner, Group, GroupCompare> signal_type;
-
- filter(const filter &) {}
- filter(){}
- const filter &operator = (const filter &) {return *this;}
-
- /// Returns the default out signal.
- signal_type &default_signal()
- { return out; }
- /// Disconnects all slots connected to the signet::filter.
- void disconnect_all_slots() {out.disconnect_all_slots();}
-protected:
- signal_type out;
-}; // class filter
-
-/** \brief Combined version of the filter class
-*/
-template<typename Signature, typename Combiner, typename Group, typename GroupCompare>
-class filter<Signature, combined_out_signal, Combiner, Group, GroupCompare>
-: public filter<Signature, unfused_out_signal, Combiner, Group, GroupCompare>
-{
- typedef filter<Signature, unfused_out_signal, Combiner, Group, GroupCompare> base_type;
-public:
- filter() : fused_out(base_type::out) {}
-
- typedef typename base_type::signature_type signature_type;
- typedef typename base_type::signal_type signal_type;
-
- typedef typename boost::function_types::parameter_types<Signature>::type parameter_types;
- typedef typename boost::fusion::result_of::as_vector<parameter_types>::type parameter_vector;
- typedef typename signal_type::result_type fused_signature_type (const parameter_vector &);
-
-protected:
- boost::signal<fused_signature_type, Combiner, Group, GroupCompare> fusion_out;
- boost::fusion::fused<typename base_type::signal_type const &> fused_out;
-}; // class filter
-
-/** \brief Fused version of the filter class
-*/
-template<typename Signature, typename Combiner, typename Group, typename GroupCompare>
-class filter<Signature, fused_out_signal, Combiner, Group, GroupCompare>
-: public filter_base
-{
-public:
- filter(const filter &) {}
- filter(){}
- const filter &operator = (const filter &) {return *this;}
-
- typedef typename boost::function_types::parameter_types<Signature>::type parameter_types;
- typedef typename boost::fusion::result_of::as_vector<parameter_types>::type parameter_vector;
- typedef typename Combiner::result_type signature_type (const parameter_vector &);
- typedef typename Combiner::result_type fused_signature_type (const parameter_vector &);
- typedef boost::signal<signature_type, Combiner, Group, GroupCompare> signal_type;
-
- /// Returns the default out signal.
- signal_type &default_signal()
- { return fused_out; }
- /// Disconnects all slots connected to the signet::filter.
- void disconnect_all_slots() {fused_out.disconnect_all_slots();}
-
-protected:
- signal_type fused_out;
-}; // class filter
-
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
-
-#endif // SIGNAL_NETWORK_FILTER_HPP
Deleted: sandbox/SOC/2007/signals/boost/signal_network/function.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/function.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
+++ (empty file)
@@ -1,64 +0,0 @@
-// function.hpp
-
-// Copyright Stjepan Rajko 2007. Use, modification and
-// distribution is subject to the Boost Software License, Version
-// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef SIGNAL_NETWORK_FUNCTION_HPP
-#define SIGNAL_NETWORK_FUNCTION_HPP
-
-#include <boost/signal_network/modifier.hpp>
-#include <boost/function.hpp>
-#include <boost/signal_network/storage.hpp>
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
-
-namespace detail
-{
- template<typename FunctionSignature, typename Signature>
- struct function_adapter
- {
- function_adapter(const boost::function<FunctionSignature> &f) :
- func(f),
- fused_func(boost::fusion::fused<boost::function<FunctionSignature> const &>(func)) {}
- function_adapter(const function_adapter &fa) :
- func(fa.func),
- fused_func(boost::fusion::fused<boost::function<FunctionSignature> const &>(func)) {}
- template<typename Seq>
- const typename storage<Signature>::storable_vector &
- operator()(const Seq &seq)
- {
- boost::fusion::at_c<0>(vector) = fused_func(seq);
- return vector;
- }
- protected:
- typename storage<Signature>::storable_vector vector;
- boost::function<FunctionSignature> func;
- boost::fusion::fused<boost::function<FunctionSignature> const &> fused_func;
- };
-}
-/** \brief Converts a function into a Signal Network filter.
-\param Signature Signature of the function to be converted.
-
-The signet::function object will receive signals of signature void(<i>function arguments</i>),
-and send signals of signature void(<i>function return type</i>).
-*/
-template<typename Signature,
- typename FunctionSignature,
- typename OutSignal=default_out_signal,
- typename Combiner = boost::last_value<void>,
- typename Group = int,
- typename GroupCompare = std::less<Group>,
- typename Base = modifier<detail::function_adapter<FunctionSignature, Signature>, Signature, OutSignal, Combiner, Group, GroupCompare>
->
-class function : public Base
-{
-public:
- typedef function<Signature, FunctionSignature, OutSignal, Combiner, Group, GroupCompare, typename Base::unfused > unfused;
-
- function(const boost::function<FunctionSignature> &f) : Base(f) {}
-};
-
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
-
-#endif // SIGNAL_NETWORK_FUNCTION_HPP
\ No newline at end of file
Deleted: sandbox/SOC/2007/signals/boost/signal_network/instantiator.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/instantiator.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
+++ (empty file)
@@ -1,66 +0,0 @@
-// Copyright Stjepan Rajko 2007. Use, modification and
-// distribution is subject to the Boost Software License, Version
-// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef SIGNAL_NETWORK_INSTANTIATOR_HPP
-#define SIGNAL_NETWORK_INSTANTIATOR_HPP
-
-#include <boost/signal_network/filter.hpp>
-#include <boost/mpl/vector.hpp>
-#include <boost/fusion/sequence/adapted/mpl.hpp>
-#include <boost/signal_network/detail/unfused_inherited.hpp>
-#include <boost/fusion/support/is_sequence.hpp>
-
-
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
-
-/** \brief Generic component which, upon receiving a signal, instantiates an object of type Instantiation from a member object
- of type Member.
-*/
-template<
-typename Instantiation,
-typename Member,
-typename Signature,
-typename OutSignal=default_out_signal,
-typename Combiner = boost::last_value<typename boost::function_types::result_type<Signature>::type>,
-typename Group = int,
-typename GroupCompare = std::less<Group> >
-class instantiator : public filter<Signature, typename OutSignal::default_normal_type, Combiner, Group, GroupCompare>
-{
- typedef filter<Signature, typename OutSignal::default_normal_type, Combiner, Group, GroupCompare> base_type;
-
-public:
-#ifndef DOXYGEN_DOCS_ONLY
- typedef boost::fusion::unfused_inherited<instantiator<Instantiation, Member, Signature,
- typename OutSignal::default_unfused_type, Combiner, Group, GroupCompare>,
- typename mpl::vector<>::type,
- typename base_type::parameter_types > unfused;
-
- template <class Seq>
- struct result : public boost::enable_if<boost::fusion::traits::is_sequence<Seq>,
- typename base_type::signal_type::result_type> {};
-#endif
-
- /** Instantiates an instance of Instantiation from the Member object.
- */
- template <class Seq>
-#ifndef DOXYGEN_DOCS_ONLY
- typename boost::enable_if<boost::fusion::traits::is_sequence<Seq>,
-#endif
- typename base_type::signal_type::result_type
-#ifndef DOXYGEN_DOCS_ONLY
- >::type
-#endif
- operator()(const Seq &seq)
- {
- Instantiation instance(member);
- return fused_out(seq);
- }
-protected:
- Member member;
-};
-
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
-
-#endif // SIGNAL_NETWORK_INSTANTIATOR_HPP
Deleted: sandbox/SOC/2007/signals/boost/signal_network/junction.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/junction.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
+++ (empty file)
@@ -1,57 +0,0 @@
-// Copyright Stjepan Rajko 2007. Use, modification and
-// distribution is subject to the Boost Software License, Version
-// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef SIGNAL_NETWORK_JUNCTION_HPP
-#define SIGNAL_NETWORK_JUNCTION_HPP
-
-#include <boost/signal_network/conditional.hpp>
-
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
-
-namespace detail
-{
- template<typename T>
- struct identity
- {
- T operator ()(T t) const
- {
- return t;
- }
- };
-}
-
-/** \brief Forwards a single signal to multiple slots, and can
-also be disabled to stop the flow of signals.
- junction is a conditional with Condition identity and Member volatile bool
-*/
-template<typename Signature,
- typename OutSignal=default_out_signal,
- typename Combiner = boost::last_value<typename boost::function_types::result_type<Signature>::type>,
- typename Group = int,
- typename GroupCompare = std::less<Group>,
- typename Base = conditional<detail::identity<bool>, volatile bool, Signature, OutSignal, Combiner, Group, GroupCompare>
->
-class junction : public Base
-{
-public:
- typedef junction<Signature, OutSignal, Combiner, Group, GroupCompare, typename Base::unfused > unfused;
-
- /** Initializes the junction to be enabled.
- */
- junction(bool enabled=true)
- {
- enable();
- }
- /** Enables the junction (signals will be forwarded).
- */
- void enable() {Base::member = true;}
- /** Disables the junction (signals will not be forwarded).
- */
- void disable() {Base::member = false;}
-};
-
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
-
-#endif
\ No newline at end of file
Deleted: sandbox/SOC/2007/signals/boost/signal_network/modifier.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/modifier.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
+++ (empty file)
@@ -1,64 +0,0 @@
-// Copyright Stjepan Rajko 2007. Use, modification and
-// distribution is subject to the Boost Software License, Version
-// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef SIGNAL_NETWORK_MODIFIER_HPP
-#define SIGNAL_NETWORK_MODIFIER_HPP
-
-#include <boost/signal_network/filter.hpp>
-#include <boost/mpl/vector.hpp>
-#include <boost/fusion/sequence/adapted/mpl.hpp>
-#include <boost/signal_network/detail/unfused_inherited.hpp>
-#include <boost/fusion/support/is_sequence.hpp>
-
-
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
-
-
-template<
-typename Modification,
-typename Signature,
-typename OutSignal=default_out_signal,
-typename Combiner = boost::last_value<typename boost::function_types::result_type<Signature>::type>,
-typename Group = int,
-typename GroupCompare = std::less<Group> >
-class modifier : public filter<Signature, typename OutSignal::default_normal_type, Combiner, Group, GroupCompare>
-{
- typedef filter<Signature, typename OutSignal::default_normal_type, Combiner, Group, GroupCompare> base_type;
-
-public:
-#ifndef DOXYGEN_DOCS_ONLY
- typedef boost::fusion::unfused_inherited<modifier<Modification, Signature,
- typename OutSignal::default_unfused_type, Combiner, Group, GroupCompare>,
- typename mpl::vector<const Modification &>::type,
- typename base_type::parameter_types > unfused;
-
- template <class Seq>
- struct result : public boost::enable_if<boost::fusion::traits::is_sequence<Seq>,
- typename base_type::signal_type::result_type> {};
-#endif
- modifier() {}
- modifier (const Modification &m) : modification(m) {}
-
- /** Applies the Modification object to the received signal parameters.
- */
- template <class Seq>
-#ifndef DOXYGEN_DOCS_ONLY
- typename boost::enable_if<boost::fusion::traits::is_sequence<Seq>,
-#endif
- typename base_type::signal_type::result_type
-#ifndef DOXYGEN_DOCS_ONLY
- >::type
-#endif
- operator()(const Seq &seq)
- {
- return fused_out(modification(seq));
- }
-protected:
- Modification modification;
-};
-
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
-
-#endif // SIGNAL_NETWORK_MODIFIER_HPP
Deleted: sandbox/SOC/2007/signals/boost/signal_network/mutex.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/mutex.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
+++ (empty file)
@@ -1,30 +0,0 @@
-// Copyright Stjepan Rajko 2007. Use, modification and
-// distribution is subject to the Boost Software License, Version
-// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef SIGNAL_NETWORK_MUTEX_HPP
-#define SIGNAL_NETWORK_MUTEX_HPP
-
-#include <boost/signal_network/instantiator.hpp>
-#include <boost/thread/mutex.hpp>
-
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
-
-/** \brief Ensures a component is processing only one signal at a time when using multiple threads.
-*/
-template<typename Signature,
-typename OutSignal=default_out_signal,
-typename Combiner = boost::last_value<typename boost::function_types::result_type<Signature>::type>,
-typename Group = int,
-typename GroupCompare = std::less<Group>,
-typename Base = instantiator<boost::mutex::scoped_lock, boost::mutex, Signature, OutSignal, Combiner, Group, GroupCompare> >
-class mutex : public Base
-{
-public:
- typedef mutex<Signature, OutSignal, Combiner, Group, GroupCompare, typename Base::unfused> unfused;
-};
-
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
-
-#endif // SIGNAL_NETWORK_MUTEX_HPP
Deleted: sandbox/SOC/2007/signals/boost/signal_network/selector.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/selector.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
+++ (empty file)
@@ -1,61 +0,0 @@
-// selector.hpp
-
-// Copyright Stjepan Rajko 2007. Use, modification and
-// distribution is subject to the Boost Software License, Version
-// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef SIGNAL_NETWORK_SELECTOR_HPP
-#define SIGNAL_NETWORK_SELECTOR_HPP
-
-#include <boost/signal_network/filter.hpp>
-#include <boost/signal_network/detail/defines.hpp>
-
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
-/** \brief Allows selection of signals from multiple inputs.
-\param Signature Signature of the signal sent and received.
-\warning Since I can't get Doxygen to unravel the preprocessed definition of this
-class, the documentation was generated through a non-functioning class Doxygen could read.
-
-This can be used to determine which signal out of a group of signals
-will continue through the selector (the others will not be forwarded).
-
-\par Example:
-\dontinclude example.cpp
-\skip selector_test
-\until end void selector_test
-*/
-
-/*
-template<typename Signature>
-class selector : public fused_filter<Signature>
-{
- selector() : selected(0) {}
-
- /// Selects the indicated input (if source is 0, no input will be selected).
- void select(int source) {selected = source;}
-
- template <class Seq>
- struct result
- {
- typedef typename boost::function_traits<Signature>::result_type type;
- };
- /// If N is selected, the signal received at this slot will be forwared.
- typename boost::function_traits<Signature>::result_type
- operator()(const VecPar &vec_par)
- {
- if (selected == n)
- return static_cast<typename boost::function_traits<Signature>::result_type>
- (fused_out(vec_par));
- }
- /// Returns the slot selector for inputN.
- template<int N>
- slot_selector_t<selector<Signature>, Signature> slot()
- {return slot_selector<Signature>(*this, &selector_impl<_inputs, Signature, _arity>::input##n);}
-private:
- volatile int selected;
-};
-*/
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
-
-#endif // SIGNAL_NETWORK_SELECTOR_HPP
Deleted: sandbox/SOC/2007/signals/boost/signal_network/socket_receiver.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/socket_receiver.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
+++ (empty file)
@@ -1,66 +0,0 @@
-// socket_receiver.hpp
-
-// Copyright Stjepan Rajko 2007. Use, modification and
-// distribution is subject to the Boost Software License, Version
-// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef SIGNAL_NETWORK_SOCKET_RECEIVER_HPP
-#define SIGNAL_NETWORK_SOCKET_RECEIVER_HPP
-
-#include <boost/signal_network/storage.hpp>
-#include <sstream>
-#include <boost/asio.hpp>
-#include <boost/archive/binary_iarchive.hpp>
-#include <boost/lambda/lambda.hpp>
-#include <boost/fusion/algorithm/iteration/for_each.hpp>
-#include <boost/signal_network/detail/serialize_fusion_vector.hpp>
-
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
-
-/** \brief Receives serializable signals through a Boost.Asio socket.
-\param Signature Signature of the signal sent (and received through the socket).
-\todo socket_sender only works for Signatures of return type void.
-
-*/
-template<typename Signature,
- typename OutSignal=default_out_signal,
- typename Combiner = boost::last_value<typename boost::function_types::result_type<Signature>::type>,
- typename Group = int,
- typename GroupCompare = std::less<Group> >
-class socket_receiver : public storage<Signature, OutSignal, Combiner, Group, GroupCompare>
-{
- typedef storage<Signature, OutSignal, Combiner, Group, GroupCompare> base_type;
-
-public:
- typedef boost::fusion::unfused_typed_class<socket_receiver<Signature,
- OutSignal, Combiner, Group, GroupCompare>,
- typename base_type::base_type::parameter_types> unfused;
-
- /// Initializes the socket_sender to use the provided socket.
- socket_receiver(asio::ip::tcp::socket &socket) :
- socket_(socket),
- stream(std::ios::in | std::ios::out | std::ios::binary) {}
- /// Sets the receiver to wait for a packet and send its contents via the signal.
- void operator()()
- {
- int received_size = socket_.receive(asio::buffer(buffer, bufferSize));
- stream.str(empty_string);
- stream.write((char *)buffer, received_size);
- boost::archive::binary_iarchive archive(stream);
- archive & storage<Signature>::stored;
- storage<Signature>::operator()();
- }
-
-private:
- asio::ip::tcp::socket &socket_;
- std::stringstream stream;
- std::string empty_string;
- boost::archive::binary_iarchive *archive;
- enum { bufferSize = 20000 };
- unsigned char buffer[bufferSize];
-};
-
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
-
-#endif
\ No newline at end of file
Deleted: sandbox/SOC/2007/signals/boost/signal_network/socket_sender.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/socket_sender.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
+++ (empty file)
@@ -1,74 +0,0 @@
-// socket_sender.hpp
-
-// Copyright Stjepan Rajko 2007. Use, modification and
-// distribution is subject to the Boost Software License, Version
-// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef SIGNAL_NETWORK_SOCKET_SENDER_HPP
-#define SIGNAL_NETWORK_SOCKET_SENDER_HPP
-
-#include <boost/mpl/vector.hpp>
-#include <boost/signal_network/filter.hpp>
-#include <boost/asio.hpp>
-#include <boost/archive/binary_oarchive.hpp>
-#include <sstream>
-#include <boost/signal_network/detail/unfused_inherited.hpp>
-#include <boost/signal_network/detail/serialize_fusion_vector.hpp>
-
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
-
-/** \brief Sends serializable signals through a Boost asio socket.
-\param Signature Signature of the signal received (and sent through the socket).
-\todo socket_sender only works for Signatures of return type void.
-*/
-template<typename Signature>
-class socket_sender
-{
-public:
- typedef boost::fusion::unfused_inherited<socket_sender<Signature>,
- typename mpl::vector<asio::ip::tcp::socket &>::type,
- typename boost::function_types::parameter_types<Signature> > unfused;
-
- typedef boost::function_types::parameter_types<Signature> ParTypes;
-
- /// Initializes the socket_sender to use the provided socket.
- socket_sender(asio::ip::tcp::socket & socket) :
- socket(& socket),
- stream(std::ios::in | std::ios::out | std::ios::binary)
- { }
- socket_sender() :
- socket(NULL),
- stream(std::ios::in | std::ios::out | std::ios::binary)
- { }
- virtual ~socket_sender()
- {
- }
-
- template<class Seq>
- struct result
- {
- typedef void type;
- };
- /// Serializes each of the arguments and sends them in a single packet through the socket.
- template <class Seq>
- void operator()(const Seq &vec_par)
- {
- if (socket)
- {
- boost::archive::binary_oarchive archive (stream);
- archive & vec_par;
- boost::asio::write(*socket, asio::buffer(stream.str()),
- boost::asio::transfer_all());
- stream.str(empty_string);
- }
- }
-private:
- asio::ip::tcp::socket *socket;
- std::stringstream stream;
- std::string empty_string;
-};
-
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
-
-#endif
Deleted: sandbox/SOC/2007/signals/boost/signal_network/storage.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/storage.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
+++ (empty file)
@@ -1,159 +0,0 @@
-// Copyright Stjepan Rajko 2007. Use, modification and
-// distribution is subject to the Boost Software License, Version
-// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef SIGNAL_NETWORK_GENERATOR_HPP
-#define SIGNAL_NETWORK_GENERATOR_HPP
-
-#include <boost/signal_network/detail/storable.hpp>
-#include <boost/signal_network/filter.hpp>
-#include <boost/type_traits.hpp>
-#include <boost/call_traits.hpp>
-
-#include <boost/function_types/parameter_types.hpp>
-#include <boost/fusion/sequence/intrinsic/at.hpp>
-#include <boost/fusion/sequence/adapted/mpl.hpp>
-#include <boost/fusion/functional/adapter/fused.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/type_traits/same_traits.hpp>
-#include <boost/mpl/greater.hpp>
-#include <boost/fusion/support/is_sequence.hpp>
-
-#include <boost/signal_network/detail/unfused_typed_class.hpp>
-
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
-
-/** \brief Stores and transmits arguments received from a signal.
- \param Signature Signature of the signal sent.
-*/
-template<typename Signature,
- typename OutSignal=default_out_signal,
- typename Combiner = boost::last_value<typename boost::function_traits<Signature>::result_type>,
- typename Group = int,
- typename GroupCompare = std::less<Group> >
- class storage : public filter<Signature, typename OutSignal::default_normal_type, Combiner, Group, GroupCompare>
-{
-#ifndef DOXYGEN_DOCS_ONLY
-protected:
- typedef filter<Signature, typename OutSignal::default_normal_type, Combiner, Group, GroupCompare> base_type;
- typedef storage<Signature, OutSignal, Combiner, Group, GroupCompare> this_type;
-public:
-
- typedef typename detail::mpl_storable<typename base_type::parameter_types>::type storable_types;
- typedef typename boost::fusion::result_of::as_vector<storable_types >::type storable_vector;
-
- typedef
- boost::fusion::unfused_typed_class<storage<
- Signature, typename OutSignal::default_unfused_type, Combiner, Group, GroupCompare>,
- typename base_type::parameter_types> unfused;
-#endif
-
- /** Initializes the stored parameter values using the provided sequence.
- \param[in] seq Sequence from which the stored parameter sequence is initialized from.
- */
- template<typename Seq>
- storage(const Seq &seq) : stored(seq) {}
- /** Initializes the stored parameter values using its default constructor.
- */
- storage() {}
-
- /** Sends a signal containing the stored parameter values.
- \return Return value of the sent signal.
- */
- typename base_type::signal_type::result_type operator()()
- {
- return base_type::fused_out(stored);
- }
- /** Sends a signal containing the stored parameter values.
- \return Return value of the sent signal.
- */
- typename base_type::signal_type::result_type operator()(const boost::fusion::vector<> &)
- {
- return base_type::fused_out(stored);
- }
-
-#ifndef DOXYGEN_DOCS_ONLY
- template<class Seq>
- struct result : public boost::enable_if<typename boost::mpl::and_<
- boost::fusion::traits::is_sequence<Seq>,
- boost::mpl::greater<boost::fusion::result_of::size<Seq>, boost::mpl::int_<0> > >::type
- > {};
-#endif
-
- /** Sets the stored parameter values using the provided sequence.
- \param[in] seq Sequence to whose value the stored parameter sequence is assigned to.
-
- <b>Note:</b> Enabled only for fusion sequences of size >= 1.
- */
- template <class Seq>
-#ifndef DOXYGEN_DOCS_ONLY
- typename boost::enable_if<typename boost::mpl::and_<
- boost::fusion::traits::is_sequence<Seq>,
- boost::mpl::greater<boost::fusion::result_of::size<Seq>, boost::mpl::int_<0> > >::type
- >::type
-#else
- void
-#endif
- operator()(const Seq &seq)
- {
- stored = seq;
- }
-
- /** \return A reference to the fusion vector of stored parameter values.
- */
- const storable_vector &stored_vector()
- {
- return stored;
- }
- /** \return The stored value of parameter N using an optimizing cast.
- */
- template<int N>
- typename boost::fusion::result_of::at_c<storable_vector, N>::type at()
- {
- return boost::fusion::at_c<N>(stored);
- }
- /** \return The stored value of parameter N typed exactly as it appears in the Signature.
- */
- template<int N>
- typename boost::mpl::at_c<typename base_type::parameter_types, N>::type value_at()
- {
- return boost::fusion::at_c<N>(stored);
- }
-
- /** \return The slot selector for the related at function.
- */
- template<int N>
- slot_selector_t
-#ifndef DOXYGEN_DOCS_ONLY
- <this_type,
- typename boost::fusion::result_of::at_c<storable_vector, N>::type ()>
-#endif
- at_slot()
- {
- return boost::signal_network::slot_selector<
- typename boost::fusion::result_of::at_c<storable_vector, N>::type ()>
- (*this, &this_type::template at<N>);
- }
- /** \return The slot selector for the value_at function.
- */
- template<int N>
- slot_selector_t
-#ifndef DOXYGEN_DOCS_ONLY
- <this_type,
- typename boost::mpl::at_c<typename base_type::parameter_types, N>::type ()>
-#endif
- value_at_slot()
- {
- return boost::signal_network::slot_selector<
- typename boost::mpl::at_c<typename base_type::parameter_types, N>::type ()>
- (*this, &this_type::template value_at<N>);
- }
-protected:
- storable_vector stored;
-};
-
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
-
-
-#endif // SIGNAL_NETWORK_GENERATOR_HPP
\ No newline at end of file
Deleted: sandbox/SOC/2007/signals/boost/signal_network/timed_generator.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/timed_generator.hpp 2007-07-05 16:37:17 EDT (Thu, 05 Jul 2007)
+++ (empty file)
@@ -1,108 +0,0 @@
-#ifndef SIGNAL_NETWORK_TIMED_GENERATOR_HPP
-#define SIGNAL_NETWORK_TIMED_GENERATOR_HPP
-
-#include <boost/signal_network/storage.hpp>
-#include <boost/thread/thread.hpp>
-#include <boost/thread/condition.hpp>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/xtime.hpp>
-
-SIGNAL_NETWORK_OPEN_SIGNET_NAMESPACE
-
-/** \brief Creates its own thread and periodically sends a signal with the stored value.
- \param Signature signature of the sent signal.
-*/
-template<class Signature,
-typename Base=storage<Signature> >
-class timed_generator : public storage<Signature>
-{
-public:
- typedef timed_generator<Signature, typename Base::unfused> unfused;
-
- /// Default constructor. Starts the thread, but signals won't be sent until the enable() function is called.
- timed_generator() : terminating(false), enabled(false)
- {
- thread_object = new boost::thread(boost::bind(&timed_generator::thread_function, boost::ref(*this)));
- }
- /// Sets the object to send the stored value at specified time intervals.
- /** \param[in] interval Sets the time interval (in seconds) at which the signal is sent.
- \param[in] signal_count The signal will be sent signal_count times, or indefinitelly if signal_count==0.
- */
- void enable(double interval, unsigned signal_count=0)
- {
- xinterval.sec = (boost::xtime::xtime_sec_t)interval;
- xinterval.nsec = boost::xtime::xtime_nsec_t((interval - xinterval.sec) / 0.000000001);
-
- boost::mutex::scoped_lock lock(mutex_);
- boost::xtime_get(&xt, boost::TIME_UTC);
- count = signal_count;
- enabled = true;
- cond.notify_all();
- };
- /// Stops the sending of signals and suspends the thread.
- void disable()
- {
- enabled = false;
- }
- /// Forces the thread to terminate.
- void join()
- {
- boost::mutex::scoped_lock lock(mutex_);
- cond.notify_all();
- terminating = true;
- cond.wait(lock);
- thread_object->join();
- }
- /// The thread should be joined by the time the destructor is called.
- ~timed_generator()
- {
- terminating = true;
- cond.notify_all();
- delete thread_object;
- }
-private:
- void thread_function()
- {
- while (!terminating)
- {
- {
- boost::mutex::scoped_lock lock(mutex_);
- if (!enabled)
- cond.wait(lock);
- }
- if (terminating) break;
-
- xt.sec += xinterval.sec;
- xt.nsec += xinterval.nsec;
- if (xt.nsec >= 1000000000)
- {
- xt.nsec -= 1000000000;
- xt.sec++;
- }
-
- boost::thread::sleep(xt);
-
- if (terminating) break;
- (*this)();
- if (count)
- if (--count==0)
- disable();
- }
- cond.notify_all();
- }
- /// Class mutex.
- boost::mutex mutex_;
- boost::condition cond;
- boost::xtime xinterval;
- volatile bool terminating;
- boost::xtime xt;
- int count;
-
- boost::thread *thread_object;
- volatile bool enabled;
-};
-
-SIGNAL_NETWORK_CLOSE_SIGNET_NAMESPACE
-
-
-#endif // SIGNAL_NETWORK_TIMED_GENERATOR_HPP
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