Boost logo

Boost-Commit :

From: stipe_at_[hidden]
Date: 2008-06-26 13:35:21


Author: srajko
Date: 2008-06-26 13:35:19 EDT (Thu, 26 Jun 2008)
New Revision: 46733
URL: http://svn.boost.org/trac/boost/changeset/46733

Log:
added DynamicPort concept, implementation and Blueprint implementation
Added:
   sandbox/SOC/2007/signals/boost/dataflow/blueprint/dynamic_port_t.hpp (contents, props changed)
   sandbox/SOC/2007/signals/boost/dataflow/support/dynamic_port.hpp (contents, props changed)
   sandbox/SOC/2007/signals/libs/dataflow/doc/layers.png (contents, props changed)
   sandbox/SOC/2007/signals/libs/dataflow/test/blueprint/test_dynamic_port.cpp (contents, props changed)
   sandbox/SOC/2007/signals/libs/dataflow/test/dynamic_multi_port.hpp (contents, props changed)
   sandbox/SOC/2007/signals/libs/dataflow/test/test_dynamic_port.cpp (contents, props changed)
Text files modified:
   sandbox/SOC/2007/signals/boost/dataflow/blueprint/port_t.hpp | 1
   sandbox/SOC/2007/signals/boost/dataflow/support/component.hpp | 1
   sandbox/SOC/2007/signals/boost/dataflow/support/detail/make_specializable_operation.hpp | 110 ++++++++++++++++++++++++++++------------
   sandbox/SOC/2007/signals/boost/dataflow/support/port_vector.hpp | 1
   sandbox/SOC/2007/signals/boost/dataflow/support/runtime.hpp | 3 +
   sandbox/SOC/2007/signals/libs/dataflow/build/xcodeide/dataflow.xcodeproj/project.pbxproj | 10 +++
   sandbox/SOC/2007/signals/libs/dataflow/doc/dataflow.qbk | 2
   sandbox/SOC/2007/signals/libs/dataflow/doc/support/concepts/port.qbk | 68 ++++++++++++++++++++++++
   sandbox/SOC/2007/signals/libs/dataflow/test/Jamfile.v2 | 1
   sandbox/SOC/2007/signals/libs/dataflow/test/blueprint/Jamfile.v2 | 3
   10 files changed, 165 insertions(+), 35 deletions(-)

Added: sandbox/SOC/2007/signals/boost/dataflow/blueprint/dynamic_port_t.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/dataflow/blueprint/dynamic_port_t.hpp 2008-06-26 13:35:19 EDT (Thu, 26 Jun 2008)
@@ -0,0 +1,74 @@
+// 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_BLUEPRINT_DYNAMIC_PORT_T_HPP
+#define BOOST_DATAFLOW_BLUEPRINT_DYNAMIC_PORT_T_HPP
+
+#include <boost/dataflow/blueprint/port_t.hpp>
+#include <boost/dataflow/support/dynamic_port.hpp>
+
+#include <boost/ptr_container/ptr_vector.hpp>
+
+
+namespace boost { namespace dataflow { namespace blueprint {
+
+namespace detail {
+
+ template<typename Base, typename PortOrRef, typename Tag>
+ class dynamic_port_impl
+ : public port_t_base<Base, PortOrRef, Tag>
+ {
+ protected:
+ typedef typename dynamic_port_impl::port_type port_type;
+ typedef typename dynamic_port_impl::port_traits_type port_traits_type;
+
+ public:
+ dynamic_port_impl(typename call_traits<PortOrRef>::param_type p)
+ : port_t_base<Base, PortOrRef, Tag>(p)
+ {
+ }
+
+ size_t num_ports() const
+ {
+ return get_dynamic_port_size<Tag>(dynamic_port_impl::p);
+ }
+ port & get_port(int port_num)
+ {
+ return m_ports[port_num];
+ }
+
+ protected:
+ ptr_vector<port> m_ports;
+ private:
+ void port_t_()
+ {
+ for(size_t i=0; i<num_ports(); i++)
+ m_ports.push_back(new port_t<result_of::get_subport<port_type, Tag> >(get_subport<Tag>(dynamic_port_impl::p, i)));
+ }
+ };
+}
+
+template<typename PortOrRef, typename Tag>
+class port_t<
+ PortOrRef,
+ Tag,
+ typename enable_if<
+ is_dynamic_port<typename remove_reference<PortOrRef>::type,Tag>
+ >::type >
+ : public detail::dynamic_port_impl<vector_port, PortOrRef, Tag>
+{
+public:
+ port_t(typename call_traits<PortOrRef>::param_type p)
+ : detail::dynamic_port_impl<vector_port, PortOrRef, Tag>(p)
+ {}
+ virtual port *clone() const
+ {
+ return new port_t(*this);
+ };
+};
+
+} } } // namespace boost::dataflow::blueprint
+
+#endif // BOOST_DATAFLOW_BLUEPRINT_DYNAMIC_PORT_T_HPP

