$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r51779 - in sandbox/dataflow-rewrite: boost/dataflow/blueprint boost/dataflow/generic boost/dataflow/managed boost/dataflow/vivid libs/dataflow/build libs/dataflow/build/xcodeide/dataflow.xcodeproj libs/dataflow/example/vivid libs/dataflow/src/managed libs/dataflow/test/blueprint libs/dataflow/test/generic libs/dataflow/test/managed libs/dataflow/test/vivid
From: stipe_at_[hidden]
Date: 2009-03-15 00:07:15
Author: srajko
Date: 2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
New Revision: 51779
URL: http://svn.boost.org/trac/boost/changeset/51779
Log:
added set_context, vivid does vectors...
Added:
   sandbox/dataflow-rewrite/boost/dataflow/generic/set_context.hpp   (contents, props changed)
   sandbox/dataflow-rewrite/boost/dataflow/vivid/vector_widget.hpp   (contents, props changed)
   sandbox/dataflow-rewrite/libs/dataflow/test/generic/test_set_context.cpp   (contents, props changed)
Text files modified: 
   sandbox/dataflow-rewrite/boost/dataflow/blueprint/factory.hpp                            |    33 +++++++++++++++++++++++++++------       
   sandbox/dataflow-rewrite/boost/dataflow/blueprint/port.hpp                               |     7 +++++++                                 
   sandbox/dataflow-rewrite/boost/dataflow/blueprint/port_adapter.hpp                       |    11 +++++++----                             
   sandbox/dataflow-rewrite/boost/dataflow/blueprint/vector.hpp                             |     4 ++++                                    
   sandbox/dataflow-rewrite/boost/dataflow/generic/port_binary_operation.hpp                |    38 +++++++++++++++++++-------------------  
   sandbox/dataflow-rewrite/boost/dataflow/managed/component.hpp                            |     8 ++++++--                                
   sandbox/dataflow-rewrite/boost/dataflow/managed/io_component.hpp                         |    10 ++++++++++                              
   sandbox/dataflow-rewrite/boost/dataflow/managed/port.hpp                                 |     7 ++++++-                                 
   sandbox/dataflow-rewrite/boost/dataflow/vivid/entity_widget.hpp                          |     7 ++++++-                                 
   sandbox/dataflow-rewrite/boost/dataflow/vivid/network_window.hpp                         |    36 ++++++++++++++++++++++++++----------    
   sandbox/dataflow-rewrite/libs/dataflow/build/Jamfile                                     |    10 ++++++++--                              
   sandbox/dataflow-rewrite/libs/dataflow/build/specializable_operation.hpp.py              |     6 +++---                                  
   sandbox/dataflow-rewrite/libs/dataflow/build/xcodeide/dataflow.xcodeproj/project.pbxproj |     6 ++++++                                  
   sandbox/dataflow-rewrite/libs/dataflow/example/vivid/Jamfile                             |    23 +++++++++++++++++++++--                 
   sandbox/dataflow-rewrite/libs/dataflow/example/vivid/vivid_graph_example.cpp             |     5 +++--                                   
   sandbox/dataflow-rewrite/libs/dataflow/example/vivid/vivid_managed_example.cpp           |    17 ++++++++---------                       
   sandbox/dataflow-rewrite/libs/dataflow/src/managed/component.cpp                         |    19 +++++++++++++++----                     
   sandbox/dataflow-rewrite/libs/dataflow/test/blueprint/test_factory.cpp                   |     5 +++--                                   
   sandbox/dataflow-rewrite/libs/dataflow/test/generic/Jamfile                              |     2 ++                                      
   sandbox/dataflow-rewrite/libs/dataflow/test/generic/my_framework_with_context.hpp        |     1 +                                       
   sandbox/dataflow-rewrite/libs/dataflow/test/managed/test_io_component.cpp                |     3 +++                                     
   sandbox/dataflow-rewrite/libs/dataflow/test/vivid/test_factory_window.cpp                |     3 ++-                                     
   22 files changed, 193 insertions(+), 68 deletions(-)
Modified: sandbox/dataflow-rewrite/boost/dataflow/blueprint/factory.hpp
==============================================================================
--- sandbox/dataflow-rewrite/boost/dataflow/blueprint/factory.hpp	(original)
+++ sandbox/dataflow-rewrite/boost/dataflow/blueprint/factory.hpp	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -11,6 +11,7 @@
 
 
 #include <boost/dataflow/blueprint/port_adapter.hpp>
+#include <boost/dataflow/blueprint/static_vector_adapter.hpp>
 #include <boost/dataflow/utility/containing_ptr.hpp>
 
 #include <boost/bind.hpp>
@@ -89,15 +90,35 @@
     function_type operator[](const std::string& k)
     {   return m_components[k]; }
 
-    template<typename T>
-    void add_port(const std::string &s)
+    struct port_adapter_selector
     {
-        m_components[s] = boost::bind(boost::factory<port_adapter<BlueprintFramework, utility::containing_ptr<T> > *>(), _1);
+        template<typename T>
+        struct apply
+        {
+            typedef port_adapter<BlueprintFramework, utility::containing_ptr<T> > type;
+        };
+    };
+
+    struct static_vector_adapter_selector
+    {
+        template<typename T>
+        struct apply
+        {
+            typedef static_vector_adapter<BlueprintFramework, utility::containing_ptr<T> > type;
+        };
+    };
+
+    template<typename AdapterSelector, typename T>
+    void add(const std::string &s)
+    {
+        typedef typename AdapterSelector::template apply<T>::type adapter_type;
+        m_components[s] = boost::bind(boost::factory<adapter_type *>(), _1);
     }
-    template<typename T, typename T0>
-    void add_port(const std::string &s, const T0 &t0)
+    template<typename AdapterSelector, typename T, typename T0>
+    void add(const std::string &s, const T0 &t0)
     {
-        m_components[s] = boost::bind(boost::factory<port_adapter<BlueprintFramework, utility::containing_ptr<T> > *>(), _1, t0);
+        typedef typename AdapterSelector::template apply<T>::type adapter_type;
+        m_components[s] = boost::bind(boost::factory<adapter_type *>(), _1, t0);
     }
     void add_entity(const std::string &s, const function_type &f)
     {
Modified: sandbox/dataflow-rewrite/boost/dataflow/blueprint/port.hpp
==============================================================================
--- sandbox/dataflow-rewrite/boost/dataflow/blueprint/port.hpp	(original)
+++ sandbox/dataflow-rewrite/boost/dataflow/blueprint/port.hpp	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -27,6 +27,13 @@
     {
         typedef ports::producer_consumer category;
     };
+    const std::type_info &category_type_info() const
+    {   return *m_category_type_info; }
+protected:
+    void set_category_type_info(const std::type_info &ti)
+    {   m_category_type_info = &ti; }
+private:
+    const std::type_info *m_category_type_info;
 };
 
 } } } // namespace boost::dataflow::blueprint
