Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r50121 - in sandbox/dataflow-rewrite: boost/dataflow/managed libs/dataflow/src/managed libs/dataflow/test libs/dataflow/test/managed
From: stipe_at_[hidden]
Date: 2008-12-04 17:24:46


Author: srajko
Date: 2008-12-04 17:24:45 EST (Thu, 04 Dec 2008)
New Revision: 50121
URL: http://svn.boost.org/trac/boost/changeset/50121

Log:
switched to shared linking, fixed managed::component copy construction
Text files modified:
   sandbox/dataflow-rewrite/boost/dataflow/managed/component.hpp | 2 ++
   sandbox/dataflow-rewrite/boost/dataflow/managed/io_component.hpp | 21 +++++++++++++++++++++
   sandbox/dataflow-rewrite/boost/dataflow/managed/port.hpp | 10 ++++++----
   sandbox/dataflow-rewrite/libs/dataflow/src/managed/component.cpp | 6 ++++++
   sandbox/dataflow-rewrite/libs/dataflow/test/Jamfile | 2 +-
   sandbox/dataflow-rewrite/libs/dataflow/test/managed/Jamfile | 4 ++--
   sandbox/dataflow-rewrite/libs/dataflow/test/managed/test_io_component.cpp | 7 +++----
   sandbox/dataflow-rewrite/libs/dataflow/test/managed/test_network.cpp | 6 +++---
   sandbox/dataflow-rewrite/libs/dataflow/test/managed/test_port.cpp | 6 +++---
   9 files changed, 47 insertions(+), 17 deletions(-)

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 2008-12-04 17:24:45 EST (Thu, 04 Dec 2008)
@@ -9,6 +9,7 @@
 namespace boost { namespace dataflow { namespace managed {
 
 class network;
+class port_base;
 
 class component
 {
@@ -27,6 +28,7 @@
     {
         return m_topological_sort_index;
     }
+ void claim_port(port_base &p);
 private:
     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 2008-12-04 17:24:45 EST (Thu, 04 Dec 2008)
@@ -14,6 +14,7 @@
 #include <boost/dataflow/utility/forced_sequence.hpp>
 //#include <boost/fusion/container/lazy_sequence.hpp>
 #include <boost/fusion/include/as_vector.hpp>
+#include <boost/fusion/include/for_each.hpp>
 #include <boost/fusion/include/size.hpp>
 #include <boost/fusion/include/transform.hpp>
 #include <boost/mpl/map.hpp>
@@ -78,6 +79,19 @@
         
         mutable result_type m_component;
     };
+
+ struct set_port_context
+ {
+ set_port_context(component &c)
+ : c(&c)
+ {}
+
+ void operator()(port_base &p) const
+ {
+ c->claim_port(p);
+ }
+ component *c;
+ };
 
 }
 
@@ -95,6 +109,12 @@
         : component(n)
         , m_ports(fusion::transform(mpl::range_c<int,0,fusion::result_of::size<ports_type>::type::value>(), detail::component_f(*this)))
     {}
+ io_component(const io_component &other)
+ : component(static_cast<const component &>(other))
+ , m_ports(other.m_ports)
+ {
+ fusion::for_each(m_ports, 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); }
@@ -102,6 +122,7 @@
     { return m_ports; }
 protected:
     ports_type m_ports;
+ friend class detail::set_port_context;
 };
 
 }

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 2008-12-04 17:24:45 EST (Thu, 04 Dec 2008)
@@ -19,14 +19,16 @@
 class port_base
 {
 public:
- port_base(component &component_context) : m_component_context(component_context)
+ port_base(component &component_context) : m_component_context(&component_context)
     {
-
     };
     component &component_context()
- { return m_component_context; }
+ { return *m_component_context; }
 private:
- component &m_component_context;
+ void set_component_context(component &c)
+ { m_component_context = &c; }
+ component *m_component_context;
+ friend class component;
 };
 
 template<typename T, typename PortCategory>

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 2008-12-04 17:24:45 EST (Thu, 04 Dec 2008)
@@ -5,6 +5,7 @@
 
 #include <boost/dataflow/managed/component.hpp>
 #include <boost/dataflow/managed/network.hpp>
+#include <boost/dataflow/managed/port.hpp>
 
 namespace boost { namespace dataflow { namespace managed {
 
@@ -23,6 +24,11 @@
     m_network_context.unregister_component(this);
 }
 
+void component::claim_port(port_base &p)
+{
+ p.set_component_context(*this);
+}
+
 
 }}}
 