Modified: sandbox/SOC/2007/signals/boost/dataflow/blueprint/port_t.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/dataflow/blueprint/port_t.hpp (original)
+++ sandbox/SOC/2007/signals/boost/dataflow/blueprint/port_t.hpp 2008-06-26 13:35:19 EDT (Thu, 26 Jun 2008)
@@ -152,5 +152,6 @@
 
 #include <boost/dataflow/blueprint/vector_port_t.hpp>
 #include <boost/dataflow/blueprint/keyed_port_t.hpp>
+#include <boost/dataflow/blueprint/dynamic_port_t.hpp>
 
 #endif // BOOST_DATAFLOW_BLUEPRINT_GET_PORT_HPP

Modified: sandbox/SOC/2007/signals/boost/dataflow/support/component.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/dataflow/support/component.hpp (original)
+++ sandbox/SOC/2007/signals/boost/dataflow/support/component.hpp 2008-06-26 13:35:19 EDT (Thu, 26 Jun 2008)
@@ -7,6 +7,7 @@
 #define BOOST_DATAFLOW_SUPPORT_COMPONENT_HPP
 
 #include <boost/dataflow/utility/enable_if_type.hpp>
+#include <boost/dataflow/support/port/default_port_provider.hpp>
 #include <boost/dataflow/support/port_vector.hpp>
 
 #include <boost/mpl/and.hpp>

Modified: sandbox/SOC/2007/signals/boost/dataflow/support/detail/make_specializable_operation.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/dataflow/support/detail/make_specializable_operation.hpp (original)
+++ sandbox/SOC/2007/signals/boost/dataflow/support/detail/make_specializable_operation.hpp 2008-06-26 13:35:19 EDT (Thu, 26 Jun 2008)
@@ -15,10 +15,14 @@
 #error DATAFLOW_SPECIALIZABLE_OPERATION_NAME undefined
 #endif
 #ifndef DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES
-#error DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES undefined
-#endif
-#ifndef DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES
-#error DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES undefined
+# define DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED 0
+# define DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES
+# define DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES
+#else
+# define DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED 1
+# ifndef DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES
+# error DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES undefined
+# endif
 #endif
 #ifndef DATAFLOW_SPECIALIZABLE_OPERATION_ARITY
 #error DATAFLOW_SPECIALIZABLE_OPERATION_ARITY undefined
@@ -39,12 +43,25 @@
 #define DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES_WDEFAULTS DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES
 #endif
 
