Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51780 - in sandbox/dataflow-rewrite: boost/dataflow/blueprint boost/dataflow/managed libs/dataflow/build/xcodeide/dataflow.xcodeproj libs/dataflow/example libs/dataflow/example/blueprint libs/dataflow/src/managed libs/dataflow/test/blueprint libs/dataflow/test/vivid
From: stipe_at_[hidden]
Date: 2009-03-15 01:23:17


Author: srajko
Date: 2009-03-15 01:23:15 EDT (Sun, 15 Mar 2009)
New Revision: 51780
URL: http://svn.boost.org/trac/boost/changeset/51780

Log:
added support for dataflow_base_type
Added:
   sandbox/dataflow-rewrite/libs/dataflow/example/blueprint/
   sandbox/dataflow-rewrite/libs/dataflow/example/blueprint/Jamfile (contents, props changed)
   sandbox/dataflow-rewrite/libs/dataflow/example/blueprint/managed_blueprint_example.cpp (contents, props changed)
   sandbox/dataflow-rewrite/libs/dataflow/test/blueprint/test_managed_blueprint.cpp (contents, props changed)
Text files modified:
   sandbox/dataflow-rewrite/boost/dataflow/blueprint/framework_entity_adapter.hpp | 32 ++++++++++++++++++++++++++------
   sandbox/dataflow-rewrite/boost/dataflow/managed/component.hpp | 2 ++
   sandbox/dataflow-rewrite/boost/dataflow/managed/io_component.hpp | 3 +++
   sandbox/dataflow-rewrite/libs/dataflow/build/xcodeide/dataflow.xcodeproj/project.pbxproj | 14 ++++++++++++++
   sandbox/dataflow-rewrite/libs/dataflow/example/Jamfile | 1 +
   sandbox/dataflow-rewrite/libs/dataflow/src/managed/component.cpp | 3 ++-
   sandbox/dataflow-rewrite/libs/dataflow/test/blueprint/Jamfile | 3 ++-
   sandbox/dataflow-rewrite/libs/dataflow/test/vivid/Jamfile | 2 +-
   8 files changed, 51 insertions(+), 9 deletions(-)

Modified: sandbox/dataflow-rewrite/boost/dataflow/blueprint/framework_entity_adapter.hpp
==============================================================================
--- sandbox/dataflow-rewrite/boost/dataflow/blueprint/framework_entity_adapter.hpp (original)
+++ sandbox/dataflow-rewrite/boost/dataflow/blueprint/framework_entity_adapter.hpp 2009-03-15 01:23:15 EDT (Sun, 15 Mar 2009)
@@ -12,30 +12,50 @@
 
 #include <boost/dataflow/blueprint/framework_entity.hpp>
 #include <boost/dataflow/blueprint/framework_context.hpp>
-#include <boost/dataflow/utility/is_type.hpp>
+#include <boost/dataflow/utility/enable_if_type.hpp>
 #include <boost/type_traits/remove_reference.hpp>