Modified: sandbox/dataflow-rewrite/boost/dataflow/blueprint/port_adapter.hpp
==============================================================================
--- sandbox/dataflow-rewrite/boost/dataflow/blueprint/port_adapter.hpp	(original)
+++ sandbox/dataflow-rewrite/boost/dataflow/blueprint/port_adapter.hpp	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -22,16 +22,19 @@
     typedef framework_entity_adapter<BlueprintFramework, PortOrRef, Base> base_type;
 public:
     port_adapter(blueprint::framework_context<BlueprintFramework> &fo)
-        : base_type(fo)        
-    {}
+        : base_type(fo)
+    {   initialize(); }
     template<typename T>
     port_adapter(blueprint::framework_context<BlueprintFramework> &fo, const T &t)
         : base_type(fo, t)
-    {}
+    {   initialize(); }
     template<typename T>
     port_adapter(blueprint::framework_context<BlueprintFramework> &fo, T &t)
         : base_type(fo, t)
-    {}
+    {   initialize(); }
+private:
+    void initialize()
+    {   base_type::set_category_type_info(typeid(typename traits_of<typename base_type::entity_type>::type::category)); }
 };
 
 } } } // namespace boost::dataflow::blueprint
Modified: sandbox/dataflow-rewrite/boost/dataflow/blueprint/vector.hpp
==============================================================================
--- sandbox/dataflow-rewrite/boost/dataflow/blueprint/vector.hpp	(original)
+++ sandbox/dataflow-rewrite/boost/dataflow/blueprint/vector.hpp	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -59,6 +59,10 @@
     {
         return m_ptr->clone();
     };
