Boost logo

Boost-Commit :

From: srajko_at_[hidden]
Date: 2007-07-17 03:05:12


Author: srajko
Date: 2007-07-17 03:05:09 EDT (Tue, 17 Jul 2007)
New Revision: 7455
URL: http://svn.boost.org/trac/boost/changeset/7455

Log:
add generic dataflow layer, fibonacci example

Added:
   sandbox/SOC/2007/signals/boost/dataflow/
   sandbox/SOC/2007/signals/boost/dataflow/connection/
   sandbox/SOC/2007/signals/boost/dataflow/connection/group.hpp (contents, props changed)
   sandbox/SOC/2007/signals/boost/dataflow/connection/operator/
   sandbox/SOC/2007/signals/boost/dataflow/connection/operator/group.hpp (contents, props changed)
   sandbox/SOC/2007/signals/boost/dataflow/connection/operators.hpp (contents, props changed)
   sandbox/SOC/2007/signals/boost/dataflow/detail/
   sandbox/SOC/2007/signals/boost/dataflow/detail/enable_if_defined.hpp (contents, props changed)
   sandbox/SOC/2007/signals/boost/dataflow/detail/make_ref.hpp (contents, props changed)
   sandbox/SOC/2007/signals/boost/dataflow/phoenix/
   sandbox/SOC/2007/signals/boost/dataflow/phoenix/advance.hpp (contents, props changed)
   sandbox/SOC/2007/signals/boost/dataflow/phoenix/component/
   sandbox/SOC/2007/signals/boost/dataflow/phoenix/component/constant.hpp (contents, props changed)
   sandbox/SOC/2007/signals/boost/dataflow/phoenix/component/consumer.hpp (contents, props changed)
   sandbox/SOC/2007/signals/boost/dataflow/phoenix/component/producer.hpp (contents, props changed)
   sandbox/SOC/2007/signals/boost/dataflow/phoenix/component/producer_accumulator.hpp (contents, props changed)
   sandbox/SOC/2007/signals/boost/dataflow/phoenix/components.hpp (contents, props changed)
   sandbox/SOC/2007/signals/boost/dataflow/phoenix/connection/
   sandbox/SOC/2007/signals/boost/dataflow/phoenix/connection/iterator_relative.hpp (contents, props changed)
   sandbox/SOC/2007/signals/boost/dataflow/phoenix/sequence_environment.hpp (contents, props changed)
   sandbox/SOC/2007/signals/boost/dataflow/phoenix/static_function.hpp (contents, props changed)
   sandbox/SOC/2007/signals/boost/dataflow/phoenix/static_value.hpp (contents, props changed)
   sandbox/SOC/2007/signals/boost/dataflow/phoenix/support.hpp (contents, props changed)
   sandbox/SOC/2007/signals/boost/dataflow/support/
   sandbox/SOC/2007/signals/boost/dataflow/support.hpp (contents, props changed)
   sandbox/SOC/2007/signals/boost/dataflow/support/fusion_groups.hpp (contents, props changed)
   sandbox/SOC/2007/signals/libs/signal_network/example/fibonacci.cpp (contents, props changed)
Text files modified:
   sandbox/SOC/2007/signals/boost-build.jam | 1
   sandbox/SOC/2007/signals/libs/signal_network/build/xcodeide/signal_network.xcodeproj/project.pbxproj | 105 +++++++++++++++++++++++++++++++++++++++
   sandbox/SOC/2007/signals/libs/signal_network/example/Jamfile.v2 | 4 +
   3 files changed, 107 insertions(+), 3 deletions(-)

Modified: sandbox/SOC/2007/signals/boost-build.jam
==============================================================================
--- sandbox/SOC/2007/signals/boost-build.jam (original)
+++ sandbox/SOC/2007/signals/boost-build.jam 2007-07-17 03:05:09 EDT (Tue, 17 Jul 2007)
@@ -6,5 +6,4 @@
 # Set the BOOST_ROOT environment variable on your command-line or in the
 # environment to point at the root of your regular Boost installation.
 
-JAMFILE = [Jj]amfile.v2 ;
 boost-build $(BOOST_ROOT)/tools/build/v2 ;

Added: sandbox/SOC/2007/signals/boost/dataflow/connection/group.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/dataflow/connection/group.hpp 2007-07-17 03:05:09 EDT (Tue, 17 Jul 2007)
@@ -0,0 +1,114 @@
+// Copyright 2007 Stjepan Rajko.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_DATAFLOW_CONNECTION_GROUP_HPP
+#define BOOST_DATAFLOW_CONNECTION_GROUP_HPP
+
+#include <boost/dataflow/support.hpp>
+
+#include <boost/fusion/algorithm/iteration/for_each.hpp>
+#include <boost/fusion/sequence/container/vector.hpp>
+#include <boost/fusion/sequence/generation/vector_tie.hpp>
+#include <boost/fusion/sequence/view/zip_view.hpp>
+#include <boost/fusion/support/is_sequence.hpp>
+#include <boost/utility/result_of.hpp>
+
+namespace boost { namespace dataflow {
+
+struct fusion_group_producer;
+
+template<class T>
+struct producer_group : public T
+{
+ producer_group(const T& t) : T(t) {}
+ typedef fusion_group_producer producer_category;
+};
+
+namespace result_of
+{
+ template<typename T1, typename T2>
+ struct group
+ {
+ typedef producer_group<
+ typename boost::fusion::result_of::vector_tie<T1,T2>::type> type;
+ };
+}
+
+template<typename T1, typename T2> inline
+typename result_of::group<T1,T2>::type
+group(T1 &t1, T2 &t2)
+{
+ return typename result_of::group<T1,T2>::type
+ (boost::fusion::vector_tie(t1, t2));
+} // need to specialize group for T1 or T2 being groups already.
+
+struct fusion_group_consumer;
+
+template <typename Sequence>
+struct consumer_category_of<Sequence,
+ typename boost::enable_if<
+ boost::fusion::traits::is_sequence<Sequence> >::type >
+{
+ typedef fusion_group_consumer type;
+};
+
+
+namespace extension
+{
+ namespace detail
+ {
+ struct zip_connect
+ {
+ template<typename T>
+ void operator()(T& t) const
+ {
+ dataflow::connect(boost::fusion::at_c<0>(t),
+ boost::fusion::at_c<1>(t));
+ }
+ template<typename T>
+ void operator()(const T& t) const
+ {
+ dataflow::connect(boost::fusion::at_c<0>(t),
+ boost::fusion::at_c<1>(t));
+ }
+ };
+ }
+
+ template<typename ProducerTag, typename ConsumerTag>
+ struct connect_impl<ProducerTag, ConsumerTag,
+ typename boost::enable_if<boost::mpl::and_<
+ boost::is_base_of<fusion_group_producer, ProducerTag>,
+ boost::is_base_of<fusion_group_consumer, ConsumerTag>
+ > >::type >
+ {
+ template<typename Producer, typename Consumer>
+ struct apply
+ {
+ static void call(const Producer &producer, const Consumer &consumer)
+ {
+ typedef boost::fusion::vector<const Producer&, const Consumer&>
+ zip_type;
+ boost::fusion::zip_view<zip_type>
+ zip(zip_type(producer, consumer));
+ boost::fusion::for_each(zip, detail::zip_connect());
+ }
+ static void call(const Producer &producer, Consumer &consumer)
+ {
+ typedef boost::fusion::vector<const Producer&, Consumer&>
+ zip_type;
+ boost::fusion::zip_view<zip_type>
+ zip(zip_type(producer, consumer));
+ boost::fusion::for_each(zip, detail::zip_connect());
+ }
+ };
+ };
+
+}
+
+} } // namespace boost::dataflow
+
+#endif // BOOST_DATAFLOW_CONNECTION_GROUP_HPP
+
+