+#ifndef DATAFLOW_SPECIALIZABLE_OPERATION_EXTRA_ARGS
+#define DATAFLOW_SPECIALIZABLE_OPERATION_EXTRA_ARGS
+#endif
+
+#ifndef DATAFLOW_SPECIALIZABLE_OPERATION_EXTRA_TYPENAME_ARGS
+#define DATAFLOW_SPECIALIZABLE_OPERATION_EXTRA_TYPENAME_ARGS
+#endif
+
+#ifndef DATAFLOW_SPECIALIZABLE_OPERATION_EXTRA_TYPENAMES
+#define DATAFLOW_SPECIALIZABLE_OPERATION_EXTRA_TYPENAMES
+#endif
+
 #ifndef BOOST_DATAFLOW_DETAIL_MAKE_SPECIALIZABLE_OPERATION
 #define BOOST_DATAFLOW_DETAIL_MAKE_SPECIALIZABLE_OPERATION
 
 #include <boost/mpl/assert.hpp>
 #include <boost/mpl/bool.hpp>
 #include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/comma_if.hpp>
 #include <boost/utility/result_of.hpp>
 
 namespace boost { namespace dataflow { namespace detail {
@@ -98,7 +115,8 @@
 {
     template<
         DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TRAITS,
- DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES,
+ DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES
+ BOOST_PP_COMMA_IF(DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED)
         typename Enable=void>
     struct DATAFLOW_SPECIALIZABLE_OPERATION_IMPL
     {
@@ -107,7 +125,7 @@
         typedef detail::not_specialized result_type;
                 
         template<DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TS>
- result_type operator()(DATAFLOW_SPECIALIZABLE_OPERATION_TARGS)
+ result_type operator()(DATAFLOW_SPECIALIZABLE_OPERATION_TARGS DATAFLOW_SPECIALIZABLE_OPERATION_EXTRA_TYPENAME_ARGS)
         {
             // Error: DATAFLOW_SPECIALIZABLE_OPERATION_IMPL has not been
             // specialized appropriately.
@@ -122,7 +140,8 @@
 
     template<
         DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TS,
- DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES_WDEFAULTS,
+ DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES_WDEFAULTS
+ BOOST_PP_COMMA_IF(DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED)
         typename Tag=default_tag,
         typename Enable=void>
     struct DATAFLOW_SPECIALIZABLE_OPERATION_CHECK_SPECIALIZED
@@ -131,16 +150,19 @@
     
     template<
         DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TS,
- DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES,
+ DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES
+ BOOST_PP_COMMA_IF(DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED)
         typename Tag>
     struct DATAFLOW_SPECIALIZABLE_OPERATION_CHECK_SPECIALIZED<
         DATAFLOW_SPECIALIZABLE_OPERATION_TS,
- DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES,
+ DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES
+ BOOST_PP_COMMA_IF(DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED)
         Tag,
         typename enable_if<
             is_same<
                typename extension::DATAFLOW_SPECIALIZABLE_OPERATION_IMPL<
- DATAFLOW_SPECIALIZABLE_OPERATION_GET_TRAITS,
+ DATAFLOW_SPECIALIZABLE_OPERATION_GET_TRAITS
+ BOOST_PP_COMMA_IF(DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED)
                     DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES
>::result_type,
                 detail::not_specialized>
@@ -152,7 +174,8 @@
 
 template<
     DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TS,
- DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES_WDEFAULTS,
+ DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES_WDEFAULTS
+ BOOST_PP_COMMA_IF(DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED)
     typename Tag=default_tag,
     typename Enable=void>
 struct DATAFLOW_SPECIALIZABLE_OPERATION_CHECK
@@ -161,18 +184,21 @@
 
 template<
     DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TS,
- DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES,
+ DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES
+ BOOST_PP_COMMA_IF(DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED)
     typename Tag>
 struct DATAFLOW_SPECIALIZABLE_OPERATION_CHECK<
     DATAFLOW_SPECIALIZABLE_OPERATION_TS,
- DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES,
+ DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES
+ BOOST_PP_COMMA_IF(DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED)
     Tag,
     typename enable_if<
         mpl::and_<
             DATAFLOW_SPECIALIZABLE_OPERATION_CHECK_TRAITS,
             detail::DATAFLOW_SPECIALIZABLE_OPERATION_CHECK_SPECIALIZED<
                 DATAFLOW_SPECIALIZABLE_OPERATION_TS,
- DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES,
+ DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES
+ BOOST_PP_COMMA_IF(DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED)
                 Tag>
>
>::type>
@@ -184,82 +210,96 @@
 
     template<
         DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TS,
- DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES_WDEFAULTS,
+ DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES_WDEFAULTS
+ BOOST_PP_COMMA_IF(DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED)
         typename Tag=default_tag>
     struct DATAFLOW_SPECIALIZABLE_OPERATION_NAME
     {
         typedef typename boost::result_of<
             extension::DATAFLOW_SPECIALIZABLE_OPERATION_IMPL<
- DATAFLOW_SPECIALIZABLE_OPERATION_GET_TRAITS,
+ DATAFLOW_SPECIALIZABLE_OPERATION_GET_TRAITS
+ BOOST_PP_COMMA_IF(DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED)
                 DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES
>
- (DATAFLOW_SPECIALIZABLE_OPERATION_TARGS)
+ (DATAFLOW_SPECIALIZABLE_OPERATION_TARGS DATAFLOW_SPECIALIZABLE_OPERATION_EXTRA_TYPENAMES)
>::type type;
     };
     
 }
 
 template<
- DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES,
+ DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES
+ BOOST_PP_COMMA_IF(DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED)
     typename Tag,
     DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TS>
 inline typename result_of::DATAFLOW_SPECIALIZABLE_OPERATION_NAME<
     DATAFLOW_SPECIALIZABLE_OPERATION_TS,
- DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES,
+ DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES
+ BOOST_PP_COMMA_IF(DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED)
     Tag>::type
-DATAFLOW_SPECIALIZABLE_OPERATION_NAME(DATAFLOW_SPECIALIZABLE_OPERATION_NAMED_TARGS)
+DATAFLOW_SPECIALIZABLE_OPERATION_NAME(DATAFLOW_SPECIALIZABLE_OPERATION_NAMED_TARGS DATAFLOW_SPECIALIZABLE_OPERATION_EXTRA_TYPENAME_ARGS)
 {
     return extension::DATAFLOW_SPECIALIZABLE_OPERATION_IMPL<
- DATAFLOW_SPECIALIZABLE_OPERATION_GET_TRAITS,
+ DATAFLOW_SPECIALIZABLE_OPERATION_GET_TRAITS
+ BOOST_PP_COMMA_IF(DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED)
         DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES
- >()(DATAFLOW_SPECIALIZABLE_OPERATION_TARGS_NAMES);
+ >()(DATAFLOW_SPECIALIZABLE_OPERATION_TARGS_NAMES DATAFLOW_SPECIALIZABLE_OPERATION_EXTRA_ARGS);
 }
 
 template<
- DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES,
+ DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES
+ BOOST_PP_COMMA_IF(DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED)
     typename Tag,
     DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TS>
 inline typename result_of::DATAFLOW_SPECIALIZABLE_OPERATION_NAME<
     DATAFLOW_SPECIALIZABLE_OPERATION_TS1,
- DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES,
+ DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES
+ BOOST_PP_COMMA_IF(DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED)
     Tag>::type
-DATAFLOW_SPECIALIZABLE_OPERATION_NAME(DATAFLOW_SPECIALIZABLE_OPERATION_NAMED_TARGS1)
+DATAFLOW_SPECIALIZABLE_OPERATION_NAME(DATAFLOW_SPECIALIZABLE_OPERATION_NAMED_TARGS1 DATAFLOW_SPECIALIZABLE_OPERATION_EXTRA_TYPENAME_ARGS)
 {
     return extension::DATAFLOW_SPECIALIZABLE_OPERATION_IMPL<
- DATAFLOW_SPECIALIZABLE_OPERATION_GET_TRAITS,
+ DATAFLOW_SPECIALIZABLE_OPERATION_GET_TRAITS
+ BOOST_PP_COMMA_IF(DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED)
         DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES
- >()(DATAFLOW_SPECIALIZABLE_OPERATION_TARGS_NAMES);
+ >()(DATAFLOW_SPECIALIZABLE_OPERATION_TARGS_NAMES DATAFLOW_SPECIALIZABLE_OPERATION_EXTRA_ARGS);
 }
 
 #if DATAFLOW_SPECIALIZABLE_OPERATION_ARITY==2
 template<
- DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES,
+ DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES
+ BOOST_PP_COMMA_IF(DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED)
     typename Tag,
     DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TS>
 inline typename result_of::DATAFLOW_SPECIALIZABLE_OPERATION_NAME<
     DATAFLOW_SPECIALIZABLE_OPERATION_TS2,
- DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES,
+ DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES
+ BOOST_PP_COMMA_IF(DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED)
     Tag>::type
 DATAFLOW_SPECIALIZABLE_OPERATION_NAME(DATAFLOW_SPECIALIZABLE_OPERATION_NAMED_TARGS2)
 {
     return extension::DATAFLOW_SPECIALIZABLE_OPERATION_IMPL<
- DATAFLOW_SPECIALIZABLE_OPERATION_GET_TRAITS,
+ DATAFLOW_SPECIALIZABLE_OPERATION_GET_TRAITS
+ BOOST_PP_COMMA_IF(DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED)
         DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES
>()(DATAFLOW_SPECIALIZABLE_OPERATION_TARGS_NAMES);
 }
 
 template<
- DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES,
+ DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES
+ BOOST_PP_COMMA_IF(DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED)
     typename Tag,
     DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TS>
 inline typename result_of::DATAFLOW_SPECIALIZABLE_OPERATION_NAME<
     DATAFLOW_SPECIALIZABLE_OPERATION_TS3,
- DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES,
+ DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES
+ BOOST_PP_COMMA_IF(DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED)
     Tag>::type
 DATAFLOW_SPECIALIZABLE_OPERATION_NAME(DATAFLOW_SPECIALIZABLE_OPERATION_NAMED_TARGS3)
 {
     return extension::DATAFLOW_SPECIALIZABLE_OPERATION_IMPL<
- DATAFLOW_SPECIALIZABLE_OPERATION_GET_TRAITS,
+ DATAFLOW_SPECIALIZABLE_OPERATION_GET_TRAITS
+ BOOST_PP_COMMA_IF(DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED)
         DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES
>()(DATAFLOW_SPECIALIZABLE_OPERATION_TARGS_NAMES);
 }
@@ -272,6 +312,10 @@
 #undef DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES
 #undef DATAFLOW_SPECIALIZABLE_OPERATION_TYPENAME_TEMPLATES_WDEFAULTS
 #undef DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES
+#undef DATAFLOW_SPECIALIZABLE_OPERATION_TEMPLATES_PROVIDED
+#undef DATAFLOW_SPECIALIZABLE_OPERATION_EXTRA_TYPENAME_ARGS
+#undef DATAFLOW_SPECIALIZABLE_OPERATION_EXTRA_TYPENAMES
+#undef DATAFLOW_SPECIALIZABLE_OPERATION_EXTRA_ARGS
 #undef DATAFLOW_SPECIALIZABLE_OPERATION_ARITY
 #undef DATAFLOW_SPECIALIZABLE_OPERATION_CHECK
 #undef DATAFLOW_SPECIALIZABLE_OPERATION_TRAITS_OF

Added: sandbox/SOC/2007/signals/boost/dataflow/support/dynamic_port.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/boost/dataflow/support/dynamic_port.hpp 2008-06-26 13:35:19 EDT (Thu, 26 Jun 2008)
@@ -0,0 +1,118 @@
+// 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_SUPPORT_DYNAMIC_PORT_HPP
+#define BOOST_DATAFLOW_SUPPORT_DYNAMIC_PORT_HPP
+
+#include <boost/dataflow/support/port/traits.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/static_assert.hpp>
+
+#ifndef DOXYGEN_DOCS_BUILD
+// ***************************************
+// * get_dynamic_port_size, has_dynamic_port_size
+// ***************************************
+#define DATAFLOW_SPECIALIZABLE_OPERATION_NAME get_dynamic_port_size
+#define DATAFLOW_SPECIALIZABLE_OPERATION_CHECK has_dynamic_port_size
+#define DATAFLOW_SPECIALIZABLE_OPERATION_ARITY 1
+#define DATAFLOW_SPECIALIZABLE_OPERATION_TRAITS_OF traits_of
+#define DATAFLOW_SPECIALIZABLE_OPERATION_HAS_TRAITS is_entity
+#include <boost/dataflow/support/detail/make_specializable_operation.hpp>
+
+#define DATAFLOW_SPECIALIZABLE_OPERATION_NAME get_subport
+#define DATAFLOW_SPECIALIZABLE_OPERATION_CHECK has_subport
+#define DATAFLOW_SPECIALIZABLE_OPERATION_ARITY 1
+#define DATAFLOW_SPECIALIZABLE_OPERATION_TRAITS_OF traits_of
+#define DATAFLOW_SPECIALIZABLE_OPERATION_HAS_TRAITS is_entity
+#define DATAFLOW_SPECIALIZABLE_OPERATION_EXTRA_TYPENAME_ARGS , size_t n
+#define DATAFLOW_SPECIALIZABLE_OPERATION_EXTRA_TYPENAMES , size_t
+#define DATAFLOW_SPECIALIZABLE_OPERATION_EXTRA_ARGS , n
+#include <boost/dataflow/support/detail/make_specializable_operation.hpp>
+
+#endif // DOXYGEN_DOCS_BUILD
+
+namespace boost { namespace dataflow {
+
+template<typename SubPort, typename Tag=default_tag>
+struct dynamic_port_traits
+ : public port_traits<typename traits_of<SubPort,Tag>::type::category, Tag>
+{
+ typedef SubPort subport_type;
+ /// INTERNAL ONLY
+ BOOST_MPL_ASSERT(( is_port<SubPort, Tag> ));
+};
+
+/// Boolean Metafunction determining whether a type is a DynamicPortTraits.
+template<typename DynamicPortTraits, typename Enable=detail::enable_guard>
+struct is_dynamic_port_traits : public mpl::false_
+{
+ /// INTERNAL ONLY
+ BOOST_MPL_ASSERT(( is_same<Enable, detail::enable_guard> ));
+};
+
+/// INTERNAL ONLY
+template<typename DynamicPortTraits>
+struct is_dynamic_port_traits<DynamicPortTraits,
+ typename utility::enable_if_type<
+ utility::all_of<
+ typename DynamicPortTraits::subport_type,
+ typename DynamicPortTraits::category,
+ typename DynamicPortTraits::tag
+ >,
+ detail::enable_guard
+ >::type>
+ : public mpl::true_
+{
+ /// INTERNAL ONLY
+ BOOST_MPL_ASSERT(( is_port<typename DynamicPortTraits::subport_type, typename DynamicPortTraits::tag> ));
+ /// INTERNAL ONLY
+ BOOST_MPL_ASSERT(( is_tag<typename DynamicPortTraits::tag>));
+};
+
+/// Boolean Metafunction determining whether a type is a DynamicPort.
+/** is_port<T, Tag> is an Integral Constant of type bool.
+ It evaluates to true if T models Port, false otherwise.
+*/
+template<typename T, typename Tag=default_tag, typename Enable=void>
+struct is_dynamic_port
+ : public mpl::false_
+{
+#ifdef DOXYGEN_DOCS_BUILD
+ /// Integral Constant value type
+ typedef bool value_type;
+ /// true if T models Port, false otherwise.
+ typedef detail::unspecified value;
+ /// Integral Constant
+ typedef detail::unspecified type;
+#endif
+};
+
+/// INTERNAL ONLY
+template<typename T, typename Tag>
+struct is_dynamic_port<
+ T,
+ Tag,
+ typename enable_if<mpl::and_<
+ is_dynamic_port_traits<typename traits_of<T, Tag>::type>,
+ has_dynamic_port_size<T, Tag>,
+ has_subport<T, Tag>
+ > >::type >
+ : public mpl::true_ {};
+
+/// Convenience base class for Port types.
+template<typename DynamicPortTraits>
+struct dynamic_port
+{
+ /// PortTraits for the Port.
+ typedef DynamicPortTraits dataflow_traits;
+ /// INTERNAL ONLY
+ BOOST_MPL_ASSERT(( is_dynamic_port_traits<DynamicPortTraits> ));
+};
+
+} } // namespace boost::dataflow
+
+#endif // BOOST_DATAFLOW_SUPPORT_DYNAMIC_PORT_HPP
+
+

Modified: sandbox/SOC/2007/signals/boost/dataflow/support/port_vector.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/dataflow/support/port_vector.hpp (original)
+++ sandbox/SOC/2007/signals/boost/dataflow/support/port_vector.hpp 2008-06-26 13:35:19 EDT (Thu, 26 Jun 2008)
@@ -7,6 +7,7 @@
 #define BOOST_DATAFLOW_SUPPORT_PORT_VECTOR_HPP
 
 #include <boost/dataflow/support/traits.hpp>
+#include <boost/utility/result_of.hpp>
 #include <boost/mpl/is_sequence.hpp>
 #include <boost/static_assert.hpp>
 

Modified: sandbox/SOC/2007/signals/boost/dataflow/support/runtime.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/dataflow/support/runtime.hpp (original)
+++ sandbox/SOC/2007/signals/boost/dataflow/support/runtime.hpp 2008-06-26 13:35:19 EDT (Thu, 26 Jun 2008)
@@ -58,6 +58,9 @@
         } \
     }; \
 } } }
