Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r50100 - in sandbox/dataflow-rewrite: boost/dataflow/blueprint libs/dataflow/build/xcodeide/dataflow.xcodeproj libs/dataflow/test/blueprint libs/dataflow/test/generic
From: stipe_at_[hidden]
Date: 2008-12-03 17:37:05


Author: srajko
Date: 2008-12-03 17:37:03 EST (Wed, 03 Dec 2008)
New Revision: 50100
URL: http://svn.boost.org/trac/boost/changeset/50100

Log:
framework_entity_adapter allows more flexible construction
Added:
   sandbox/dataflow-rewrite/libs/dataflow/test/generic/my_ports_with_context.hpp (contents, props changed)
Text files modified:
   sandbox/dataflow-rewrite/boost/dataflow/blueprint/framework_entity_adapter.hpp | 16 ++++++++++++++--
   sandbox/dataflow-rewrite/libs/dataflow/build/xcodeide/dataflow.xcodeproj/project.pbxproj | 4 +++-
   sandbox/dataflow-rewrite/libs/dataflow/test/blueprint/my_blueprint_framework.hpp | 6 +++++-
   sandbox/dataflow-rewrite/libs/dataflow/test/blueprint/test_framework_context.cpp | 2 +-
   sandbox/dataflow-rewrite/libs/dataflow/test/blueprint/test_framework_entity.cpp | 9 +++++++++
   sandbox/dataflow-rewrite/libs/dataflow/test/generic/my_framework_with_context.hpp | 2 +-
   sandbox/dataflow-rewrite/libs/dataflow/test/generic/my_ports.hpp | 22 +++++++++++++++++++++-
   sandbox/dataflow-rewrite/libs/dataflow/test/generic/test_framework.cpp | 6 +++---
   8 files changed, 57 insertions(+), 10 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 2008-12-03 17:37:03 EST (Wed, 03 Dec 2008)
@@ -12,6 +12,7 @@
 
 #include <boost/dataflow/blueprint/framework_entity.hpp>
 #include <boost/dataflow/blueprint/framework_context.hpp>
+#include <boost/dataflow/utility/is_type.hpp>
 #include <boost/type_traits/remove_reference.hpp>
 #include <boost/utility/enable_if.hpp>
 