Added: sandbox/SOC/2007/signals/boost/dataflow/connection/operator/group.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/dataflow/connection/operator/group.hpp 2007-07-17 03:05:09 EDT (Tue, 17 Jul 2007)
@@ -0,0 +1,26 @@
+// 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 BOOST_DATAFLOW_CONNECTION_OPERATOR_GROUP_HPP
+#define BOOST_DATAFLOW_CONNECTION_OPERATOR_GROUP_HPP
+
+#include <boost/dataflow/connection/group.hpp>
+#include <boost/utility/result_of.hpp>
+
+namespace boost { namespace dataflow {
+
+namespace operators {
+
+ template<typename T1, typename T2>
+ typename boost::dataflow::result_of::group<T1,T2>::type
+ operator & (T1 &t1, T2 &t2)
+ { return boost::dataflow::group(t1, t2); }
+
+} // namespace operators
+
+} } // namespace boost::dataflow
+
+#endif // BOOST_DATAFLOW_CONNECTION_OPERATORS_HPP
+

Added: sandbox/SOC/2007/signals/boost/dataflow/connection/operators.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/dataflow/connection/operators.hpp 2007-07-17 03:05:09 EDT (Tue, 17 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 BOOST_DATAFLOW_CONNECTION_OPERATORS_HPP
+#define BOOST_DATAFLOW_CONNECTION_OPERATORS_HPP
+
+#include <boost/dataflow/connection/operator/group.hpp>
+
+namespace boost { namespace dataflow {
+
+namespace operators {
+
+ /// 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 components.
+ */
+ template<typename Input, typename Output>
+ typename boost::enable_if<dataflow::is_producer<Input>, Input & >::type
+ operator >>= (Input &input, Output &output)
+ { connect(input, output); return input;}
+
+ template<typename Input, typename Output>
+ typename boost::enable_if<dataflow::is_producer<Input>, Input & >::type
+ operator >>= (Input &input, const Output &output)
+ { connect(input, output); return input;}
+
+ template<typename Input, typename Output>
+ typename boost::enable_if<dataflow::is_producer<Input>, const Input & >::type
+ operator >>= (const Input &input, Output &output)
+ { connect(input, output); return input;}
+
+ template<typename Input, typename Output>
+ typename boost::enable_if<dataflow::is_producer<Input>, const Input & >::type
+ operator >>= (const Input &input, const Output &output)
+ { connect(input, output); return input;}
+
+ /// 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.
+ */
+ template<typename Input, typename Output>
+ typename boost::enable_if<dataflow::is_producer<Input>, Input & >::type
+ operator | (Input &input, Output &output)
+ { connect(input, output); return input;}
+
+ template<typename Input, typename Output>
+ typename boost::enable_if<dataflow::is_producer<Input>, Input & >::type
+ operator | (Input &input, const Output &output)
+ { connect(input, output); return input;}
+
+ template<typename Input, typename Output>
+ typename boost::enable_if<dataflow::is_producer<Input>, const Input & >::type
+ operator | (const Input &input, Output &output)
+ { connect(input, output); return input;}
+
+ template<typename Input, typename Output>
+ typename boost::enable_if<dataflow::is_producer<Input>, const Input & >::type
+ operator | (const Input &input, const Output &output)
+ { connect(input, output); return input;}
+
+} // namespace operators
+
+} } // namespace boost::dataflow
+
+#endif // BOOST_DATAFLOW_CONNECTION_OPERATORS_HPP
+

Added: sandbox/SOC/2007/signals/boost/dataflow/detail/enable_if_defined.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/dataflow/detail/enable_if_defined.hpp 2007-07-17 03:05:09 EDT (Tue, 17 Jul 2007)
@@ -0,0 +1,25 @@
+// 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 DATAFLOW_DETAIL_ENABLE_IF_DEFINED_HPP
+#define DATAFLOW_DETAIL_ENABLE_IF_DEFINED_HPP
+
+#include <boost/type_traits/integral_constant.hpp>
+#include <boost/utility/enable_if.hpp>
+
+namespace boost { namespace dataflow {
+
+namespace detail
+{
+ template<typename T, typename Result=void>
+ struct enable_if_defined
+ {
+ typedef Result type;
+ };
+}
+
+} } // namespace boost::dataflow
+
+#endif // DATAFLOW_DETAIL_ENABLE_IF_DEFINED_HPP

Added: sandbox/SOC/2007/signals/boost/dataflow/detail/make_ref.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/dataflow/detail/make_ref.hpp 2007-07-17 03:05:09 EDT (Tue, 17 Jul 2007)
@@ -0,0 +1,37 @@
+// Copyright 2007 Stjepan Rajko.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_DATAFLOW_DETAIL_MAKE_REF_HPP
+#define BOOST_DATAFLOW_DETAIL_MAKE_REF_HPP
+
+#include <boost/type_traits/add_reference.hpp>
+
+namespace boost { namespace dataflow {
+
+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;
+ }
+ };
+
+} // namespace detail
+
+} } // namespace boost::dataflow
+
+#endif // BOOST_DATAFLOW_DETAIL_MAKE_REF_HPP

