Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r50141 - in sandbox/dataflow-rewrite: boost/dataflow/blueprint boost/dataflow/managed boost/dataflow/utility libs/dataflow/build/managed libs/dataflow/build/xcodeide/dataflow.xcodeproj libs/dataflow/test libs/dataflow/test/utility
From: stipe_at_[hidden]
Date: 2008-12-05 13:42:02


Author: srajko
Date: 2008-12-05 13:42:00 EST (Fri, 05 Dec 2008)
New Revision: 50141
URL: http://svn.boost.org/trac/boost/changeset/50141

Log:
added shared_ptr_to_element, added blueprint:: to framework_context so msvc can find it, trying BOOST_ALL_NO_LIB for managed
Added:
   sandbox/dataflow-rewrite/boost/dataflow/utility/shared_ptr_to_element.hpp (contents, props changed)
   sandbox/dataflow-rewrite/libs/dataflow/test/utility/
   sandbox/dataflow-rewrite/libs/dataflow/test/utility/Jamfile (contents, props changed)
   sandbox/dataflow-rewrite/libs/dataflow/test/utility/test_shared_ptr_to_element.cpp (contents, props changed)
Text files modified:
   sandbox/dataflow-rewrite/boost/dataflow/blueprint/framework_entity.hpp | 2 +-
   sandbox/dataflow-rewrite/boost/dataflow/blueprint/framework_entity_adapter.hpp | 18 +++++++++---------
   sandbox/dataflow-rewrite/boost/dataflow/blueprint/port_adapter.hpp | 6 +++---
   sandbox/dataflow-rewrite/boost/dataflow/blueprint/static_vector_adapter.hpp | 6 +++---
   sandbox/dataflow-rewrite/boost/dataflow/blueprint/vector.hpp | 2 +-
   sandbox/dataflow-rewrite/boost/dataflow/managed/io_component.hpp | 2 +-
   sandbox/dataflow-rewrite/libs/dataflow/build/managed/Jamfile | 3 ++-
   sandbox/dataflow-rewrite/libs/dataflow/build/xcodeide/dataflow.xcodeproj/project.pbxproj | 14 ++++++++++++++
   sandbox/dataflow-rewrite/libs/dataflow/test/Jamfile | 1 +
   9 files changed, 35 insertions(+), 19 deletions(-)