@@ -59,6 +60,7 @@
     typename enable_if<typename BlueprintFramework::framework_has_object>::type>
     : public Base
 {
+ typedef typename is_reference<EntityOrRef>::type is_reference;
 public:
     typedef typename remove_reference<EntityOrRef>::type entity_type;
     
@@ -66,18 +68,28 @@
         : Base(fo, typeid(m_entity))
         , m_entity(fo.object())
     {}
+ framework_entity_adapter(framework_context<BlueprintFramework> &fo, entity_type &t)
+ : Base(fo, typeid(m_entity))
+ , m_entity(t)
+ {}
+ framework_entity_adapter(framework_context<BlueprintFramework> &fo, const entity_type &t)
+ : Base(fo, typeid(m_entity))
+ , m_entity(t)
+ {}
     template<typename T>
     framework_entity_adapter(framework_context<BlueprintFramework> &fo, const T &t)
         : Base(fo, typeid(m_entity))
         , m_entity(fo.object(), t)
     {}
     template<typename T>
- framework_entity_adapter(framework_context<BlueprintFramework> &fo, T &t)
+ framework_entity_adapter(framework_context<BlueprintFramework> &fo, T &t,
+ typename disable_if<mpl::and_<utility::is_type<T>, is_reference> >::type* dummy = 0)
         : Base(fo, typeid(m_entity))
         , m_entity(fo.object(), t)
     {}
     template<typename T>
- framework_entity_adapter(framework_context<BlueprintFramework> &fo, const entity_type &t)
+ framework_entity_adapter(framework_context<BlueprintFramework> &fo, T &t,
+ typename enable_if<mpl::and_<utility::is_type<T>, is_reference> >::type* dummy = 0)
         : Base(fo, typeid(m_entity))
         , m_entity(t)
     {}

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 2008-12-03 17:37:03 EST (Wed, 03 Dec 2008)
@@ -162,6 +162,7 @@
                 08AA90690EAD46A000409A2E /* Jamfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.jam; path = Jamfile; sourceTree = "<group>"; };
                 08AB471E0EE72D7F0068375D /* io_component.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = io_component.hpp; sourceTree = "<group>"; };
                 08AB471F0EE72D940068375D /* test_io_component.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_io_component.cpp; sourceTree = "<group>"; };
+ 08AB47EC0EE73B1E0068375D /* my_ports_with_context.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = my_ports_with_context.hpp; sourceTree = "<group>"; };
                 08AB81AA0EC7A1F700A2B98A /* traits.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = traits.hpp; sourceTree = "<group>"; };
                 08AB81AB0EC7A20200A2B98A /* static_vector.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = static_vector.hpp; sourceTree = "<group>"; };
                 08AB81BB0EC7A50200A2B98A /* test_static_vector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_static_vector.cpp; sourceTree = "<group>"; };
@@ -383,7 +384,6 @@
                         isa = PBXGroup;
                         children = (
                                 08D6B0BA0EDE06A8005821A8 /* test_entities.cpp */,
- 08B3CC220EC8B7D3002D2124 /* my_framework_with_context.hpp */,
                                 08A77B060E4FC58D00B8793E /* Jamfile */,
                                 08DD9DFA0E7B22DD008DC46A /* test_default_framework_of.cpp */,
                                 08B8F1D00E513569000545B8 /* test_framework.cpp */,
@@ -395,7 +395,9 @@
                                 08982F6D0E8C5F8F008C1918 /* test_port_binary_operation.cpp */,
                                 0826E32F0EA53E360090AB4E /* test_operation.cpp */,
                                 089A28B10E8D96F2000FCCC9 /* my_framework.hpp */,
+ 08B3CC220EC8B7D3002D2124 /* my_framework_with_context.hpp */,
                                 089A28B50E8D9772000FCCC9 /* my_ports.hpp */,
+ 08AB47EC0EE73B1E0068375D /* my_ports_with_context.hpp */,
                                 089A28D80E8D99BC000FCCC9 /* my_entity.hpp */,
                                 0826E2DC0EA52A850090AB4E /* my_connect.hpp */,
                                 08AB81BF0EC7A52F00A2B98A /* my_static_vector.hpp */,

Modified: sandbox/dataflow-rewrite/libs/dataflow/test/blueprint/my_blueprint_framework.hpp
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/test/blueprint/my_blueprint_framework.hpp (original)
+++ sandbox/dataflow-rewrite/libs/dataflow/test/blueprint/my_blueprint_framework.hpp 2008-12-03 17:37:03 EST (Wed, 03 Dec 2008)
@@ -11,8 +11,12 @@
 #include <boost/dataflow/blueprint/framework_context.hpp>
 
 #include "../generic/my_framework.hpp"
+#include "../generic/my_framework_with_context.hpp"
 
 namespace df = boost::dataflow;
 
 typedef df::blueprint::framework<my_framework> my_blueprint_framework;
-typedef df::blueprint::framework_context<my_blueprint_framework> my_blueprint_framework_context;
\ No newline at end of file
+typedef df::blueprint::framework_context<my_blueprint_framework> my_blueprint_framework_context;
+
+typedef df::blueprint::framework<my_framework_with_context> my_blueprint_framework_with_context;
+typedef df::blueprint::framework_context<my_blueprint_framework_with_context> my_blueprint_framework_with_context_context;

Modified: sandbox/dataflow-rewrite/libs/dataflow/test/blueprint/test_framework_context.cpp
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/test/blueprint/test_framework_context.cpp (original)
+++ sandbox/dataflow-rewrite/libs/dataflow/test/blueprint/test_framework_context.cpp 2008-12-03 17:37:03 EST (Wed, 03 Dec 2008)
@@ -42,7 +42,7 @@
 
 BOOST_AUTO_TEST_CASE( test_framework_with_object )
 {
- typedef df::blueprint::framework<my_framework_with_object> my_blueprint_framework_with_object;
+ typedef df::blueprint::framework<my_framework_with_context> my_blueprint_framework_with_object;
     
     df::blueprint::framework_context<my_blueprint_framework_with_object> object;
 

Modified: sandbox/dataflow-rewrite/libs/dataflow/test/blueprint/test_framework_entity.cpp
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/test/blueprint/test_framework_entity.cpp (original)
+++ sandbox/dataflow-rewrite/libs/dataflow/test/blueprint/test_framework_entity.cpp 2008-12-03 17:37:03 EST (Wed, 03 Dec 2008)
@@ -12,6 +12,7 @@
 
 #include "my_blueprint_framework.hpp"
 #include "../generic/my_ports.hpp"
+#include "../generic/my_ports_with_context.hpp"
 
 #define BOOST_TEST_MAIN
 #include <boost/test/unit_test.hpp>
@@ -28,5 +29,13 @@
     df::blueprint::framework_entity_adapter<my_blueprint_framework, my_port_producer> composition_entity(fo);
     
     BOOST_CHECK(ref_entity.type_info() == typeid(p));
+ BOOST_CHECK_EQUAL(&ref_entity.entity(), &p);
     BOOST_CHECK(composition_entity.type_info() == typeid(p));
+
+ my_blueprint_framework_with_context_context fcc;
+ my_object context;
+ my_port_with_context pwc(context);
+
+ // test copy construction
+ df::blueprint::framework_entity_adapter<my_blueprint_framework_with_context, my_port_with_context> context_copy_construction(fcc, pwc);
 }

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 2008-12-03 17:37:03 EST (Wed, 03 Dec 2008)
@@ -16,7 +16,7 @@
 struct my_object
 {};
 
-struct my_framework_with_object
+struct my_framework_with_context
     : public df::framework<void, my_object>
 {};
 

Modified: sandbox/dataflow-rewrite/libs/dataflow/test/generic/my_ports.hpp
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/test/generic/my_ports.hpp (original)
+++ sandbox/dataflow-rewrite/libs/dataflow/test/generic/my_ports.hpp 2008-12-03 17:37:03 EST (Wed, 03 Dec 2008)
@@ -18,7 +18,27 @@
 typedef df::port_traits<df::ports::producer, my_framework> my_port_producer_traits;
 
 struct my_port_producer : public df::port<my_port_producer_traits>
-{};
+{
+ my_port_producer()
+ : int_value(0)
+ , double_value(0)
+ {}
+ my_port_producer(int i)
+ : int_value(i)
+ , double_value(0)
+ {}
+ my_port_producer(double d)
+ : int_value(0)
+ , double_value(d)
+ {}
+ my_port_producer(int i, double d)
+ : int_value(i)
+ , double_value(d)
+ {}
+
+ int int_value;
+ double double_value;
+};
 
 typedef df::port_traits<df::ports::consumer, my_framework> my_port_consumer_traits;
 

Added: sandbox/dataflow-rewrite/libs/dataflow/test/generic/my_ports_with_context.hpp
==============================================================================
--- (empty file)
+++ sandbox/dataflow-rewrite/libs/dataflow/test/generic/my_ports_with_context.hpp 2008-12-03 17:37:03 EST (Wed, 03 Dec 2008)
@@ -0,0 +1,43 @@
+/*=================================---------------------------------------------
+ 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__TEST__GENERIC__MY_PORTS_WITH_CONTEXT_HPP
+#define BOOST__DATAFLOW__TEST__GENERIC__MY_PORTS_WITH_CONTEXT_HPP
+
+#include <boost/dataflow/generic/port/port.hpp>
+
+#include "my_framework_with_context.hpp"
+
+namespace df=boost::dataflow;
+
+typedef df::port_traits<df::ports::producer_consumer, my_framework_with_context> my_port_with_context_traits;
+
+struct my_port_with_context : public df::port<my_port_with_context_traits>
+{
+ my_port_with_context(my_object)
+ : int_value(0)
+ , double_value(0)
+ {}
+ my_port_with_context(my_object, int i)
+ : int_value(i)
+ , double_value(0)
+ {}
+ my_port_with_context(my_object, double d)
+ : int_value(0)
+ , double_value(d)
+ {}
+ my_port_with_context(my_object, int i, double d)
+ : int_value(i)
+ , double_value(d)
+ {}
+
+ int int_value;
+ double double_value;
+};
+
+#endif // BOOST__DATAFLOW__TEST__GENERIC__MY_PORTS_WITH_CONTEXT_HPP
\ No newline at end of file

Modified: sandbox/dataflow-rewrite/libs/dataflow/test/generic/test_framework.cpp
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/test/generic/test_framework.cpp (original)
+++ sandbox/dataflow-rewrite/libs/dataflow/test/generic/test_framework.cpp 2008-12-03 17:37:03 EST (Wed, 03 Dec 2008)
@@ -27,9 +27,9 @@
     
     BOOST_CHECK((!df::is_framework<not_framework>::value));
 
- BOOST_CHECK((df::is_framework<my_framework_with_object>::value));
- BOOST_CHECK((df::has_framework_context<my_framework_with_object>::value));
- BOOST_CHECK((boost::is_same<my_framework_with_object::framework_context_type, my_object>::value));
+ BOOST_CHECK((df::is_framework<my_framework_with_context>::value));
+ BOOST_CHECK((df::has_framework_context<my_framework_with_context>::value));
+ BOOST_CHECK((boost::is_same<my_framework_with_context::framework_context_type, my_object>::value));
 }
 
 


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