+
+DATAFLOW_RUNTIME_PROPERTY(default_tag, const char *, "default_tag")
+DATAFLOW_RUNTIME_PROPERTY(default_tag, int, 0)
     
 DATAFLOW_RUNTIME_PROPERTY(ports::producer, const char *, "producer")
 DATAFLOW_RUNTIME_PROPERTY(ports::producer, int, 0)

Modified: sandbox/SOC/2007/signals/libs/dataflow/build/xcodeide/dataflow.xcodeproj/project.pbxproj
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/build/xcodeide/dataflow.xcodeproj/project.pbxproj (original)
+++ sandbox/SOC/2007/signals/libs/dataflow/build/xcodeide/dataflow.xcodeproj/project.pbxproj 2008-06-26 13:35:19 EDT (Thu, 26 Jun 2008)
@@ -137,6 +137,7 @@
                 089C098C0E0B11FF00397123 /* test_network.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_network.cpp; sourceTree = "<group>"; };
                 089CDA940D832AD200731C70 /* tutorial.qbk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tutorial.qbk; sourceTree = "<group>"; };
                 089CDAA90D8333CC00731C70 /* unary_operation.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = unary_operation.hpp; sourceTree = "<group>"; };
+ 089E78C20E132E220008C0BB /* dynamic_multi_port.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = dynamic_multi_port.hpp; sourceTree = "<group>"; };
                 08A0B20C0D21C4A90054AD32 /* cppgui_example.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cppgui_example.cpp; sourceTree = "<group>"; };
                 08A0B20D0D21C4A90054AD32 /* Jamfile.v2 */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = Jamfile.v2; sourceTree = "<group>"; };
                 08A0B2AC0D21D88F0054AD32 /* blueprint_bank.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = blueprint_bank.cpp; sourceTree = "<group>"; };
@@ -147,6 +148,8 @@
                 08A0B43D0D21EDDE0054AD32 /* blueprint_component.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = blueprint_component.hpp; sourceTree = "<group>"; };
                 08A0B5710D220CCF0054AD32 /* introduction.qbk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = introduction.qbk; sourceTree = "<group>"; };
                 08A0E54C0D7A7674009B11DD /* quick_start_examples.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = quick_start_examples.cpp; sourceTree = "<group>"; };
+ 08A364C10E129DC7001E6002 /* test_dynamic_port.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_dynamic_port.cpp; sourceTree = "<group>"; };
+ 08A82B550E11EBF500AAB117 /* dynamic_port.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = dynamic_port.hpp; sourceTree = "<group>"; };
                 08AD8AB50D84DF31008A9764 /* test_has_call_operator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_has_call_operator.cpp; sourceTree = "<group>"; };
                 08AD8AC40D84E3A9008A9764 /* has_call_operator.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = has_call_operator.hpp; sourceTree = "<group>"; };
                 08B234E40DC92C3A002A7FFE /* fusion_filter.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = fusion_filter.hpp; sourceTree = "<group>"; };
@@ -156,6 +159,8 @@
                 08BD9B090CEB9E3D0069AFE2 /* port.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = port.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>"; };
+ 08C8FA0F0E130E9B00FE64F3 /* dynamic_port_t.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = dynamic_port_t.hpp; sourceTree = "<group>"; };
+ 08C8FA140E13112D00FE64F3 /* test_dynamic_port.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_dynamic_port.cpp; sourceTree = "<group>"; };
                 08C9D7DA0D83C5EB00354FF8 /* bind_mem_fn_overload.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = bind_mem_fn_overload.hpp; sourceTree = "<group>"; };
                 08D2C7330D1DDE5C008388D7 /* Jamfile.v2 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Jamfile.v2; sourceTree = "<group>"; };
                 08D2C7390D1DDEB8008388D7 /* fltk_gui_example.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fltk_gui_example.cpp; sourceTree = "<group>"; };
@@ -458,6 +463,8 @@
                                 08F2D4D10D0B106F0054E4A2 /* test_vector_port.cpp */,
                                 08F1AAA40D0B69D200D3812E /* test_entity.cpp */,
                                 0815AEC90D0B814E007ED135 /* test_complemented_port.cpp */,