Added: sandbox/SOC/2007/signals/boost/dataflow/phoenix/advance.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/dataflow/phoenix/advance.hpp 2007-07-17 03:05:09 EDT (Tue, 17 Jul 2007)
@@ -0,0 +1,55 @@
+// 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 BOOST_DATAFLOW_PHOENIX_ADVANCE_HPP
+#define BOOST_DATAFLOW_PHOENIX_ADVANCE_HPP
+
+#include <boost/spirit/phoenix/function/function.hpp>
+
+#include <iterator>
+
+namespace boost { namespace phoenix {
+
+ namespace impl
+{
+ struct advance
+{
+ template<class InputIterator, class Distance>
+ struct result
+{
+ typedef InputIterator& type;
+};
+
+template<class InputIterator, class Distance>
+InputIterator operator()(InputIterator& i, Distance n) const
+{
+ return std::advance(i, n);
+}
+};
+
+template<int N>
+struct copy_advance_c
+{
+ template<class InputIterator>
+ struct result
+ {
+ typedef InputIterator type;
+ };
+
+ template<class InputIterator>
+ InputIterator operator()(InputIterator i) const
+ {
+ std::advance(i, N);
+ return i;
+ }
+};
+
+}
+
+function<impl::advance> advance = impl::advance();
+
+} } // namespace boost::phoenix
+
+#endif // BOOST_DATAFLOW_PHOENIX_ADVANCE_HPP
\ No newline at end of file

Added: sandbox/SOC/2007/signals/boost/dataflow/phoenix/component/constant.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/dataflow/phoenix/component/constant.hpp 2007-07-17 03:05:09 EDT (Tue, 17 Jul 2007)
@@ -0,0 +1,33 @@
+// Copyright 2007 Stjepan Rajko.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_DATAFLOW_PHOENIX_COMPONENT_CONSTANT_HPP
+#define BOOST_DATAFLOW_PHOENIX_COMPONENT_CONSTANT_HPP
+
+#include <boost/spirit/phoenix/core/actor.hpp>
+
+namespace boost { namespace phoenix {
+
+template <int N>
+struct constant
+{
+ typedef mpl::false_ no_nullary;
+
+ template <typename Env>
+ struct result
+ {
+ typedef int type;
+ };
+
+ template <typename Env>
+ int eval(Env const&) const
+ {
+ return N;
+ }
+};
+
+} } // namespace boost::phoenix
+
+#endif // BOOST_DATAFLOW_PHOENIX_COMPONENT_CONSTANT_HPP
\ No newline at end of file

Added: sandbox/SOC/2007/signals/boost/dataflow/phoenix/component/consumer.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/dataflow/phoenix/component/consumer.hpp 2007-07-17 03:05:09 EDT (Tue, 17 Jul 2007)
@@ -0,0 +1,52 @@
+// Copyright 2007 Stjepan Rajko.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_DATAFLOW_PHOENIX_COMPONENT_CONSUMER_HPP
+#define BOOST_DATAFLOW_PHOENIX_COMPONENT_CONSUMER_HPP
+
+#include <boost/utility/result_of.hpp>
+#include <boost/fusion/sequence/container/vector.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/spirit/phoenix/core/actor.hpp>
+
+namespace boost { namespace phoenix {
+
+ template <typename T>
+ struct consumer
+ {
+ typedef boost::dataflow::phoenix_consumer consumer_category;
+
+ typedef mpl::false_ no_nullary;
+
+ template <typename Env>
+ struct result
+ {
+ typedef const T& type;
+ };
+
+ consumer(T& arg)
+ : ptr(&arg) {}
+ consumer()
+ : ptr(NULL) {}
+
+ template <typename Env>
+ const T& eval(Env const&) const
+ {
+ return *ptr;
+ }
+
+ mutable const T *ptr;
+ };
+
+ template <typename T>
+ inline boost::phoenix::actor<consumer<T> > const
+ make_consumer(T& v)
+ {
+ return consumer<T>(v);
+ }
+
+} } // namespace boost::phoenix
+
+#endif // BOOST_DATAFLOW_PHOENIX_COMPONENT_CONSUMER_HPP

Added: sandbox/SOC/2007/signals/boost/dataflow/phoenix/component/producer.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/dataflow/phoenix/component/producer.hpp 2007-07-17 03:05:09 EDT (Tue, 17 Jul 2007)
@@ -0,0 +1,56 @@
+// Copyright 2007 Stjepan Rajko.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_DATAFLOW_PHOENIX_COMPONENT_PRODUCER_HPP
+#define BOOST_DATAFLOW_PHOENIX_COMPONENT_PRODUCER_HPP
+
+#include <boost/dataflow/phoenix/support.hpp>
+
+namespace boost { namespace phoenix {
+
+ template<typename T, typename Function>
+ class producer : public Function
+ {
+ public:
+ typedef boost::dataflow::phoenix_producer producer_category;
+ typedef T produced_type;
+
+ producer(const Function &f) : Function(f) {}
+ producer() {}
+
+ void operator()()
+ {
+ value = Function::operator()();
+ }
+
+ T value;
+ };
+
+ template<typename T, typename Function>
+ class producer2
+ {
+ public:
+ typedef boost::dataflow::phoenix_producer producer_category;
+ typedef T produced_type;
+
+ void operator()()
+ {
+ value = Function()();
+ }
+
+ template<typename T1>
+ void operator()(T1 &t1)
+ {
+ value = Function()(t1);
+ }
+
+ T value;
+
+ operator T&(){return value;}
+ };
+
+} } // namespace boost::phoenix
+
+#endif // BOOST_DATAFLOW_PHOENIX_COMPONENT_PRODUCER_HPP

Added: sandbox/SOC/2007/signals/boost/dataflow/phoenix/component/producer_accumulator.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/dataflow/phoenix/component/producer_accumulator.hpp 2007-07-17 03:05:09 EDT (Tue, 17 Jul 2007)
@@ -0,0 +1,63 @@
+// Copyright 2007 Stjepan Rajko.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_DATAFLOW_PHOENIX_COMPONENT_PRODUCER_ACCUMULATOR_HPP
+#define BOOST_DATAFLOW_PHOENIX_COMPONENT_PRODUCER_ACCUMULATOR_HPP
+
+#include <boost/fusion/algorithm/iteration/accumulate.hpp>
+
+#include <functional>
+
+namespace boost { namespace phoenix {
+
+namespace detail {
+
+ template<typename Op>
+ struct function_op : public Op
+ {
+ template<typename Function>
+ typename Op::result_type
+ operator()(Function f, typename Op::second_argument_type operand)
+ {
+ return Op::operator()(f(), operand);
+ }
+ };
+
+}
+
+namespace extension
+{
+ template<typename T>
+ struct identity_element;
+
+ template<typename T>
+ struct identity_element<std::plus<T> >
+ {
+ typedef T type;
+ T operator()()
+ {
+ return 0;
+ }
+ };
+}
+
+template<typename AccumulateOp, typename Operations>
+class producer_accumulator : public Operations // should be a fusion sequence
+{
+public:
+ producer_accumulator(const Operations &op) : Operations(op) {}
+ producer_accumulator() {}
+
+ typename extension::identity_element<AccumulateOp>::type operator()()
+ {
+ return boost::fusion::accumulate(*this,
+ extension::identity_element<AccumulateOp>()(),
+ detail::function_op<AccumulateOp>());
+ }
+};
+
+} } // namespace boost::phoenix
+
+#endif // BOOST_DATAFLOW_PHOENIX_COMPONENT_PRODUCER_ACCUMULATOR_HPP

