|
Boost-Commit : |
From: srajko_at_[hidden]
Date: 2007-07-09 02:46:09
Author: srajko
Date: 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
New Revision: 7395
URL: http://svn.boost.org/trac/boost/changeset/7395
Log:
clean code and update docs for SoC mid-review. docs now include more generic dataflow ideas, and document the support / connection layers better.
Added:
sandbox/SOC/2007/signals/boost/signal_network/connection/detail/replace_return_type.hpp (contents, props changed)
sandbox/SOC/2007/signals/boost/signal_network/detail/enable_if_defined.hpp (contents, props changed)
sandbox/SOC/2007/signals/libs/signal_network/doc/dataflow1.png (contents, props changed)
sandbox/SOC/2007/signals/libs/signal_network/doc/dataflow2.png (contents, props changed)
sandbox/SOC/2007/signals/libs/signal_network/doc/dataflow3.png (contents, props changed)
sandbox/SOC/2007/signals/libs/signal_network/doc/dataflow_table.xml (contents, props changed)
sandbox/SOC/2007/signals/libs/signal_network/doc/rationale.qbk (contents, props changed)
sandbox/SOC/2007/signals/libs/signal_network/doc/support.qbk (contents, props changed)
Text files modified:
sandbox/SOC/2007/signals/boost/signal_network/component/detail/generic_template.hpp | 8
sandbox/SOC/2007/signals/boost/signal_network/component/filter.hpp | 35 +++--
sandbox/SOC/2007/signals/boost/signal_network/component/filter_base.hpp | 8
sandbox/SOC/2007/signals/boost/signal_network/component/storage.hpp | 3
sandbox/SOC/2007/signals/boost/signal_network/component/traits.hpp | 14 +
sandbox/SOC/2007/signals/boost/signal_network/connection/connect.hpp | 33 +++++
sandbox/SOC/2007/signals/boost/signal_network/connection/detail/result_of_defined.hpp | 32 ----
sandbox/SOC/2007/signals/boost/signal_network/connection/operators.hpp | 13 +-
sandbox/SOC/2007/signals/boost/signal_network/connection/signal.hpp | 58 ++++++---
sandbox/SOC/2007/signals/boost/signal_network/connection/slot_selector.hpp | 17 ++
sandbox/SOC/2007/signals/boost/signal_network/connection/slot_selector_map.hpp | 50 ++++++-
sandbox/SOC/2007/signals/libs/signal_network/build/xcodeide/signal_network.xcodeproj/project.pbxproj | 10 +
sandbox/SOC/2007/signals/libs/signal_network/doc/Jamfile.v2 | 7
sandbox/SOC/2007/signals/libs/signal_network/doc/components.qbk | 24 ++--
sandbox/SOC/2007/signals/libs/signal_network/doc/connections.qbk | 65 ++++++++++
sandbox/SOC/2007/signals/libs/signal_network/doc/html/boostbook.css | 2
sandbox/SOC/2007/signals/libs/signal_network/doc/introduction.qbk | 237 +++++++++++++++++++++++++--------------
sandbox/SOC/2007/signals/libs/signal_network/doc/signal_network.qbk | 34 +++-
sandbox/SOC/2007/signals/libs/signal_network/example/Jamfile.v2 | 2
sandbox/SOC/2007/signals/libs/signal_network/example/example.cpp | 78 +++++++++++--
sandbox/SOC/2007/signals/libs/signal_network/example/timing_example.cpp | 24 ++--
sandbox/SOC/2007/signals/libs/signal_network/test/test_branching.cpp | 4
sandbox/SOC/2007/signals/libs/signal_network/test/test_chain.cpp | 4
sandbox/SOC/2007/signals/libs/signal_network/test/test_connect.cpp | 11 +
sandbox/SOC/2007/signals/libs/signal_network/test/test_filter.cpp | 1
sandbox/SOC/2007/signals/libs/signal_network/test/test_storage.cpp | 22 +--
26 files changed, 541 insertions(+), 255 deletions(-)
Modified: sandbox/SOC/2007/signals/boost/signal_network/component/detail/generic_template.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/component/detail/generic_template.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/detail/generic_template.hpp 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -26,14 +26,14 @@
typename SIGNAL_NETWORK_GENERIC_TYPENAME2,
#endif
typename Signature,
- typename OutSignal=combined,
+ 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 BOOST_PP_CAT(SIGNAL_NETWORK_GENERIC_CLASS,_impl) : public filter<Signature, typename OutSignal::combined_type, Combiner, Group, GroupCompare>
+ class BOOST_PP_CAT(SIGNAL_NETWORK_GENERIC_CLASS,_impl) : public filter<Signature, typename OutSignal::filter_type, Combiner, Group, GroupCompare>
{
protected:
- typedef filter<Signature, typename OutSignal::combined_type, Combiner, Group, GroupCompare> base_type;
+ typedef filter<Signature, typename OutSignal::filter_type, Combiner, Group, GroupCompare> base_type;
public:
SIGNAL_NETWORK_GENERIC_CLASS_IMPL() {}
@@ -66,7 +66,7 @@
typename SIGNAL_NETWORK_GENERIC_TYPENAME2,
#endif
typename Signature,
-typename OutSignal=combined,
+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> >
Modified: sandbox/SOC/2007/signals/boost/signal_network/component/filter.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/component/filter.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/filter.hpp 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -15,32 +15,43 @@
#include <boost/fusion/sequence/adapted/mpl.hpp>
#ifndef SIGNAL_NETWORK_DEFAULT_OUT
-#define SIGNAL_NETWORK_DEFAULT_OUT combined
+#define SIGNAL_NETWORK_DEFAULT_OUT unfused
#endif
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.
+// the unfused, combined, and fused structs are used for specification of the filter class.
+// unfused and fused are also used for specification of provided components based on the filter class.
+// in the latter case, the filter_type member specifies the type of the underlying filter.
- Use this class as a base class for classes that produce a signal
- of a particular signature.
+/** \brief Used for specification of the filter class using an internal fused adaptor for an unfused output signal.
+*/
+struct combined {};
+
+/** \brief Used to specify unfused versions of provided components.
+ For the filter class, this means the filter will use an unfused output signal only,
*/
-struct combined
-{
- typedef combined combined_type;
-};
struct unfused
{
- typedef combined combined_type;
+ typedef combined filter_type;
};
+
+/** \brief Used to specify unfused versions of provided components.
+ For the filter class, this means the filter will use a fused output signal only.
+*/
struct fused
{
- typedef fused combined_type;
+ typedef fused filter_type;
};
+/// 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.
+*/
template<typename Signature,
-typename OutSignal=fused,
+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>
Modified: sandbox/SOC/2007/signals/boost/signal_network/component/filter_base.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/component/filter_base.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/filter_base.hpp 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -43,11 +43,11 @@
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>
+/*template<class T>
+struct get_signal_type<T, typename boost::enable_if<is_filter<T> >::type>
{
- typedef typename T::signature_type type;
-};
+ typedef typename T::signal_type type;
+};*/
} } // namespace boost::signals
Modified: sandbox/SOC/2007/signals/boost/signal_network/component/storage.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/component/storage.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/storage.hpp 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -85,7 +85,6 @@
>
class storage : public conditional_modifier<detail::storage_modifier<Signature>, Signature, OutSignal, Combiner, Group, GroupCompare>
{
-#ifndef DOXYGEN_DOCS_ONLY
protected:
typedef conditional_modifier<detail::storage_modifier<Signature>, Signature, OutSignal, Combiner, Group, GroupCompare> base_type;
public:
@@ -94,8 +93,6 @@
typedef typename detail::storage_modifier<Signature>::storable_types storable_types;
typedef typename detail::storage_modifier<Signature>::storable_vector storable_vector;
-#endif
-
/** Initializes the stored parameter values using the provided sequence.
\param[in] seq Sequence from which the stored parameter sequence is initialized from.
*/
Modified: sandbox/SOC/2007/signals/boost/signal_network/component/traits.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/component/traits.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/component/traits.hpp 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -6,7 +6,7 @@
#ifndef SIGNAL_NETWORK_COMPONENT_TRAITS_HPP
#define SIGNAL_NETWORK_COMPONENT_TRAITS_HPP
-#include <boost/type_traits/integral_constant.hpp>
+#include <boost/signal_network/detail/enable_if_defined.hpp>
namespace boost { namespace signals {
@@ -16,12 +16,18 @@
template<class T, typename Enable=void>
struct get_signal;
+template<typename T, typename Enable=void>
+struct get_signal_type;
+
+template<typename T>
+struct get_signal_type<T, typename detail::enable_if_defined<typename T::signal_type>::type >
+{
+ typedef typename T::signal_type type;
+};
+
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
Modified: sandbox/SOC/2007/signals/boost/signal_network/connection/connect.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/connection/connect.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/connection/connect.hpp 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -8,27 +8,54 @@
namespace boost { namespace signals {
+/** \brief A functor which connects two components. It must be specialized to support each component to be used with the library.
+*/
template<typename Input, typename Output, typename Enable=void>
-struct connect_impl;
-
+struct connect_impl
+#ifdef DOXYGEN_DOCS_ONLY
+{
+ /** Connects input to output.
+ */
+ void operator()(Input &input, Output &output);
+ /** Connects input to output.
+ */
+ void operator()(Input &input, const Output &output);
+ /** Connects input to output.
+ */
+ void operator()(const Input &input, Output &output);
+ /** Connects input to output.
+ */
+ void operator()(const Input &input, const Output &output);
+}
+#endif
+ ;
+
+/** Connects two components using boost::signals::connect_impl.
+*/
template<typename Input, typename Output>
void connect(Input &input, Output &output)
{
connect_impl<Input, Output>()(input, output);
};
-
+
+/** Connects two components using boost::signals::connect_impl.
+*/
template<typename Input, typename Output>
void connect(Input &input, const Output &output)
{
connect_impl<Input, Output>()(input, output);
};
+/** Connects two components using boost::signals::connect_impl.
+*/
template<typename Input, typename Output>
void connect(const Input &input, Output &output)
{
connect_impl<Input, Output>()(input, output);
};
+/** Connects two components using boost::signals::connect_impl.
+*/
template<typename Input, typename Output>
void connect(const Input &input, const Output &output)
{
Added: sandbox/SOC/2007/signals/boost/signal_network/connection/detail/replace_return_type.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/signal_network/connection/detail/replace_return_type.hpp 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -0,0 +1,28 @@
+// 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_REPLACE_RETURN_TYPE_HPP
+#define SIGNAL_NETWORK_REPLACE_RETURN_TYPE_HPP
+
+namespace boost { namespace signals {
+
+namespace detail {
+
+ 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
+ >
+ {};
+
+} // namespace detail
+
+} } // namespace boost::signals
+
+#endif // SIGNAL_NETWORK_REPLACE_RETURN_TYPE_HPP
+
Modified: sandbox/SOC/2007/signals/boost/signal_network/connection/detail/result_of_defined.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/connection/detail/result_of_defined.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/connection/detail/result_of_defined.hpp 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -6,6 +6,8 @@
#ifndef SIGNAL_NETWORK_RESULT_OF_DEFINED_HPP
#define SIGNAL_NETWORK_RESULT_OF_DEFINED_HPP
+#include <boost/signal_network/detail/enable_if_defined.hpp>
+
#include <boost/function_types/function_type.hpp>
#include <boost/function_types/parameter_types.hpp>
#include <boost/function_types/result_type.hpp>
@@ -19,40 +21,18 @@
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
- > {};
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(result_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>
+ struct result_defined<F, FArgs, typename detail::enable_if_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
@@ -61,9 +41,7 @@
result_defined<typename boost::function_types::result_type<T>::type, T>
>::type
>::type>
- : public boost::true_type {};
-
-
+ : public boost::true_type {};
} // namespace detail
Modified: sandbox/SOC/2007/signals/boost/signal_network/connection/operators.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/connection/operators.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/connection/operators.hpp 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -10,17 +10,16 @@
namespace boost { namespace signals {
-/// Connects a sequence of components using signals.
-/** This operator is identical to signals::filter::operator| (it connects the
+/// Connects two components (typically as a part of a chain of components).
+/** This operator is identical to signals::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.
+connecting a chain of components.
*/
-
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;}
@@ -33,8 +32,8 @@
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
+/// Connects two components (typically as a part of branching from a single component).
+/** This operator is identical to signals::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.
Modified: sandbox/SOC/2007/signals/boost/signal_network/connection/signal.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/connection/signal.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/connection/signal.hpp 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -1,11 +1,7 @@
-/*
- * signal.hpp
- * signal_network
- *
- * Created by Stjepan Rajko on 7/3/07.
- * Copyright 2007 __MyCompanyName__. All rights reserved.
- *
- */
+// 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_SIGNAL_HPP
#define SIGNAL_NETWORK_CONNECTION_SIGNAL_HPP
@@ -13,6 +9,8 @@
#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/connection/detail/replace_return_type.hpp>
+#include <boost/signal_network/detail/enable_if_defined.hpp>
#include <boost/signal_network/component/traits.hpp>
#include <boost/signal.hpp>
@@ -21,27 +19,49 @@
namespace boost { namespace signals {
+namespace detail
+{
+ template<typename T>
+ struct get_signature;
+
+ template<typename Signature, typename Combiner, typename Group, typename GroupCompare>
+ struct get_signature<boost::signal<Signature, Combiner, Group, GroupCompare> >
+ {
+ typedef Signature type;
+ };
+}
+
+/** \brief Support for components using the signal data transport mechanism.
+*/
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));
+ get_signal<Input>()(input).connect(get_slot<typename detail::get_signature<typename get_signal_type<Input>::type>::type, Output>()(output));
}
void operator()(Input &input, const Output &output)
{
- get_signal<Input>()(input).connect(get_slot<typename get_signature<Input>::type, Output>()(output));
+ get_signal<Input>()(input).connect(get_slot<typename detail::get_signature<typename get_signal_type<Input>::type>::type, Output>()(output));
}
void operator()(const Input &input, Output &output)
{
- get_signal<Input>()(input).connect(get_slot<typename get_signature<Input>::type, Output>()(output));
+ get_signal<Input>()(input).connect(get_slot<typename detail::get_signature<typename get_signal_type<Input>::type>::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));
+ get_signal<Input>()(input).connect(get_slot<typename detail::get_signature<typename get_signal_type<Input>::type>::type, Output>()(output));
}
};
+/** \brief Support for boost::signal.
+*/
+template<typename Signature, typename Combiner, typename Group, typename GroupCompare>
+struct is_component<boost::signal<Signature, Combiner, Group, GroupCompare> >
+ : public boost::true_type {};
+
+/** \brief Support for boost::signal.
+*/
template<typename Signature, typename Combiner, typename Group, typename GroupCompare>
struct get_signal<boost::signal<Signature, Combiner, Group, GroupCompare> >
{
@@ -49,15 +69,19 @@
(boost::signal<Signature, Combiner, Group, GroupCompare> &s) {return s;}
};
+/** \brief Support for boost::signal.
+*/
template<typename Signature, typename Combiner, typename Group, typename GroupCompare>
-struct get_signature<boost::signal<Signature, Combiner, Group, GroupCompare> >
+struct get_signal_type<boost::signal<Signature, Combiner, Group, GroupCompare> >
{
- typedef Signature type;
+ typedef boost::signal<Signature, Combiner, Group, GroupCompare> type;
};
+/** \brief Support for function objects that for which boost::result_of is defined.
+*/
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>
+ typename detail::replace_return_type<Signature, T>::type > >::type>
{
boost::function<Signature> operator()(T &object)
{
@@ -71,9 +95,5 @@
}
};
-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
Modified: sandbox/SOC/2007/signals/boost/signal_network/connection/slot_selector.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/connection/slot_selector.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/connection/slot_selector.hpp 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -15,6 +15,8 @@
namespace boost { namespace signals {
+/** \brief Reference to a class instance and pointer to a class member function.
+*/
template<typename Signature, typename T>
struct slot_selector
{
@@ -28,26 +30,37 @@
: object(object), func(func) {}
};
-/// Allows functions other than operator() to serve as signals::filter slots.
+/** \brief Allows arbitrary member functions to serve as 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);
}
+/// Support for slot_selector as an input component (producer).
template<typename Signature, typename T>
struct is_component<slot_selector<Signature, T> >
: public boost::true_type {};
+/// Support for slot_selector as an input component (producer).
template<typename Signature, typename T>
struct get_signal<slot_selector<Signature, T> >
{
- typename T::signal_type &operator()(const slot_selector<Signature, T> &selector)
+ typename get_signal_type<T>::type &operator()(const slot_selector<Signature, T> &selector)
{
return selector.object.default_signal();
}
};
+/// Support for slot_selector as an input component (producer).
+template<typename Signature, typename T>
+struct get_signal_type<slot_selector<Signature, T> >
+{
+ typedef typename get_signal_type<T>::type type;
+};
+
+/// Support for slot_selector as an output component (consumer).
template<typename Signature, typename T>
struct get_slot<Signature, slot_selector<Signature, T> >
{
Modified: sandbox/SOC/2007/signals/boost/signal_network/connection/slot_selector_map.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/signal_network/connection/slot_selector_map.hpp (original)
+++ sandbox/SOC/2007/signals/boost/signal_network/connection/slot_selector_map.hpp 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -1,11 +1,7 @@
-/*
- * slot_selector_map.hpp
- * signal_network
- *
- * Created by Stjepan Rajko on 7/3/07.
- * Copyright 2007 __MyCompanyName__. All rights reserved.
- *
- */
+// 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_SELECTOR_MAP_HPP
#define SIGNAL_NETWORK_SLOT_SELECTOR_MAP_HPP
@@ -15,11 +11,15 @@
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/fusion/sequence/intrinsic/at_key.hpp>
#include <boost/fusion/sequence/intrinsic/value_at_key.hpp>
+#include <boost/fusion/sequence/intrinsic/front.hpp>
+#include <boost/type_traits/remove_reference.hpp>
namespace boost { namespace signals {
+/** Support for fusion maps of consumer components.
+*/
template<typename Signature, typename T>
-struct get_slot<Signature, T, typename boost::enable_if<boost::fusion::traits::is_sequence<T> >::type>
+struct get_slot<Signature, T, typename boost::enable_if<boost::fusion::traits::is_sequence<T> >::type> // this should be is_map
{
boost::function<Signature> operator()(const T &seq)
{
@@ -28,6 +28,38 @@
}
};
+/// Support for fusion maps as a producer component (it will try to use the first component).
+template<typename T>
+struct is_component<T, typename boost::enable_if<boost::fusion::traits::is_sequence<T> >::type>
+ : public boost::true_type {};
+
+/// Support for slot_selector as an input component (producer).
+template<typename T>
+struct get_signal_type<T, typename boost::enable_if<boost::fusion::traits::is_sequence<T> >::type>
+{
+ typedef
+ typename get_signal_type<
+ typename boost::remove_reference<
+ typename boost::fusion::result_of::front<T>::type
+ >::type::second_type
+ >::type type;
+};
+
+/// Support for slot_selector as an input component (producer).
+template<typename T>
+struct get_signal<T, typename boost::enable_if<boost::fusion::traits::is_sequence<T> >::type>
+{
+ typename get_signal_type<T>::type &operator()(const T &map)
+ {
+ return get_signal<
+ typename boost::remove_reference<
+ typename boost::fusion::result_of::front<T>::type
+ >::type::second_type>()(boost::fusion::front(map).second);
+ }
+};
+
+
+
} } // namespace boost::signals
#endif // SIGNAL_NETWORK_SLOT_SELECTOR_MAP_HPP
\ No newline at end of file
Added: sandbox/SOC/2007/signals/boost/signal_network/detail/enable_if_defined.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/signal_network/detail/enable_if_defined.hpp 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -0,0 +1,31 @@
+// 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_ENABLE_IF_DEFINED_HPP
+#define SIGNAL_NETWORK_ENABLE_IF_DEFINED_HPP
+
+#include <boost/type_traits/integral_constant.hpp>
+#include <boost/utility/enable_if.hpp>
+
+namespace boost { namespace signals {
+
+namespace detail
+{
+/* template<typename T>
+ struct defined : public boost::true_type {};
+
+ template<typename T, typename Result=void>
+ struct enable_if_defined : public boost::enable_if<defined<T>, Result>
+ {};*/
+ template<typename T, typename Result=void>
+ struct enable_if_defined
+ {
+ typedef Result type;
+ };
+}
+
+} } // namespace boost::signals
+
+#endif // SIGNAL_NETWORK_ENABLE_IF_DEFINED_HPP
Modified: sandbox/SOC/2007/signals/libs/signal_network/build/xcodeide/signal_network.xcodeproj/project.pbxproj
==============================================================================
--- sandbox/SOC/2007/signals/libs/signal_network/build/xcodeide/signal_network.xcodeproj/project.pbxproj (original)
+++ sandbox/SOC/2007/signals/libs/signal_network/build/xcodeide/signal_network.xcodeproj/project.pbxproj 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -123,6 +123,9 @@
08F082570C1DD53400687E1B /* components.qbk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = components.qbk; sourceTree = "<group>"; };
08F0825A0C1DD58500687E1B /* connections.qbk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = connections.qbk; sourceTree = "<group>"; };
08F082840C1DE02F00687E1B /* test_branching.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_branching.cpp; sourceTree = "<group>"; };
+ 08F36DFB0C41375B00E2F9A1 /* dataflow_table.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = dataflow_table.xml; sourceTree = "<group>"; };
+ 08F36EED0C416DEB00E2F9A1 /* support.qbk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = support.qbk; sourceTree = "<group>"; };
+ 08F3701D0C41968800E2F9A1 /* enable_if_defined.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = enable_if_defined.hpp; sourceTree = "<group>"; };
08F74F790C3A9E8200FD50BE /* slot_type.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = slot_type.hpp; sourceTree = "<group>"; };
08F74F7D0C3A9F6900FD50BE /* slot_selector.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = slot_selector.hpp; sourceTree = "<group>"; };
08F74F820C3AA0FA00FD50BE /* operators.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = operators.hpp; sourceTree = "<group>"; };
@@ -134,6 +137,8 @@
08F803D30C21895700D8296D /* test_multi_out.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_multi_out.cpp; sourceTree = "<group>"; };
08F804AD0C219CC300D8296D /* test_filter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_filter.cpp; sourceTree = "<group>"; };
08F8A00B0C3C879C007637A9 /* test_result_of_defined.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_result_of_defined.cpp; sourceTree = "<group>"; };
+ 08FA69EE0C41DDFD00434913 /* replace_return_type.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = replace_return_type.hpp; sourceTree = "<group>"; };
+ 08FA6A050C41E11800434913 /* rationale.qbk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rationale.qbk; sourceTree = "<group>"; };
08FD5DE80C1BA60700F00877 /* html_footer.html */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.html; path = html_footer.html; sourceTree = "<group>"; };
08FD5DE90C1BA60700F00877 /* html_header.html */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.html; path = html_header.html; sourceTree = "<group>"; };
08FD5DEA0C1BA60700F00877 /* signal_network.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = signal_network.hpp; sourceTree = "<group>"; };
@@ -171,6 +176,7 @@
isa = PBXGroup;
children = (
080DD77A0C13912C00EEB53D /* unfused_typed_class.hpp */,
+ 08F3701D0C41968800E2F9A1 /* enable_if_defined.hpp */,
);
path = detail;
sourceTree = "<group>";
@@ -270,6 +276,7 @@
08EC0E640C3C215900CC8AE0 /* result_of_defined.hpp */,
08F74F790C3A9E8200FD50BE /* slot_type.hpp */,
08C8F1470C3B22F200B3CE45 /* bind_object.hpp */,
+ 08FA69EE0C41DDFD00434913 /* replace_return_type.hpp */,
);
path = detail;
sourceTree = "<group>";
@@ -284,6 +291,9 @@
08F082020C1D591000687E1B /* introduction.qbk */,
08F082570C1DD53400687E1B /* components.qbk */,
08F0825A0C1DD58500687E1B /* connections.qbk */,
+ 08F36DFB0C41375B00E2F9A1 /* dataflow_table.xml */,
+ 08F36EED0C416DEB00E2F9A1 /* support.qbk */,
+ 08FA6A050C41E11800434913 /* rationale.qbk */,
);
name = doc;
path = ../../doc;
Modified: sandbox/SOC/2007/signals/libs/signal_network/doc/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/signals/libs/signal_network/doc/Jamfile.v2 (original)
+++ sandbox/SOC/2007/signals/libs/signal_network/doc/Jamfile.v2 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -15,9 +15,9 @@
xml signal_network_xml : signal_network.qbk ;
doxygen signal_network_doxygen
:
- [ glob
- ../../../boost/signal_network/*.hpp
- ]
+ [ glob ../../../boost/signal_network/*.hpp ]
+ [ glob ../../../boost/signal_network/connection/*.hpp ]
+ [ glob ../../../boost/signal_network/component/*.hpp ]
:
<doxygen:param>TAB_SIZE=4
<doxygen:param>EXAMPLE_PATH=../test
@@ -26,6 +26,7 @@
<doxygen:param>STRIP_FROM_INC_PATH=$(root)
<doxygen:param>EXTRACT_ALL=NO
<doxygen:param>HIDE_UNDOC_MEMBERS=YES
+ <doxygen:param>INHERIT_DOCS=YES
<doxygen:param>EXTRACT_PRIVATE=NO
<doxygen:param>ENABLE_PREPROCESSING=YES
<doxygen:param>MACRO_EXPANSION=YES
Modified: sandbox/SOC/2007/signals/libs/signal_network/doc/components.qbk
==============================================================================
--- sandbox/SOC/2007/signals/libs/signal_network/doc/components.qbk (original)
+++ sandbox/SOC/2007/signals/libs/signal_network/doc/components.qbk 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -3,7 +3,7 @@
[section:generic Generic]
[section:filter filter]
-[*See also]: [classref boost::signal_network::signet::filter filter class reference.]
+[*See also]: [classref boost::signals::filter filter class reference.]
The __filter__ class is provided as a base class for in / out components. It provides support for Signal Network connection operators,
and provides a default output signal. Here is an example of a simple class which inherits __filter__:
@@ -29,7 +29,7 @@
[endsect][/filter]
[section:applicator applicator]
-[*See also]: [classref boost::signal_network::signet::applicator applicator class reference.]
+[*See also]: [classref boost::signals::applicator applicator class reference.]
The __applicator__ class applies a specified function object to a member variable of a specified type whenever it receives a signal.
The signal is always forwarded.
@@ -41,7 +41,7 @@
[endsect][/applicator]
[section:conditional conditional]
-[*See also]: [classref boost::signal_network::signet::conditional conditional class reference.]
+[*See also]: [classref boost::signals::conditional conditional class reference.]
The __conditional__ class applies a specified function object to a member variable of a specified type whenever it receives a signal.
The signal is forwarded if the function object returns true.
@@ -53,7 +53,7 @@
[endsect][/conditional]
[section:instantiator instantiator]
-[*See also]: [classref boost::signal_network::signet::instantiator instantiator class reference.]
+[*See also]: [classref boost::signals::instantiator instantiator class reference.]
The __instantiator__ class instantiates a specified type from a member variable of a specified type whenever it receives a signal.
The signal is always forwarded.
@@ -65,7 +65,7 @@
[endsect][/instantiator]
[section:modifier modifier]
-[*See also]: [classref boost::signal_network::signet::modifier modifier class reference.]
+[*See also]: [classref boost::signals::modifier modifier class reference.]
The __modifier__ class instantiates a member function object of specified type Member. It applies the member function object
to each incoming signal, and sends the returned value.
@@ -80,7 +80,7 @@
[section:properties Signal Properties]
[section:storage storage]
-[*See also]: [classref boost::signal_network::signet::storage storage class reference.]
+[*See also]: [classref boost::signals::storage storage class reference.]
The __storage__ class can store the parameters it receives from a signal, as well as transmit the stored
parameter values through its own signal.
@@ -92,7 +92,7 @@
[endsect][/storage]
[section:counter counter]
-[*See also]: [classref boost::signal_network::signet::counter counter class reference.]
+[*See also]: [classref boost::signals::counter counter class reference.]
The __counter__ class counts the number of passing signals. Each time it receives a signal, it will increment an internal
counter and forward the signal.
@@ -108,7 +108,7 @@
[section:flow Signal Flow]
[section:junction junction]
-[*See also]: [classref boost::signal_network::signet::junction junction class reference.]
+[*See also]: [classref boost::signals::junction junction class reference.]
The __junction__ class can be used to bring in multiple signals, and forward them all to the same set of
output signals.
@@ -121,7 +121,7 @@
[endsect][/junction]
[section:mutex mutex]
-[*See also]: [classref boost::signal_network::signet::mutex mutex class reference.]
+[*See also]: [classref boost::signals::mutex mutex class reference.]
The __mutex__ class locks an internal mutex when it receives a signal, and then forwards the signal.
__mutex__ is an __instantiator__ with the Instantiation boost::mutex::scoped_lock and Member boost::mutex.
@@ -137,7 +137,7 @@
[section:adapters Adapters]
[section:function function]
-[*See also]: [classref boost::signal_network::signet::function function class reference.]
+[*See also]: [classref boost::signals::function function class reference.]
The __function__ class can be used to apply a function to an incoming signal and output the result.
__function__ is a __modifier__ with the Modifier set to an adapter for the provided function.
@@ -173,7 +173,7 @@
[section:network Network]
[section:socket_sender socket_sender]
-[*See also]: [classref boost::signal_network::signet::socket_sender socket_sender class reference.]
+[*See also]: [classref boost::signals::socket_sender socket_sender class reference.]
The __socket_sender__ class can be used to bridge a signal network accross multiple computers via a
network connection. Any signal going to the __socket_sender__ will be serialized and sent over a provided
@@ -187,7 +187,7 @@
[section:socket_receiver socket_receiver]
-[*See also]: [classref boost::signal_network::signet::socket_receiver socket_receiver class reference.]
+[*See also]: [classref boost::signals::socket_receiver socket_receiver class reference.]
The __socket_receiver__ class can be used to bridge a signal network accross multiple computers via a
network connection. Any signal going to the __socket_sender__ will be serialized and sent over a provided
Modified: sandbox/SOC/2007/signals/libs/signal_network/doc/connections.qbk
==============================================================================
--- sandbox/SOC/2007/signals/libs/signal_network/doc/connections.qbk (original)
+++ sandbox/SOC/2007/signals/libs/signal_network/doc/connections.qbk 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -1,5 +1,64 @@
[section:connections Connections]
+[section:connect connect function]
+
+[*See also]: [funcref boost::signals::connect connect function reference.]
+
+The __connect__ function is the fundamental connection-creating mechanism of
+the library. Given a /producer/ `p` and /consumer/ `c` supported by the library,
+
+ connect(p, c);
+
+will create a connection between the two. The examples in this documentation typically
+use __operators__ to create connections. The __operators__ use the __connect__ function
+directly, and can be replaced by invocations of __connect__ if preferred.
+
+The support for various types of components that are supported by __connect__ is currently
+divided in the following files:
+
+ #include <boost/signal_network/connection/signal.hpp>
+
+will add support for `boost::signal` as a producer, and function objects for which `boost::result_of` is defined
+as consumers.
+
+ #include <boost/signal_network/connection/slot_selector.hpp>
+
+will add support for __slot_selector__ objects as signal consumers. In addition, they can be used
+as signal producers if the underlying object is a signal producer.
+
+ #include <boost/signal_network/connection/slot_selector_map.hpp>
+
+will add support for fusion maps from signatures to __slot_selector__ objects (and perhaps to any signal consumer,
+not tested yet) as signal consumers. This can be used to pack multiple slots of an object together, and then make
+connections based on the appropriate signature (see the send_slot function of __storage__ as an example).
+In addition, fusion maps can be used as signal producers if the underlying object of the front element is a signal
+producer.
+
+[table connect example
+ [[unfused]]
+ [[[test_connect]]]
+]
+
+[endsect]
+
+[section:classes Classes]
+
+[section:slot_selector slot_selector]
+
+[*See also]: [classref boost::signals::slot_selector slot_selector class reference.]
+
+The __slot_selector__ class is used to refer to a particular member function of a particular object, and can be used
+can be used as a receiver.
+
+__slot_selector__ objects can be constructed using the [funcref boost::signals::make_slot_selector] function.
+See the [link signal_network.connections.examples.multiple_same Multiple inputs of the same signature] example.
+
+[endsect]
+
+[endsect][/classes]
+
+[section:operators Operators]
+
[section:chaining Chaining]
Chaining of components can be done using `operator >>=`.
@@ -24,6 +83,10 @@
[endsect][/branching]
+[endsect][/operators]
+
+[section Examples]
+
[section:pull Pull-based networks]
The Signal Network library was built with push-based networks in
@@ -120,4 +183,6 @@
[endsect][/multi_out]
+[endsect][/examples]
+
[endsect][/connections]
Added: sandbox/SOC/2007/signals/libs/signal_network/doc/dataflow1.png
==============================================================================
Binary file. No diff available.
Added: sandbox/SOC/2007/signals/libs/signal_network/doc/dataflow2.png
==============================================================================
Binary file. No diff available.
Added: sandbox/SOC/2007/signals/libs/signal_network/doc/dataflow3.png
==============================================================================
Binary file. No diff available.
Added: sandbox/SOC/2007/signals/libs/signal_network/doc/dataflow_table.xml
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/signal_network/doc/dataflow_table.xml 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -0,0 +1,23 @@
+<!DOCTYPE table PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+ "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
+<table frame='all'><title>Dataflow library tentative design</title>
+<tgroup cols='3' align='center' colsep='1' rowsep='1'>
+<colspec colname='c1'/>
+<colspec colname='c2'/>
+<colspec colname='c3'/>
+<tbody>
+<row>
+ <entry>operators</entry>
+ <entry>blueprint</entry>
+ <entry>component</entry>
+</row>
+<row>
+ <entry namest="c1" nameend="c2" align="center">connect</entry>
+ <entry>mechanism-specific</entry>
+</row>
+<row>
+ <entry namest="c1" nameend="c3">support</entry>
+</row>
+</tbody>
+</tgroup>
+</table>
Modified: sandbox/SOC/2007/signals/libs/signal_network/doc/html/boostbook.css
==============================================================================
--- sandbox/SOC/2007/signals/libs/signal_network/doc/html/boostbook.css (original)
+++ sandbox/SOC/2007/signals/libs/signal_network/doc/html/boostbook.css 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -236,7 +236,7 @@
div.table table tr td
{
padding: 0.5em;
- text-align: left;
+<!-- text-align: left; -->
}
div.informaltable table tr th,
Modified: sandbox/SOC/2007/signals/libs/signal_network/doc/introduction.qbk
==============================================================================
--- sandbox/SOC/2007/signals/libs/signal_network/doc/introduction.qbk (original)
+++ sandbox/SOC/2007/signals/libs/signal_network/doc/introduction.qbk 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -1,98 +1,154 @@
[section:introduction Introduction]
-[section:dataflow Dataflow-oriented programming in C++]
+[section:dataflow Dataflow programming in C++]
-[note The purpose of this section is to place the Signal Network library in the bigger picture.
-It is only a start, so please forgive the incompleteness and possible inaccuracies.
-A lot of the ideas in this section have come from a discussion with Tobias Schwinger,
-whom I thank sincerely for his continuing help and suggestions.]
-
-The Signal Network library attempts to afford some of the benefits of
-[@http://en.wikipedia.org/wiki/Dataflow_language dataflow languages] to portable, generic C++, while
-at the same time allowing the power and flexibility of C++ to be used easily
-in a dataflow-oriented environment. It does so by
-facilitating large-scale use of Boost.Signals as a mechanism to model the transfer
-of data between processing components.
-
-The wikipedia description of [@http://en.wikipedia.org/wiki/Dataflow_language dataflow languages]
-does a pretty good job of introducing the dataflow concept. Perhaps the most interesting point I'd like to
-focus on here is the notion that "data is what it is all about". Even though data is an integral
-part of C++, and lot of things are very much about the data, programs tend not to be modeled with the
-flow of data as the central representation mechanism.
-
-[*["Data is all over the place in C++. How is it not already a dataflow language?]]
-
-Take the following example - a simple real-time camera-input-displayed-on-the-screen
-application. Suppose there are three parts to the application - getting each image frame from the camera,
-processing the image in some way, and displaying it on the screen. A program that does it might
+[@http://en.wikipedia.org/wiki/Dataflow_language Dataflow languages] provide a programming paradigm
+based on interconnected /components/ which process passing /data/. In general,
+this conceptually models data as something that originates from a source, flows through
+a number of processing components that manipulate it (e.g., by changing it, duplicating, etc.),
+and arrives at some final destination. As such, the dataflow paradigm is most suitable when developing
+applications that are themselves focused on the "flow" of data.
+
+Perhaps the most readily available examples of a
+dataflow-oriented applications come from the realm of [@http://en.wikipedia.org/wiki/Signal_processing
+signal processing], e.g. a video signal processor which perhaps starts with a video input,
+modifies it through a number of processing components (video filters), and finally
+outputs it to a video display.
+
+[heading A motivating example]
+
+Let's take a simple real-time camera-input-displayed-on-the-screen application. Suppose there are three
+parts to the application - getting each image frame from the camera, processing the image in some way,
+and displaying it on the screen. To see how we might arrive at a dataflow-oriented implementation
+of this application, let's first begin with an imperative approach. Such an implementation might
be structured as follows:
[$dataflow1.png]
Basically, the main program loop is a series of instructions which does this particular job.
If you wanted to be a little bit more object oriented, you could encapsulate all this functionality
-into an Image class and just call the methods that do the right thing from the main program loop.
-But that's still not all about the flow of data. It's about the instructions that work on the data.
+into an Image class and just call the methods that do the right thing from the main program loop,
+which would give you an object-oriented imperative solution.
-Let's take this a step further. Video input libraries often provide callback functionality which will
-deliver a video stream as image frames at the appropriate frame rate. With this in mind, we do the following
+However, let's take this a step further in the dataflow direction. Video input libraries often provide callback
+functionality which will deliver a video stream as a sequence of image frames given at the appropriate frame rate.
+With this in mind, we do the following:
# implement a function which takes an image as input.
# the function first invokes the image processing library function that modifies the image as appropriate
# the function then invokes the GUI library function that displays the image
# register the function as a callback with the camera library
-# relax and have some coffee.
+# the main program loop can relax and have some coffee.
The situation now looks something like this:
[$dataflow2.png]
-OK, let's look at the situation now. The image library is acting as some sort of a signal generator - it
-generates images at a certain frame rate. And the function we implemented, that seems to be like
+So now, the image library is acting as a data/signal generator - it
+generates images at a certain frame rate. And the function we implemented seems to be
a signal consumer which can take an image, process it, and display it on the screen.
-This does seem to be a little more about the flow of data.
-But let's take it even further, and go into the realm of the atypical. Right now
-we have two "components" - one image signal generator and one signal consumer. How about this:
+This now employs the basic elements of the dataflow paradigm, but we could take it even further.
+Instead of just having two components, one image signal generator and one signal consumer, how about this:
# implement a component which accepts an input image signal, modifies the image as appropriate, and then outputs
a signal with the modified image
# implement a component which receives an imput image signal and displays it on the screen
# connect the camera library input stream to the first component
# connect the first component to the second component
-# relax and have some tea. go take a nap.
+# the main program loop can relax and have some tea, or even take a nap.
The big picture now looks like the following:
[$dataflow3.png]
-[*["So what did we gain?]]
+[heading Advantages]
-First, maintenance of the program has just become very intuitive. You don't
-want to process the image any more? Connect the camera signal directly to the screen display and cut out
+There are already many programming paradigms supported by C++ (either directly or through
+additional libraries), so let's examine what the advantages of the the dataflow paradigm might be.
+
+First of all, [*dataflow programming is not exclusive of other techniques], so adopting the dataflow paradigm
+does not hinder the use of other approaches. In fact, in C++ it can't - since the components
+themselves need to be implemented somehow, and we can't recursively define them
+forever as finer and finer dataflow diagrams, the dataflow paradigm relies on other
+programming techniques to do the underlying work. Also, dataflow can only be a part of a complete
+application implementation. You can always "extend your fingers" from other parts of the program in order
+to insert data into the dataflow, catch it on the other end, probe and adjust the components, etc.
+You can think of it as working with electronic components and changing the connections, turning knobs,
+flipping switches, or hanging over a circuit board and tinkering with it using, say, a multimeter and a
+5V lead (just do it with care).
+
+Second, [*dataflow promotes some good programming practices]. When developing processing components,
+we have only the incoming data to deal with - with no requirements on where it is coming from. Hence,
+the developed components tend to be quite versatile and reusable. In the above example, the image
+processing component can be used with any image data generator - there is nothing inside the component
+that says "get the image from the camera", or "get the image from this type of data source (where the
+type is either a base class or a concept)". It just does it's thing, no matter where the data is coming
+from.
+
+Third, when used in the right context, [*dataflow programming makes development and maintenance
+very intuitive]. In the image processing example, say you don't want to process the image any more. You can
+just connect the camera signal directly to the screen display and cut out
the image processing component. Someone gives you a new video signal generator component you'd like to use as input
instead of the camera? Just plug it in. Literally.
-Second, the program can now be divided between threads, processors, or computers more easily.
-The display is on a different computer? No problem, just put the connection to it through a network socket.
+Fourth, [*dataflow-oriented programs can be divided between threads, processors, or computers more easily],
+because the data dependencies are much more visible. In the image processing example, say you have
+the display on a different computer. You can just pass the connection to it through a network socket.
With the data flow clearly specified, it is much easier to distribute the work either manually or
even automatically (although the Signal Network library at the moment offers no such automatic functionality).
-Third, we are not to far from the advantages of a [@http://en.wikipedia.org/wiki/Visual_programming_language
-visual programming language], since the components and the connections have a natural graphical representation.
+Finally, [*we are not to far from the advantages of a [@http://en.wikipedia.org/wiki/Visual_programming_language
+visual programming language]], since the components and the connections have a natural graphical representation.
With a visaul development environment, programming becomes as easy as connecting components with connections
(again, the Signal Network library provides no visual programming functionality).
-[*["But I can do all of this using my favorite non-dataflow programming approach just the same!]]
+[heading Go with the flow?]
+
+If you are interested in exploring the dataflow concept further, see
+
+* generic approach to dataflow in C++.
+* using Boost.Signals as a data transport mechanism.
+
+[endsect][/dataflow]
+
+[section:generic_dataflow A generic approach to dataflow]
+
+[note A lot of the ideas in this section have come from discussions with Tobias Schwinger and Douglas Gregor,
+whom I thank sincerely for their continuing help and suggestions.]
+
+The Signal Network library started as a way to facilitate dataflow programming by
+providing components and connections which allow large-scale use of Boost.Signals as a mechanism to
+model the transfer of data between processing components. However, during the planning, design and development
+of the library, it became apparent that
+
+* there are a lot of good ways to move data around, Boost.Signals being one of them
+* there are generic properties of dataflow programs which do not depend on the data transport mechanism,
+ and can be used to develop mechanism-independent dataflow code.
-Sure. Maybe you can. But if the application is really about the flow of data, why not
-model it and implement it that way? If it's about the data signals and the components that process it,
-rather than about the sequence of instructions that needs to be executed, then the dataflow implementation can reflect
-the application more closely, and it just might be easier to design and maintain.
+Hence, the Signal Network library is planned to be redesigned into a generic dataflow library (probably called
+Dataflow), and offer individual mechanism-specific modules (the Signal Network library being one of them).
-[h4 Signal-based approach and pin-based approach]
+The design of the Dataflow library might look something like this:
-To explore the concept of dataflow in C++ further, let us take a step back and examine where the flow of data
+[xinclude dataflow_table.xml]
+
+The layers are a bottom-up hierarchy, with dependencies only on layers underneath.
+The /support/ layer provides the necessary generic traits and functions required for generic code to work with mechanism-specific
+components. Each type of mechanism or component must specialize the elements of the support layer to work with the mechanism\/component.
+The /connect/ layer provides the generic connect free function, which is then used by the /operators/ and
+the envisioned /blueprint/ layer. Each mechanism might have its own /mechanism-specific/ layer, on top of which a mechanism-specific
+/component/ can be implemented. As long as the support layer is implemented for the mechanism/component, the component should
+work seamlesly with the rest of the dataflow library.
+
+Essentially, the support layer is a very minimal layer implementing a generic and extensible intrusive directed graph
+framework. The blueprint layer could be implemented as a BGL graph over a hierarchy of classes with a common interface
+(implemented using a base class with virtual methods) which provides serialization, instantiation, and (if applicable)
+execution capability for an entire network.
+
+[heading The different data transport mechanisms]
+
+To explore the concept of generic dataflow in C++ further, let us take a step back and examine where the flow of data
happens in C++. Rather informally, we can divide things as follows:
* on one hand, there is /data/ (variables, objects, etc...)
@@ -112,7 +168,7 @@
* the component places a value somewhere where it can be read
* the component returns it as a return value
-There is a separation between providing the data to a component, and invoking the
+Another important thing to note is that there is a separation between providing the data to a component, and invoking the
component. In some cases, the two happen simoultaneously (when the data is passed and returned
via a function call), while in others invoking the computational component
can happen separately from providing the data (at least from a modeling perspective).
@@ -155,12 +211,29 @@
Google Summer of Code project, I believe it is worthwhile to keep the connections in
mind while designing and implementing the Signal Network library.
-For example, both frameworks could possibly benefit from the separation of the network
-creation layer (which may include factories and reflection) from the network execution
-layer (which only includes the necessary computation components). Also, allowing additional
-mechanisms for network creation such as through a visual GUI designer, serialization/deserialization
-etc. would also be beneficial. If I address any of these for the GSoC project, I will try to
-address them in a way that might be useful for both the signal-based approach and pin-based approach.
+To this end, I have started implementing a very simple framework that is based on
+phoenix2 actors, and uses straight pointers to indicate the flow of
+data. This is somewhat related to the pin-based approach (but much simpler and without the support for things
+like buffer/pin management which Tobias has envisioned), so it is helping me see what tends to be similar accross
+data transport mechanisms, and what tends to be different. This additional framework, as well as the generic
+Dataflow layers, will be committed to the repository shortly (mid-July), after I get a chance to integrate everything
+in a joint design.
+
+[endsect]
+
+[section:signals Boost.Signals as a data transport mechanism]
+
+Boost.Signals is an excellent building block for dataflow networks, as it provides support for
+all of the essential elements - data transport through parameters and return values, combining
+return values from multiple signal calls, component invocation, and reconfigurability through connection
+and disconnection.
+
+The Signal Network library uses Boost.Signals as the data transport mechanism in dataflow networks.
+In addition, it provides two major elements that facilitate the building of large signals-based dataflow
+networks:
+
+* The __connect__ function and its associated operators which can be used to easily connect different kinds of components.
+* A number of generic and specific components which can be extended and customized for use in particular dataflow networks.
[endsect]
@@ -191,6 +264,7 @@
[endsect]
[section:fusion Signal Network and Boost.Fusion]
+
The components in the Signal Network library are implemented using __fusion__. To use the
Signal Network library, you might benefit from the following if you're not familiar with fusion.
@@ -232,44 +306,33 @@
While writing the generic components provided in the Signal Network library benefits from using
__fusion__, your particular use case might not. For this reason, every component provided
-by the Signal Network library has both a fused and an unfused version. The unfused
-component type is always accessible through the `::unfused` typedef of each component
-(which is fused by default)
+by the Signal Network library:
+
+* can receive both fused and unfused signals
+* has both a version that sends fused signals and a version that sends unfused signals.
+
+The type of sent signal is provided as a template argument to the class, and the default value can be set
+by defining `SIGNAL_NETWORK_DEFAULT_OUT` to either `unfused` or `fused` before including a sinal
+network component.
For example,
- signet::storage<int (int, int &, const std::string &>)> fused_storage;
- signet::storage<int (int, int &, const std::string &>)>::unfused unfused_storage;
+ signals::storage<int (int, int &, const std::string &>), signals::unfused> unfused_storage;
+ signals::storage<int (int, int &, const std::string &>), signals::fused> fused_storage;
-In the above case, `fused_storage` acts as a function object similar to `fused_f` above.
-Hence, it can be used as a slot for signals which carry a fusion container as an argument.
-On the other hand, `unfused_storage` is similar to `f` above, and can be used as a slot
+In the above case, `unfused_storage` is similar to `f` above, and can be used as a slot
for signals which carry regular, unfused arguments.
-
-In general, the difference between the fused and unfused components are as follows:
-
-[table Fused vs. Unfused differences
- [[trait][fused][unfused]]
- [[signals receivable][receives only fused signals][receives both fused and unfused signals]]
- [[signals sent][sends fused signals by default][sends unfused signals by default]]
-]
+On the other hand, `fused_storage` acts as a function object similar to `fused_f` above.
+Hence, it can be used as a slot for signals which carry a fusion container as an argument.
[endsect][/fusion]
[section:namespace Namespace use]
-The connection operators (and a few other things) are located in the boost::signal_network namespace.
-All of the components are in the boost::signal_network::signet namespace.
-
-It is recommended that you do
-
- using namespace boost::signal_network
-
-so that your code can use the operators >>= and |, and you can access the components via signet::/component/.
-
-Otherwise, the following might be helpful:
+Currently, everything in the Signal Network library is located in the `boost::signals` namespace.
+All of the examples shown are assuming the use of
- namespace signet = boost::signal_network::signet;
+ using namespace boost;
[endsect]
@@ -284,11 +347,11 @@
By default, components in the library use `operator()` to receive a signal.
For example, __storage__ objects can receive
-signals through [memberref boost::signal_network::signet::storage::operator()(void) operator()()].
+signals through [memberref boost::signals::storage::operator()(void) operator()()].
Upon receiving this signal, they will output their stored value through another signal.
The value stored inside a __storage__ object
-can be retrieved via the [memberref boost::signal_network::signet::storage::at() at()] method.
+can be retrieved via the [memberref boost::signals::storage::at() at()] method.
Using a few __storage__ objects, it is easy to
create a network using [funcref boost::signal_network::operator>>=() operator>>=]:
@@ -351,7 +414,7 @@
[[fused][unfused]]
[[``
SignalVoidCounter counter;
- signet::storage<void()> storage;
+ signals::storage<void()> storage;
storage >>= counter;
for (int i=0; i<33; i++)
@@ -360,7 +423,7 @@
assert(counter.GetCount());
``][``
SignalVoidCounter counter;
- signet::storage<void()>::unfused storage;
+ signals::storage<void(), signals::unfused> storage;
storage >>= counter;
for (int i=0; i<33; i++)
Added: sandbox/SOC/2007/signals/libs/signal_network/doc/rationale.qbk
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/signal_network/doc/rationale.qbk 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -0,0 +1,18 @@
+[section Rationale]
+
+[heading Naming conventions]
+
+* I encountered the term /dataflow/ after starting this library. Although the information I can find about dataflow as
+ a programming paradigm seems to be a little sub-par, it seems like the right name for this programming paradigm.
+ As a part of developing this library and doing the accompanying research I can work on improving the information that i
+ out there (on Wikipedia, etc.)
+* I chose /component/ to refer to a processing element of a dataflow network, because the term has no prior (to my knowledge)
+ C++ meaning.
+* In differentiating components that output data from those that input data, I originally thought about using "input component"
+ and "output component". However, I realized that "input" and "output" switch depending on perspective - from the perspective
+ of a component, it is "output" if it outputs data, but from the perspective of a corresponding connection, that same component is the
+ "input". A better choice might be /producer/ and /consumer/ as they don't suffer from the same problem. Perhaps "provider"
+ would be more accurate (since the component does not necessarily need to produce new data each time, but can keep providing
+ the same data), but there is a precedent for using producer and consumer. The filter class might be renamed to producer.
+
+[endsect]
\ No newline at end of file
Modified: sandbox/SOC/2007/signals/libs/signal_network/doc/signal_network.qbk
==============================================================================
--- sandbox/SOC/2007/signals/libs/signal_network/doc/signal_network.qbk (original)
+++ sandbox/SOC/2007/signals/libs/signal_network/doc/signal_network.qbk 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -11,6 +11,12 @@
]
]
+[def __connect__ [link signal_network.connections.connect connect]]
+[def __components__ [link signal_network.components components]]
+[def __operators__ [link signal_network.connections.operators operators]]
+
+[def __slot_selector__ [link signal_network.connections.classes.slot_selector slot_selector]]
+
[def __filter__ [link signal_network.components.generic.filter filter]]
[def __applicator__ [link signal_network.components.generic.applicator applicator]]
[def __conditional__ [link signal_network.components.generic.conditional conditional]]
@@ -27,11 +33,7 @@
[def __fusion__ [@http://spirit.sourceforge.net/dl_more/fusion_v2/libs/fusion/doc/html/index.html Boost.Fusion]]
-[import ../test/test_filter.cpp]
-[import ../test/test_storage.cpp]
-[import ../test/test_function.cpp]
-[import ../test/test_chain.cpp]
-[import ../test/test_socket.cpp]
+[import ../test/test_connect.cpp]
[import ../test/test_branching.cpp]
[import ../test/test_pull.cpp]
[import ../test/test_disconnect.cpp]
@@ -40,6 +42,12 @@
[import ../test/test_same_type.cpp]
[import ../test/test_multi_out.cpp]
+[import ../test/test_filter.cpp]
+[import ../test/test_storage.cpp]
+[import ../test/test_function.cpp]
+[import ../test/test_chain.cpp]
+[import ../test/test_socket.cpp]
+
The Signal Network library aims to facilitate the
implementation and interconnection of objects into signal networks using Boost.Signals.
To see the rationale behind the Signal Network library, please visit the associated
@@ -119,34 +127,38 @@
Proposal for Boost / Google SoC version \[[@signal_network.zip download]\]
-* finished the signet::socket_sender and signet::socket_receiver components
+* finished the signals::socket_sender and signals::socket_receiver components
Draft proposal for Boost / Google SoC version
* changed the file and namespace structure
* implemented a file-iteration based mechanism for arity-dependent classes
* changed the operators used
-* signal_link is now signet::filter and does not need to know it's descendant's type
-* implemented signet::junction, signet::selector, signet::storage, signet::timed_generator,
- signet::mutex, signet::chain, signet::function classes
+* signal_link is now signals::filter and does not need to know it's descendant's type
+* implemented signals::junction, signals::selector, signals::storage, signals::timed_generator,
+ signals::mutex, signals::chain, signals::function classes
Original request for interest version available as attachment to
[@http://lists.boost.org/Archives/boost/2007/02/116869.php]
[endsect]
+[include support.qbk]
+
[include connections.qbk]
[include components.qbk]
+[include rationale.qbk]
+
[xinclude signal_network_doxygen.xml]
[section:acknowledgements Acknowledgements]
+* Thanks to Douglas Gregor for making himself available as a mentor for this project, and for his support, suggestions and feedback.
* Thanks to all the members of the Boost community who have expressed an interest in this library
and contributed [link signal_network.discussion valuable feedback].
-* Thanks to Douglas Gregor for making himself available as a mentor for this project, and for his support, suggestions and feedback.
-* Thanks to Tobias Schwinger for a most valuable discussion on various [link signal_network.introduction.dataflow
+* Thanks to Tobias Schwinger for a most valuable discussion on various [link signal_network.introduction.generic_dataflow
dataflow-oriented approaches and ideas].
[endsect]
Added: sandbox/SOC/2007/signals/libs/signal_network/doc/support.qbk
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/signal_network/doc/support.qbk 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -0,0 +1,25 @@
+[section The Support Layer]
+
+[section Support traits and function objects]
+
+There are a few things that must be defined in order for a class to function seamlessly as a component within the
+library.
+
+[variablelist Components that produce data must specialize:
+
+ [[boost::signals::is_component] [Boost.TypeTraits style trait - true for data-producing components.]]
+ [[boost::signals::get_signal_type] [Metafunction returning the underlying boost::signal type of the produced data
+ (currently, underlying signal signature). If the component is a class with a type `signal_type`, it is
+ already supported.]]
+ [[boost::signals::get_signal] [Function object returning a reference to the underlying signal.]]
+]
+
+[variablelist Components that consume data must specialize:
+
+ [[boost::signals::get_slot] [Function object returning a boost::function of the underlying slot.]]
+
+]
+
+[endsect]
+
+[endsect]
\ No newline at end of file
Modified: sandbox/SOC/2007/signals/libs/signal_network/example/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/signals/libs/signal_network/example/Jamfile.v2 (original)
+++ sandbox/SOC/2007/signals/libs/signal_network/example/Jamfile.v2 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -12,4 +12,4 @@
;
exe example : example.cpp ;
-exe timing_example : timing_example.cpp ;
+# exe timing_example : timing_example.cpp ;
Modified: sandbox/SOC/2007/signals/libs/signal_network/example/example.cpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/signal_network/example/example.cpp (original)
+++ sandbox/SOC/2007/signals/libs/signal_network/example/example.cpp 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -3,29 +3,83 @@
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#include <boost/signal_network/function.hpp>
-#include <boost/signal_network/storage.hpp>
+//#include <boost/signal_network/function.hpp>
+//#include <boost/signal_network/storage.hpp>
-// for access to connection operators >>= and |
-using namespace boost::signal_network;
-using namespace boost;
+#include <boost/fusion/sequence/container/map.hpp>
+#include <iostream>
-float DoublerFunc(float x)
+#include <boost/fusion/sequence/container/vector.hpp>
+#include <boost/fusion/sequence/view/transform_view.hpp>
+#include <boost/fusion/sequence/intrinsic.hpp>
+#include <boost/fusion/sequence/io.hpp>
+
+#include <boost/type_traits/add_reference.hpp>
+
+namespace fusion = boost::fusion;
+
+//using namespace boost;
+
+float DoublerFunc(float x)
{
return x*2;
}
+namespace dataflow
+{
+ template<typename X>
+ struct print;
+};
+
+namespace dataflow
+{
+ template<>
+ struct print<int>
+ {
+ void operator()(int x)
+ {
+ std::cout << x << std::endl;
+ }
+ };
+}
+
+namespace specific
+{
+ struct print : public dataflow::print<int> {};
+}
+
int main(int, char* [])
{
- signet::function<void (float), float(float)>::unfused double_fun1(&DoublerFunc);
- signet::function<void (float), float(float)>::unfused double_fun2(&DoublerFunc);
- signet::storage<void (float)>::unfused floater(1.0f);
- signet::storage<void (float)>::unfused collector(0.0f);
+ specific::print()(3);
+
+ /*
+ signals::storage<void (), signals::unfused> banger;
+ signals::function<void (float), float(float), signals::unfused> double_fun1(&DoublerFunc);
+ signals::function<void (float), float(float), signals::unfused> double_fun2(&DoublerFunc);
+ signals::storage<void (float), signals::unfused> floater(1.0f);
+ signals::storage<void (float), signals::unfused> collector(0.0f);*/
- floater >>= double_fun1 >>= double_fun2 >>= collector;
- floater();
+/* floater >>= double_fun1 >>= double_fun2 >>= collector;
+ floater.send();
assert(collector.at<0>() == 4.0f);
+ floater.disconnect_all_slots();*/
+
+/* banger >>= boost::fusion::at_key<void()> (floater.send_slot());
+ typedef
+ boost::fusion::map<
+ boost::fusion::pair<void(), slot_selector_t<signals::storage<void (float), signals::unfused>, void()> >,
+ boost::fusion::pair<void(const boost::fusion::vector<> &), slot_selector_t<signals::storage<void (float), signals::unfused>, void (const boost::fusion::vector<> &)> >
+ > map_type;
+
+ map_type m = floater.send_slot();
+
+// int x = default_slot<map_type, void()>()(m);
+ floater >>= collector;
+// banger.send();
+ floater.send();
+ assert(collector.at<0>() == 1.0f);*/
+
return 0;
} // int main(int, char* [])
\ No newline at end of file
Modified: sandbox/SOC/2007/signals/libs/signal_network/example/timing_example.cpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/signal_network/example/timing_example.cpp (original)
+++ sandbox/SOC/2007/signals/libs/signal_network/example/timing_example.cpp 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -5,6 +5,8 @@
#include <boost/signal_network/storage.hpp>
+#include <boost/fusion/sequence/generation/make_vector.hpp>
+
// for access to connection operators >>= and |
using namespace boost::signal_network;
using namespace boost;
@@ -21,38 +23,36 @@
std::vector<float> v(1);
// instantiate all of the components we need
- signet::storage<void ()>::unfused banger;
- signet::storage<void (std::vector<float> &)>::unfused floater;
- signet::storage<void (std::vector<float> &)>::unfused collector;
+ signals::storage<void (std::vector<float> &, std::vector<float>), signals::unfused> floater;
+ signals::storage<void (std::vector<float> &, std::vector<float>), signals::unfused> collector;
// create the network
- banger >>= floater >>= collector;
+ floater >>= collector;
start = clock();
for (int i=0; i<iter; i++)
{
v[0] = i;
- floater(v);
- banger();
+ floater(boost::fusion::make_vector(boost::ref(v), boost::ref(v)));
+ floater.send();
assert(collector.at<0>()[0] == i);
}
finish = clock();
std::cout << "unfused:" << double(finish - start) / CLOCKS_PER_SEC << std::endl;
- boost::fusion::vector<const std::vector<float> &> fv(v);
+ boost::fusion::vector<std::vector<float> &> fv(boost::fusion::make_vector(boost::ref(v), boost::ref(v)));
- signet::storage<void ()> fbanger;
- signet::storage<void (std::vector<float> &)> ffloater;
- signet::storage<void (std::vector<float> &)> fcollector;
+ signals::storage<void (std::vector<float> &)> ffloater;
+ signals::storage<void (std::vector<float> &)> fcollector;
- fbanger >>= ffloater >>= fcollector;
+ ffloater >>= fcollector;
start = clock();
for (int i=0; i<iter; i++)
{
v[0] = i;
ffloater(fv);
- fbanger();
+ ffloater.send();
assert(fcollector.at<0>()[0] == i);
}
finish = clock();
Modified: sandbox/SOC/2007/signals/libs/signal_network/test/test_branching.cpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/signal_network/test/test_branching.cpp (original)
+++ sandbox/SOC/2007/signals/libs/signal_network/test/test_branching.cpp 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -22,7 +22,7 @@
banger
// floater connects to collector, banger to floater.send_slot()
- | (floater >>= collector).send_slot()
+ | (floater.send_slot() >>= collector)
| counter; // and banger to counter
banger();
@@ -39,7 +39,7 @@
banger
// floater connects to collector, banger to floater.send_slot()
- | (floater >>= collector).send_slot()
+ | (floater.send_slot() >>= collector)
| counter; // and banger to counter
banger();
Modified: sandbox/SOC/2007/signals/libs/signal_network/test/test_chain.cpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/signal_network/test/test_chain.cpp (original)
+++ sandbox/SOC/2007/signals/libs/signal_network/test/test_chain.cpp 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -54,8 +54,8 @@
{
//[ test_chain_fused
signals::chain<void(float), FusedDoublerClass> doubling_chain(4, NULL);
- signals::storage<void (float)> floater(1.0f);
- signals::storage<void (float)> collector(0.0f);
+ signals::storage<void (float), signals::fused> floater(1.0f);
+ signals::storage<void (float), signals::fused> collector(0.0f);
floater >>= doubling_chain >>= collector;
floater.send();
Modified: sandbox/SOC/2007/signals/libs/signal_network/test/test_connect.cpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/signal_network/test/test_connect.cpp (original)
+++ sandbox/SOC/2007/signals/libs/signal_network/test/test_connect.cpp 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -23,14 +23,17 @@
int test_main(int, char* [])
{
- boost::signal<void(int)> signal;
+ //[ test_connect
+
+ boost::signal<void(int)> p;
receiver r;
- connect(signal, r);
+ connect(p, r);
- signal(3);
+ p(3);
BOOST_CHECK_EQUAL(r.stored, 3);
-
+
+ //]
return 0;
}
\ No newline at end of file
Modified: sandbox/SOC/2007/signals/libs/signal_network/test/test_filter.cpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/signal_network/test/test_filter.cpp (original)
+++ sandbox/SOC/2007/signals/libs/signal_network/test/test_filter.cpp 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -19,6 +19,7 @@
class DoublerClass : public signals::filter<void (float), signals::unfused>
{
public:
+ typedef signals::filter<void (float), signals::unfused>::signal_type signal_type;
template<typename FArgs>
struct result
{
Modified: sandbox/SOC/2007/signals/libs/signal_network/test/test_storage.cpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/signal_network/test/test_storage.cpp (original)
+++ sandbox/SOC/2007/signals/libs/signal_network/test/test_storage.cpp 2007-07-09 02:46:05 EDT (Mon, 09 Jul 2007)
@@ -6,8 +6,6 @@
#include <boost/signal_network/component/storage.hpp>
#include <boost/signal_network/connection.hpp>
-#include <boost/fusion/sequence/view/single_view.hpp>
-
#include <boost/test/included/test_exec_monitor.hpp>
using namespace boost;
@@ -21,14 +19,11 @@
signals::storage<void (float), signals::unfused> floater(2.5f);
signals::storage<void (float), signals::unfused> collector(0.0f);
- signals::get_slot<void(float), signals::storage<void (float), signals::unfused> >()(collector);
-
- // create the network
- banger >>= floater.send_slot();
- floater >>= collector;
+ // create the network (banger to floater.send, floater to collector)
+ banger >>= floater.send_slot() >>= collector;
// signal from banger causes floater to output 2.5
- banger.send();
+ banger();
BOOST_CHECK_EQUAL(floater.at<0>(), 2.5f);
BOOST_CHECK_EQUAL(collector.at<0>(), 2.5f);
@@ -41,20 +36,19 @@
{
//[ test_storage_fused
// instantiate all of the components we need
- signals::storage<void (), signals::unfused> banger;
+ signals::storage<void (), signals::fused> banger;
signals::storage<void (float), signals::fused> floater(2.5f);
signals::storage<void (float), signals::fused> collector(0.0f);
- // create the network
- banger >>= floater.send_slot();
- floater >>= collector;
+ // create the network (banger to floater.send, floater to collector)
+ banger >>= floater.send_slot() >>= collector;
// signal from banger causes floater to output 2.5
- banger.send();
+ banger();
BOOST_CHECK_EQUAL(collector.at<0>(), 2.5f);
// change the value in floater
- floater(boost::fusion::single_view<float>(1.5f));
+ floater(1.5f);
floater.send(); // we can also signal floater directly
BOOST_CHECK_EQUAL(collector.at<0>(), 1.5f);
//]
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