+ 08A364C10E129DC7001E6002 /* test_dynamic_port.cpp */,
+ 089E78C20E132E220008C0BB /* dynamic_multi_port.hpp */,
                         );
                         name = test;
                         path = ../../test;
@@ -582,6 +589,7 @@
                                 08F2D4A60D0B0C640054E4A2 /* fusion_port_vector.hpp */,
                                 08F322740D0A0445007C1658 /* vector_port.hpp */,
                                 08F2A83A0D0C634200AED0BC /* fusion_vector_port.hpp */,
+ 08A82B550E11EBF500AAB117 /* dynamic_port.hpp */,
                         );
                         path = support;
                         sourceTree = "<group>";
@@ -674,6 +682,7 @@
                                 08F346EC0D0CFE9700A037A3 /* vector_port_t.hpp */,
                                 08F244EA0D1B682D00EC9B03 /* keyed_port_t.hpp */,
                                 08622E2E0D1EE4A70068A238 /* component_bank.hpp */,
+ 08C8FA0F0E130E9B00FE64F3 /* dynamic_port_t.hpp */,
                         );
                         path = blueprint;
                         sourceTree = "<group>";
@@ -763,6 +772,7 @@
                                 08F5FF070D07082200FDBAEE /* Jamfile.v2 */,
                                 08F5FF130D070A1400FDBAEE /* test_port.cpp */,
                                 08F49BFE0D08AD9400D0CF0E /* test_component.cpp */,
