|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r50126 - sandbox/dataflow-rewrite/boost/dataflow/managed
From: stipe_at_[hidden]
Date: 2008-12-04 22:20:03
Author: srajko
Date: 2008-12-04 22:20:03 EST (Thu, 04 Dec 2008)
New Revision: 50126
URL: http://svn.boost.org/trac/boost/changeset/50126
Log:
fixed usage of adjacency_list
Text files modified:
sandbox/dataflow-rewrite/boost/dataflow/managed/io_component.hpp | 2 +-
sandbox/dataflow-rewrite/boost/dataflow/managed/network.hpp | 16 ++++++++++------
2 files changed, 11 insertions(+), 7 deletions(-)
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 22:20:03 EST (Thu, 04 Dec 2008)
@@ -113,7 +113,7 @@
: component(static_cast<const component &>(other))
, m_ports(other.m_ports)
{
- fusion::for_each(m_ports, set_port_context(*this));
+ fusion::for_each(m_ports, detail::set_port_context(*this));
}
template<int Index>
typename fusion::result_of::at_c<ports_type, Index>::type port()
Modified: sandbox/dataflow-rewrite/boost/dataflow/managed/network.hpp
==============================================================================
--- sandbox/dataflow-rewrite/boost/dataflow/managed/network.hpp (original)
+++ sandbox/dataflow-rewrite/boost/dataflow/managed/network.hpp 2008-12-04 22:20:03 EST (Thu, 04 Dec 2008)
@@ -14,6 +14,8 @@
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/topological_sort.hpp>
+#include <boost/foreach.hpp>
+
namespace boost { namespace dataflow { namespace managed {
@@ -39,20 +41,22 @@
public:
void register_component(component *c)
{
- std::cout << this << " registering " << c << std::endl;
graph_type::vertex_descriptor v = add_vertex(m_graph);
+ std::cout << this << " registering " << c << " with descriptor " << v << std::endl;
m_graph[v].ptr = c;
- std::cout << m_descriptor_map.size() << std::endl;
m_descriptor_map[c]=v;
- std::cout << m_descriptor_map.size() << std::endl;
}
void unregister_component(component *c)
{
- std::cout << this << " unregistering " << c << std::endl;
BOOST_ASSERT(m_descriptor_map.find(c) != m_descriptor_map.end());
graph_type::vertex_descriptor v = m_descriptor_map[c];
+ std::cout << this << " unregistering " << c << " with descriptor " << v << std::endl;
remove_vertex(v, m_graph);
m_descriptor_map.erase(c);
+ // vertex_descriptors have been adjusted
+ BOOST_FOREACH(descriptor_map_type::value_type &pair, m_descriptor_map)
+ if(pair.second >= v)
+ pair.second--;
}
void notify_connect(component &producer, component &consumer)
{
@@ -89,7 +93,6 @@
m_graph[*it].ptr->topological_sort_index(it - topological_sort.begin());
for(std::vector<graph_type::vertex_descriptor>::iterator it=topological_sort.begin(); it!=topological_sort.end(); it++)
m_changed.insert(m_graph[*it].ptr);
-
}
void update()
{
@@ -102,7 +105,8 @@
}
private:
graph_type m_graph;
- std::map<component *, graph_type::vertex_descriptor> m_descriptor_map;
+ typedef std::map<component *, graph_type::vertex_descriptor> descriptor_map_type;
+ descriptor_map_type m_descriptor_map;
changed_type m_changed;
};
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