[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r3769 - gnuradio/branches/developers/jcorgan/cppwrap/g
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r3769 - gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/native |
Date: |
Tue, 10 Oct 2006 16:33:17 -0600 (MDT) |
Author: jcorgan
Date: 2006-10-10 16:33:17 -0600 (Tue, 10 Oct 2006)
New Revision: 3769
Modified:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/native/gr_flow_graph.cc
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/native/gr_flow_graph.h
Log:
Work in progress.
Completed 'connect_blocks' functionality and sub-functions.
Modified:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/native/gr_flow_graph.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/native/gr_flow_graph.cc
2006-10-10 21:44:07 UTC (rev 3768)
+++
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/native/gr_flow_graph.cc
2006-10-10 22:33:17 UTC (rev 3769)
@@ -160,8 +160,20 @@
(*block_iter)->set_detail(detail);
}
- // connect_inputs() functionality will require separate loop as all the
blocks
- // will need to have details and buffers set first
+ // 'connect_inputs()'
+ for(block_iter = d_blocks.begin(); block_iter != d_blocks.end();
block_iter++) {
+ gr_block_detail_sptr detail = (*block_iter)->detail();
+ gr_edge_vector_t in_edges = calc_input_edges(*block_iter);
+ gr_edge_vector_iterator_t edge_iter;
+ for(edge_iter = in_edges.begin(); edge_iter != in_edges.end();
edge_iter++) {
+ int dst_port = edge_iter->second.second;
+ int src_port = edge_iter->first.second;
+ gr_block_sptr src_block = edge_iter->first.first;
+ gr_buffer_sptr src_buffer = src_block->detail()->output(src_port);
+ printf("Setting input %i on block.\n", dst_port);
+ detail->set_input(dst_port, gr_buffer_add_reader(src_buffer,
(*block_iter)->history()-1));
+ }
+ }
}
std::vector<int> gr_flow_graph::calc_used_ports(gr_block_sptr block, bool
direction)
@@ -233,6 +245,7 @@
nitems = std::max(nitems, 2*(decimation*multiple+history));
}
+ printf("Making output buffer of %i items, each of size %i\n", nitems,
item_size);
return gr_make_buffer(nitems, item_size);
}
@@ -250,6 +263,17 @@
return result;
}
+gr_edge_vector_t gr_flow_graph::calc_input_edges(gr_block_sptr block)
+{
+ gr_edge_vector_t result;
+ gr_edge_vector_iterator_t edge_iter;
+ for(edge_iter = d_edges.begin(); edge_iter != d_edges.end(); edge_iter++)
+ if (edge_iter->second.first == block)
+ result.push_back(*edge_iter);
+
+ return result;
+}
+
void gr_flow_graph::start()
{
// TODO: check if already started
Modified:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/native/gr_flow_graph.h
===================================================================
---
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/native/gr_flow_graph.h
2006-10-10 21:44:07 UTC (rev 3768)
+++
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/native/gr_flow_graph.h
2006-10-10 22:33:17 UTC (rev 3769)
@@ -58,7 +58,8 @@
gr_buffer_sptr allocate_buffer(gr_block_sptr block, int port);
gr_block_vector_t calc_downstream_blocks(gr_endpoint_t src);
-
+ gr_edge_vector_t calc_input_edges(gr_block_sptr block);
+
static const int s_fixed_buffer_size = GR_FIXED_BUFFER_SIZE;
gr_edge_vector_t d_edges;
gr_block_vector_t d_blocks;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r3769 - gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/native,
jcorgan <=