-#include <boost/utility/enable_if.hpp>
 #include <boost/pointee.hpp>
 
 namespace boost { namespace dataflow { namespace blueprint {
 
+namespace detail {
+
+template<typename T, typename Enable=void>
+struct dataflow_base_of
+{
+ typedef T type;
+};
+
+template<typename T>
+struct dataflow_base_of<T,
+ typename utility::enable_if_type<typename T::dataflow_base_type>::type>
+{
+ typedef typename T::dataflow_base_type type;
+};
+
+}
+
 template<typename BlueprintFramework, typename Dereferencable, typename Base=framework_entity<BlueprintFramework>, typename Enable=void >
 class framework_entity_adapter : public Base
 {
 public:
     typedef typename pointee<Dereferencable>::type entity_type;
+ typedef
+ typename detail::dataflow_base_of<
+ typename pointee<Dereferencable>::type
+ >::type castable_entity_type;
     
     framework_entity_adapter(blueprint::framework_context<BlueprintFramework> &fo)
- : Base(fo, typeid(entity_type))
+ : Base(fo, typeid(castable_entity_type))
     {}
     template<typename T>
     framework_entity_adapter(blueprint::framework_context<BlueprintFramework> &fo, const T &t)
- : Base(fo, typeid(entity_type))
+ : Base(fo, typeid(castable_entity_type))
         , m_entity(t)
     {}
     template<typename T>
     framework_entity_adapter(blueprint::framework_context<BlueprintFramework> &fo, T &t)
- : Base(fo, typeid(entity_type))
+ : Base(fo, typeid(castable_entity_type))
         , m_entity(t)
     {}
 
@@ -50,7 +70,7 @@
 private:
     virtual void *get_ptr()
     {
- return &*m_entity;
+ return static_cast<castable_entity_type *>(&*m_entity);
     };
     Dereferencable m_entity;
 };

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 01:23:15 EDT (Sun, 15 Mar 2009)
@@ -17,6 +17,8 @@
 class BOOST_EXPORT_SYMBOLS component
 {
 public:
+ typedef component dataflow_base_type;
+
     component()
         : m_network_context(0), m_topological_sort_index(0)
     {}

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 01:23:15 EDT (Sun, 15 Mar 2009)
@@ -105,6 +105,9 @@
     typedef component_traits<in_types_sequence, out_types_sequence> dataflow_traits;
     typedef typename detail::make_fusion_ports<in_types_sequence, out_types_sequence>::type ports_type;
     
+ io_component()
+ : m_ports(fusion::transform(mpl::range_c<int,0,fusion::result_of::size<ports_type>::type::value>(), detail::component_f(*this)))
+ {}
     io_component(network &n)
         : component(n)
         , m_ports(fusion::transform(mpl::range_c<int,0,fusion::result_of::size<ports_type>::type::value>(), detail::component_f(*this)))

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 01:23:15 EDT (Sun, 15 Mar 2009)
@@ -122,6 +122,9 @@
                 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>"; };
+ 08986FF10F6CBCE000FAF4D5 /* test_managed_blueprint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_managed_blueprint.cpp; sourceTree = "<group>"; };
+ 089870AA0F6CC4C400FAF4D5 /* managed_blueprint_example.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = managed_blueprint_example.cpp; sourceTree = "<group>"; };
+ 089870AB0F6CC4CB00FAF4D5 /* Jamfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.jam; path = Jamfile; sourceTree = "<group>"; };
                 0898B4700E83E6E1004F3E91 /* port_binary_operation.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = port_binary_operation.hpp; sourceTree = "<group>"; };
                 089971740E83014B00284E42 /* dataflow.qbk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = dataflow.qbk; sourceTree = "<group>"; };
                 089971750E83014B00284E42 /* Jamfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.jam; path = Jamfile; sourceTree = "<group>"; };
@@ -260,6 +263,7 @@
                 08668C4D0C19A16300ACB19A /* example */ = {
                         isa = PBXGroup;
                         children = (
+ 089870A80F6CC48F00FAF4D5 /* blueprint */,
                                 08A2279B0EAE425000F70466 /* generic */,
                                 08A2277C0EAE3E6D00F70466 /* vivid */,
                                 08A227910EAE417000F70466 /* Jamfile */,
@@ -268,6 +272,15 @@
                         path = ../../example;
                         sourceTree = SOURCE_ROOT;
                 };
+ 089870A80F6CC48F00FAF4D5 /* blueprint */ = {
+ isa = PBXGroup;
+ children = (
+ 089870AA0F6CC4C400FAF4D5 /* managed_blueprint_example.cpp */,
+ 089870AB0F6CC4CB00FAF4D5 /* Jamfile */,
+ );
+ path = blueprint;
+ sourceTree = "<group>";
+ };
                 089971810E83058D00284E42 /* generic */ = {
                         isa = PBXGroup;
                         children = (
@@ -590,6 +603,7 @@
                                 08ADD5080EDCC9A400838188 /* my_blueprint_static_vector.hpp */,
                                 08A53F920EAC14A4000B9C17 /* test_factory.cpp */,
                                 08ADD5040EDCC92D00838188 /* test_static_vector.cpp */,
+ 08986FF10F6CBCE000FAF4D5 /* test_managed_blueprint.cpp */,
                         );
                         path = blueprint;
                         sourceTree = "<group>";

Modified: sandbox/dataflow-rewrite/libs/dataflow/example/Jamfile
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/example/Jamfile (original)
+++ sandbox/dataflow-rewrite/libs/dataflow/example/Jamfile 2009-03-15 01:23:15 EDT (Sun, 15 Mar 2009)
@@ -13,6 +13,7 @@
     ;
 
 build-project generic ;
+build-project blueprint ;
 
 if $(guigl_present)
 {

Added: sandbox/dataflow-rewrite/libs/dataflow/example/blueprint/Jamfile
==============================================================================
--- (empty file)
+++ sandbox/dataflow-rewrite/libs/dataflow/example/blueprint/Jamfile 2009-03-15 01:23:15 EDT (Sun, 15 Mar 2009)
@@ -0,0 +1,12 @@
+#==================================---------------------------------------------
+# 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)
+#----------------------------------------------===============================*/
+
+
+exe managed_blueprint_example
+ : managed_blueprint_example.cpp
+ : <library>../../build/managed//dataflow_managed/<link>static ;

Added: sandbox/dataflow-rewrite/libs/dataflow/example/blueprint/managed_blueprint_example.cpp
==============================================================================
--- (empty file)
+++ sandbox/dataflow-rewrite/libs/dataflow/example/blueprint/managed_blueprint_example.cpp 2009-03-15 01:23:15 EDT (Sun, 15 Mar 2009)
@@ -0,0 +1,42 @@
+/*=================================---------------------------------------------
+ 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/blueprint/framework.hpp>
+#include <boost/dataflow/blueprint/framework_context.hpp>
+#include <boost/dataflow/blueprint/static_vector_adapter.hpp>
+#include <boost/dataflow/managed/io_component.hpp>
+
+#include <boost/scoped_ptr.hpp>
+
+
+namespace df = boost::dataflow;
+
+typedef df::blueprint::framework<df::managed::framework> managed_blueprint_framework;
+typedef df::blueprint::framework_context<managed_blueprint_framework> managed_blueprint_framework_context;
+
+struct component : public df::managed::io_component<int, int>
+{
+};
+
+typedef
+ df::blueprint::static_vector_adapter
+ <
+ managed_blueprint_framework,
+ boost::scoped_ptr<component>
+ >
+ managed_blueprint_static_vector;
+
+
+int main()
+{
+ managed_blueprint_framework_context fo;
+ managed_blueprint_static_vector vector(fo, new component());
+
+ return 0;
+}
\ No newline at end of file

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 01:23:15 EDT (Sun, 15 Mar 2009)
@@ -36,7 +36,8 @@
 
 component::~component()
 {
- m_network_context->unregister_component(this);
+ if(m_network_context)
+ m_network_context->unregister_component(this);
 }
 
 void component::claim_port(port_base &p)

Modified: sandbox/dataflow-rewrite/libs/dataflow/test/blueprint/Jamfile
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/test/blueprint/Jamfile (original)
+++ sandbox/dataflow-rewrite/libs/dataflow/test/blueprint/Jamfile 2009-03-15 01:23:15 EDT (Sun, 15 Mar 2009)
@@ -13,6 +13,7 @@
 run test_port_binary_operation.cpp ;
 run test_port_binary_operation_implementation.cpp ;
 run test_operation.cpp ;
-run test_static_vector.cpp ;
+# run test_static_vector.cpp ;
 run test_framework_context.cpp ;
 run test_factory.cpp ;
+run test_managed_blueprint.cpp : : : <library>../../build/managed//dataflow_managed ;

Added: sandbox/dataflow-rewrite/libs/dataflow/test/blueprint/test_managed_blueprint.cpp
==============================================================================
--- (empty file)
+++ sandbox/dataflow-rewrite/libs/dataflow/test/blueprint/test_managed_blueprint.cpp 2009-03-15 01:23:15 EDT (Sun, 15 Mar 2009)
@@ -0,0 +1,44 @@
+/*=================================---------------------------------------------
+ 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/blueprint/framework.hpp>
+#include <boost/dataflow/blueprint/framework_context.hpp>
+#include <boost/dataflow/blueprint/static_vector_adapter.hpp>
+#include <boost/dataflow/managed/io_component.hpp>
+
+#include <boost/scoped_ptr.hpp>
+
+#define BOOST_TEST_MAIN
+#include <boost/test/unit_test.hpp>
+
+
+namespace df = boost::dataflow;
+
+typedef df::blueprint::framework<df::managed::framework> managed_blueprint_framework;
+typedef df::blueprint::framework_context<managed_blueprint_framework> managed_blueprint_framework_context;
+
+struct component : public df::managed::io_component<int, int>
+{
+};
+
+typedef
+ df::blueprint::static_vector_adapter
+ <
+ managed_blueprint_framework,
+ boost::scoped_ptr<component>
+ >
+ managed_blueprint_static_vector;
+
+
+BOOST_AUTO_TEST_CASE( test )
+{
+ managed_blueprint_framework_context fo;
+ managed_blueprint_static_vector vector(fo, new component());
+ vector.get_as<df::managed::component>().set_network_context(fo.object());
+}
\ No newline at end of file

Modified: sandbox/dataflow-rewrite/libs/dataflow/test/vivid/Jamfile
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/test/vivid/Jamfile (original)
+++ sandbox/dataflow-rewrite/libs/dataflow/test/vivid/Jamfile 2009-03-15 01:23:15 EDT (Sun, 15 Mar 2009)
@@ -7,4 +7,4 @@
 #----------------------------------------------===============================*/
 
 
-run test_factory_window.cpp /boost_guigl//boost_guigl/<link>static ;
+# run test_factory_window.cpp /boost_guigl//boost_guigl/<link>static ;


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