+ 08C8FA140E13112D00FE64F3 /* test_dynamic_port.cpp */,
                         );
                         path = blueprint;
                         sourceTree = "<group>";

Modified: sandbox/SOC/2007/signals/libs/dataflow/doc/dataflow.qbk
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/doc/dataflow.qbk (original)
+++ sandbox/SOC/2007/signals/libs/dataflow/doc/dataflow.qbk 2008-06-26 13:35:19 EDT (Thu, 26 Jun 2008)
@@ -30,6 +30,8 @@
 [template VectorPortTraits[] [link dataflow.support.concepts.port_related.vectorport [^VectorPortTraits]]]
 [template KeyedPort[] [link dataflow.support.concepts.port_related.keyedport [^KeyedPort]]]
 [template KeyedPortTraits[] [link dataflow.support.concepts.port_related.keyedport [^KeyedPortTraitr]]]
+[template DynamicPort[] [link dataflow.support.concepts.port_related.dynamicport [^DynamicPort]]]
+[template DynamicPortTraits[] [link dataflow.support.concepts.port_related.dynamicport [^DynamicPortTraits]]]
 
 [template ProxyPortTraits[] [link dataflow.support.concepts.port_related.proxyporttraits [^ProxyPortTraits]]]
 [template ProxyPort[] [link dataflow.support.concepts.port_related.proxyport [^ProxyPort]]]