Added: sandbox/SOC/2007/signals/boost/dataflow/phoenix/components.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/dataflow/phoenix/components.hpp 2007-07-17 03:05:09 EDT (Tue, 17 Jul 2007)
@@ -0,0 +1,13 @@
+// Copyright 2007 Stjepan Rajko.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_DATAFLOW_PHOENIX_COMPONENTS_HPP
+#define BOOST_DATAFLOW_PHOENIX_COMPONENTS_HPP
+
+#include <boost/dataflow/phoenix/component/producer.hpp>
+#include <boost/dataflow/phoenix/component/consumer.hpp>
+#include <boost/dataflow/phoenix/component/producer_accumulator.hpp>
+
+#endif // BOOST_DATAFLOW_PHOENIX_COMPONENTS_HPP

Added: sandbox/SOC/2007/signals/boost/dataflow/phoenix/connection/iterator_relative.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/dataflow/phoenix/connection/iterator_relative.hpp 2007-07-17 03:05:09 EDT (Tue, 17 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 BOOST_DATAFLOW_PHOENIX_CONNECTION_ITERATOR_RELATIVE_HPP
+#define BOOST_DATAFLOW_PHOENIX_CONNECTION_ITERATOR_RELATIVE_HPP
+
+#include <boost/dataflow/phoenix/static_value.hpp>
+
+#include <boost/mpl/int.hpp>
+#include <boost/spirit/phoenix/core/argument.hpp>
+#include <boost/spirit/phoenix/operator/arithmetic.hpp>
+#include <boost/spirit/phoenix/operator/self.hpp>
+#include <boost/typeof/typeof.hpp>
+
+namespace boost { namespace phoenix {
+
+namespace iterator_relative
+{
+// function<boost::phoenix::impl::copy_advance_c<-1> > prev;
+// function<boost::phoenix::impl::copy_advance_c<-2> > prev2;
+ BOOST_TYPEOF(*(boost::phoenix::arg_names::arg1-
+ boost::phoenix::actor<boost::phoenix::static_value<boost::mpl::int_<2> > >())) const prev2;
+ BOOST_TYPEOF(*(boost::phoenix::arg_names::arg1-
+ boost::phoenix::actor<boost::phoenix::static_value<boost::mpl::int_<2> > >())) const prev1;
+}
+
+} } // namespace boost::phoenix
+
+#endif // BOOST_DATAFLOW_PHOENIX_CONNECTION_ITERATOR_RELATIVE_HPP
\ No newline at end of file

Added: sandbox/SOC/2007/signals/boost/dataflow/phoenix/sequence_environment.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/dataflow/phoenix/sequence_environment.hpp 2007-07-17 03:05:09 EDT (Tue, 17 Jul 2007)
@@ -0,0 +1,46 @@
+// Copyright 2007 Stjepan Rajko.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_DATAFLOW_PHOENIX_SEQUENCE_ENVIRONMENT_HPP
+#define BOOST_DATAFLOW_PHOENIX_SEQUENCE_ENVIRONMENT_HPP
+
+#include <boost/dataflow/detail/make_ref.hpp>
+
+#include <boost/fusion/sequence/view/transform_view.hpp>
+
+namespace boost { namespace phoenix {
+
+namespace detail {
+
+ template<class Sequence>
+ class environment_wrapper : public Sequence
+ {
+ public:
+ typedef typename Sequence::types args_type;
+ typedef boost::fusion::transform_view<const Sequence
+ , boost::dataflow::detail::make_ref> tie_type;
+
+ tie_type args() const
+ {
+ return tie_type(*this, boost::dataflow::detail::make_ref());
+ }
+ };
+
+} // namespace detail
+
+template<typename Sequence, typename Op>
+class sequence_environment : public detail::environment_wrapper<
+Sequence >
+{
+public:
+ double operator()()
+ {
+ return Op().eval(*this);
+ }
+};
+
+} } // namespace boost::phoenix
+
+#endif // BOOST_DATAFLOW_DETAIL_MAKE_REF_HPP

Added: sandbox/SOC/2007/signals/boost/dataflow/phoenix/static_function.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/dataflow/phoenix/static_function.hpp 2007-07-17 03:05:09 EDT (Tue, 17 Jul 2007)
@@ -0,0 +1,45 @@
+// Copyright 2007 Stjepan Rajko.
+// Copyright (c) 2001-2007 Joel de Guzman
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_DATAFLOW_PHOENIX_STATIC_FUNCTION_HPP
+#define BOOST_DATAFLOW_PHOENIX_STATIC_FUNCTION_HPP
+
+#include <boost/dataflow/phoenix/static_value.hpp>
+
+#include <boost/spirit/phoenix/core/compose.hpp>
+#include <boost/spirit/phoenix/core/detail/function_eval.hpp>
+
+namespace boost { namespace phoenix
+{
+ template <typename F>
+ struct static_function
+ {
+ actor<typename as_composite<detail::function_eval<0>, actor<static_value<F> > >::type>
+ operator()() const
+ {
+ return compose<detail::function_eval<0> >(actor<static_value<F> >());
+ }
+
+ template <typename A0>
+ actor<typename as_composite<detail::function_eval<1>, actor<static_value<F> >, A0>::type>
+ operator()(A0 const& _0) const
+ {
+ return compose<detail::function_eval<1> >(actor<static_value<F> >(), _0);
+ }
+
+ template <typename A0, typename A1>
+ actor<typename as_composite<detail::function_eval<2>, actor<static_value<F> >, A0, A1>::type>
+ operator()(A0 const& _0, A1 const& _1) const
+ {
+ return compose<detail::function_eval<2> >(actor<static_value<F> >(), _0, _1);
+ }
+
+// // Bring in the rest of the function call operators - not implemented
+// #include <boost/spirit/phoenix/function/detail/static_function_call.hpp>
+ };
+}}
+
+#endif
\ No newline at end of file

Added: sandbox/SOC/2007/signals/boost/dataflow/phoenix/static_value.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/dataflow/phoenix/static_value.hpp 2007-07-17 03:05:09 EDT (Tue, 17 Jul 2007)
@@ -0,0 +1,34 @@
+// Copyright 2007 Stjepan Rajko.
+// Copyright (c) 2001-2007 Joel de Guzman
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_DATAFLOW_PHOENIX_STATIC_VALUE_HPP
+#define BOOST_DATAFLOW_PHOENIX_STATIC_VALUE_HPP
+
+#include <boost/spirit/phoenix/core/actor.hpp>
+
+namespace boost { namespace phoenix {
+
+template <typename T>
+struct static_value
+{
+ typedef mpl::false_ no_nullary;
+
+ template <typename Env>
+ struct result
+ {
+ typedef T type;
+ };
+
+ template <typename Env>
+ T eval(Env const&) const
+ {
+ return T();
+ }
+};
+
+} } // namespace boost::phoenix
+
+#endif // BOOST_DATAFLOW_PHOENIX_STATIC_VALUE_HPP
\ No newline at end of file

Added: sandbox/SOC/2007/signals/boost/dataflow/phoenix/support.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/dataflow/phoenix/support.hpp 2007-07-17 03:05:09 EDT (Tue, 17 Jul 2007)
@@ -0,0 +1,122 @@
+// Copyright 2007 Stjepan Rajko.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_DATAFLOW_PHOENIX_SUPPORT_HPP
+#define BOOST_DATAFLOW_PHOENIX_SUPPORT_HPP
+
+#include <boost/dataflow/support.hpp>
+
+#include <boost/mpl/and.hpp>
+#include <boost/type_traits/is_base_of.hpp>
+
+namespace boost { namespace dataflow {
+
+namespace mechanism
+{
+ struct phoenix;
+}
+
+struct phoenix_producer {};
+struct phoenix_consumer {};
+
+struct ptr_consumer : public phoenix_consumer {};
+
+template <typename T>
+struct consumer_category_of<T *>
+{
+ typedef ptr_consumer type;
+};
+
+template <typename T>
+struct consumer_category_of<T * const>
+{
+ typedef ptr_consumer type;
+};
+
+namespace extension
+{
+ // phoenix specific extensions
+ namespace phoenix
+ {
+ template<typename ConsumerTag>
+ struct set_address
+ {
+ template<typename Consumer>
+ struct apply
+ {
+ template<typename T>
+ static void call(const Consumer &consumer, T *ptr)
+ {
+ consumer.ptr = ptr;
+ }
+ };
+ };
+
+ template<>
+ struct set_address<boost::dataflow::ptr_consumer>
+ {
+ template<typename Consumer>
+ struct apply
+ {
+ template<typename T>
+ static void call(Consumer &consumer, T *ptr)
+ {
+ consumer = ptr;
+ }
+ };
+ };
+
+ template<typename ProducerTag>
+ struct get_address
+ {
+ template<typename Producer>
+ struct apply
+ {
+ static const typename produced_type_of<Producer>::type *
+ call(const Producer &producer)
+ {
+ return &producer.value;
+ }
+ };
+ };
+ }
+
+ template<typename ProducerTag, typename ConsumerTag>
+ struct connect_impl<ProducerTag, ConsumerTag,
+ typename boost::enable_if<boost::mpl::and_<
+ boost::is_base_of<phoenix_producer, ProducerTag>,
+ boost::is_base_of<phoenix_consumer, ConsumerTag>
+ > >::type >
+ {
+ template<typename Producer, typename Consumer>
+ struct apply
+ {
+ static void call(const Producer &producer, const Consumer &consumer)
+ {
+ phoenix::set_address<ConsumerTag>::template apply<Consumer>
+ ::call(consumer,
+ phoenix::template get_address<ProducerTag>
+ ::template apply<Producer>::call(producer));
+ }
+ static void call(const Producer &producer, Consumer &consumer)
+ {
+ phoenix::set_address<ConsumerTag>::template apply<Consumer>
+ ::call(consumer,
+ phoenix::template get_address<ProducerTag>
+ ::template apply<Producer>::call(producer));
+ }
+ };
+ };
+}
+
+} } // namespace boost::dataflow
+
+namespace boost { namespace phoenix {
+
+ using boost::dataflow::connect;
+
+} } // namespace boost::phoenix
+
+#endif // BOOST_DATAFLOW_SUPPORT_HPP

Added: sandbox/SOC/2007/signals/boost/dataflow/support.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/dataflow/support.hpp 2007-07-17 03:05:09 EDT (Tue, 17 Jul 2007)
@@ -0,0 +1,122 @@
+// Copyright 2007 Stjepan Rajko.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_DATAFLOW_SUPPORT_HPP
+#define BOOST_DATAFLOW_SUPPORT_HPP
+
+#include <boost/type_traits/integral_constant.hpp>
+#include <boost/mpl/has_xxx.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/dataflow/detail/enable_if_defined.hpp>
+
+namespace boost { namespace dataflow {
+
+namespace detail
+{
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(producer_category)
+
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(consumer_category)
+
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(produced_type)
+}
+
+// contains mechanism tags
+namespace mechanism
+{
+
+}
+
+// returns the underlying mechanism associated with a type.
+template<typename T>
+struct mechanism_of;
+
+// trait giving the producer category of a type.
+template<typename T, typename Enable=void>
+struct producer_category_of;
+
+template<typename T>
+struct producer_category_of<T,
+typename boost::enable_if<detail::has_producer_category<T> >::type >
+{
+ typedef typename T::producer_category type;
+};
+
+// trait giving the consumer category of a type.
+template<typename T, typename Enable=void>
+struct consumer_category_of;
+
+template<typename T>
+struct consumer_category_of<T,
+typename boost::enable_if<detail::has_consumer_category<T> >::type >
+{
+ typedef typename T::consumer_category type;
+};
+
+// trait determining whether a type is a producer.
+template<typename T, typename Enable=void>
+struct is_producer
+ : public boost::false_type {};
+
+template<typename T>
+struct is_producer<T,
+ typename detail::enable_if_defined<producer_category_of<T> >::type >
+ : public boost::true_type {};
+
+// trait determining whether a type is a consumer.
+template<typename T, typename Enable=void>
+struct is_consumer
+ : public boost::false_type {};
+
+template<typename T>
+struct is_consumer<T,
+ typename detail::enable_if_defined<consumer_category_of<T> >::type >
+ : public boost::true_type {};
+
+template<typename T, typename Enable=void>
+struct produced_type_of;
+
+template<typename T>
+struct produced_type_of<T,
+typename boost::enable_if<detail::has_produced_type<T> >::type >
+{
+ typedef typename T::produced_type type;
+};
+
+namespace extension
+{
+ template<typename ProducerTag, typename ConsumerTag, typename Enable=void>
+ struct connect_impl
+ {
+ template<typename Producer, typename Consumer>
+ struct apply
+ {
+
+ };
+ };
+}
+
+template<typename Producer, typename Consumer>
+inline void connect(Producer &producer, Consumer &consumer)
+{
+ extension::connect_impl<
+ typename producer_category_of<Producer>::type,
+ typename consumer_category_of<Consumer>::type>
+ ::template apply<Producer,Consumer>
+ ::call(producer,consumer);
+}
+
+template<typename Producer, typename Consumer>
+inline void connect(const Producer &producer, Consumer &consumer)
+{
+ extension::connect_impl<
+ typename producer_category_of<Producer>::type,
+ typename consumer_category_of<Consumer>::type>
+ ::template apply<Producer,Consumer>
+ ::call(producer,consumer);
+}
+
+} } // namespace boost::dataflow
+
+#endif // BOOST_DATAFLOW_SUPPORT_HPP

Added: sandbox/SOC/2007/signals/boost/dataflow/support/fusion_groups.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/dataflow/support/fusion_groups.hpp 2007-07-17 03:05:09 EDT (Tue, 17 Jul 2007)
@@ -0,0 +1,88 @@
+// Copyright 2007 Stjepan Rajko.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_DATAFLOW_SUPPORT_FUSION_GROUPS_HPP
+#define BOOST_DATAFLOW_SUPPORT_FUSION_GROUPS_HPP
+
+#include <boost/fusion/algorithm/iteration/for_each.hpp>
+#include <boost/fusion/sequence/container/vector.hpp>
+#include <boost/fusion/sequence/generation/vector_tie.hpp>
+#include <boost/fusion/sequence/view/joint_view.hpp>
+#include <boost/fusion/sequence/view/zip_view.hpp>
+#include <boost/fusion/support/is_sequence.hpp>
+
+namespace boost { namespace dataflow {
+
+struct fusion_group_producer;
+
+template<class T>
+struct producer_group : public T
+{
+ fusion_producer_group(const T& t) : T(t) {}
+ typedef fusion_group_producer producer_category;
+};
+
+template<typename T1, typename T2> inline
+producer_group<typename boost::fusion::result_of::vector_tie<T1,T2>::type>
+group(T1 &t1, T2 &t2)
+{
+ return fusion_group<
+ typename boost::fusion::result_of::vector_tie<T1,T2>::type>
+ (boost::fusion::vector_tie(t1, t2));
+} // need to specialize make_group for T1 or T2 being groups already.
+
+struct fusion_group_consumer;
+
+template <typename Sequence>
+struct consumer_category_of<Sequence,
+ typename boost::enable_if<
+ boost::fusion::traits::is_sequence<Sequence> >::type >
+{
+ typedef fusion_group_consumer type;
+};
+
+
+namespace extension
+{
+ namespace detail
+ {
+ struct zip_connect
+ {
+ template<typename T>
+ void operator()(const T& t) const
+ {
+ dataflow::connect(boost::fusion::at_c<0>(t),
+ boost::fusion::at_c<1>(t));
+ }
+ };
+ }
+
+ template<typename ProducerTag, typename ConsumerTag>
+ struct connect_impl<ProducerTag, ConsumerTag,
+ typename boost::enable_if<boost::mpl::and_<
+ boost::is_base_of<fusion_group_producer, ProducerTag>,
+ boost::is_base_of<fusion_group_consumer, ConsumerTag>
+ > >::type >
+ {
+ template<typename Producer, typename Consumer>
+ struct apply
+ {
+ static void call(const Producer &producer, const Consumer &consumer)
+ {
+ typedef boost::fusion::vector<const Producer&, const Consumer&> zip_type;
+ boost::fusion::zip_view<zip_type>
+ zip(zip_type(producer, consumer));
+ boost::fusion::for_each(zip, detail::zip_connect());
+ }
+ };
+ };
+
+}
+
+} } // namespace boost::dataflow
+
+#endif // BOOST_DATAFLOW_SUPPORT_FUSION_GROUPS_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-17 03:05:09 EDT (Tue, 17 Jul 2007)
@@ -119,10 +119,23 @@
                 08EFEC960C1CC6F200097C80 /* conditional_modifier.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = conditional_modifier.hpp; sourceTree = "<group>"; };
                 08EFECA40C1CCE8300097C80 /* storable.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = storable.hpp; sourceTree = "<group>"; };
                 08EFED440C1CD55100097C80 /* timing_example.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = timing_example.cpp; sourceTree = "<group>"; };
+ 08F01F970C470EB700C0ED27 /* support.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = support.hpp; sourceTree = "<group>"; };
+ 08F01FA30C47132000C0ED27 /* support.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = support.hpp; sourceTree = "<group>"; };
+ 08F0216B0C473AF000C0ED27 /* enable_if_defined.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = enable_if_defined.hpp; sourceTree = "<group>"; };
+ 08F022C20C47556200C0ED27 /* group.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = group.hpp; sourceTree = "<group>"; };
+ 08F022C70C47565600C0ED27 /* operators.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = operators.hpp; sourceTree = "<group>"; };
                 08F082020C1D591000687E1B /* introduction.qbk */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = introduction.qbk; sourceTree = "<group>"; };
                 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>"; };