Modified: sandbox/dataflow-rewrite/boost/dataflow/blueprint/framework_entity.hpp
==============================================================================
--- sandbox/dataflow-rewrite/boost/dataflow/blueprint/framework_entity.hpp (original)
+++ sandbox/dataflow-rewrite/boost/dataflow/blueprint/framework_entity.hpp 2008-12-05 13:42:00 EST (Fri, 05 Dec 2008)
@@ -18,7 +18,7 @@
 template<typename BlueprintFramework>
 class framework_entity : public castable_polymorphic_object
 {
- typedef framework_context<BlueprintFramework> framework_context_type;
+ typedef blueprint::framework_context<BlueprintFramework> framework_context_type;
 public:
     struct dataflow_traits
     {

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-05 13:42:00 EST (Fri, 05 Dec 2008)
@@ -25,16 +25,16 @@
 public:
     typedef typename remove_reference<EntityOrRef>::type entity_type;
     
- framework_entity_adapter(framework_context<BlueprintFramework> &fo)
+ framework_entity_adapter(blueprint::framework_context<BlueprintFramework> &fo)
         : Base(fo, typeid(m_entity))
     {}
     template<typename T>
- framework_entity_adapter(framework_context<BlueprintFramework> &fo, const T &t)
+ framework_entity_adapter(blueprint::framework_context<BlueprintFramework> &fo, const T &t)
         : Base(fo, typeid(m_entity))
         , m_entity(t)
     {}
     template<typename T>
- framework_entity_adapter(framework_context<BlueprintFramework> &fo, T &t)
+ framework_entity_adapter(blueprint::framework_context<BlueprintFramework> &fo, T &t)
         : Base(fo, typeid(m_entity))
         , m_entity(t)
     {}
@@ -64,31 +64,31 @@
 public:
     typedef typename remove_reference<EntityOrRef>::type entity_type;
     
- framework_entity_adapter(framework_context<BlueprintFramework> &fo)
+ framework_entity_adapter(blueprint::framework_context<BlueprintFramework> &fo)
         : Base(fo, typeid(m_entity))
         , m_entity(fo.object())
     {}
- framework_entity_adapter(framework_context<BlueprintFramework> &fo, entity_type &t)
+ framework_entity_adapter(blueprint::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)
+ framework_entity_adapter(blueprint::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)
+ framework_entity_adapter(blueprint::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(blueprint::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, T &t,
+ framework_entity_adapter(blueprint::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/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 2008-12-05 13:42:00 EST (Fri, 05 Dec 2008)
@@ -21,15 +21,15 @@
 {
     typedef framework_entity_adapter<BlueprintFramework, PortOrRef, Base> base_type;
 public:
- port_adapter(framework_context<BlueprintFramework> &fo)
+ port_adapter(blueprint::framework_context<BlueprintFramework> &fo)
         : base_type(fo)
     {}
     template<typename T>
- port_adapter(framework_context<BlueprintFramework> &fo, const T &t)
+ port_adapter(blueprint::framework_context<BlueprintFramework> &fo, const T &t)
         : base_type(fo, t)
     {}
     template<typename T>
- port_adapter(framework_context<BlueprintFramework> &fo, T &t)
+ port_adapter(blueprint::framework_context<BlueprintFramework> &fo, T &t)
         : base_type(fo, t)
     {}
 };

Modified: sandbox/dataflow-rewrite/boost/dataflow/blueprint/static_vector_adapter.hpp
==============================================================================
--- sandbox/dataflow-rewrite/boost/dataflow/blueprint/static_vector_adapter.hpp (original)
+++ sandbox/dataflow-rewrite/boost/dataflow/blueprint/static_vector_adapter.hpp 2008-12-05 13:42:00 EST (Fri, 05 Dec 2008)
@@ -88,19 +88,19 @@
 {
     typedef framework_entity_adapter<BlueprintFramework, VectorOrRef, Base> base_type;
 public:
- static_vector_adapter(framework_context<BlueprintFramework> &fo)
+ static_vector_adapter(blueprint::framework_context<BlueprintFramework> &fo)
         : base_type(fo)
     {
         initialize_ports();
     }
     template<typename T>
- static_vector_adapter(framework_context<BlueprintFramework> &fo, const T &t)
+ static_vector_adapter(blueprint::framework_context<BlueprintFramework> &fo, const T &t)
         : base_type(fo, t)
     {
         initialize_ports();
     }
     template<typename T>
- static_vector_adapter(framework_context<BlueprintFramework> &fo, T &t)
+ static_vector_adapter(blueprint::framework_context<BlueprintFramework> &fo, T &t)
         : base_type(fo, t)
     {
         initialize_ports();

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 2008-12-05 13:42:00 EST (Fri, 05 Dec 2008)
@@ -77,7 +77,7 @@
 {
     typedef framework_entity<BlueprintFramework> base_type;
 public:
- vector(framework_context<BlueprintFramework> &fo, const std::type_info &ti)
+ vector(blueprint::framework_context<BlueprintFramework> &fo, const std::type_info &ti)
         : base_type(fo, ti)
     {}
     struct dataflow_traits : public base_type::dataflow_traits

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-05 13:42:00 EST (Fri, 05 Dec 2008)
@@ -122,7 +122,7 @@
     { return m_ports; }
 protected:
     ports_type m_ports;
- friend class detail::set_port_context;
+ friend struct detail::set_port_context;
 };
 
 }

Added: sandbox/dataflow-rewrite/boost/dataflow/utility/shared_ptr_to_element.hpp
==============================================================================
--- (empty file)
+++ sandbox/dataflow-rewrite/boost/dataflow/utility/shared_ptr_to_element.hpp 2008-12-05 13:42:00 EST (Fri, 05 Dec 2008)
@@ -0,0 +1,72 @@
+/*=================================---------------------------------------------
+ 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)
+-----------------------------------------------===============================*/
+
+#ifndef BOOST__DATAFLOW__UTILITY__SHARED_PTR_TO_ELEMENT_HPP
+#define BOOST__DATAFLOW__UTILITY__SHARED_PTR_TO_ELEMENT_HPP
+
+
+#include <boost/shared_ptr.hpp>
+#include <boost/fusion/include/value_at.hpp>
+#include <boost/fusion/include/at.hpp>
+
+
+namespace boost { namespace dataflow {
+
+namespace utility
+{
+ namespace result_of
+ {
+ template<typename Sequence, int N>
+ struct shared_ptr_to_element_c
+ {
+ typedef
+ boost::shared_ptr
+ <
+ typename fusion::result_of::value_at_c<Sequence, N>::type
+ >
+ type;
+ };
+
+ template<typename Sequence, typename N>
+ struct shared_ptr_to_element
+ {
+ typedef
+ typename shared_ptr_to_element_c<Sequence, N::value>::type
+ type;
+ };
+ }
+
+ template<int N, typename Sequence>
+ typename result_of::shared_ptr_to_element_c<Sequence, N>::type
+ shared_ptr_to_element_c(const boost::shared_ptr<Sequence> &ptr)
+ {
+ return
+ typename result_of::shared_ptr_to_element_c<Sequence, N>::type
+ (
+ ptr,
+ &fusion::at_c<N>(*ptr)
+ );
+ }
+
+ template<typename N, typename Sequence>
+ typename result_of::shared_ptr_to_element<Sequence, N>::type
+ shared_ptr_to_element(const boost::shared_ptr<Sequence> &ptr)
+ {
+ return
+ typename result_of::shared_ptr_to_element<Sequence, N>::type
+ (
+ ptr,
+ &fusion::at<N>(*ptr)
+ );
+ }
+
+} // namespace utility
+
+} } // namespace boost::dataflow
+
+#endif // BOOST__DATAFLOW__UTILITY__ALL_OF_HPP

Modified: sandbox/dataflow-rewrite/libs/dataflow/build/managed/Jamfile
==============================================================================
--- sandbox/dataflow-rewrite/libs/dataflow/build/managed/Jamfile (original)
+++ sandbox/dataflow-rewrite/libs/dataflow/build/managed/Jamfile 2008-12-05 13:42:00 EST (Fri, 05 Dec 2008)
@@ -6,7 +6,8 @@
 project dataflow/managed
     : source-location ../../src/managed
     : requirements
- <library>/boost/system//boost_system
+ <library>/boost/system//boost_system
+ <define>BOOST_ALL_NO_LIB=1
     : usage-requirements
         <library>/boost/system//boost_system
     ;

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-05 13:42:00 EST (Fri, 05 Dec 2008)
@@ -136,6 +136,9 @@
                 089A28B10E8D96F2000FCCC9 /* my_framework.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = my_framework.hpp; sourceTree = "<group>"; };
                 089A28B50E8D9772000FCCC9 /* my_ports.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = my_ports.hpp; sourceTree = "<group>"; };
                 089A28D80E8D99BC000FCCC9 /* my_entity.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = my_entity.hpp; sourceTree = "<group>"; };
+ 089F03530EE9615200C88FE5 /* shared_ptr_to_element.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = shared_ptr_to_element.hpp; sourceTree = "<group>"; };
+ 089F03570EE96BA800C88FE5 /* test_shared_ptr_to_element.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_shared_ptr_to_element.cpp; sourceTree = "<group>"; };
+ 089F03590EE96BEB00C88FE5 /* Jamfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.jam; path = Jamfile; sourceTree = "<group>"; };
                 08A0FF8A0E8B4012000F0F8F /* file_template.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = file_template.py; sourceTree = "<group>"; };
                 08A227910EAE417000F70466 /* Jamfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.jam; path = Jamfile; sourceTree = "<group>"; };
                 08A227930EAE417C00F70466 /* Jamfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.jam; path = Jamfile; sourceTree = "<group>"; };
@@ -293,6 +296,15 @@
                         path = examples;
                         sourceTree = "<group>";
                 };
+ 089F03560EE96B8E00C88FE5 /* utility */ = {
+ isa = PBXGroup;
+ children = (
+ 089F03570EE96BA800C88FE5 /* test_shared_ptr_to_element.cpp */,
+ 089F03590EE96BEB00C88FE5 /* Jamfile */,
+ );
+ path = utility;
+ sourceTree = "<group>";
+ };
                 08A2277C0EAE3E6D00F70466 /* vivid */ = {
                         isa = PBXGroup;
                         children = (
@@ -378,6 +390,7 @@
                                 0826E3370EA53F0C0090AB4E /* guarded_enable_if_type.hpp */,
                                 08A77AEE0E4FB4C800B8793E /* is_type.hpp */,
                                 0826E33A0EA53F4C0090AB4E /* all_of.hpp */,
+ 089F03530EE9615200C88FE5 /* shared_ptr_to_element.hpp */,
                         );
                         path = utility;
                         sourceTree = "<group>";
@@ -529,6 +542,7 @@
                 08C675960C13A03E00D85379 /* test */ = {
                         isa = PBXGroup;
                         children = (
+ 089F03560EE96B8E00C88FE5 /* utility */,
                                 08B3CC230EC8B823002D2124 /* managed */,
                                 08AA90400EAD43AD00409A2E /* vivid */,
                                 08ED9F2B0E9AFE0F00894656 /* blueprint */,

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-05 13:42:00 EST (Fri, 05 Dec 2008)
@@ -18,6 +18,7 @@
 build-project generic ;
 build-project blueprint ;
 build-project managed ;
+build-project utility ;
 
 if $(guigl_present)
 {

Added: sandbox/dataflow-rewrite/libs/dataflow/test/utility/Jamfile
==============================================================================
--- (empty file)
+++ sandbox/dataflow-rewrite/libs/dataflow/test/utility/Jamfile 2008-12-05 13:42:00 EST (Fri, 05 Dec 2008)
@@ -0,0 +1,14 @@
+# 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)
+
+import testing ;
+
+project dataflow/test/utility
+ : requirements
+ <include>../../../..
+ <define>BOOST_ALL_NO_LIB=1
+ ;
+
+run test_shared_ptr_to_element.cpp ;

Added: sandbox/dataflow-rewrite/libs/dataflow/test/utility/test_shared_ptr_to_element.cpp
==============================================================================
--- (empty file)
+++ sandbox/dataflow-rewrite/libs/dataflow/test/utility/test_shared_ptr_to_element.cpp 2008-12-05 13:42:00 EST (Fri, 05 Dec 2008)
@@ -0,0 +1,82 @@
+/*=================================---------------------------------------------
+ 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/utility/shared_ptr_to_element.hpp>
+#include <boost/fusion/include/vector.hpp>
+#include <boost/weak_ptr.hpp>
+#include <boost/mpl/int.hpp>
+
+
+#define BOOST_TEST_MAIN
+#include <boost/test/unit_test.hpp>
+
+BOOST_AUTO_TEST_CASE( test_c )
+{
+ using namespace boost;
+ using boost::dataflow::utility::shared_ptr_to_element_c;
+
+ typedef fusion::vector2<int, float> vector_type;
+
+ weak_ptr<vector_type> weak_vector_ptr;
+ {
+ shared_ptr<float> float_ptr;
+ weak_ptr<int> weak_int_ptr;
+ {
+ shared_ptr<int> int_ptr;
+ {
+ shared_ptr<vector_type> vector_ptr(new vector_type(1, 2.5));
+ weak_vector_ptr = vector_ptr;
+
+ int_ptr = shared_ptr_to_element_c<0>(vector_ptr);
+ weak_int_ptr = int_ptr;
+
+ BOOST_CHECK_EQUAL(vector_ptr.use_count(), 2);
+ BOOST_CHECK_EQUAL(*int_ptr, 1);
+
+ float_ptr = shared_ptr_to_element_c<1>(vector_ptr);
+
+ BOOST_CHECK_EQUAL(vector_ptr.use_count(), 3);
+ BOOST_CHECK_EQUAL(*float_ptr, 2.5);
+
+ shared_ptr<float> other_float_ptr = float_ptr;
+ BOOST_CHECK_EQUAL(vector_ptr.use_count(), 4);
+ }
+
+ BOOST_CHECK_EQUAL(weak_vector_ptr.use_count(), 2);
+ }
+
+ BOOST_CHECK_EQUAL(weak_vector_ptr.use_count(), 1);
+ BOOST_CHECK_EQUAL(weak_int_ptr.use_count(), 1);
+ }
+
+ BOOST_CHECK(weak_vector_ptr.expired());
+}
+
+BOOST_AUTO_TEST_CASE( test )
+{
+ using namespace boost;
+ using boost::dataflow::utility::shared_ptr_to_element;
+
+ typedef fusion::vector2<int, float> vector_type;
+ shared_ptr<float> float_ptr;
+ shared_ptr<int> int_ptr;
+ shared_ptr<vector_type> vector_ptr(new vector_type(1, 2.5));
+
+ int_ptr = shared_ptr_to_element<mpl::int_<0> >(vector_ptr);
+
+ BOOST_CHECK_EQUAL(vector_ptr.use_count(), 2);
+ BOOST_CHECK_EQUAL(*int_ptr, 1);
+
+ float_ptr = shared_ptr_to_element<mpl::int_<1> >(vector_ptr);
+
+ BOOST_CHECK_EQUAL(vector_ptr.use_count(), 3);
+ BOOST_CHECK_EQUAL(*float_ptr, 2.5);
+}
+
+


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