Added: sandbox/SOC/2007/signals/libs/dataflow/doc/layers.png
==============================================================================
Binary file. No diff available.

Modified: sandbox/SOC/2007/signals/libs/dataflow/doc/support/concepts/port.qbk
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/doc/support/concepts/port.qbk (original)
+++ sandbox/SOC/2007/signals/libs/dataflow/doc/support/concepts/port.qbk 2008-06-26 13:35:19 EDT (Thu, 26 Jun 2008)
@@ -215,7 +215,7 @@
     [[Name] [Expression] [Result Type] [Semantics]]
     [
         [Port Traits]
- [`traits_of<M, PC, P>::type`]
+ [`traits_of<P, T>::type`]
         [`PT`]
         [
             The [ComplementedPortTraits] of the port.
@@ -277,5 +277,71 @@
 
 [endsect][/keyed_port]
 
+[section:dynamicport DynamicPort, DynamicPortTraits]
+
+A DynamicPort `P` is a [Port] that has a number of subports, where
+the number is determined at run-time.
+
+[heading DynamicPort Refines]
+* [Port]
+
+[heading DynamicPortTraits Refines]
+* [PortTraits]
+
+[heading Notation]
+The following expressions are used in this document:
+
+[variablelist
+ [[`T`] [A [Tag] type. If omitted, `T` defaults to [default_tag].]]
+ [[`P`] [A [DynamicPort] type, for [Tag] `T`.]]
+ [[`PT`] [[DynamicPortTraits] of `P` for `T`.]]
+ [[`p`] [An object of type `P`.]]
+ [[`n`] [An object convertible to `size_t`.]]
+]
+
+[heading DynamicPort Requirements]
+[table
+ [[Name] [Expression] [Result Type] [Semantics]]
+ [
+ [Port Traits]
+ [`traits_of<P, T>::type`]
+ [`PT`]
+ [
+ The [DynamicPortTraits] of the port.
+ ]
+ ]
+ [
+ [Number of Subports]
+ [`get_dynamic_port_size<T>(p)`]
+ [`size_t`]
+ [
+ Returns the number of subports accessible through `p`.
+ ]
+ ]
+ [
+ [Subport]
+ [`get_subport<T>(p, n)`]
+ [`result_of::get_subport<P,T>::type`]
+ [
+ Returns the `n`-th subport accessible through `p`.
+ ]
+ ]
+]
+
+[heading DynamicPortTraits Requirements]
+[table
+ [[Name] [Expression] [Result Type] [Semantics]]
+ [
+ [Subport type]
+ [`PT::subport_type`]
+ [Any [Port] type]
+ [
+ The type of subport accessible through objects of type `P`.
+ ]
+ ]
+]
+
+[endsect]
+
  
 

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 2008-06-26 13:35:19 EDT (Thu, 26 Jun 2008)
@@ -19,6 +19,7 @@
 run test_complemented_port.cpp ;
 run test_keyed_port.cpp ;
 run test_vector_port.cpp ;
+run test_dynamic_port.cpp ;
 run test_component.cpp ;
 
 build-project signals ;

Modified: sandbox/SOC/2007/signals/libs/dataflow/test/blueprint/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/test/blueprint/Jamfile.v2 (original)
+++ sandbox/SOC/2007/signals/libs/dataflow/test/blueprint/Jamfile.v2 2008-06-26 13:35:19 EDT (Thu, 26 Jun 2008)
@@ -5,7 +5,7 @@
 
 import testing ;
 
-project dataflow/test/signals
+project dataflow/test/blueprint
     : requirements
       <include>../../../..
       <library>/boost/signals//boost_signals/<link>static
@@ -14,3 +14,4 @@
 
 run test_port.cpp ;
 run test_component.cpp ;
+run test_dynamic_port.cpp ;

Added: sandbox/SOC/2007/signals/libs/dataflow/test/blueprint/test_dynamic_port.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/dataflow/test/blueprint/test_dynamic_port.cpp 2008-06-26 13:35:19 EDT (Thu, 26 Jun 2008)
@@ -0,0 +1,59 @@
+// 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 <boost/dataflow/support/component_operation.hpp>
+#include <boost/dataflow/support/fusion_component.hpp>
+#include <boost/dataflow/blueprint/component.hpp>
+#include <boost/dataflow/signals/runtime_support.hpp>
+#include <boost/mpl/map.hpp>
+
+#include "../dynamic_multi_port.hpp"
+
+#include <boost/test/included/test_exec_monitor.hpp>
+
+using namespace boost;
+
+
+struct my_component_traits : public boost::dataflow::fusion_component_traits<
+ boost::fusion::vector<
+ multi_port &,
+ my_consumer &
+ >,
+ mpl::map<
+ mpl::pair<
+ df::default_port_selector<df::args::left>,
+ mpl::int_<0> >,
+ mpl::pair<
+ df::default_port_selector<dataflow::args::right>,
+ mpl::int_<1> >
+ >
+>
+{
+ template<typename Component>
+ static typename my_component_traits::fusion_ports get_ports(Component &c)
+ {
+ return typename my_component_traits::fusion_ports(c.p, c.c);
+ }
+};
+
+struct my_component : public boost::dataflow::component<my_component_traits>
+{
+ multi_port p;
+ my_consumer c;
+};
+
+namespace df = boost::dataflow;
+namespace blueprint = df::blueprint;
+
+int test_main(int, char* [])
+{
+ blueprint::component_t<my_component> mpc;
+
+ BOOST_CHECK(df::is_dynamic_port<multi_port>::value);
+ BOOST_CHECK(mpc.get_port(0).is_vector_port());
+ if(mpc.get_port(0).is_vector_port())
+ BOOST_CHECK_EQUAL(mpc.get_port(0).as<blueprint::vector_port>().num_ports(),2u);
+ return 0;
+}

Added: sandbox/SOC/2007/signals/libs/dataflow/test/dynamic_multi_port.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/dataflow/test/dynamic_multi_port.hpp 2008-06-26 13:35:19 EDT (Thu, 26 Jun 2008)
@@ -0,0 +1,57 @@
+// 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_DYNAMIC_MULTI_PORT_HPP
+#define DATAFLOW_TEST_DYNAMIC_MULTI_PORT_HPP
+
+#include "my_producer_consumer.hpp"
+
+#include <boost/dataflow/support/dynamic_port.hpp>
+#include <vector>
+
+namespace df = boost::dataflow;
+
+struct multi_port_traits : public df::dynamic_port_traits<my_producer>
+{};
+
+struct multi_port
+ : public df::dynamic_port<multi_port_traits>
+{
+ multi_port()
+ {
+ p.resize(2);
+ }
+ std::vector<my_producer> p;
+};
+
+namespace boost { namespace dataflow { namespace extension {
+
+template<>
+struct get_dynamic_port_size_impl<multi_port_traits>
+{
+ typedef size_t result_type;
+
+ template<typename Port>
+ size_t operator()(Port &port)
+ {
+ return port.p.size();
+ }
+};
+
+template<>
+struct get_subport_impl<multi_port_traits>
+{
+ typedef my_producer &result_type;
+
+ template<typename Port>
+ result_type operator()(Port &port, size_t n)
+ {
+ return port.p[n];
+ }
+};
+
+} } }
+
+#endif

Added: sandbox/SOC/2007/signals/libs/dataflow/test/test_dynamic_port.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/dataflow/test/test_dynamic_port.cpp 2008-06-26 13:35:19 EDT (Thu, 26 Jun 2008)
@@ -0,0 +1,18 @@
+// 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 "dynamic_multi_port.hpp"
+
+#include <boost/test/included/test_exec_monitor.hpp>
+
+int test_main(int, char* [])
+{
+ multi_port mp;
+ BOOST_CHECK((df::is_dynamic_port<multi_port>::value));
+ BOOST_CHECK_EQUAL(df::get_dynamic_port_size<df::default_tag>(mp),2u);
+ BOOST_CHECK_EQUAL((&df::get_subport<df::default_tag>(mp, 0)),&mp.p[0]);
+
+ 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