|
Boost-Commit : |
From: stipe_at_[hidden]
Date: 2007-10-17 17:12:30
Author: srajko
Date: 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
New Revision: 40137
URL: http://svn.boost.org/trac/boost/changeset/40137
Log:
implement most port concepts and operations
Added:
sandbox/SOC/2007/signals/boost/dataflow/connection/port_map.hpp
- copied, changed from r39908, /sandbox/SOC/2007/signals/boost/dataflow/connection/producer_map.hpp
sandbox/SOC/2007/signals/boost/dataflow/support/binary_operation.hpp (contents, props changed)
sandbox/SOC/2007/signals/boost/dataflow/support/keyed_port.hpp
- copied, changed from r39908, /sandbox/SOC/2007/signals/boost/dataflow/support/keyed_producer.hpp
sandbox/SOC/2007/signals/boost/dataflow/support/port/
sandbox/SOC/2007/signals/boost/dataflow/support/port/detail/
sandbox/SOC/2007/signals/boost/dataflow/support/port/detail/port_traits_sequence.hpp (contents, props changed)
sandbox/SOC/2007/signals/boost/dataflow/support/port/detail/proxy_port_traits_sequence.hpp (contents, props changed)
sandbox/SOC/2007/signals/boost/dataflow/support/unary_operation.hpp
- copied, changed from r39908, /sandbox/SOC/2007/signals/boost/dataflow/support/disconnect_all_outs.hpp
sandbox/SOC/2007/signals/libs/dataflow/test/my_producer_consumer.hpp (contents, props changed)
sandbox/SOC/2007/signals/libs/dataflow/test/test_binary_op.cpp (contents, props changed)
sandbox/SOC/2007/signals/libs/dataflow/test/test_keyed_port.cpp (contents, props changed)
sandbox/SOC/2007/signals/libs/dataflow/test/test_unary_op.cpp (contents, props changed)
Removed:
sandbox/SOC/2007/signals/boost/dataflow/connection/consumer_map.hpp
sandbox/SOC/2007/signals/boost/dataflow/connection/producer_map.hpp
sandbox/SOC/2007/signals/boost/dataflow/support/connectable.hpp
sandbox/SOC/2007/signals/boost/dataflow/support/disconnect_all_ins.hpp
sandbox/SOC/2007/signals/boost/dataflow/support/disconnect_all_outs.hpp
sandbox/SOC/2007/signals/boost/dataflow/support/header.hpp
sandbox/SOC/2007/signals/boost/dataflow/support/keyed_consumer.hpp
sandbox/SOC/2007/signals/boost/dataflow/support/keyed_producer.hpp
sandbox/SOC/2007/signals/boost/dataflow/support/only_connectable.hpp
Text files modified:
sandbox/SOC/2007/signals/boost/dataflow/connection/port_map.hpp | 80 +++++++++++++++++++----------------
sandbox/SOC/2007/signals/boost/dataflow/support/keyed_port.hpp | 89 ++++++++++++++++++++++++++++-----------
sandbox/SOC/2007/signals/boost/dataflow/support/port.hpp | 60 ++++++++------------------
sandbox/SOC/2007/signals/boost/dataflow/support/proxy_port.hpp | 33 ++++++++++++--
sandbox/SOC/2007/signals/boost/dataflow/support/unary_operation.hpp | 66 +++++++++++++++++------------
sandbox/SOC/2007/signals/libs/dataflow/build/xcodeide/signal_network.xcodeproj/project.pbxproj | 58 ++++++++++++++-----------
sandbox/SOC/2007/signals/libs/dataflow/test/Jamfile.v2 | 4 +
sandbox/SOC/2007/signals/libs/dataflow/test/test_port.cpp | 28 ------------
sandbox/SOC/2007/signals/libs/dataflow/test/test_proxy_port.cpp | 77 +++++++++++++---------------------
9 files changed, 257 insertions(+), 238 deletions(-)
Deleted: sandbox/SOC/2007/signals/boost/dataflow/connection/consumer_map.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/dataflow/connection/consumer_map.hpp 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
+++ (empty file)
@@ -1,83 +0,0 @@
-// 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_CONSUMER_MAP_HPP
-#define BOOST_DATAFLOW_CONNECTION_CONSUMER_MAP_HPP
-
-#include <boost/dataflow/support.hpp>
-
-#include <boost/mpl/not.hpp>
-#include <boost/fusion/sequence/intrinsic/value_at.hpp>
-#include <boost/fusion/algorithm/iteration/for_each.hpp>
-#include <boost/fusion/sequence/container/vector.hpp>
-#include <boost/fusion/sequence/intrinsic/at_key.hpp>
-#include <boost/fusion/sequence/intrinsic/front.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/type_traits/remove_const.hpp>
-#include <boost/type_traits/remove_reference.hpp>
-#include <boost/utility/result_of.hpp>
-#include <boost/call_traits.hpp>
-
-namespace boost { namespace dataflow {
-
-struct fusion_map_consumer
- : public consumer_category<concepts::keyed_consumer> {};
-
-template<class T>
-struct consumer_map : public T
-{
- consumer_map(const T& t) : T(t) {}
- template<typename Mechanism>
- struct dataflow
- {
- typedef fusion_map_consumer consumer_category;
-/* typedef typename boost::fusion::result_of::value_at_c<T, 0>::type::second_type
- proxy_producer_for;*/
- typedef
- typename boost::remove_const<
- typename boost::remove_reference<
- typename boost::fusion::result_of::front<T>::type
- >::type
- >::type::second_type proxy_producer_for;
- typedef mutable_proxy_producer<proxy_producer_for> proxy_producer_category;
-
- static typename get_proxied_producer_result_type<Mechanism, proxy_producer_for>::type get_proxied_producer(const T &t)
- {
- return boost::dataflow::get_proxied_producer<Mechanism>(boost::fusion::front(t).second);
- }
- };
-};
-
-namespace extension
-{
- template<typename Mechanism, typename ProducerTag>
- struct get_keyed_consumer_impl<Mechanism, ProducerTag, fusion_map_consumer>
- {
- template<typename Producer, typename KeyedConsumer>
- struct apply
- {
- typedef typename boost::fusion::result_of::at_key<
- KeyedConsumer,
- ProducerTag
- >::type type;
-
- static type
- call(Producer &, KeyedConsumer &consumer)
- {
- return boost::fusion::at_key<
- ProducerTag
- >(consumer);
- }
- };
- };
-}
-
-} } // namespace boost::dataflow
-
-#endif // BOOST_DATAFLOW_CONNECTION_CONSUMER_MAP_HPP
-
-
Copied: sandbox/SOC/2007/signals/boost/dataflow/connection/port_map.hpp (from r39908, /sandbox/SOC/2007/signals/boost/dataflow/connection/producer_map.hpp)
==============================================================================
--- /sandbox/SOC/2007/signals/boost/dataflow/connection/producer_map.hpp (original)
+++ sandbox/SOC/2007/signals/boost/dataflow/connection/port_map.hpp 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
@@ -3,74 +3,82 @@
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#ifndef BOOST_DATAFLOW_CONNECTION_PRODUCER_MAP_HPP
-#define BOOST_DATAFLOW_CONNECTION_PRODUCER_MAP_HPP
+#ifndef BOOST_DATAFLOW_CONNECTION_PORT_MAP_HPP
+#define BOOST_DATAFLOW_CONNECTION_PORT_MAP_HPP
-#include <boost/dataflow/support.hpp>
+#include <boost/dataflow/support/keyed_port.hpp>
-#include <boost/mpl/not.hpp>
-#include <boost/fusion/sequence/intrinsic/value_at.hpp>
-#include <boost/fusion/algorithm/iteration/for_each.hpp>
-#include <boost/fusion/sequence/container/vector.hpp>
+//#include <boost/fusion/sequence/intrinsic/value_at.hpp>
#include <boost/fusion/sequence/intrinsic/at_key.hpp>
#include <boost/fusion/sequence/intrinsic/front.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/type_traits/remove_const.hpp>
#include <boost/type_traits/remove_reference.hpp>
-#include <boost/utility/result_of.hpp>
#include <boost/call_traits.hpp>
+#include <boost/type_traits/is_same.hpp>
namespace boost { namespace dataflow {
-struct fusion_map_producer
- : public producer_category<concepts::keyed_producer> {};
-
-template<class T>
-struct producer_map : public T
+template<typename Mechanism, typename PortCategory>
+struct fusion_map_port
+ : public port_traits<Mechanism, PortCategory, concepts::keyed_port> {};
+
+template<typename Mechanism, typename PortCategory, typename T>
+class port_map
+ : public port<fusion_map_port<Mechanism, PortCategory> >
{
- producer_map(const T& t) : T(t) {}
- template<typename Mechanism>
- struct dataflow
+public:
+ typedef Mechanism mechanism_type;
+ typedef PortCategory port_category_type;
+ typedef T map_type;
+
+ port_map(const T& t) : t(t) {}
+ const map_type &map() const {return t;}
+
+private:
+ map_type t;
+
+public:
+
+/* template<typename PT>
+ struct dataflow<Mechanism, PT, typename enable_if<is_same<PT, typename PortCategory::complement> >::type >
{
- typedef fusion_map_producer producer_category;
-/* typedef typename boost::fusion::result_of::value_at_c<T, 0>::type::second_type
- proxy_consumer_for;*/
+// typedef typename boost::fusion::result_of::value_at_c<T, 0>::type::second_type
+// proxy_consumer_for;
typedef
typename boost::remove_const<
typename boost::remove_reference<
typename boost::fusion::result_of::front<T>::type
>::type
>::type::second_type proxy_consumer_for;
- typedef mutable_proxy_consumer<proxy_consumer_for> proxy_consumer_category;
-
- static typename boost::call_traits<typename get_proxied_consumer_type<Mechanism, proxy_consumer_for>::type>::reference get_proxied_consumer(const T &t)
+
+ typedef mutable_proxy_port<Mechanism, typename PortCategory::complement, proxy_consumer_for> proxy_port_traits;
+ static typename get_port_result_type<Mechanism, typename PortCategory::complement, proxy_consumer_for>::type
+ get_proxied_port(const port_map &map)
{
- return boost::dataflow::get_proxied_consumer(boost::fusion::front(t).second);
+ return get_port<typename PortCategory::complement>(boost::fusion::front(map.t).second);
}
- };
+ };*/
};
namespace extension
{
- template<typename Mechanism, typename ConsumerTag>
- struct get_keyed_producer_impl<Mechanism, fusion_map_producer, ConsumerTag>
+ template<typename Mechanism, typename PortCategory, typename KeyTag>
+ struct get_keyed_port_impl<Mechanism, fusion_map_port<Mechanism, PortCategory>, KeyTag>
{
- template<typename KeyedProducer, typename Consumer>
+ template<typename KeyedPort, typename Key>
struct apply
{
typedef typename boost::fusion::result_of::at_key<
- KeyedProducer,
- ConsumerTag
+ typename KeyedPort::map_type,
+ KeyTag
>::type type;
static type
- call(KeyedProducer &producer, Consumer &)
+ call(KeyedPort &port, Key &)
{
return boost::fusion::at_key<
- ConsumerTag
- >(producer);
+ KeyTag
+ >(port.map());
}
};
};
@@ -78,6 +86,6 @@
} } // namespace boost::dataflow
-#endif // BOOST_DATAFLOW_CONNECTION_PRODUCER_MAP_HPP
+#endif // BOOST_DATAFLOW_CONNECTION_PORT_MAP_HPP
Deleted: sandbox/SOC/2007/signals/boost/dataflow/connection/producer_map.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/dataflow/connection/producer_map.hpp 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
+++ (empty file)
@@ -1,83 +0,0 @@
-// 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_PRODUCER_MAP_HPP
-#define BOOST_DATAFLOW_CONNECTION_PRODUCER_MAP_HPP
-
-#include <boost/dataflow/support.hpp>
-
-#include <boost/mpl/not.hpp>
-#include <boost/fusion/sequence/intrinsic/value_at.hpp>
-#include <boost/fusion/algorithm/iteration/for_each.hpp>
-#include <boost/fusion/sequence/container/vector.hpp>
-#include <boost/fusion/sequence/intrinsic/at_key.hpp>
-#include <boost/fusion/sequence/intrinsic/front.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/type_traits/remove_const.hpp>
-#include <boost/type_traits/remove_reference.hpp>
-#include <boost/utility/result_of.hpp>
-#include <boost/call_traits.hpp>
-
-namespace boost { namespace dataflow {
-
-struct fusion_map_producer
- : public producer_category<concepts::keyed_producer> {};
-
-template<class T>
-struct producer_map : public T
-{
- producer_map(const T& t) : T(t) {}
- template<typename Mechanism>
- struct dataflow
- {
- typedef fusion_map_producer producer_category;
-/* typedef typename boost::fusion::result_of::value_at_c<T, 0>::type::second_type
- proxy_consumer_for;*/
- typedef
- typename boost::remove_const<
- typename boost::remove_reference<
- typename boost::fusion::result_of::front<T>::type
- >::type
- >::type::second_type proxy_consumer_for;
- typedef mutable_proxy_consumer<proxy_consumer_for> proxy_consumer_category;
-
- static typename boost::call_traits<typename get_proxied_consumer_type<Mechanism, proxy_consumer_for>::type>::reference get_proxied_consumer(const T &t)
- {
- return boost::dataflow::get_proxied_consumer(boost::fusion::front(t).second);
- }
- };
-};
-
-namespace extension
-{
- template<typename Mechanism, typename ConsumerTag>
- struct get_keyed_producer_impl<Mechanism, fusion_map_producer, ConsumerTag>
- {
- template<typename KeyedProducer, typename Consumer>
- struct apply
- {
- typedef typename boost::fusion::result_of::at_key<
- KeyedProducer,
- ConsumerTag
- >::type type;
-
- static type
- call(KeyedProducer &producer, Consumer &)
- {
- return boost::fusion::at_key<
- ConsumerTag
- >(producer);
- }
- };
- };
-}
-
-} } // namespace boost::dataflow
-
-#endif // BOOST_DATAFLOW_CONNECTION_PRODUCER_MAP_HPP
-
-
Added: sandbox/SOC/2007/signals/boost/dataflow/support/binary_operation.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/dataflow/support/binary_operation.hpp 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
@@ -0,0 +1,65 @@
+// 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_BINARY_OPERATION_HPP
+#define BOOST_DATAFLOW_SUPPORT_BINARY_OPERATION_HPP
+
+#include <boost/dataflow/support/proxy_port.hpp>
+
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+
+
+namespace boost { namespace dataflow {
+
+namespace operations {
+ struct connect;
+ struct connect_only;
+ struct disconnect;
+ struct extract;
+}
+
+namespace extension
+{
+ template<typename Operation, typename ProducerTag, typename ConsumerTag, typename Enable=void>
+ struct binary_operation_impl
+ {
+ template<typename Producer, typename Consumer>
+ struct apply
+ {
+ static void call(Producer &, Consumer &)
+ {
+ // Error: binary_operation_impl has not been implemented
+ // for ProducerTag and ConsumerTag.
+ BOOST_STATIC_ASSERT(sizeof(Producer)==0);
+ }
+ };
+ };
+}
+
+template<typename Operation, typename Mechanism, typename Producer, typename Consumer>
+inline void binary_operation(Producer &producer, Consumer &consumer)
+{
+ typedef typename boost::remove_cv<Producer>::type ProducerNoCV;
+ typedef typename boost::remove_cv<Consumer>::type ConsumerNoCV;
+
+ extension::binary_operation_impl<
+ Operation,
+ typename port_traits_of<Mechanism, ports::producer, ProducerNoCV>::type,
+ typename port_traits_of<Mechanism, ports::consumer, ConsumerNoCV>::type>
+ ::template apply<
+ typename boost::remove_reference<
+ typename get_port_result_type<Mechanism, ports::producer, Producer>::type
+ >::type,
+ typename boost::remove_reference<
+ typename get_port_result_type<Mechanism, ports::consumer, Consumer>::type
+ >::type
+ >::call(get_port<Mechanism, ports::producer>(producer),
+ get_port<Mechanism, ports::consumer>(consumer));
+}
+
+} } // namespace boost::dataflow
+
+#endif // BOOST_DATAFLOW_SUPPORT_BINARY_OPERATION_HPP
Deleted: sandbox/SOC/2007/signals/boost/dataflow/support/connectable.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/dataflow/support/connectable.hpp 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
+++ (empty file)
@@ -1,93 +0,0 @@
-// 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_CONNECTABLE_HPP
-#define BOOST_DATAFLOW_SUPPORT_CONNECTABLE_HPP
-
-#include <boost/dataflow/support/proxy_producer.hpp>
-#include <boost/dataflow/support/proxy_consumer.hpp>
-#include <boost/dataflow/support/keyed_producer.hpp>
-#include <boost/dataflow/support/keyed_consumer.hpp>
-
-#include <boost/static_assert.hpp>
-#include <boost/type_traits/remove_reference.hpp>
-
-
-namespace boost { namespace dataflow {
-
-namespace extension
-{
- template<typename Mechanism, typename ProducerTag, typename ConsumerTag, typename Enable=void>
- struct connect_impl
- {
- template<typename Producer, typename Consumer>
- struct apply
- {
- static void call(const Producer &, const Consumer &)
- {
- // Error: connect_impl has not been implemented for ProducerTag
- // and ConsumerTag.
- BOOST_STATIC_ASSERT(sizeof(Producer)==0);
- }
- };
- };
-
- template<typename Mechanism, typename ProducerTag, typename ConsumerTag>
- struct connect_impl<Mechanism, ProducerTag, ConsumerTag,
- typename enable_if<
- boost::is_same<typename ProducerTag::producer_concept, concepts::keyed_producer>
- >::type >
- {
- template<typename Producer, typename Consumer>
- struct apply
- {
- static void call(Producer &producer, Consumer &consumer)
- {
- connect(get_keyed_producer<Mechanism>(producer, consumer), consumer);
- }
- };
- };
-
- template<typename Mechanism, typename ProducerTag, typename ConsumerTag>
- struct connect_impl<Mechanism, ProducerTag, ConsumerTag,
- typename enable_if<
- boost::is_same<typename ConsumerTag::consumer_concept, concepts::keyed_consumer>
- >::type >
- {
- template<typename Producer, typename Consumer>
- struct apply
- {
- static void call(Producer &producer, Consumer &consumer)
- {
- connect(producer, get_keyed_consumer<Mechanism>(producer, consumer));
- }
- };
- };
-}
-
-template<typename Mechanism, typename Producer, typename Consumer>
-inline void connect(Producer &producer, Consumer &consumer)
-{
- typedef typename boost::remove_cv<Producer>::type ProducerNoCV;
- typedef typename boost::remove_cv<Consumer>::type ConsumerNoCV;
-
- extension::connect_impl<
- Mechanism,
- typename producer_category_of<Mechanism, ProducerNoCV>::type,
- typename consumer_category_of<Mechanism, ConsumerNoCV>::type>
- ::template apply<
- typename boost::remove_reference<
- typename get_proxied_producer_result_type<Mechanism, Producer>::type
- >::type,
- typename boost::remove_reference<
- typename get_proxied_consumer_result_type<Mechanism, Consumer>::type
- >::type
- >::call(get_proxied_producer<Mechanism>(producer),
- get_proxied_consumer<Mechanism>(consumer));
-}
-
-} } // namespace boost::dataflow
-
-#endif // BOOST_DATAFLOW_SUPPORT_CONNECTABLE_HPP
Deleted: sandbox/SOC/2007/signals/boost/dataflow/support/disconnect_all_ins.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/dataflow/support/disconnect_all_ins.hpp 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
+++ (empty file)
@@ -1,68 +0,0 @@
-// 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_DISCONNECT_ALL_INS_HPP
-#define BOOST_DATAFLOW_SUPPORT_DISCONNECT_ALL_INS_HPP
-
-#include <boost/dataflow/detail/enable_if_defined.hpp>
-
-#include <boost/static_assert.hpp>
-#include <boost/type_traits/integral_constant.hpp>
-
-
-namespace boost { namespace dataflow {
-
-namespace extension
-{
- template<typename Mechanism, typename ConsumerTag, typename Enable=void>
- struct disconnect_all_ins_impl
- {
- template<typename Consumer>
- struct apply
- {
- struct detail
- {
- typedef void disconnect_all_ins_impl_unspecialized;
- };
-
- static void call(Consumer &)
- {
- // Error: disconnect_all_ins_impl has not been implemented for
- // ConsumerTag.
- BOOST_STATIC_ASSERT(sizeof(Consumer)==0);
- }
- };
- };
-}
-
-template<typename Mechanism, typename T, typename Enable=void>
-struct is_in_disconnectable
- : public boost::true_type {};
-
-template<typename Mechanism, typename Producer>
-struct is_in_disconnectable<
- Mechanism,
- Producer,
- typename detail::enable_if_defined<
- typename extension::disconnect_all_ins_impl<
- Mechanism,
- typename producer_category_of<Mechanism, Producer>::type
- >::detail::template apply<Producer>::disconnect_all_ins_impl_unspecified
- >::type
->
- : public boost::false_type {};
-
-template<typename Mechanism, typename Producer>
-void disconnect_all_ins(Producer &producer)
-{
- extension::disconnect_all_ins_impl<
- Mechanism,
- typename producer_category_of<Mechanism, Producer>::type
- >::template apply<Producer>::call(producer);
-}
-
-} } // namespace boost::dataflow
-
-#endif // BOOST_DATAFLOW_SUPPORT_DISCONNECT_ALL_INS_HPP
Deleted: sandbox/SOC/2007/signals/boost/dataflow/support/disconnect_all_outs.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/dataflow/support/disconnect_all_outs.hpp 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
+++ (empty file)
@@ -1,68 +0,0 @@
-// 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_DISCONNECT_ALL_OUTS_HPP
-#define BOOST_DATAFLOW_SUPPORT_DISCONNECT_ALL_OUTS_HPP
-
-#include <boost/dataflow/detail/enable_if_defined.hpp>
-
-#include <boost/static_assert.hpp>
-#include <boost/type_traits/integral_constant.hpp>
-
-
-namespace boost { namespace dataflow {
-
-namespace extension
-{
- template<typename Mechanism, typename ProducerTag, typename Enable=void>
- struct disconnect_all_outs_impl
- {
- template<typename Producer>
- struct apply
- {
- struct detail
- {
- typedef void disconnect_all_outs_impl_unspecialized;
- };
-
- static void call(Producer &)
- {
- // Error: disconnect_all_outs_impl has not been implemented for
- // ProducerTag.
- BOOST_STATIC_ASSERT(sizeof(Producer)==0);
- }
- };
- };
-}
-
-template<typename Mechanism, typename T, typename Enable=void>
-struct is_out_disconnectable
- : public boost::true_type {};
-
-template<typename Mechanism, typename Producer>
-struct is_out_disconnectable<
- Mechanism,
- Producer,
- typename detail::enable_if_defined<
- typename extension::disconnect_all_outs_impl<
- Mechanism,
- typename producer_category_of<Mechanism, Producer>::type
- >::detail::template apply<Producer>::disconnect_all_outs_impl_unspecified
- >::type
->
- : public boost::false_type {};
-
-template<typename Mechanism, typename Producer>
-void disconnect_all_outs(Producer &producer)
-{
- extension::disconnect_all_outs_impl<
- Mechanism,
- typename producer_category_of<Mechanism, Producer>::type
- >::template apply<Producer>::call(producer);
-}
-
-} } // namespace boost::dataflow
-
-#endif // BOOST_DATAFLOW_SUPPORT_DISCONNECT_ALL_OUTS_HPP
Deleted: sandbox/SOC/2007/signals/boost/dataflow/support/header.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/dataflow/support/header.hpp 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
+++ (empty file)
@@ -1,9 +0,0 @@
-/*
- * header.hpp
- * signal_network
- *
- * Created by Stjepan Rajko on 10/10/07.
- * Copyright 2007 __MyCompanyName__. All rights reserved.
- *
- */
-
Deleted: sandbox/SOC/2007/signals/boost/dataflow/support/keyed_consumer.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/dataflow/support/keyed_consumer.hpp 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
+++ (empty file)
@@ -1,68 +0,0 @@
-// 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_KEYED_CONSUMER_HPP
-#define BOOST_DATAFLOW_SUPPORT_KEYED_CONSUMER_HPP
-
-#include <boost/dataflow/support/consumer.hpp>
-
-#include <boost/type_traits/integral_constant.hpp>
-#include <boost/type_traits/is_same.hpp>
-
-
-namespace boost { namespace dataflow {
-
-namespace concepts
-{
- struct keyed_consumer;
-}
-
-namespace extension
-{
- template<typename Mechanism, typename ProducerTag, typename KeyedConsumerTag>
- struct get_keyed_consumer_impl
- {
- struct not_implemented;
-
- template<typename Producer, typename KeyedConsumer>
- struct apply
- {
- typedef not_implemented type;
- static type call(Producer &, KeyedConsumer &)
- {
- // Error: get_keyed_producer_impl has not been implemented
- // for KeyedProducerTag and ConsumerTag.
- BOOST_STATIC_ASSERT(sizeof(Producer)==0);
- }
- };
- };
-}
-
-template<typename Mechanism, typename T1, typename T2>
-typename extension::get_keyed_consumer_impl<
- Mechanism,
- typename producer_category_of<
- Mechanism, typename boost::remove_cv<T1>::type
- >::type,
- typename consumer_category_of<
- Mechanism, typename boost::remove_cv<T2>::type
- >::type
->::template apply<T1, T2>::type
-get_keyed_consumer(T1 &t1, T2 &t2)
-{
- return extension::get_keyed_consumer_impl<
- Mechanism,
- typename producer_category_of<
- Mechanism, typename boost::remove_cv<T1>::type
- >::type,
- typename consumer_category_of<
- Mechanism, typename boost::remove_cv<T2>::type
- >::type
- >::template apply<T1, T2>::call(t1, t2);
-}
-
-} } // namespace boost::dataflow
-
-#endif // BOOST_DATAFLOW_SUPPORT_KEYED_CONSUMER_HPP
Copied: sandbox/SOC/2007/signals/boost/dataflow/support/keyed_port.hpp (from r39908, /sandbox/SOC/2007/signals/boost/dataflow/support/keyed_producer.hpp)
==============================================================================
--- /sandbox/SOC/2007/signals/boost/dataflow/support/keyed_producer.hpp (original)
+++ sandbox/SOC/2007/signals/boost/dataflow/support/keyed_port.hpp 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
@@ -3,11 +3,12 @@
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#ifndef BOOST_DATAFLOW_SUPPORT_KEYED_PRODUCER_HPP
-#define BOOST_DATAFLOW_SUPPORT_KEYED_PRODUCER_HPP
+#ifndef BOOST_DATAFLOW_SUPPORT_KEYED_PORT_HPP
+#define BOOST_DATAFLOW_SUPPORT_KEYED_PORT_HPP
-#include <boost/dataflow/support/producer.hpp>
+#include <boost/dataflow/support/binary_operation.hpp>
+#include <boost/static_assert.hpp>
#include <boost/type_traits/integral_constant.hpp>
#include <boost/type_traits/is_same.hpp>
@@ -16,51 +17,89 @@
namespace concepts
{
- struct keyed_producer;
+ struct keyed_port;
}
namespace extension
{
- template<typename Mechanism, typename KeyedProducerTag, typename ConsumerTag>
- struct get_keyed_producer_impl
+ template<typename Mechanism, typename KeyedPortTag, typename KeyPortTag>
+ struct get_keyed_port_impl
{
- template<typename KeyedProducer, typename Consumer>
+ template<typename KeyedPort, typename Key>
struct apply
{
typedef void type;
- static void call(KeyedProducer &, Consumer &)
+ static void call(KeyedPort &, Key &)
{
- // Error: get_keyed_producer_impl has not been implemented
- // for KeyedProducerTag and ConsumerTag.
- BOOST_STATIC_ASSERT(sizeof(KeyedProducer)==0);
+ // Error: get_keyed_port_impl has not been implemented
+ // for KeyedPortTag and KeyPort.
+ BOOST_STATIC_ASSERT(sizeof(KeyedPort)==0);
}
};
};
}
-
-template<typename Mechanism, typename T1, typename T2>
-typename extension::get_keyed_producer_impl<
+
+template<typename Mechanism, typename PortCategory, typename T1, typename T2>
+typename extension::get_keyed_port_impl<
Mechanism,
- typename producer_category_of<
- Mechanism, typename boost::remove_cv<T1>::type
+ typename port_traits_of<
+ Mechanism, PortCategory, typename boost::remove_cv<T1>::type
>::type,
- typename consumer_category_of<
- Mechanism, typename boost::remove_cv<T2>::type
+ typename port_traits_of<
+ Mechanism, typename PortCategory::complement, typename boost::remove_cv<T2>::type
>::type
>::template apply<T1, T2>::type
-get_keyed_producer(T1 &t1, T2 &t2)
+get_keyed_port(T1 &t1, T2 &t2)
{
- return extension::get_keyed_producer_impl<
+ return extension::get_keyed_port_impl<
Mechanism,
- typename producer_category_of<
- Mechanism, typename boost::remove_cv<T1>::type
+ typename port_traits_of<
+ Mechanism, PortCategory, typename boost::remove_cv<T1>::type
>::type,
- typename consumer_category_of<
- Mechanism, typename boost::remove_cv<T2>::type
+ typename port_traits_of<
+ Mechanism, typename PortCategory::complement, typename boost::remove_cv<T2>::type
>::type
>::template apply<const T1, const T2>::call(t1, t2);
}
+namespace extension
+{
+ template<typename Operation, typename ProducerTag, typename ConsumerTag>
+ struct binary_operation_impl<Operation, ProducerTag, ConsumerTag,
+ typename enable_if<
+ boost::is_same<typename ProducerTag::concept, concepts::keyed_port>
+ >::type >
+ {
+ template<typename Producer, typename Consumer>
+ struct apply
+ {
+ static void call(Producer &producer, Consumer &consumer)
+ {
+ binary_operation<Operation, typename ProducerTag::mechanism>
+ (get_keyed_port<typename ProducerTag::mechanism, typename ProducerTag::category>(producer, consumer), consumer);
+ }
+ };
+ };
+
+ template<typename Operation, typename ProducerTag, typename ConsumerTag>
+ struct binary_operation_impl<Operation, ProducerTag, ConsumerTag,
+ typename enable_if<
+ boost::is_same<typename ConsumerTag::concept, concepts::keyed_port>
+ >::type >
+ {
+ template<typename Producer, typename Consumer>
+ struct apply
+ {
+ static void call(Producer &producer, Consumer &consumer)
+ {
+ binary_operation<Operation, typename ProducerTag::mechanism>
+ (producer, get_keyed_port<typename ProducerTag::mechanism, typename ConsumerTag::category>(consumer, producer));
+ }
+ };
+ };
+
+}
+
} } // namespace boost::dataflow
-#endif // BOOST_DATAFLOW_SUPPORT_KEYED_PRODUCER_HPP
+#endif // BOOST_DATAFLOW_SUPPORT_KEYED_PORT_HPP
Deleted: sandbox/SOC/2007/signals/boost/dataflow/support/keyed_producer.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/dataflow/support/keyed_producer.hpp 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
+++ (empty file)
@@ -1,66 +0,0 @@
-// 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_KEYED_PRODUCER_HPP
-#define BOOST_DATAFLOW_SUPPORT_KEYED_PRODUCER_HPP
-
-#include <boost/dataflow/support/producer.hpp>
-
-#include <boost/type_traits/integral_constant.hpp>
-#include <boost/type_traits/is_same.hpp>
-
-
-namespace boost { namespace dataflow {
-
-namespace concepts
-{
- struct keyed_producer;
-}
-
-namespace extension
-{
- template<typename Mechanism, typename KeyedProducerTag, typename ConsumerTag>
- struct get_keyed_producer_impl
- {
- template<typename KeyedProducer, typename Consumer>
- struct apply
- {
- typedef void type;
- static void call(KeyedProducer &, Consumer &)
- {
- // Error: get_keyed_producer_impl has not been implemented
- // for KeyedProducerTag and ConsumerTag.
- BOOST_STATIC_ASSERT(sizeof(KeyedProducer)==0);
- }
- };
- };
-}
-
-template<typename Mechanism, typename T1, typename T2>
-typename extension::get_keyed_producer_impl<
- Mechanism,
- typename producer_category_of<
- Mechanism, typename boost::remove_cv<T1>::type
- >::type,
- typename consumer_category_of<
- Mechanism, typename boost::remove_cv<T2>::type
- >::type
->::template apply<T1, T2>::type
-get_keyed_producer(T1 &t1, T2 &t2)
-{
- return extension::get_keyed_producer_impl<
- Mechanism,
- typename producer_category_of<
- Mechanism, typename boost::remove_cv<T1>::type
- >::type,
- typename consumer_category_of<
- Mechanism, typename boost::remove_cv<T2>::type
- >::type
- >::template apply<const T1, const T2>::call(t1, t2);
-}
-
-} } // namespace boost::dataflow
-
-#endif // BOOST_DATAFLOW_SUPPORT_KEYED_PRODUCER_HPP
Deleted: sandbox/SOC/2007/signals/boost/dataflow/support/only_connectable.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/dataflow/support/only_connectable.hpp 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
+++ (empty file)
@@ -1,92 +0,0 @@
-// 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_ONLY_CONNECTABLE_HPP
-#define BOOST_DATAFLOW_SUPPORT_ONLY_CONNECTABLE_HPP
-
-#include <boost/dataflow/support/proxy_producer.hpp>
-#include <boost/dataflow/support/proxy_consumer.hpp>
-#include <boost/dataflow/support/keyed_producer.hpp>
-#include <boost/dataflow/support/keyed_consumer.hpp>
-
-#include <boost/static_assert.hpp>
-
-
-namespace boost { namespace dataflow {
-
-namespace extension
-{
- template<typename Mechanism, typename ProducerTag, typename ConsumerTag, typename Enable=void>
- struct connect_only_impl
- {
- template<typename Producer, typename Consumer>
- struct apply
- {
- static void call(const Producer &, const Consumer &)
- {
- // Error: connect_only_impl has not been implemented for ProducerTag
- // and ConsumerTag.
- BOOST_STATIC_ASSERT(sizeof(Producer)==0);
- }
- };
- };
-
- template<typename Mechanism, typename ProducerTag, typename ConsumerTag>
- struct connect_only_impl<Mechanism, ProducerTag, ConsumerTag,
- typename enable_if<
- boost::is_same<typename ProducerTag::producer_concept, concepts::keyed_producer>
- >::type >
- {
- template<typename Producer, typename Consumer>
- struct apply
- {
- static void call(Producer &producer, Consumer &consumer)
- {
- connect_only(get_keyed_producer<Mechanism>(producer, consumer), consumer);
- }
- };
- };
-
- template<typename Mechanism, typename ProducerTag, typename ConsumerTag>
- struct connect_only_impl<Mechanism, ProducerTag, ConsumerTag,
- typename enable_if<
- boost::is_same<typename ConsumerTag::consumer_concept, concepts::keyed_consumer>
- >::type >
- {
- template<typename Producer, typename Consumer>
- struct apply
- {
- static void call(Producer &producer, Consumer &consumer)
- {
- connect_only(producer, get_keyed_consumer<Mechanism>(producer, consumer));
- }
- };
- };
-}
-
-template<typename Mechanism, typename Producer, typename Consumer>
-inline void connect_only(Producer &producer, Consumer &consumer)
-{
- typedef typename boost::remove_cv<Producer>::type ProducerNoCV;
- typedef typename boost::remove_cv<Consumer>::type ConsumerNoCV;
-
- extension::connect_only_impl<
- Mechanism,
- typename producer_category_of<Mechanism, ProducerNoCV>::type,
- typename consumer_category_of<Mechanism, ConsumerNoCV>::type>
- ::template apply<
- typename boost::remove_reference<
- typename get_proxied_producer_result_type<Mechanism, Producer>::type
- >::type,
- typename boost::remove_reference<
- typename get_proxied_consumer_result_type<Mechanism, Consumer>::type
- >::type
- >::call(get_proxied_producer<Mechanism>(producer),
- get_proxied_consumer<Mechanism>(consumer));
-}
-
-} } // namespace boost::dataflow
-
-#endif // BOOST_DATAFLOW_SUPPORT_ONLY_CONNECTABLE_HPP
Modified: sandbox/SOC/2007/signals/boost/dataflow/support/port.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/dataflow/support/port.hpp (original)
+++ sandbox/SOC/2007/signals/boost/dataflow/support/port.hpp 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
@@ -7,11 +7,12 @@
#define BOOST_DATAFLOW_SUPPORT_PORT_HPP
#include <boost/dataflow/detail/enable_if_defined.hpp>
-//#include <boost/dataflow/support/common.hpp>
#include <boost/mpl/and.hpp>
+#include <boost/mpl/at.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/bool.hpp>
+#include <boost/mpl/is_sequence.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_cv.hpp>
@@ -91,14 +92,26 @@
/// Specialization allowing intrusive specification of the PortTraits.
template<typename Mechanism, typename PortCategory, typename T>
struct port_traits_of<Mechanism, PortCategory, T,
- typename detail::enable_if_defined<
- typename T::template dataflow<Mechanism, PortCategory>::traits >::type
- >
+ typename enable_if<
+ mpl::and_<
+ mpl::not_<mpl::is_sequence<typename T::port_traits> >,
+ is_same<Mechanism, typename T::port_traits::mechanism>,
+ is_same<PortCategory, typename T::port_traits::category>
+ >
+ >::type
+>
{
- typedef typename T::template dataflow<Mechanism, PortCategory>::traits type;
+ typedef typename T::port_traits type;
BOOST_MPL_ASSERT(( is_port_traits<type> ));
};
+} }
+
+/// Specialization allowing intrusive specification of a sequence of PortTraits.
+#include <boost/dataflow/support/port/detail/port_traits_sequence.hpp>
+
+namespace boost { namespace dataflow {
+
/// Boolean metafunction determining whether a type is a Port.
template<typename Mechanism, typename PortCategory, typename T, typename Enable=void>
struct is_port
@@ -119,22 +132,7 @@
template<typename PortTraits>
struct port
{
- template<typename Mechanism, typename PortCategory, typename Enable=void>
- struct dataflow;
-
- template<typename Mechanism, typename PortCategory>
- struct dataflow<
- Mechanism,
- PortCategory,
- typename boost::enable_if<
- mpl::and_<
- is_same<Mechanism, typename PortTraits::mechanism>,
- is_same<PortCategory, typename PortTraits::category>
- >
- >::type>
- {
- typedef PortTraits traits;
- };
+ typedef PortTraits port_traits;
};
// trait determining whether a type is a port proxy.
@@ -197,26 +195,6 @@
>::template apply<T>::call(p);
}
-/// Convenience class for Producer types for all Mechanisms.
-/*template<typename PortCategory, typename PortTag>
-struct port<all_mechanisms, PortCategory, PortTag>
-{
- template<typename M>
- struct dataflow
- {
- template<typename P, typename Enable=void>
- struct port
- {
- };
-
- template<typename P>
- struct port<P, typename boost::enable_if<is_same<P, PortCategory> >::type>
- {
- typedef PortTag category;
- };
- };
-};*/
-
} } // namespace boost::dataflow
/// Macro simplifying non-intrusive specification of a type's PortTraits.
Added: sandbox/SOC/2007/signals/boost/dataflow/support/port/detail/port_traits_sequence.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/dataflow/support/port/detail/port_traits_sequence.hpp 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
@@ -0,0 +1,67 @@
+// 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)
+
+#if !BOOST_PP_IS_ITERATING
+
+ #ifndef DATAFLOW_SUPPORT_PORT_TRAITS_SEQUENCE_HPP
+ #define DATAFLOW_SUPPORT_PORT_TRAITS_SEQUENCE_HPP
+
+ #include <boost/preprocessor/iteration/iterate.hpp>
+
+ #include <boost/mpl/int.hpp>
+ #include <boost/mpl/less.hpp>
+ #include <boost/mpl/size.hpp>
+
+namespace boost { namespace dataflow {
+
+namespace detail {
+
+ template<typename Mechanism, typename T, int N>
+ struct lazy_is_same_port_traits_mechanism
+ {
+ typedef typename is_same<Mechanism, typename mpl::at_c<typename T::port_traits, N>::type::mechanism>::type type;
+ };
+
+ template<typename PortCategory, typename T, int N>
+ struct lazy_is_same_port_traits_port_category
+ {
+ typedef typename is_same<PortCategory, typename mpl::at_c<typename T::port_traits, N>::type::port_category>::type type;
+ };
+}
+
+} }
+
+ #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 1, <boost/dataflow/support/port/detail/port_traits_sequence.hpp>))
+ #include BOOST_PP_ITERATE()
+
+ #endif
+
+#else
+
+namespace boost { namespace dataflow {
+
+
+template<typename Mechanism, typename PortCategory, typename T>
+struct port_traits_of<Mechanism, PortCategory, T,
+ typename enable_if<
+ mpl::and_<
+ mpl::is_sequence<typename T::port_traits>,
+ typename mpl::less<
+ mpl::int_<BOOST_PP_ITERATION()>,
+ typename mpl::size<typename T::port_traits>::type
+ >::type,
+ detail::lazy_is_same_port_traits_mechanism<Mechanism, T, BOOST_PP_ITERATION()>,
+ detail::lazy_is_same_port_traits_port_category<PortCategory, T, BOOST_PP_ITERATION()>
+ >
+ >::type
+>
+{
+ typedef typename mpl::at_c<typename T::port_traits, BOOST_PP_ITERATION()>::type type;
+ BOOST_MPL_ASSERT(( is_port_traits<type> ));
+};
+
+}}
+
+#endif
Added: sandbox/SOC/2007/signals/boost/dataflow/support/port/detail/proxy_port_traits_sequence.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/dataflow/support/port/detail/proxy_port_traits_sequence.hpp 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
@@ -0,0 +1,67 @@
+// 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)
+
+#if !BOOST_PP_IS_ITERATING
+
+ #ifndef DATAFLOW_SUPPORT_PROXY_PORT_TRAITS_SEQUENCE_HPP
+ #define DATAFLOW_SUPPORT_PROXY_PORT_TRAITS_SEQUENCE_HPP
+
+ #include <boost/preprocessor/iteration/iterate.hpp>
+
+ #include <boost/mpl/int.hpp>
+ #include <boost/mpl/less.hpp>
+ #include <boost/mpl/size.hpp>
+
+namespace boost { namespace dataflow {
+
+namespace detail {
+
+ template<typename Mechanism, typename T, int N>
+ struct lazy_is_same_proxy_port_traits_mechanism
+ {
+ typedef typename is_same<Mechanism, typename mpl::at_c<typename T::proxy_port_traits, N>::type::mechanism>::type type;
+ };
+
+ template<typename PortCategory, typename T, int N>
+ struct lazy_is_same_proxy_port_traits_port_category
+ {
+ typedef typename is_same<PortCategory, typename mpl::at_c<typename T::proxy_port_traits, N>::type::port_category>::type type;
+ };
+}
+
+} }
+
+ #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 1, <boost/dataflow/support/port/detail/proxy_port_traits_sequence.hpp>))
+ #include BOOST_PP_ITERATE()
+
+ #endif
+
+#else
+
+namespace boost { namespace dataflow {
+
+
+template<typename Mechanism, typename PortCategory, typename T>
+struct proxy_port_traits_of<Mechanism, PortCategory, T,
+ typename enable_if<
+ mpl::and_<
+ mpl::is_sequence<typename T::proxy_port_traits>,
+ typename mpl::less<
+ mpl::int_<BOOST_PP_ITERATION()>,
+ typename mpl::size<typename T::proxy_port_traits>::type
+ >::type,
+ detail::lazy_is_same_proxy_port_traits_mechanism<Mechanism, T, BOOST_PP_ITERATION()>,
+ detail::lazy_is_same_proxy_port_traits_port_category<PortCategory, T, BOOST_PP_ITERATION()>
+ >
+ >::type
+>
+{
+ typedef typename mpl::at_c<typename T::proxy_port_traits, BOOST_PP_ITERATION()>::type type;
+ BOOST_MPL_ASSERT(( is_proxy_port_traits<type> ));
+};
+
+}}
+
+#endif
Modified: sandbox/SOC/2007/signals/boost/dataflow/support/proxy_port.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/dataflow/support/proxy_port.hpp (original)
+++ sandbox/SOC/2007/signals/boost/dataflow/support/proxy_port.hpp 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
@@ -37,7 +37,7 @@
: public mpl::true_
{};
-template<typename Mechanism, typename PortCategory, typename T>
+template<typename Mechanism, typename PortCategory, typename T, typename GetProxiedObject>
struct default_proxy_port : public proxy_port_traits<Mechanism, PortCategory>
{};
@@ -57,6 +57,29 @@
typedef typename T::template dataflow<Mechanism, PortCategory>::proxy_port_traits type;
};
+/// Specialization allowing intrusive specification of the PortTraits.
+template<typename Mechanism, typename PortCategory, typename T>
+struct proxy_port_traits_of<Mechanism, PortCategory, T,
+ typename enable_if<
+ mpl::and_<
+ mpl::not_<mpl::is_sequence<typename T::proxy_port_traits> >,
+ is_same<Mechanism, typename T::proxy_port_traits::mechanism>,
+ is_same<PortCategory, typename T::proxy_port_traits::category>
+ >
+ >::type
+>
+{
+ typedef typename T::proxy_port_traits type;
+ BOOST_MPL_ASSERT(( is_proxy_port_traits<type> ));
+};
+
+} }
+
+/// Specialization allowing intrusive specification of a sequence of PortTraits.
+#include <boost/dataflow/support/port/detail/proxy_port_traits_sequence.hpp>
+
+namespace boost { namespace dataflow {
+
template<typename Mechanism, typename PortCategory, typename T>
struct is_proxy_port<Mechanism, PortCategory, T,
typename detail::enable_if_defined<
@@ -83,8 +106,8 @@
namespace extension
{
- template<typename Mechanism, typename PortCategory, typename ProxiedPort>
- struct get_port_impl<default_proxy_port<Mechanism, PortCategory, ProxiedPort> >
+ template<typename Mechanism, typename PortCategory, typename ProxiedPort, typename GetProxiedObject>
+ struct get_port_impl<default_proxy_port<Mechanism, PortCategory, ProxiedPort, GetProxiedObject> >
{
template<typename ProxyPort>
struct apply
@@ -98,9 +121,7 @@
static type call(ProxyPort &t)
{
- return get_port<Mechanism, PortCategory>(
- ProxyPort::template dataflow<Mechanism, PortCategory>
- ::get_proxied_port(t));
+ return get_port<Mechanism, PortCategory>(GetProxiedObject()(t));
}
};
};
Copied: sandbox/SOC/2007/signals/boost/dataflow/support/unary_operation.hpp (from r39908, /sandbox/SOC/2007/signals/boost/dataflow/support/disconnect_all_outs.hpp)
==============================================================================
--- /sandbox/SOC/2007/signals/boost/dataflow/support/disconnect_all_outs.hpp (original)
+++ sandbox/SOC/2007/signals/boost/dataflow/support/unary_operation.hpp 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
@@ -3,66 +3,76 @@
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#ifndef BOOST_DATAFLOW_SUPPORT_DISCONNECT_ALL_OUTS_HPP
-#define BOOST_DATAFLOW_SUPPORT_DISCONNECT_ALL_OUTS_HPP
+#ifndef BOOST_DATAFLOW_SUPPORT_UNARY_OPERATION_HPP
+#define BOOST_DATAFLOW_SUPPORT_UNARY_OPERATION_HPP
-#include <boost/dataflow/detail/enable_if_defined.hpp>
+#include <boost/dataflow/support/port.hpp>
#include <boost/static_assert.hpp>
-#include <boost/type_traits/integral_constant.hpp>
namespace boost { namespace dataflow {
+namespace detail {
+ struct not_implemented;
+}
+
+namespace operations
+{
+ struct disconnect_all;
+}
+
namespace extension
{
- template<typename Mechanism, typename ProducerTag, typename Enable=void>
- struct disconnect_all_outs_impl
+ template<typename Operation, typename PortTraits, typename Enable=void>
+ struct unary_operation_impl
{
template<typename Producer>
struct apply
{
struct detail
{
- typedef void disconnect_all_outs_impl_unspecialized;
+ typedef void not_specialized;
};
static void call(Producer &)
{
- // Error: disconnect_all_outs_impl has not been implemented for
- // ProducerTag.
+ // Error: unary_operation_impl Operation has not been
+ // implemented for PortTraits.
BOOST_STATIC_ASSERT(sizeof(Producer)==0);
}
};
};
}
-template<typename Mechanism, typename T, typename Enable=void>
-struct is_out_disconnectable
- : public boost::true_type {};
-
-template<typename Mechanism, typename Producer>
-struct is_out_disconnectable<
+template<typename Operation, typename Mechanism, typename PortCategory, typename T, typename Enable=void>
+struct implements_unary_operation
+ : public mpl::true_ {};
+
+template<typename Operation, typename Mechanism, typename Producer, typename PortCategory, typename T>
+struct implements_unary_operation<
+ Operation,
Mechanism,
- Producer,
+ PortCategory,
+ T,
typename detail::enable_if_defined<
- typename extension::disconnect_all_outs_impl<
- Mechanism,
- typename producer_category_of<Mechanism, Producer>::type
- >::detail::template apply<Producer>::disconnect_all_outs_impl_unspecified
+ typename extension::unary_operation_impl<
+ Operation,
+ typename port_traits_of<Mechanism, PortCategory, Producer>::type
+ >::template apply<Producer>::detail::not_specialized
>::type
>
- : public boost::false_type {};
+ : public mpl::false_ {};
-template<typename Mechanism, typename Producer>
-void disconnect_all_outs(Producer &producer)
+template<typename Operation, typename Mechanism, typename PortCategory, typename Port>
+void unary_operation(Port &producer)
{
- extension::disconnect_all_outs_impl<
- Mechanism,
- typename producer_category_of<Mechanism, Producer>::type
- >::template apply<Producer>::call(producer);
+ extension::unary_operation_impl<
+ Operation,
+ typename port_traits_of<Mechanism, PortCategory, Port>::type
+ >::template apply<Port>::call(producer);
}
} } // namespace boost::dataflow
-#endif // BOOST_DATAFLOW_SUPPORT_DISCONNECT_ALL_OUTS_HPP
+#endif // BOOST_DATAFLOW_SUPPORT_UNARY_OPERATION_HPP
Modified: sandbox/SOC/2007/signals/libs/dataflow/build/xcodeide/signal_network.xcodeproj/project.pbxproj
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/build/xcodeide/signal_network.xcodeproj/project.pbxproj (original)
+++ sandbox/SOC/2007/signals/libs/dataflow/build/xcodeide/signal_network.xcodeproj/project.pbxproj 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
@@ -83,9 +83,6 @@
08061C2D0CBEE985002DC710 /* binary_operation.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = binary_operation.hpp; sourceTree = "<group>"; };
08061C980CBEF0C6002DC710 /* keyed_port.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = keyed_port.hpp; sourceTree = "<group>"; };
08061CC40CBEF3F7002DC710 /* port_map.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = port_map.hpp; sourceTree = "<group>"; };
- 082761BB0C6037740030E557 /* producer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = producer.hpp; sourceTree = "<group>"; };
- 082761BC0C6037940030E557 /* consumer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = consumer.hpp; sourceTree = "<group>"; };
- 082761BD0C60379F0030E557 /* connectable.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = connectable.hpp; sourceTree = "<group>"; };
082761BE0C6037A90030E557 /* invocable.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = invocable.hpp; sourceTree = "<group>"; };
083FD3B90C62A4CB00EF3F6B /* concepts.qbk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = concepts.qbk; sourceTree = "<group>"; };
083FD3C10C62A75B00EF3F6B /* concepts.qbk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = concepts.qbk; sourceTree = "<group>"; };
@@ -93,8 +90,8 @@
084482560CA0B37200B88137 /* operators.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = operators.hpp; sourceTree = "<group>"; };
08668C4E0C19A16300ACB19A /* example.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = example.cpp; sourceTree = "<group>"; };
08668C4F0C19A16300ACB19A /* Jamfile.v2 */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = Jamfile.v2; sourceTree = "<group>"; };
- 089A9A090C931A1800C6C5F1 /* proxy_consumer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = proxy_consumer.hpp; sourceTree = "<group>"; };
- 089A9A150C931BDD00C6C5F1 /* producer_map.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = producer_map.hpp; sourceTree = "<group>"; };
+ 08B9D4190CC3D0790050F10B /* test_binary_op.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = test_binary_op.cpp; sourceTree = "<group>"; };
+ 08B9D41E0CC3D0A80050F10B /* my_producer_consumer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = my_producer_consumer.hpp; sourceTree = "<group>"; };
08C3EEA20C625AE30074AB9E /* simple_example.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = simple_example.cpp; sourceTree = "<group>"; };
08C675970C13A03E00D85379 /* Jamfile.v2 */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = Jamfile.v2; sourceTree = "<group>"; };
08DC14FC0C951C4800B96B2E /* Cone.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Cone.cxx; sourceTree = "<group>"; };
@@ -134,14 +131,16 @@
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>"; };
- 08F076F80C63C78C003D448D /* consumer_map.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = consumer_map.hpp; sourceTree = "<group>"; };
08F077830C63F736003D448D /* components.qbk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = components.qbk; sourceTree = "<group>"; };
08F079950CA88EBF001E6E24 /* connect.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = connect.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>"; };
- 08F14AE60CA8A72700C8296E /* disconnect_all_outs.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = disconnect_all_outs.hpp; sourceTree = "<group>"; };
+ 08F1CD280CC55A5100EB5B4A /* port_traits_sequence.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = port_traits_sequence.hpp; sourceTree = "<group>"; };
08F20FB60C95AD97005D01D4 /* filter.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = filter.hpp; sourceTree = "<group>"; };
+ 08F217BB0CC570CD00F9A91B /* proxy_port_traits_sequence.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = proxy_port_traits_sequence.hpp; sourceTree = "<group>"; };
+ 08F21F770CC6A2EB00DE649A /* test_unary_op.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_unary_op.cpp; sourceTree = "<group>"; };
+ 08F21FAD0CC6ABCF00DE649A /* component.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = component.hpp; 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>"; };
@@ -154,23 +153,18 @@
08F2464D0CA86D85001C3D41 /* Cone4.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Cone4.cxx; sourceTree = "<group>"; };
08F2464E0CA86D85001C3D41 /* Cone5.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Cone5.cxx; sourceTree = "<group>"; };
08F2464F0CA86D85001C3D41 /* Cone6.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Cone6.cxx; sourceTree = "<group>"; };
+ 08F24D6E0CC4419F00FC4A0C /* test_keyed_port.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_keyed_port.cpp; sourceTree = "<group>"; };
08F26C8B0CBF1CBA00EDC3F6 /* test_port.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_port.cpp; sourceTree = "<group>"; };
08F26D630CBF2D4100EDC3F6 /* test_proxy_port.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_proxy_port.cpp; sourceTree = "<group>"; };
08F2C31A0CAD961F00F9100C /* operators.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = operators.hpp; sourceTree = "<group>"; };
08F2C31B0CAD961F00F9100C /* support.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = support.hpp; sourceTree = "<group>"; };
- 08F308790CA6E54200652D11 /* keyed_producer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = keyed_producer.hpp; sourceTree = "<group>"; };
- 08F343460CAAEF92004F6DA7 /* disconnect_all_ins.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = disconnect_all_ins.hpp; sourceTree = "<group>"; };
08F348510C492B4B0096097F /* group.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = group.hpp; sourceTree = "<group>"; };
08F348970CC021E0006D0A67 /* copy_cv.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = copy_cv.hpp; sourceTree = "<group>"; };
08F36DFB0C41375B00E2F9A1 /* dataflow_table.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = dataflow_table.xml; sourceTree = "<group>"; };
08F37EDF0C57A4A700AC7FB8 /* static_function_call.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = static_function_call.hpp; sourceTree = "<group>"; };
08F3FE0C0CA0975100F0E144 /* common.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = common.hpp; sourceTree = "<group>"; };
- 08F404190CAA055C00E80B8C /* keyed_consumer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = keyed_consumer.hpp; sourceTree = "<group>"; };
- 08F404420CAA0C5200E80B8C /* only_connectable.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = only_connectable.hpp; sourceTree = "<group>"; };
- 08F418060CBD69DC007E7F7A /* header.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = header.hpp; sourceTree = "<group>"; };
08F418080CBD69FE007E7F7A /* port.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = port.hpp; sourceTree = "<group>"; };
08F418AB0CBD7668007E7F7A /* proxy_port.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = proxy_port.hpp; sourceTree = "<group>"; };
- 08F4533A0C92259D00877528 /* proxy_producer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = proxy_producer.hpp; sourceTree = "<group>"; };
08F4FBB80C56AFDF00EB271A /* producer_wrapper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = producer_wrapper.hpp; sourceTree = "<group>"; };
08F4FC170C56C96300EB271A /* producer_container.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = producer_container.hpp; sourceTree = "<group>"; };
08F585BE0C5A7ED70086F4F4 /* concepts.qbk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = concepts.qbk; sourceTree = "<group>"; };
@@ -205,6 +199,7 @@
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>"; };
+ 08FCB38D0CC5DCD2003906C1 /* unary_operation.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = unary_operation.hpp; sourceTree = "<group>"; };
08FCEFCE0CB9CEB000BBB599 /* future.qbk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = future.qbk; sourceTree = "<group>"; };
08FD5E4D0C1BA60800F00877 /* Jamfile.v2 */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = Jamfile.v2; sourceTree = "<group>"; };
08FD5E4E0C1BA60800F00877 /* dataflow.qbk */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = dataflow.qbk; sourceTree = "<group>"; };
@@ -266,11 +261,15 @@
08C675960C13A03E00D85379 /* test */ = {
isa = PBXGroup;
children = (
+ 08B9D4190CC3D0790050F10B /* test_binary_op.cpp */,
08F71D3D0CA3547C0010099E /* signals */,
08C675970C13A03E00D85379 /* Jamfile.v2 */,
08F8A00B0C3C879C007637A9 /* test_result_of_defined.cpp */,
08F26C8B0CBF1CBA00EDC3F6 /* test_port.cpp */,
08F26D630CBF2D4100EDC3F6 /* test_proxy_port.cpp */,
+ 08B9D41E0CC3D0A80050F10B /* my_producer_consumer.hpp */,
+ 08F24D6E0CC4419F00FC4A0C /* test_keyed_port.cpp */,
+ 08F21F770CC6A2EB00DE649A /* test_unary_op.cpp */,
);
name = test;
path = ../../test;
@@ -365,24 +364,16 @@
08F01F950C470E1500C0ED27 /* support */ = {
isa = PBXGroup;
children = (
- 082761BB0C6037740030E557 /* producer.hpp */,
- 082761BC0C6037940030E557 /* consumer.hpp */,
- 082761BD0C60379F0030E557 /* connectable.hpp */,
+ 08FCB38D0CC5DCD2003906C1 /* unary_operation.hpp */,
+ 08F1CD260CC55A2A00EB5B4A /* port */,
082761BE0C6037A90030E557 /* invocable.hpp */,
- 08F4533A0C92259D00877528 /* proxy_producer.hpp */,
- 089A9A090C931A1800C6C5F1 /* proxy_consumer.hpp */,
08F20FB60C95AD97005D01D4 /* filter.hpp */,
08F3FE0C0CA0975100F0E144 /* common.hpp */,
- 08F308790CA6E54200652D11 /* keyed_producer.hpp */,
- 08F14AE60CA8A72700C8296E /* disconnect_all_outs.hpp */,
- 08F404190CAA055C00E80B8C /* keyed_consumer.hpp */,
- 08F404420CAA0C5200E80B8C /* only_connectable.hpp */,
- 08F343460CAAEF92004F6DA7 /* disconnect_all_ins.hpp */,
- 08F418060CBD69DC007E7F7A /* header.hpp */,
08F418080CBD69FE007E7F7A /* port.hpp */,
08F418AB0CBD7668007E7F7A /* proxy_port.hpp */,
08061C2D0CBEE985002DC710 /* binary_operation.hpp */,
08061C980CBEF0C6002DC710 /* keyed_port.hpp */,
+ 08F21FAD0CC6ABCF00DE649A /* component.hpp */,
);
path = support;
sourceTree = "<group>";
@@ -402,8 +393,6 @@
08F348500C492B320096097F /* operator */,
08F022C20C47556200C0ED27 /* group.hpp */,
08F022C70C47565600C0ED27 /* operators.hpp */,
- 08F076F80C63C78C003D448D /* consumer_map.hpp */,
- 089A9A150C931BDD00C6C5F1 /* producer_map.hpp */,
08061CC40CBEF3F7002DC710 /* port_map.hpp */,
);
path = connection;
@@ -417,6 +406,23 @@
path = templates;
sourceTree = "<group>";
};
+ 08F1CD260CC55A2A00EB5B4A /* port */ = {
+ isa = PBXGroup;
+ children = (
+ 08F1CD270CC55A2A00EB5B4A /* detail */,
+ );
+ path = port;
+ sourceTree = "<group>";
+ };
+ 08F1CD270CC55A2A00EB5B4A /* detail */ = {
+ isa = PBXGroup;
+ children = (
+ 08F1CD280CC55A5100EB5B4A /* port_traits_sequence.hpp */,
+ 08F217BB0CC570CD00F9A91B /* proxy_port_traits_sequence.hpp */,
+ );
+ path = detail;
+ sourceTree = "<group>";
+ };
08F22F1B0C4C1CC70027D364 /* connection */ = {
isa = PBXGroup;
children = (
Modified: sandbox/SOC/2007/signals/libs/dataflow/test/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/test/Jamfile.v2 (original)
+++ sandbox/SOC/2007/signals/libs/dataflow/test/Jamfile.v2 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
@@ -17,4 +17,6 @@
#run test_result_of_defined.cpp ;
run test_port.cpp ;
run test_proxy_port.cpp ;
-
+run test_unary_op.cpp ;
+run test_binary_op.cpp ;
+run test_keyed_port.cpp ;
Added: sandbox/SOC/2007/signals/libs/dataflow/test/my_producer_consumer.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/dataflow/test/my_producer_consumer.hpp 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
@@ -0,0 +1,39 @@
+// 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_TEST_MY_PRODUCER_CONSUMER_HPP
+#define DATAFLOW_TEST_MY_PRODUCER_CONSUMER_HPP
+
+#include <boost/dataflow/support/port.hpp>
+
+
+namespace df = boost::dataflow;
+
+struct incomplete;
+struct empty {};
+
+struct my_mechanism;
+
+struct my_producer_traits
+ : public df::port_traits<
+ my_mechanism,
+ df::ports::producer,
+ df::concepts::producer>
+{};
+
+struct my_consumer_traits
+ : public df::port_traits<
+ my_mechanism,
+ df::ports::consumer,
+ df::concepts::consumer>
+{};
+
+struct my_producer : public df::port<my_producer_traits>
+{};
+
+struct my_consumer : public df::port<my_consumer_traits>
+{};
+
+#endif
Added: sandbox/SOC/2007/signals/libs/dataflow/test/test_binary_op.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/dataflow/test/test_binary_op.cpp 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
@@ -0,0 +1,76 @@
+// 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)
+
+#include "my_producer_consumer.hpp"
+#include <boost/dataflow/support/binary_operation.hpp>
+
+bool connected = false;
+bool only_connected = false;
+bool disconnected = false;
+
+namespace boost { namespace dataflow { namespace extension {
+
+template<>
+struct binary_operation_impl<operations::connect, my_producer_traits, my_consumer_traits>
+{
+ template<typename Producer, typename Consumer>
+ struct apply
+ {
+ static void call(Producer &, Consumer &)
+ {
+ connected = true;
+ }
+ };
+};
+
+template<>
+struct binary_operation_impl<operations::connect_only, my_producer_traits, my_consumer_traits>
+{
+ template<typename Producer, typename Consumer>
+ struct apply
+ {
+ static void call(Producer &, Consumer &)
+ {
+ only_connected = true;
+ }
+ };
+};
+
+template<>
+struct binary_operation_impl<operations::disconnect, my_producer_traits, my_consumer_traits>
+{
+ template<typename Producer, typename Consumer>
+ struct apply
+ {
+ static void call(Producer &, Consumer &)
+ {
+ disconnected = true;
+ }
+ };
+};
+
+}}}
+
+#include <boost/test/included/test_exec_monitor.hpp>
+
+namespace df = boost::dataflow;
+
+int test_main(int, char* [])
+{
+ my_producer p;
+ my_consumer c;
+
+ df::binary_operation<df::operations::connect, my_mechanism>(p, c);
+ BOOST_CHECK(connected);
+
+ df::binary_operation<df::operations::connect_only, my_mechanism>(p, c);
+ BOOST_CHECK(only_connected);
+
+ df::binary_operation<df::operations::disconnect, my_mechanism>(p, c);
+ BOOST_CHECK(disconnected);
+
+ return 0;
+} // int test_main(int, char* [])
+
Added: sandbox/SOC/2007/signals/libs/dataflow/test/test_keyed_port.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/dataflow/test/test_keyed_port.cpp 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
@@ -0,0 +1,92 @@
+// 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)
+
+#include "my_producer_consumer.hpp"
+#include <boost/dataflow/support/keyed_port.hpp>
+#include <boost/dataflow/connection/port_map.hpp>
+
+#include <boost/fusion/sequence/container/map.hpp>
+#include <boost/test/included/test_exec_monitor.hpp>
+
+namespace df = boost::dataflow;
+
+bool connected = false;
+bool connected_other = false;
+
+struct my_other_producer_traits
+ : public df::port_traits<
+ my_mechanism,
+ df::ports::producer,
+ df::concepts::producer>
+{};
+
+struct my_other_consumer_traits
+ : public df::port_traits<
+ my_mechanism,
+ df::ports::consumer,
+ df::concepts::consumer>
+{};
+
+struct my_other_producer : public df::port<my_other_producer_traits>
+{};
+
+struct my_other_consumer : public df::port<my_other_consumer_traits>
+{};
+
+namespace boost { namespace dataflow { namespace extension {
+
+template<>
+struct binary_operation_impl<operations::connect, my_producer_traits, my_consumer_traits>
+{
+ template<typename Producer, typename Consumer>
+ struct apply
+ {
+ static void call(Producer &, Consumer &)
+ {
+ connected = true;
+ }
+ };
+};
+
+template<>
+struct binary_operation_impl<operations::connect, my_other_producer_traits, my_other_consumer_traits>
+{
+ template<typename Producer, typename Consumer>
+ struct apply
+ {
+ static void call(Producer &, Consumer &)
+ {
+ connected_other = true;
+ }
+ };
+};
+
+}}}
+
+int test_main(int, char* [])
+{
+ my_consumer consumer;
+ my_other_consumer other_consumer;
+ my_producer producer;
+ my_other_producer other_producer;
+
+ typedef
+ boost::fusion::map<
+ boost::fusion::pair<my_consumer_traits, my_producer &>,
+ boost::fusion::pair<my_other_consumer_traits, my_other_producer &>
+ > map_type;
+
+ df::port_map<
+ my_mechanism,
+ df::ports::producer,
+ map_type
+ > producer_map(map_type(producer, other_producer));
+
+ df::binary_operation<df::operations::connect, my_mechanism>(producer_map, consumer);
+ df::binary_operation<df::operations::connect, my_mechanism>(producer_map, other_consumer);
+
+ return 0;
+} // int test_main(int, char* [])
+
Modified: sandbox/SOC/2007/signals/libs/dataflow/test/test_port.cpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/test/test_port.cpp (original)
+++ sandbox/SOC/2007/signals/libs/dataflow/test/test_port.cpp 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
@@ -3,36 +3,10 @@
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#include <boost/dataflow/support/port.hpp>
+#include "my_producer_consumer.hpp"
#include <boost/test/included/test_exec_monitor.hpp>
-namespace df = boost::dataflow;
-
-struct incomplete;
-struct empty {};
-
-struct my_mechanism;
-
-struct my_producer_traits
- : public df::port_traits<
- my_mechanism,
- df::ports::producer,
- df::concepts::producer>
-{};
-
-struct my_consumer_traits
- : public df::port_traits<
- my_mechanism,
- df::ports::consumer,
- df::concepts::consumer>
-{};
-
-struct my_producer : public df::port<my_producer_traits>
-{};
-
-struct my_consumer : public df::port<my_consumer_traits>
-{};
int test_main(int, char* [])
{
Modified: sandbox/SOC/2007/signals/libs/dataflow/test/test_proxy_port.cpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/test/test_proxy_port.cpp (original)
+++ sandbox/SOC/2007/signals/libs/dataflow/test/test_proxy_port.cpp 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
@@ -3,85 +3,66 @@
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
+#include "my_producer_consumer.hpp"
#include <boost/dataflow/support/proxy_port.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
-namespace df = boost::dataflow;
-
-struct incomplete;
-struct empty {};
-
-struct my_mechanism;
-
-struct my_producer_traits
- : public df::port_traits<
- my_mechanism,
- df::ports::producer,
- df::concepts::producer>
-{};
-
-struct my_producer : public df::port<my_producer_traits>
-{};
struct my_proxy_producer
{
public:
my_producer p;
+
+ struct get_my_producer
+ {
+ template<typename T>
+ typename boost::dataflow::utility::copy_cv<my_producer, T>::type &
+ operator()(T &t)
+ {
+ return t.p;
+ }
+ };
- template<typename Mechanism, typename PortCategory>
- struct dataflow;
-};
-
-template<>
-struct my_proxy_producer::dataflow<my_mechanism, df::ports::producer>
-{
typedef df::default_proxy_port<
my_mechanism,
df::ports::producer,
- my_producer> proxy_port_traits;
-
- template<typename T>
- static typename boost::dataflow::utility::copy_cv<my_producer, T>::type &
- get_proxied_port(T &t)
- {
- return t.p;
- };
+ my_producer,
+ get_my_producer
+ > proxy_port_traits;
};
struct my_proxy_proxy_producer
{
public:
my_proxy_producer proxy;
-
- template<typename Mechanism, typename PortCategory>
- struct dataflow;
-};
-template<>
-struct my_proxy_proxy_producer::dataflow<my_mechanism, df::ports::producer>
-{
+ struct get_my_proxy_producer
+ {
+ template<typename T>
+ typename boost::dataflow::utility::copy_cv<my_proxy_producer, T>::type &
+ operator()(T &t)
+ {
+ return t.proxy;
+ }
+ };
+
typedef df::default_proxy_port<
my_mechanism,
df::ports::producer,
- my_proxy_producer> proxy_port_traits;
-
- template<typename T>
- static typename boost::dataflow::utility::copy_cv<my_proxy_producer, T>::type &
- get_proxied_port(T &t)
- {
- return t.proxy;
- };
+ my_proxy_producer,
+ get_my_proxy_producer> proxy_port_traits;
};
-
int test_main(int, char* [])
{
BOOST_CHECK(( df::is_proxy_port_traits<
df::default_proxy_port<
my_mechanism,
df::ports::producer,
- my_producer>
+ my_producer,
+ my_proxy_producer::get_my_producer
+ >
>::value ));
BOOST_CHECK(( df::is_proxy_port<my_mechanism, df::ports::producer, my_proxy_producer>::value ));
Added: sandbox/SOC/2007/signals/libs/dataflow/test/test_unary_op.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/dataflow/test/test_unary_op.cpp 2007-10-17 17:12:27 EDT (Wed, 17 Oct 2007)
@@ -0,0 +1,41 @@
+// 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)
+
+#include "my_producer_consumer.hpp"
+#include <boost/dataflow/support/unary_operation.hpp>
+
+bool disconnected = false;
+
+namespace boost { namespace dataflow { namespace extension {
+
+template<>
+struct unary_operation_impl<operations::disconnect_all, my_producer_traits>
+{
+ template<typename Producer>
+ struct apply
+ {
+ static void call(Producer &)
+ {
+ disconnected = true;
+ }
+ };
+};
+
+}}}
+
+#include <boost/test/included/test_exec_monitor.hpp>
+
+namespace df = boost::dataflow;
+
+int test_main(int, char* [])
+{
+ my_producer p;
+
+ df::unary_operation<df::operations::disconnect_all, my_mechanism, df::ports::producer>(p);
+ BOOST_CHECK(disconnected);
+
+ return 0;
+} // int test_main(int, char* [])
+
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