+ 08F22ECE0C4BF6130027D364 /* make_ref.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = make_ref.hpp; sourceTree = "<group>"; };
+ 08F22ED60C4BF78B0027D364 /* sequence_environment.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = sequence_environment.hpp; sourceTree = "<group>"; };
+ 08F22F1C0C4C1CE50027D364 /* iterator_relative.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = iterator_relative.hpp; sourceTree = "<group>"; };
+ 08F22FB40C4C83900027D364 /* constant.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = constant.hpp; sourceTree = "<group>"; };
+ 08F22FD70C4C87C50027D364 /* static_value.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = static_value.hpp; sourceTree = "<group>"; };
+ 08F230020C4C894E0027D364 /* advance.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = advance.hpp; sourceTree = "<group>"; };
+ 08F230430C4C8D810027D364 /* static_function.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = static_function.hpp; sourceTree = "<group>"; };
+ 08F348510C492B4B0096097F /* group.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = group.hpp; 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>"; };
@@ -137,8 +150,14 @@
                 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>"; };
+ 08F9459A0C46A86E00E224E4 /* components.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = components.hpp; sourceTree = "<group>"; };
+ 08F9462E0C46C2F000E224E4 /* fibonacci.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fibonacci.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>"; };
+ 08FC25DB0C45D0F700F59CDD /* producer.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = producer.hpp; sourceTree = "<group>"; };
+ 08FC25DF0C45D18700F59CDD /* consumer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = consumer.hpp; sourceTree = "<group>"; };
+ 08FC25FC0C45E77B00F59CDD /* producer_accumulator.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = producer_accumulator.hpp; sourceTree = "<group>"; };
+ 08FC26060C46049400F59CDD /* edit_distance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = edit_distance.cpp; 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>"; };
@@ -153,6 +172,7 @@
                 080DD7560C13908400EEB53D = {
                         isa = PBXGroup;
                         children = (
+ 08FC25BA0C45B60E00F59CDD /* dataflow */,
                                 08FD5DE40C1BA60700F00877 /* doc */,
                                 08668C4D0C19A16300ACB19A /* example */,
                                 08C675960C13A03E00D85379 /* test */,