+    bool operator!=(port_iterator_base<BlueprintFramework> const& other) const
+    {
+        return !this->equal(other);
+    }
     bool operator==(port_iterator_base<BlueprintFramework> const& other) const
     {
         return this->equal(other);
Modified: sandbox/dataflow-rewrite/boost/dataflow/generic/port_binary_operation.hpp
==============================================================================
--- sandbox/dataflow-rewrite/boost/dataflow/generic/port_binary_operation.hpp	(original)
+++ sandbox/dataflow-rewrite/boost/dataflow/generic/port_binary_operation.hpp	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -31,7 +31,7 @@
         typedef detail::not_specialized result_type;
 
         template<typename T1,typename T2>
-        result_type operator()(T1 &t1,T2 &t2,const Operation &operation)
+        result_type operator()(T1 &t1,T2 &t2,const Operation & operation)
         {
             // Error: port_binary_operation_impl has not been
             // specialized appropriately.
@@ -48,7 +48,7 @@
         typedef bool result_type;
 
         template<typename T1,typename T2>
-        result_type operator()(T1 &t1,T2 &t2,const Operation &operation)
+        result_type operator()(T1 &t1,T2 &t2,const Operation & operation)
         {
             return
                 !is_same<
@@ -113,7 +113,7 @@
             extension::port_binary_operation_impl<
                 typename traits_of<T1, Framework1>::type,typename traits_of<T2, Framework2>::type,Operation
             >
-            (T1,T2,Operation)
+            (T1,T2,const Operation)
         >::type type;
     };
     
@@ -124,7 +124,7 @@
 inline typename result_of::port_binary_operation<
     T1,T2,Operation,Framework1,Framework2
     >::type 
-port_binary_operation_framework(T1 &t1,T2 &t2,const Operation &operation=Operation())
+port_binary_operation_framework(T1 &t1,T2 &t2,const Operation & operation=Operation())
 {
     return extension::port_binary_operation_impl<
         typename traits_of<T1, Framework1>::type,typename traits_of<T2, Framework2>::type,Operation
@@ -135,7 +135,7 @@
 inline typename result_of::port_binary_operation<
     T1,T2,Operation,typename default_framework_of<T1>::type,typename default_framework_of<T2>::type
     >::type 
-port_binary_operation(T1 &t1,T2 &t2,const Operation &operation=Operation())
+port_binary_operation(T1 &t1,T2 &t2,const Operation & operation=Operation())
 {
     typedef typename default_framework_of<T1>::type Framework1;
 typedef typename default_framework_of<T2>::type Framework2;
@@ -146,7 +146,7 @@
 
 template<typename Operation,typename Framework1,typename Framework2,typename T1,typename T2>
 inline bool
-port_binary_operation_will_succeed_framework(T1 &t1,T2 &t2,const Operation &operation=Operation())
+port_binary_operation_will_succeed_framework(T1 &t1,T2 &t2,const Operation & operation=Operation())
 {
     return extension::port_binary_operation_will_succeed_impl<
         typename traits_of<T1, Framework1>::type,typename traits_of<T2, Framework2>::type,Operation
@@ -155,7 +155,7 @@
 
 template<typename Operation,typename T1,typename T2>
 inline bool 
-port_binary_operation_will_succeed(T1 &t1,T2 &t2,const Operation &operation=Operation())
+port_binary_operation_will_succeed(T1 &t1,T2 &t2,const Operation & operation=Operation())
 {
     typedef typename default_framework_of<T1>::type Framework1;
 typedef typename default_framework_of<T2>::type Framework2;
@@ -168,7 +168,7 @@
 inline typename result_of::port_binary_operation<
     T1,T2,Operation,Framework1,Framework2
     >::type 
-port_binary_operation_framework(const T1 &t1,T2 &t2,const Operation &operation=Operation())
+port_binary_operation_framework(const T1 &t1,T2 &t2,const Operation & operation=Operation())
 {
     return extension::port_binary_operation_impl<
         typename traits_of<T1, Framework1>::type,typename traits_of<T2, Framework2>::type,Operation
@@ -179,7 +179,7 @@
 inline typename result_of::port_binary_operation<
     T1,T2,Operation,typename default_framework_of<T1>::type,typename default_framework_of<T2>::type
     >::type 
-port_binary_operation(const T1 &t1,T2 &t2,const Operation &operation=Operation())
+port_binary_operation(const T1 &t1,T2 &t2,const Operation & operation=Operation())
 {
     typedef typename default_framework_of<T1>::type Framework1;
 typedef typename default_framework_of<T2>::type Framework2;
@@ -190,7 +190,7 @@
 
 template<typename Operation,typename Framework1,typename Framework2,typename T1,typename T2>
 inline bool
-port_binary_operation_will_succeed_framework(const T1 &t1,T2 &t2,const Operation &operation=Operation())
+port_binary_operation_will_succeed_framework(const T1 &t1,T2 &t2,const Operation & operation=Operation())
 {
     return extension::port_binary_operation_will_succeed_impl<
         typename traits_of<T1, Framework1>::type,typename traits_of<T2, Framework2>::type,Operation
@@ -199,7 +199,7 @@
 
 template<typename Operation,typename T1,typename T2>
 inline bool 
-port_binary_operation_will_succeed(const T1 &t1,T2 &t2,const Operation &operation=Operation())
+port_binary_operation_will_succeed(const T1 &t1,T2 &t2,const Operation & operation=Operation())
 {
     typedef typename default_framework_of<T1>::type Framework1;
 typedef typename default_framework_of<T2>::type Framework2;
@@ -212,7 +212,7 @@
 inline typename result_of::port_binary_operation<
     T1,T2,Operation,Framework1,Framework2
     >::type 
-port_binary_operation_framework(T1 &t1,const T2 &t2,const Operation &operation=Operation())
+port_binary_operation_framework(T1 &t1,const T2 &t2,const Operation & operation=Operation())
 {
     return extension::port_binary_operation_impl<
         typename traits_of<T1, Framework1>::type,typename traits_of<T2, Framework2>::type,Operation
@@ -223,7 +223,7 @@
 inline typename result_of::port_binary_operation<
     T1,T2,Operation,typename default_framework_of<T1>::type,typename default_framework_of<T2>::type
     >::type 
-port_binary_operation(T1 &t1,const T2 &t2,const Operation &operation=Operation())
+port_binary_operation(T1 &t1,const T2 &t2,const Operation & operation=Operation())
 {
     typedef typename default_framework_of<T1>::type Framework1;
 typedef typename default_framework_of<T2>::type Framework2;
@@ -234,7 +234,7 @@
 
 template<typename Operation,typename Framework1,typename Framework2,typename T1,typename T2>
 inline bool
-port_binary_operation_will_succeed_framework(T1 &t1,const T2 &t2,const Operation &operation=Operation())
+port_binary_operation_will_succeed_framework(T1 &t1,const T2 &t2,const Operation & operation=Operation())
 {
     return extension::port_binary_operation_will_succeed_impl<
         typename traits_of<T1, Framework1>::type,typename traits_of<T2, Framework2>::type,Operation
@@ -243,7 +243,7 @@
 
 template<typename Operation,typename T1,typename T2>
 inline bool 
-port_binary_operation_will_succeed(T1 &t1,const T2 &t2,const Operation &operation=Operation())
+port_binary_operation_will_succeed(T1 &t1,const T2 &t2,const Operation & operation=Operation())
 {
     typedef typename default_framework_of<T1>::type Framework1;
 typedef typename default_framework_of<T2>::type Framework2;
@@ -256,7 +256,7 @@
 inline typename result_of::port_binary_operation<
     T1,T2,Operation,Framework1,Framework2
     >::type 
-port_binary_operation_framework(const T1 &t1,const T2 &t2,const Operation &operation=Operation())
+port_binary_operation_framework(const T1 &t1,const T2 &t2,const Operation & operation=Operation())
 {
     return extension::port_binary_operation_impl<
         typename traits_of<T1, Framework1>::type,typename traits_of<T2, Framework2>::type,Operation
@@ -267,7 +267,7 @@
 inline typename result_of::port_binary_operation<
     T1,T2,Operation,typename default_framework_of<T1>::type,typename default_framework_of<T2>::type
     >::type 
-port_binary_operation(const T1 &t1,const T2 &t2,const Operation &operation=Operation())
+port_binary_operation(const T1 &t1,const T2 &t2,const Operation & operation=Operation())
 {
     typedef typename default_framework_of<T1>::type Framework1;
 typedef typename default_framework_of<T2>::type Framework2;
@@ -278,7 +278,7 @@
 
 template<typename Operation,typename Framework1,typename Framework2,typename T1,typename T2>
 inline bool
-port_binary_operation_will_succeed_framework(const T1 &t1,const T2 &t2,const Operation &operation=Operation())
+port_binary_operation_will_succeed_framework(const T1 &t1,const T2 &t2,const Operation & operation=Operation())
 {
     return extension::port_binary_operation_will_succeed_impl<
         typename traits_of<T1, Framework1>::type,typename traits_of<T2, Framework2>::type,Operation
@@ -287,7 +287,7 @@
 
 template<typename Operation,typename T1,typename T2>
 inline bool 
-port_binary_operation_will_succeed(const T1 &t1,const T2 &t2,const Operation &operation=Operation())
+port_binary_operation_will_succeed(const T1 &t1,const T2 &t2,const Operation & operation=Operation())
 {
     typedef typename default_framework_of<T1>::type Framework1;
 typedef typename default_framework_of<T2>::type Framework2;
Added: sandbox/dataflow-rewrite/boost/dataflow/generic/set_context.hpp
==============================================================================
--- (empty file)
+++ sandbox/dataflow-rewrite/boost/dataflow/generic/set_context.hpp	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -0,0 +1,210 @@
+/*=================================---------------------------------------------
+    Copyright 2007,2008 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__GENERIC__SET_CONTEXT_HPP
+#define BOOST__DATAFLOW__GENERIC__SET_CONTEXT_HPP
+
+
+#include <boost/mpl/assert.hpp>
+#include <boost/utility/result_of.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/dataflow/generic/framework_entity/default_framework_of.hpp>
+#include <boost/dataflow/generic/framework_entity/traits_of.hpp>
+#include <boost/dataflow/detail/not_specialized.hpp>
+
+
+#include <boost/dataflow/generic/framework_entity.hpp>
+namespace boost { namespace dataflow {
+
+namespace extension
+{
+    template<typename Traits1,typename Enable=void>
+    struct set_context_impl
+    {
+        BOOST_MPL_ASSERT(( is_same<Enable, void> ));
+        
+        typedef detail::not_specialized result_type;
+
+        template<typename T1,typename Context>
+        result_type operator()(T1 &t1,Context & context)
+        {
+            // Error: set_context_impl has not been
+            // specialized appropriately.
+            BOOST_MPL_ASSERT(( mpl::bool_<sizeof(T1)==0> ));
+            return result_type();
+        }
+    };
+    
+    template<typename Traits1,typename Enable=void>
+    struct set_context_will_succeed_impl
+    {
+        BOOST_MPL_ASSERT(( is_same<Enable, void> ));
+        
+        typedef bool result_type;
+
+        template<typename T1,typename Context>
+        result_type operator()(T1 &t1,Context & context)
+        {
+            return
+                !is_same<
+                        typename  extension::set_context_impl<
+                            Traits1
+                            >::result_type,
+                    detail::not_specialized
+                >::value;
+        }
+    };
+}
+
+namespace detail
+{
+
+    template<typename T1,typename Context,typename Framework1=typename default_framework_of<T1>::type,typename Enable=void>
+    struct has_set_context_specialized
+        : public mpl::true_
+    {};
+    
+    template<typename T1,typename Context,typename Framework1>
+    struct has_set_context_specialized<
+        T1,Context,Framework1
+        ,
+        typename enable_if<
+            is_same<
+               typename  extension::set_context_impl<
+                typename traits_of<T1, Framework1>::type
+                >::result_type,
+                detail::not_specialized>
+        >::type>
+        : public mpl::false_
+    {};
+
+}
+
+template<typename T1,typename Framework1=typename default_framework_of<T1>::type,typename Enable=void>
+struct has_set_context
+    : public mpl::false_
+{
+    BOOST_MPL_ASSERT((mpl::and_<is_framework_entity<T1,Framework1> >));
+};
+
+template<typename T1,typename Framework1>
+struct has_set_context<
+    T1,Framework1,
+    typename enable_if<
+        detail::has_set_context_specialized<
+            T1,Framework1>
+     >::type>
+    : public mpl::true_
+{
+    BOOST_MPL_ASSERT((mpl::and_<is_framework_entity<T1,Framework1> >));
+};
+
+namespace result_of {
+
+    template<typename T1,typename Context,typename Framework1=typename default_framework_of<T1>::type>
+    struct set_context
+    {
+        typedef typename boost::result_of<
+            extension::set_context_impl<
+                typename traits_of<T1, Framework1>::type
+            >
+            (T1,Context)
+        >::type type;
+    };
+    
+}
+
+
+template<typename Context,typename Framework1,typename T1>
+inline typename result_of::set_context<
+    T1,Context,Framework1
+    >::type 
+set_context_framework(T1 &t1,Context & context=Context())
+{
+    return extension::set_context_impl<
+        typename traits_of<T1, Framework1>::type
+        >()(t1,context);
+}
+
+template<typename Context,typename T1>
+inline typename result_of::set_context<
+    T1,Context,typename default_framework_of<T1>::type
+    >::type 
+set_context(T1 &t1,Context & context=Context())
+{
+    typedef typename default_framework_of<T1>::type Framework1;
+    return extension::set_context_impl<
+        typename traits_of<T1, Framework1>::type
+        >()(t1,context);
+}
+
+template<typename Context,typename Framework1,typename T1>
+inline bool
+set_context_will_succeed_framework(T1 &t1,Context & context=Context())
+{
+    return extension::set_context_will_succeed_impl<
+        typename traits_of<T1, Framework1>::type
+        >()(t1,context);
+}
+
+template<typename Context,typename T1>
+inline bool 
+set_context_will_succeed(T1 &t1,Context & context=Context())
+{
+    typedef typename default_framework_of<T1>::type Framework1;
+    return extension::set_context_will_succeed_impl<
+        typename traits_of<T1, Framework1>::type
+        >()(t1,context);
+}
+
+template<typename Context,typename Framework1,typename T1>
+inline typename result_of::set_context<
+    T1,Context,Framework1
+    >::type 
+set_context_framework(const T1 &t1,Context & context=Context())
+{
+    return extension::set_context_impl<
+        typename traits_of<T1, Framework1>::type
+        >()(t1,context);
+}
+
+template<typename Context,typename T1>
+inline typename result_of::set_context<
+    T1,Context,typename default_framework_of<T1>::type
+    >::type 
+set_context(const T1 &t1,Context & context=Context())
+{
+    typedef typename default_framework_of<T1>::type Framework1;
+    return extension::set_context_impl<
+        typename traits_of<T1, Framework1>::type
+        >()(t1,context);
+}
+
+template<typename Context,typename Framework1,typename T1>
+inline bool
+set_context_will_succeed_framework(const T1 &t1,Context & context=Context())
+{
+    return extension::set_context_will_succeed_impl<
+        typename traits_of<T1, Framework1>::type
+        >()(t1,context);
+}
+
+template<typename Context,typename T1>
+inline bool 
+set_context_will_succeed(const T1 &t1,Context & context=Context())
+{
+    typedef typename default_framework_of<T1>::type Framework1;
+    return extension::set_context_will_succeed_impl<
+        typename traits_of<T1, Framework1>::type
+        >()(t1,context);
+}
+
+}}
+
+
+#endif // BOOST__DATAFLOW__GENERIC__SET_CONTEXT_HPP
Modified: sandbox/dataflow-rewrite/boost/dataflow/managed/component.hpp
==============================================================================
--- sandbox/dataflow-rewrite/boost/dataflow/managed/component.hpp	(original)
+++ sandbox/dataflow-rewrite/boost/dataflow/managed/component.hpp	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -17,11 +17,15 @@
 class BOOST_EXPORT_SYMBOLS component
 {
 public:
+    component()
+        : m_network_context(0), m_topological_sort_index(0)
+    {}
     component(network &network_context);
     component(const component &other);
     virtual ~component();
+    void set_network_context(network &network_context);
     network &network_context()
-    {   return m_network_context; }
+    {   return *m_network_context; }
     virtual void invoke(){};
     void topological_sort_index(unsigned index)
     {
@@ -33,7 +37,7 @@
     }
     void claim_port(port_base &p);
 private:
-    network &m_network_context;
+    network *m_network_context;
     unsigned m_topological_sort_index;
 };
 
Modified: sandbox/dataflow-rewrite/boost/dataflow/managed/io_component.hpp
==============================================================================
--- sandbox/dataflow-rewrite/boost/dataflow/managed/io_component.hpp	(original)
+++ sandbox/dataflow-rewrite/boost/dataflow/managed/io_component.hpp	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -115,9 +115,19 @@
     {
         fusion::for_each(m_ports, detail::set_port_context(*this)); 
     }
+
     template<int Index>
     typename fusion::result_of::at_c<ports_type, Index>::type port()
     {   return fusion::at_c<Index>(m_ports); }
+
+    template<int Index>
+    const typename fusion::result_of::value_at_c<ports_type, Index>::type::value_type &get()
+    {   return fusion::at_c<Index>(m_ports).get(); }
+
+    template<int Index>
+    void set(const typename fusion::result_of::value_at_c<ports_type, Index>::type::value_type &value)
+    {   fusion::at_c<Index>(m_ports).set(value); }
+
     ports_type &ports()
     {   return m_ports; }
 protected:
Modified: sandbox/dataflow-rewrite/boost/dataflow/managed/port.hpp
==============================================================================
--- sandbox/dataflow-rewrite/boost/dataflow/managed/port.hpp	(original)
+++ sandbox/dataflow-rewrite/boost/dataflow/managed/port.hpp	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -37,6 +37,8 @@
 template<typename T>
 void connect(port<T, ports::producer> &producer, port<T, ports::consumer> &consumer)
 {
+    BOOST_ASSERT(&producer.component_context().network_context());
+    BOOST_ASSERT(&producer.component_context().network_context() == &consumer.component_context().network_context());
     if(consumer.connected())
         disconnect(consumer.connected_producer(), consumer);
     producer.m_consumers.insert(&consumer);
@@ -60,6 +62,7 @@
 class port<T, ports::producer> : public port_base
 {
 public:
+    typedef T value_type;
     typedef producer_port_traits<T> dataflow_traits;
     
     port(component &component_context) : port_base(component_context), m_value()
@@ -74,7 +77,7 @@
     T &get()
     {   return m_value; }
 private:
-    T m_value;
+    value_type m_value;
     typedef std::set<port<T, ports::consumer> *> consumers_type;
     consumers_type m_consumers;
 
@@ -91,7 +94,9 @@
 class port<T, ports::consumer> : public port_base
 {
 public:
+    typedef T value_type;
     typedef consumer_port_traits<T> dataflow_traits;
+    
     port(component &component_context)
         : port_base(component_context), m_producer(0)
     {
Modified: sandbox/dataflow-rewrite/boost/dataflow/vivid/entity_widget.hpp
==============================================================================
--- sandbox/dataflow-rewrite/boost/dataflow/vivid/entity_widget.hpp	(original)
+++ sandbox/dataflow-rewrite/boost/dataflow/vivid/entity_widget.hpp	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -15,10 +15,13 @@
 #include <boost/guigl/widget/labeled_button.hpp>
 #include <boost/guigl/view/impl/draggable.hpp>
 #include <boost/scoped_ptr.hpp>
+#include <boost/function.hpp>
+
 
 namespace boost { namespace dataflow { namespace vivid {
 
 BOOST_PARAMETER_UNTYPED_NAME(entity);
+BOOST_PARAMETER_UNTYPED_NAME(click_callback);
 
 template<typename BlueprintFramework>
 class entity_widget
@@ -34,7 +37,9 @@
     entity_widget(const Args &args)
         : base_type(args)
         , m_entity(args[_entity])
-    {}
+    {
+        this->on_click.connect(boost::bind(args[_click_callback], this));
+    }
     void draggable_on_drag(const guigl::position_type &position)
     {
         guigl::position_type difference(position - base_type::drag_origin());
Modified: sandbox/dataflow-rewrite/boost/dataflow/vivid/network_window.hpp
==============================================================================
--- sandbox/dataflow-rewrite/boost/dataflow/vivid/network_window.hpp	(original)
+++ sandbox/dataflow-rewrite/boost/dataflow/vivid/network_window.hpp	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -13,6 +13,7 @@
 #include <boost/dataflow/blueprint/port_binary_operation.hpp>
 #include <boost/dataflow/blueprint/operation_adapter.hpp>
 #include <boost/dataflow/vivid/entity_widget.hpp>
+#include <boost/dataflow/vivid/vector_widget.hpp>
 #include <boost/guigl/draw.hpp>
 #include <boost/guigl/geometry.hpp>
 #include <boost/guigl/window.hpp>
@@ -46,8 +47,8 @@
         glColor3f(0,1,0);
         for(typename std::vector<connection_type>::iterator it=m_connections.begin(); it!= m_connections.end(); it++)
         {
-            guigl::draw::vertex(guigl::geometry::midpoint(*it->first));
-            guigl::draw::vertex(guigl::geometry::midpoint(*it->second));
+            guigl::draw::vertex(guigl::geometry::root_midpoint(*it->first));
+            guigl::draw::vertex(guigl::geometry::root_midpoint(*it->second));
         }
         glEnd();
     }
@@ -71,7 +72,9 @@
     typedef blueprint::framework_entity<BlueprintFramework> framework_entity_type;
     typedef blueprint::framework_context<BlueprintFramework> framework_context_type;
     typedef entity_widget<BlueprintFramework> entity_widget_type;
+    typedef vector_widget<BlueprintFramework> vector_widget_type;
     typedef blueprint::port<BlueprintFramework> port_type;
+    typedef blueprint::vector<BlueprintFramework> vector_type;
 public:
     network_window()
         : m_window(( guigl::_label="Network", guigl::_size=guigl::size_type(800, 600) ))
@@ -90,15 +93,28 @@
     
     void add_entity(std::auto_ptr<framework_entity_type> entity)
     {
-        entity_widget_type *widget = m_layout.create<entity_widget_type>((
-            _entity=entity.release(),
-            guigl::_background(.5,.5,.5),
-            guigl::_label="entity" ));
+        if(dynamic_cast<port_type *> (entity.get()))
+        {
+            entity_widget_type *widget = m_layout.create<entity_widget_type>((
+                _entity=entity.release(),
+                guigl::_background(.5,.5,.5),
+                guigl::_label="entity",
+                _click_callback= boost::bind(&network_window::clicked, this, _1)));
+            
+            (*m_network_widget) << widget;
+        }
+        else if(dynamic_cast<vector_type *> (entity.get()))
+        {
+            vector_widget_type *widget = m_layout.create<vector_widget_type>((
+                _entity=entity.release(),
+                guigl::_background(.5,.5,.5),
+                guigl::_label="entity",
+                _click_callback= boost::bind(&network_window::clicked, this, _1) ));
+
+            (*m_network_widget) << widget;
+        }
             
-        (*m_network_widget) << widget;
         guigl::window::redraw(*m_network_widget);
-        
-        widget->on_click.connect(boost::bind(&network_window::clicked, this, widget));
     }
     
     framework_context_type &framework_context()
@@ -141,7 +157,7 @@
     network_widget<BlueprintFramework> *m_network_widget;
     guigl::layout::grid m_layout;
     entity_widget_type *m_dragged;
-    
+
     blueprint::operation *m_selected_operation;
     boost::ptr_vector<blueprint::operation> m_operations;
 };
Added: sandbox/dataflow-rewrite/boost/dataflow/vivid/vector_widget.hpp
==============================================================================
--- (empty file)
+++ sandbox/dataflow-rewrite/boost/dataflow/vivid/vector_widget.hpp	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -0,0 +1,77 @@
+/*=================================---------------------------------------------
+    Copyright 2007,2008 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__VIVID__VECTOR_WIDGET_HPP
+#define BOOST__DATAFLOW__VIVID__VECTOR_WIDGET_HPP
+
+
+#include <boost/dataflow/vivid/entity_widget.hpp>
+#include <boost/dataflow/blueprint/vector.hpp>
+
+#include <boost/guigl/widget/compound.hpp>
+#include <boost/guigl/layout/grid.hpp>
+
+namespace boost { namespace dataflow { namespace vivid {
+
+template<typename BlueprintFramework>
+class vector_widget
+    : public guigl::view::draggable<vector_widget<BlueprintFramework>, guigl::button::right_type,
+        guigl::widget::compound>
+{
+    typedef blueprint::port<BlueprintFramework> port_type;
+    typedef blueprint::vector<BlueprintFramework> vector_type;
+    typedef entity_widget<BlueprintFramework> entity_widget_type;
+    
+public:
+    typedef guigl::view::draggable<vector_widget<BlueprintFramework>, guigl::button::right_type,
+        guigl::widget::compound> base_type;
+
+    template<typename Args>
+    vector_widget(const Args &args)
+        : base_type(args)
+        , m_entity(dynamic_cast<vector_type *>(args[_entity]))
+    {
+        guigl::layout::grid layout((guigl::_vertical=3, guigl::_grid_size=this->size()));
+        guigl::widget::compound *consumer_ports = layout.create<guigl::widget::compound>((guigl::_background=guigl::color_type(0.5,0,0)));
+        layout.next();
+        guigl::widget::compound *producer_ports = layout.create<guigl::widget::compound>((guigl::_background=guigl::color_type(0,0,0.5)));
+
+        guigl::layout::grid consumer_layout((guigl::_horizontal=3, guigl::_grid_size=consumer_ports->size()));
+        guigl::layout::grid producer_layout((guigl::_horizontal=3, guigl::_grid_size=producer_ports->size()));
+        blueprint::port_iterator<BlueprintFramework> it = m_entity->begin();
+        blueprint::port_iterator<BlueprintFramework> end = m_entity->end();
+        for(;it!=end;++it)
+        {
+            port_type *port;
+            if((port = dynamic_cast<port_type *>(&*it)))
+            {
+                bool consumer = port->category_type_info() == typeid(ports::consumer);
+                *(consumer ? consumer_ports : producer_ports)
+                    << (consumer ? consumer_layout : producer_layout).create<entity_widget_type>((_entity=port, guigl::_label=(consumer ? "<" : ">"), _click_callback=args[_click_callback]));
+            }
+        }
+
+        *this << consumer_ports;
+        layout.next();
+        *this << producer_ports;
+    }
+    void draggable_on_drag(const guigl::position_type &position)
+    {
+        guigl::position_type difference(position - base_type::drag_origin());
+        base_type::set_position(base_type::position() + difference);
+        guigl::window::redraw(*this);
+    }
+    vector_type &entity()
+    {   return *m_entity; }
+private:
+    boost::scoped_ptr<vector_type> m_entity;
+};
+
+} } }
+
+#endif // BOOST__DATAFLOW__VIVID__VECTOR_WIDGET_HPP
Modified: sandbox/dataflow-rewrite/libs/dataflow/build/Jamfile
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/build/Jamfile	(original)
+++ sandbox/dataflow-rewrite/libs/dataflow/build/Jamfile	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -12,10 +12,11 @@
 
 make port_binary_operation.hpp : specializable_operation.hpp.py : @in2out ;
 make entities.hpp : specializable_operation.hpp.py : @entities ;
+make set_context.hpp : specializable_operation.hpp.py : @set_context ;
 
 actions in2out
 {
-    python $(TOP)/libs/dataflow/build/file_template.py template=$(>) erase="y" into=$(<) NAME="port_binary_operation" CHECK="are_port_binary_operable" TEMPLATES="Operation" EXTRA_ARGS="Operation" ARITY=2 HAS_TRAITS="is_port" INCLUDES="<boost/dataflow/generic/port/port.hpp>"
+    python $(TOP)/libs/dataflow/build/file_template.py template=$(>) erase="y" into=$(<) NAME="port_binary_operation" CHECK="are_port_binary_operable" TEMPLATES="Operation" EXTRA_ARGS="const Operation" ARITY=2 HAS_TRAITS="is_port" INCLUDES="<boost/dataflow/generic/port/port.hpp>"
 }
 
 actions entities
@@ -23,6 +24,11 @@
     python $(TOP)/libs/dataflow/build/file_template.py template=$(>) erase="y" into=$(<) NAME="entities" CHECK="has_entities" ARITY=1 HAS_TRAITS="is_framework_entity" INCLUDES="<boost/dataflow/generic/framework_entity.hpp>"
 }
 
+actions set_context
+{
+    python $(TOP)/libs/dataflow/build/file_template.py template=$(>) erase="y" into=$(<) NAME="set_context" CHECK="has_set_context" INNER_TEMPLATES="Context" EXTRA_ARGS="Context" ARITY=1 HAS_TRAITS="is_framework_entity" INCLUDES="<boost/dataflow/generic/framework_entity.hpp>"
+}
+
 install port_binary_operation_result : port_binary_operation.hpp : <location>$(TOP)/boost/dataflow/generic ;
-install get_port_result : get_port.hpp : <location>$(TOP)/boost/dataflow/generic/static_vector ;
 install entities_result : entities.hpp : <location>$(TOP)/boost/dataflow/generic ;
+install set_context_result : set_context.hpp : <location>$(TOP)/boost/dataflow/generic ;
Modified: sandbox/dataflow-rewrite/libs/dataflow/build/specializable_operation.hpp.py
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/build/specializable_operation.hpp.py	(original)
+++ sandbox/dataflow-rewrite/libs/dataflow/build/specializable_operation.hpp.py	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -47,9 +47,9 @@
 
 targs = [("T" + x + " &t" + x) for x in arity_range]
 targs_names = [("t" + x) for x in arity_range]
-extra_args_args = [("const " + x + " &" + x.lower()) for x in extra_args]
-extra_args_names = [(x.lower()) for x in extra_args]
-default_extra_args_args = [(extra_args_args[x] + '=' + extra_args[x] + '()') for x in range(len(extra_args))]
+extra_args_args = [(x + " & " + x.rpartition(" ")[2].lower()) for x in extra_args]
+extra_args_names = [(x.rpartition(" ")[2].lower()) for x in extra_args]
+default_extra_args_args = [(extra_args_args[x] + '=' + extra_args[x].rpartition(" ")[2] + '()') for x in range(len(extra_args))]
 
 content = """
 namespace boost { namespace dataflow {
Modified: sandbox/dataflow-rewrite/libs/dataflow/build/xcodeide/dataflow.xcodeproj/project.pbxproj
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/build/xcodeide/dataflow.xcodeproj/project.pbxproj	(original)
+++ sandbox/dataflow-rewrite/libs/dataflow/build/xcodeide/dataflow.xcodeproj/project.pbxproj	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -119,6 +119,7 @@
                 087535C70E9C1BCF00AD4E99 /* framework_entity_adapter.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = framework_entity_adapter.hpp; sourceTree = "<group>"; };
                 0875360D0E9C29BC00AD4E99 /* port_adapter.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = port_adapter.hpp; sourceTree = "<group>"; };
                 08960FE40E8B60C400FC2A70 /* specializable_operation.hpp.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = specializable_operation.hpp.py; sourceTree = "<group>"; };
+		0896F70B0F0A8163000EA0D2 /* vector_widget.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = vector_widget.hpp; sourceTree = "<group>"; };
                 0897C7860E838AEA00DD0CF9 /* framework.qbk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = framework.qbk; sourceTree = "<group>"; };
                 08982F6D0E8C5F8F008C1918 /* test_port_binary_operation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_port_binary_operation.cpp; sourceTree = "<group>"; };
                 0898B4700E83E6E1004F3E91 /* port_binary_operation.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = port_binary_operation.hpp; sourceTree = "<group>"; };
@@ -206,6 +207,8 @@
                 08B8F1C00E512F45000545B8 /* test_framework_entity_traits.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_framework_entity_traits.cpp; sourceTree = "<group>"; };
                 08B8F1D00E513569000545B8 /* test_framework.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_framework.cpp; sourceTree = "<group>"; };
                 08BA454B0EDCF1A00053808D /* my_dynamic_vector.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = my_dynamic_vector.hpp; sourceTree = "<group>"; };
+		08C39EC30F01B009001F5448 /* set_context.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = set_context.hpp; sourceTree = "<group>"; };
+		08C39ECA0F01B3C0001F5448 /* test_set_context.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_set_context.cpp; sourceTree = "<group>"; };
                 08D18D770EBE25E800B1A160 /* static_vector.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = static_vector.hpp; sourceTree = "<group>"; };
                 08D6B0BA0EDE06A8005821A8 /* test_entities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_entities.cpp; sourceTree = "<group>"; };
                 08D6B0DE0EDE1F55005821A8 /* static_vector_adapter.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = static_vector_adapter.hpp; sourceTree = "<group>"; };
@@ -348,6 +351,7 @@
                                 08AA903B0EAD3BF100409A2E /* factory_window.hpp */,
                                 08A53F850EAC07E6000B9C17 /* blueprint_component.hpp */,
                                 08B44C1B0EB63549004B133F /* entity_widget.hpp */,
+				0896F70B0F0A8163000EA0D2 /* vector_widget.hpp */,
                         );
                         path = vivid;
                         sourceTree = "<group>";
@@ -369,6 +373,7 @@
                 08A77ACD0E4F941C00B8793E /* generic */ = {
                         isa = PBXGroup;
                         children = (
+				08C39EC30F01B009001F5448 /* set_context.hpp */,
                                 08AD7BC10EDD1715002E9432 /* dynamic_vector */,
                                 08AD7BB30EDD1332002E9432 /* entities.hpp */,
                                 08AB81A90EC7A1E300A2B98A /* static_vector */,
@@ -425,6 +430,7 @@
                                 08BA454B0EDCF1A00053808D /* my_dynamic_vector.hpp */,
                                 08AB81BB0EC7A50200A2B98A /* test_static_vector.cpp */,
                                 08AD7BB50EDD13F2002E9432 /* test_dynamic_vector.cpp */,
+				08C39ECA0F01B3C0001F5448 /* test_set_context.cpp */,
                         );
                         path = generic;
                         sourceTree = "<group>";
Modified: sandbox/dataflow-rewrite/libs/dataflow/example/vivid/Jamfile
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/example/vivid/Jamfile	(original)
+++ sandbox/dataflow-rewrite/libs/dataflow/example/vivid/Jamfile	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -7,5 +7,24 @@
 #----------------------------------------------===============================*/
 
 
-exe vivid_graph_example : vivid_graph_example.cpp /boost_guigl//boost_guigl/<link>static ;
-exe vivid_managed_example : vivid_managed_example.cpp /boost_guigl//boost_guigl/<link>static ;
\ No newline at end of file
+exe vivid_graph_example
+    :
+        vivid_graph_example.cpp
+        /boost_guigl//boost_guigl/<use-window-manager>platform_glut
+    ;
+    
+exe vivid_managed_example
+    :
+        vivid_managed_example.cpp
+        /boost_guigl//boost_guigl/<use-window-manager>platform_glut
+        ../../build/managed//dataflow_managed
+    ;
+    
+install $(TOP)/bin.v2/examples
+    :
+        vivid_graph_example
+        vivid_managed_example
+    :
+        <install-dependencies>on <install-type>EXE <install-type>LIB
+    ;
+
Modified: sandbox/dataflow-rewrite/libs/dataflow/example/vivid/vivid_graph_example.cpp
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/example/vivid/vivid_graph_example.cpp	(original)
+++ sandbox/dataflow-rewrite/libs/dataflow/example/vivid/vivid_graph_example.cpp	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -38,9 +38,10 @@
     df::vivid::network_window<graph_blueprint_framework> network_window;
     factory_window.set_network_window(network_window);
     
-    df::blueprint::factory<graph_blueprint_framework> factory;
+    typedef df::blueprint::factory<graph_blueprint_framework> factory_type;
+    factory_type factory;
     
-    factory.add_port<df::ugraph::vertex>("vertex");
+    factory.add<factory_type::port_adapter_selector, df::ugraph::vertex>("vertex", boost::ref(network_window.framework_context().object()));
     network_window.framework_context().register_operation<df::ugraph::vertex, df::ugraph::vertex, df::operations::connect>();
 
     factory_window.set_factory(factory);
Modified: sandbox/dataflow-rewrite/libs/dataflow/example/vivid/vivid_managed_example.cpp
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/example/vivid/vivid_managed_example.cpp	(original)
+++ sandbox/dataflow-rewrite/libs/dataflow/example/vivid/vivid_managed_example.cpp	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -121,16 +121,14 @@
 class example_factory : public df::blueprint::factory<managed_blueprint_framework>
 {
 public:
-    example_factory()
+    example_factory(df::managed::network &m_network)
     {
-/*        add_component<io>("io", boost::ref(m_network));
-        add_component<not_operation>("not", boost::ref(m_network));
-        add_component<and_operation>("and", boost::ref(m_network));
-        add_component<or_operation>("or", boost::ref(m_network));
-        add_component<update_network>("upd", boost::ref(m_network));*/
+        add<static_vector_adapter_selector, io>("io", boost::ref(m_network));
+        add<static_vector_adapter_selector, not_operation>("not", boost::ref(m_network));
+        add<static_vector_adapter_selector, and_operation>("and", boost::ref(m_network));
+        add<static_vector_adapter_selector, or_operation>("or", boost::ref(m_network));
+        add<static_vector_adapter_selector, update_network>("upd", boost::ref(m_network));
     }
-private:
-    df::managed::network m_network;
 };
 
 int main()
@@ -141,8 +139,9 @@
     df::vivid::factory_window<managed_blueprint_framework> factory_window;
     df::vivid::network_window<managed_blueprint_framework> network_window;
     factory_window.set_network_window(network_window);
+    network_window.framework_context().register_operation<df::managed::port<bool, df::ports::producer>, df::managed::port<bool, df::ports::consumer>, df::operations::connect>();
     
-    example_factory factory;
+    example_factory factory(network_window.framework_context().object());
     
     factory_window.set_factory(factory);
     
Modified: sandbox/dataflow-rewrite/libs/dataflow/src/managed/component.cpp
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/src/managed/component.cpp	(original)
+++ sandbox/dataflow-rewrite/libs/dataflow/src/managed/component.cpp	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -13,19 +13,30 @@
 
 namespace boost { namespace dataflow { namespace managed {
 
-component::component(network &network_context) : m_network_context(network_context), m_topological_sort_index(0)
+component::component(network &network_context) : m_network_context(&network_context), m_topological_sort_index(0)
 {
-    network_context.register_component(this);
+    if(m_network_context)
+        m_network_context->register_component(this);
 };
 
 component::component(const component &other) : m_network_context(other.m_network_context), m_topological_sort_index(0)
 {
-    m_network_context.register_component(this);
+    if(m_network_context)
+        m_network_context->register_component(this);
+}
+
+void component::set_network_context(network &network_context)
+{
+    if(m_network_context)
+        m_network_context->unregister_component(this);
+
+    m_network_context = &network_context;
+    m_network_context->register_component(this);
 }
 
 component::~component()
 {
-    m_network_context.unregister_component(this);
+    m_network_context->unregister_component(this);
 }
 
 void component::claim_port(port_base &p)
Modified: sandbox/dataflow-rewrite/libs/dataflow/test/blueprint/test_factory.cpp
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/test/blueprint/test_factory.cpp	(original)
+++ sandbox/dataflow-rewrite/libs/dataflow/test/blueprint/test_factory.cpp	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -20,8 +20,9 @@
 
 BOOST_AUTO_TEST_CASE( test_default ) 
 {
-    df::blueprint::factory<my_blueprint_framework> factory;
-    factory.add_port<my_port_producer>("my_port_producer");
+    typedef df::blueprint::factory<my_blueprint_framework> factory_type;
+    factory_type factory;
+    factory.add<factory_type::port_adapter_selector, my_port_producer>("my_port_producer");
     
     df::blueprint::framework_context<my_blueprint_framework> fo;
     df::blueprint::framework_entity<my_blueprint_framework> *entity = factory["my_port_producer"](fo);
Modified: sandbox/dataflow-rewrite/libs/dataflow/test/generic/Jamfile
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/test/generic/Jamfile	(original)
+++ sandbox/dataflow-rewrite/libs/dataflow/test/generic/Jamfile	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -22,3 +22,5 @@
 run test_static_vector.cpp ;
 run test_dynamic_vector.cpp ;
 run test_entities.cpp ;
+
+run test_set_context.cpp ;
Modified: sandbox/dataflow-rewrite/libs/dataflow/test/generic/my_framework_with_context.hpp
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/test/generic/my_framework_with_context.hpp	(original)
+++ sandbox/dataflow-rewrite/libs/dataflow/test/generic/my_framework_with_context.hpp	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -12,6 +12,7 @@
 
 #include <boost/dataflow/generic/framework.hpp>
 
+namespace df=boost::dataflow;
 
 struct my_object
 {};
Added: sandbox/dataflow-rewrite/libs/dataflow/test/generic/test_set_context.cpp
==============================================================================
--- (empty file)
+++ sandbox/dataflow-rewrite/libs/dataflow/test/generic/test_set_context.cpp	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -0,0 +1,39 @@
+/*=================================---------------------------------------------
+    Copyright 2008 Stjepan Rajko
+  
+    Distributed under the Boost Software License, Version 1.0.
+    (See accompanying file LICENSE_1_0.txt or copy at
+    http://www.boost.org/LICENSE_1_0.txt)
+-----------------------------------------------===============================*/
+
+
+#include <boost/dataflow/generic/set_context.hpp>
+#include "my_ports_with_context.hpp"
+
+
+#define BOOST_TEST_MAIN
+#include <boost/test/unit_test.hpp>
+
+namespace df=boost::dataflow;
+
+namespace boost { namespace dataflow { namespace extension {
+
+    template<>
+    struct set_context_impl<my_port_with_context_traits>
+    {
+        typedef void result_type;
+        
+        void operator()(my_port_with_context &context, my_object &object)
+        {
+        }
+    };
+
+}}}
+
+BOOST_AUTO_TEST_CASE( test )
+{
+    my_object object;
+    my_port_with_context port(object);
+    
+    df::set_context(port, object);
+}
\ No newline at end of file
Modified: sandbox/dataflow-rewrite/libs/dataflow/test/managed/test_io_component.cpp
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/test/managed/test_io_component.cpp	(original)
+++ sandbox/dataflow-rewrite/libs/dataflow/test/managed/test_io_component.cpp	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -23,6 +23,9 @@
 
     BOOST_CHECK_EQUAL(&at_c<0>(df::entities(c)), &c.port<0>());
     BOOST_CHECK_EQUAL(&at_c<1>(df::entities(c)), &c.port<1>());
+    
+    c.set<1>(true);
+    c.get<1>();
 } // int test_main(int, char* [])
 
 
Modified: sandbox/dataflow-rewrite/libs/dataflow/test/vivid/test_factory_window.cpp
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/test/vivid/test_factory_window.cpp	(original)
+++ sandbox/dataflow-rewrite/libs/dataflow/test/vivid/test_factory_window.cpp	2009-03-15 00:07:12 EDT (Sun, 15 Mar 2009)
@@ -20,8 +20,9 @@
 {
     df::vivid::factory_window<my_blueprint_framework> window;
     
+    typedef df::blueprint::factory<my_blueprint_framework> factory_type;
     df::blueprint::factory<my_blueprint_framework> factory;
-    factory.add_port<my_port_producer>("my_port_producer");
+    factory.add<factory_type::port_adapter_selector, my_port_producer>("my_port_producer");
 
     window.set_factory(factory);
 }