Modified: sandbox/dataflow-rewrite/libs/dataflow/test/Jamfile
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/test/Jamfile (original)
+++ sandbox/dataflow-rewrite/libs/dataflow/test/Jamfile 2008-12-04 17:24:45 EST (Thu, 04 Dec 2008)
@@ -12,7 +12,7 @@
 project dataflow/test
     : requirements
       <define>BOOST_ALL_NO_LIB=1
- <library>/boost/test//boost_unit_test_framework/<link>static
+ <library>/boost/test//boost_unit_test_framework
     ;
 
 build-project generic ;

Modified: sandbox/dataflow-rewrite/libs/dataflow/test/managed/Jamfile
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/test/managed/Jamfile (original)
+++ sandbox/dataflow-rewrite/libs/dataflow/test/managed/Jamfile 2008-12-04 17:24:45 EST (Thu, 04 Dec 2008)
@@ -9,8 +9,8 @@
     : requirements
       <include>../../../..
       <define>BOOST_ALL_NO_LIB=1
-# <library>/dataflow/managed//dataflow_managed/<link>static
- <library>../../build/managed//dataflow_managed/<link>static
+# <library>/dataflow/managed//dataflow_managed
+ <library>../../build/managed//dataflow_managed
     ;
 
 run test_port.cpp ;

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 2008-12-04 17:24:45 EST (Thu, 04 Dec 2008)
@@ -10,9 +10,10 @@
 #include <boost/dataflow/managed/io_component.hpp>
 #include <boost/dataflow/managed/network.hpp>
 
-#include <boost/test/included/test_exec_monitor.hpp>
+#define BOOST_TEST_MAIN
+#include <boost/test/unit_test.hpp>
 
-int test_main(int, char* [])
+BOOST_AUTO_TEST_CASE( test )
 {
     using namespace boost;
     using boost::fusion::at_c;
@@ -22,8 +23,6 @@
 
     BOOST_CHECK_EQUAL(&at_c<0>(df::entities(c)), &c.port<0>());
     BOOST_CHECK_EQUAL(&at_c<1>(df::entities(c)), &c.port<1>());
-
- return 0;
 } // int test_main(int, char* [])
 
 

Modified: sandbox/dataflow-rewrite/libs/dataflow/test/managed/test_network.cpp
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/test/managed/test_network.cpp (original)
+++ sandbox/dataflow-rewrite/libs/dataflow/test/managed/test_network.cpp 2008-12-04 17:24:45 EST (Thu, 04 Dec 2008)
@@ -8,7 +8,8 @@
 #include <boost/dataflow/managed/network.hpp>
 #include <boost/assign/std/vector.hpp>
 
-#include <boost/test/included/test_exec_monitor.hpp>
+#define BOOST_TEST_MAIN
+#include <boost/test/unit_test.hpp>
 
 namespace df=boost::dataflow;
 
@@ -66,7 +67,7 @@
     unsigned invoke_count;
 };
 
-int test_main(int, char* [])
+BOOST_AUTO_TEST_CASE( test )
 {
     // our network
     df::managed::network network;
@@ -137,7 +138,6 @@
     BOOST_CHECK_EQUAL(CplusD.invoke_count, 2u);
     BOOST_CHECK_EQUAL(ApBtimesCpD.invoke_count, 3u);
     
- return 0;
 } // int test_main(int, char* [])
 
 

Modified: sandbox/dataflow-rewrite/libs/dataflow/test/managed/test_port.cpp
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/test/managed/test_port.cpp (original)
+++ sandbox/dataflow-rewrite/libs/dataflow/test/managed/test_port.cpp 2008-12-04 17:24:45 EST (Thu, 04 Dec 2008)
@@ -7,9 +7,10 @@
 #include <boost/dataflow/managed/port.hpp>
 #include <boost/dataflow/managed/network.hpp>
 
-#include <boost/test/included/test_exec_monitor.hpp>
+#define BOOST_TEST_MAIN
+#include <boost/test/unit_test.hpp>
 
-int test_main(int, char* [])
+BOOST_AUTO_TEST_CASE( test )
 {
     using namespace boost;
     namespace df=boost::dataflow;
@@ -37,7 +38,6 @@
     BOOST_CHECK_EQUAL(network.changed_components().size(), 1u);
     BOOST_CHECK_EQUAL(*network.changed_components().begin(), &input_component);
     
- 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