@@ -187,6 +207,8 @@
                                 08668C4E0C19A16300ACB19A /* example.cpp */,
                                 08668C4F0C19A16300ACB19A /* Jamfile.v2 */,
                                 08EFED440C1CD55100097C80 /* timing_example.cpp */,
+ 08FC26060C46049400F59CDD /* edit_distance.cpp */,
+ 08F9462E0C46C2F000E224E4 /* fibonacci.cpp */,
                         );
                         name = example;
                         path = ../../example;
@@ -220,6 +242,48 @@
                         path = ../../test;
                         sourceTree = SOURCE_ROOT;
                 };
+ 08F01F950C470E1500C0ED27 /* support */ = {
+ isa = PBXGroup;
+ children = (
+ );
+ path = support;
+ sourceTree = "<group>";
+ };
+ 08F0216A0C473AE000C0ED27 /* detail */ = {
+ isa = PBXGroup;
+ children = (
+ 08F0216B0C473AF000C0ED27 /* enable_if_defined.hpp */,
+ 08F22ECE0C4BF6130027D364 /* make_ref.hpp */,
+ );
+ path = detail;
+ sourceTree = "<group>";
+ };
+ 08F022C10C47556200C0ED27 /* connection */ = {
+ isa = PBXGroup;
+ children = (
+ 08F348500C492B320096097F /* operator */,
+ 08F022C20C47556200C0ED27 /* group.hpp */,
+ 08F022C70C47565600C0ED27 /* operators.hpp */,
+ );
+ path = connection;
+ sourceTree = "<group>";
+ };
+ 08F22F1B0C4C1CC70027D364 /* connection */ = {
+ isa = PBXGroup;
+ children = (
+ 08F22F1C0C4C1CE50027D364 /* iterator_relative.hpp */,
+ );
+ path = connection;
+ sourceTree = "<group>";
+ };
+ 08F348500C492B320096097F /* operator */ = {
+ isa = PBXGroup;
+ children = (
+ 08F348510C492B4B0096097F /* group.hpp */,
+ );
+ path = operator;
+ sourceTree = "<group>";
+ };
                 08F74F650C3A9C9700FD50BE /* component */ = {
                         isa = PBXGroup;
                         children = (
@@ -281,6 +345,45 @@
                         path = detail;
                         sourceTree = "<group>";
                 };
+ 08FC25BA0C45B60E00F59CDD /* dataflow */ = {
+ isa = PBXGroup;
+ children = (
+ 08F022C10C47556200C0ED27 /* connection */,
+ 08F0216A0C473AE000C0ED27 /* detail */,
+ 08F01F950C470E1500C0ED27 /* support */,
+ 08FC25CA0C45CF5B00F59CDD /* phoenix */,
+ 08F01F970C470EB700C0ED27 /* support.hpp */,
+ );
+ name = dataflow;
+ path = ../../../../boost/dataflow;
+ sourceTree = SOURCE_ROOT;
+ };
+ 08FC25CA0C45CF5B00F59CDD /* phoenix */ = {
+ isa = PBXGroup;
+ children = (
+ 08F22F1B0C4C1CC70027D364 /* connection */,
+ 08FC25DA0C45D0F700F59CDD /* component */,
+ 08F9459A0C46A86E00E224E4 /* components.hpp */,
+ 08F01FA30C47132000C0ED27 /* support.hpp */,
+ 08F22ED60C4BF78B0027D364 /* sequence_environment.hpp */,
+ 08F22FD70C4C87C50027D364 /* static_value.hpp */,
+ 08F230020C4C894E0027D364 /* advance.hpp */,
+ 08F230430C4C8D810027D364 /* static_function.hpp */,
+ );
+ path = phoenix;
+ sourceTree = "<group>";
+ };
+ 08FC25DA0C45D0F700F59CDD /* component */ = {
+ isa = PBXGroup;
+ children = (
+ 08FC25DB0C45D0F700F59CDD /* producer.hpp */,
+ 08FC25DF0C45D18700F59CDD /* consumer.hpp */,
+ 08FC25FC0C45E77B00F59CDD /* producer_accumulator.hpp */,
+ 08F22FB40C4C83900027D364 /* constant.hpp */,
+ );
+ path = component;
+ sourceTree = "<group>";
+ };
                 08FD5DE40C1BA60700F00877 /* doc */ = {
                         isa = PBXGroup;
                         children = (
@@ -380,7 +483,7 @@
                         );
                         runOnlyForDeploymentPostprocessing = 0;
                         shellPath = /bin/sh;
- shellScript = "# shell script goes here\nstyle=`echo $BUILD_STYLE | sed 'y/DR/dr/'` \nbjam --v2 --toolset=darwin ../../example $style";
+ shellScript = "# shell script goes here\nstyle=`echo $BUILD_STYLE | sed 'y/DR/dr/'` \nbjam --v2 ../../example $style";
                 };
                 08C675730C139E1300D85379 /* ShellScript */ = {
                         isa = PBXShellScriptBuildPhase;

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-17 03:05:09 EDT (Tue, 17 Jul 2007)
@@ -11,5 +11,7 @@
       <define>BOOST_ALL_NO_LIB=1
     ;
 
-exe example : example.cpp ;
+# exe example : example.cpp ;
 # exe timing_example : timing_example.cpp ;
+# exe edit_distance : edit_distance.cpp ;
+exe fibonacci : fibonacci.cpp ;
\ No newline at end of file

Added: sandbox/SOC/2007/signals/libs/signal_network/example/fibonacci.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/signal_network/example/fibonacci.cpp 2007-07-17 03:05:09 EDT (Tue, 17 Jul 2007)
@@ -0,0 +1,193 @@
+// Copyright 2007 Stjepan Rajko.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/dataflow/connection/operators.hpp>
+#include <boost/dataflow/phoenix/components.hpp>
+#include <boost/dataflow/phoenix/connection/iterator_relative.hpp>
+#include <boost/dataflow/phoenix/sequence_environment.hpp>
+
+#include <boost/spirit/phoenix/core/argument.hpp>
+#include <boost/spirit/phoenix/core/value.hpp>
+#include <boost/spirit/phoenix/function/function.hpp>
+#include <boost/spirit/phoenix/operator/arithmetic.hpp>
+#include <boost/spirit/phoenix/operator/self.hpp>
+#include <boost/progress.hpp>
+#include <boost/typeof/typeof.hpp>
+#include <iostream>
+#include <vector>
+
+using namespace boost;
+using namespace boost::dataflow::operators;
+using namespace boost::phoenix::arg_names;
+using namespace boost::phoenix::iterator_relative;
+
+typedef int fib_type;
+
+// This example shows a number of completely unnecessary ways
+// to implement a fibonacci sequence generator.
+// Each method uses different ways of connecting the "cells", i.e. elements
+// of the sequence.
+//
+// Conceptually, each cell has two inputs (the previous two cells)
+// and the function that combines them into this cell's value (plus).
+// Most of the methods here are complete overkill because they provide
+// runtime reconnection of cells - which is not necessary here.
+// the relative_link_fibonacci example is the closest to capturing
+// the needs of the problem (apart from sane_fibonacci)
+
+
+// this one uses a persistent environment (lives in the args)
+// combined with a phoenix function that adds the pointers that live in
+// the args
+void phoenix_simple_fibonacci(int n)
+{
+ // link to two cells - pointers and the function that joins their pointees
+ typedef phoenix::sequence_environment<
+ boost::fusion::vector2<const fib_type *, const fib_type *>,
+ BOOST_TYPEOF(*arg1 + *arg2)
+ > link_type;
+
+ std::cout << sizeof(phoenix::producer<fib_type, link_type>) << std::endl;
+
+ std::vector<phoenix::producer<fib_type, link_type> > cells(n);
+
+ for (int i=2; i<n; i++)
+ // connect the previous two cells to this one
+ (cells[i-1] & cells[i-2]) >>= cells[i];
+
+ // and run the calculation
+ {
+ boost::progress_timer t;
+
+ cells[0].value = cells[1].value = 1;
+ for (int i=2; i<n; i++)
+ cells[i]();
+ }
+}
+
+// this one is using the producer_accumulator that takes care of the
+// pointing to previous cells via two embedded consumers.
+void phoenix_fibonacci(int n)
+{
+ // the producer_accumulator automaticall accumulates the links
+ typedef phoenix::producer_accumulator<std::plus<fib_type>,
+ boost::fusion::vector2<
+ phoenix::actor<phoenix::consumer<fib_type> >,
+ phoenix::actor<phoenix::consumer<fib_type> >
+ > > link_type;
+
+ std::cout << sizeof(phoenix::producer<fib_type, link_type>) << std::endl;
+
+ std::vector<phoenix::producer<fib_type, link_type> > cells(n);
+
+ for (int i=2; i<n; i++)
+ // connect the previous two cells to this one
+ (cells[i-1] & cells[i-2]) >>= cells[i];
+
+ {
+ boost::progress_timer t;
+
+ cells[0].value = 0;
+ cells[1].value = 1;
+ for (int i=2; i<n; i++)
+ cells[i]();
+ }
+
+}
+
+// this one is a hand-coded mimic of the above two
+struct cell
+{
+ typedef dataflow::phoenix_producer producer_category;
+ typedef fib_type produced_type;
+
+ fib_type value;
+ const fib_type *ptr1;
+ const fib_type *ptr2;
+ void operator()()
+ {
+ value = *ptr1 + *ptr2;
+ }
+};
+
+void mimic_fibonacci(int n)
+{
+
+ std::cout << sizeof(cell) << std::endl;
+
+ std::vector<cell> cells(n);
+
+ for (int i=2; i<n; i++)
+ {
+ // even though this is hand coded, we still can't resist the >>=
+ cells[i-2] >>= cells[i].ptr1;
+ cells[i-1] >>= cells[i].ptr2;
+ }
+
+ {
+ boost::progress_timer t;
+
+ cells[0].value = 0;
+ cells[1].value = 1;
+ for (int i=2; i<n; i++)
+ cells[i]();
+ }
+}
+
+// This one uses relative links
+// * prev2 refers to the value two back from the supplied iterator,
+// and prev1 refers to the value one back from the supplied iterator.
+// Relative links need to be stored.
+void relative_link_fibonacci(int n)
+{
+ // each element of the vector contains relative links to the
+ // previous two elements
+ typedef std::vector<
+ phoenix::producer2<fib_type, BOOST_TYPEOF(prev2 + prev1) >
+ > cells_type;
+
+ std::cout << sizeof(phoenix::producer2<fib_type, BOOST_TYPEOF(prev2 + prev1)>) << std::endl;
+
+ cells_type cells(n);
+
+ {
+ boost::progress_timer t;
+
+ cells[0].value = 0;
+ cells[1].value = 1;
+ for (cells_type::iterator it=cells.begin()+2; it!=cells.end(); it++)
+ (*it)(it);
+ }
+}
+
+// This would be what a sane person would write.
+void sane_fibonacci(int n)
+{
+ std::vector<fib_type> cells(n);
+
+ {
+ boost::progress_timer t;
+
+ cells[0] = 0;
+ cells[1] = 1;
+ for (int i=2; i<n; i++)
+ cells[i] = cells[i-1] + cells[i-2];
+ }
+}
+
+int main (int argc, char * const argv[])
+{
+ // never mind the overflow
+ int len = 50000000;
+
+ // display the cell sizes and times...
+ // most of the time comes from memory access (cell size)
+ phoenix_simple_fibonacci(len);
+ phoenix_fibonacci(len);
+ mimic_fibonacci(len);
+ relative_link_fibonacci(len);
+ sane_fibonacci(len);
+ return 0;
+}


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