[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r3786 - gnuradio/branches/developers/jcorgan/cppwrap/g
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r3786 - gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++ |
Date: |
Fri, 13 Oct 2006 18:06:29 -0600 (MDT) |
Author: jcorgan
Date: 2006-10-13 18:06:29 -0600 (Fri, 13 Oct 2006)
New Revision: 3786
Modified:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_flow_graph.cc
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_flow_graph.h
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_scheduler.cc
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_scheduler.h
Log:
Work in progress.
Modified:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_flow_graph.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_flow_graph.cc
2006-10-12 14:42:51 UTC (rev 3785)
+++
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_flow_graph.cc
2006-10-14 00:06:29 UTC (rev 3786)
@@ -20,6 +20,7 @@
*/
#include <gr_flow_graph.h>
+#include <gr_scheduler.h>
#include <gr_block_detail.h>
#include <gr_io_signature.h>
#include <gr_buffer.h>
@@ -60,15 +61,18 @@
check_type_match(src, dst);
d_edges.push_back(gr_edge_t(src, dst));
+ printf("Successfully connected %s(%li):%i to %i:%s(%li)\n",
+ src.first->name().c_str(), src.first->unique_id(), src.second,
+ dst.second, dst.first->name().c_str(), dst.first->unique_id());
}
void gr_flow_graph::check_valid_port(gr_io_signature_sptr sig, int port)
{
if (port < 0)
- throw std::out_of_range("gr_flow_graph::check_valid_port");
-
+ throw std::out_of_range("gr_flow_graph::check_valid_port: negative port
number");
+
if (sig->max_streams() >= 0 && port >= sig->max_streams())
- throw std::out_of_range("gr_flow_graph::check_valid_port");
+ throw std::out_of_range("gr_flow_graph::check_valid_port: port exceeds
max_streams");
}
void gr_flow_graph::check_dst_not_used(gr_endpoint_t dst)
@@ -77,7 +81,7 @@
for(edge_iter = d_edges.begin(); edge_iter != d_edges.end(); edge_iter++) {
gr_endpoint_t endp = edge_iter->second;
if (endp == dst)
- throw std::invalid_argument("gr_flow_graph::check_dst_not_used");
+ throw std::invalid_argument("gr_flow_graph::check_dst_not_used: dst
already used");
}
}
@@ -109,12 +113,17 @@
if (edge_iter != d_edges.end())
d_edges.erase(edge_iter);
else
- throw std::invalid_argument("gr_flow_graph::disconnect_prim");
+ throw std::invalid_argument("gr_flow_graph::disconnect_prim: not
connected");
+
+ printf("Successfully disconnected %s(%li):%i to %i:%s(%li)\n",
+ src.first->name().c_str(), src.first->unique_id(), src.second,
+ dst.second, dst.first->name().c_str(), dst.first->unique_id());
}
void gr_flow_graph::disconnect_all()
{
d_edges.clear();
+ printf("Disconnected all blocks.\n");
}
void gr_flow_graph::create_block_list()
@@ -135,6 +144,8 @@
if (block_iter == d_blocks.end())
d_blocks.push_back(dst_block);
}
+
+ printf("Flow graph has %i connected blocks.\n", d_blocks.size());
}
void gr_flow_graph::connect_blocks()
@@ -152,7 +163,7 @@
if (!(*block_iter)->check_topology(ninputs, noutputs))
throw std::invalid_argument("gr_flow_graph::validate");
-
+
// Allocate block detail and output buffer and assign
gr_block_detail_sptr detail = gr_make_block_detail(ninputs, noutputs);
for(int i = 0; i < noutputs; i++)
@@ -170,7 +181,8 @@
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);
+ printf("Setting input buffer on %s(%i).\n",
+ edge_iter->second.first->name().c_str(), dst_port);
detail->set_input(dst_port, gr_buffer_add_reader(src_buffer,
(*block_iter)->history()-1));
}
}
@@ -245,7 +257,9 @@
nitems = std::max(nitems, 2*(decimation*multiple+history));
}
- printf("Making output buffer of %i items, each of size %i\n", nitems,
item_size);
+ printf("Block %s(%i) has output buffer of %i items, each of size %i\n",
+ block->name().c_str(), block->unique_id(), nitems, item_size);
+
return gr_make_buffer(nitems, item_size);
}
@@ -311,4 +325,8 @@
wait();
}
-// Topological sort and partition functions here
+gr_partitions_t gr_flow_graph::calc_partitions()
+{
+ gr_partitions_t result;
+ return result;
+}
Modified:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_flow_graph.h
===================================================================
---
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_flow_graph.h
2006-10-12 14:42:51 UTC (rev 3785)
+++
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_flow_graph.h
2006-10-14 00:06:29 UTC (rev 3786)
@@ -23,21 +23,27 @@
#define INCLUDED_GR_FLOW_GRAPH_H
#include <gr_block.h>
-#include <gr_scheduler.h>
#include <boost/enable_shared_from_this.hpp>
+class gr_flow_graph;
+typedef boost::shared_ptr<gr_flow_graph> gr_flow_graph_sptr;
+gr_flow_graph_sptr gr_make_flow_graph();
+
+// Dupe to gr_scheduler.h, but we can't include it here
+class gr_scheduler;
+typedef boost::shared_ptr<gr_scheduler> gr_scheduler_sptr;
+
+// Container for list of gr_blocks, and list of lists
typedef std::vector<gr_block_sptr> gr_block_vector_t;
typedef std::vector<gr_block_sptr>::iterator gr_block_vector_iterator_t;
+typedef std::vector<gr_block_vector_t> gr_partitions_t;
+
+// Flow graph endpoints and edges
typedef std::pair<gr_block_sptr, int> gr_endpoint_t;
typedef std::pair<gr_endpoint_t, gr_endpoint_t> gr_edge_t;
typedef std::vector<gr_edge_t> gr_edge_vector_t;
typedef std::vector<gr_edge_t>::iterator gr_edge_vector_iterator_t;
-class gr_flow_graph;
-typedef boost::shared_ptr<gr_flow_graph> gr_flow_graph_sptr;
-
-gr_flow_graph_sptr gr_make_flow_graph();
-
#define GR_FIXED_BUFFER_SIZE 32000
class gr_flow_graph : public boost::enable_shared_from_this<gr_flow_graph>
@@ -81,6 +87,8 @@
// more disconnect convenience functions go here
+ gr_partitions_t calc_partitions();
+
void start();
void stop();
void wait();
Modified:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_scheduler.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_scheduler.cc
2006-10-12 14:42:51 UTC (rev 3785)
+++
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_scheduler.cc
2006-10-14 00:06:29 UTC (rev 3786)
@@ -27,10 +27,9 @@
return gr_scheduler_sptr(new gr_scheduler(fg));
}
-gr_scheduler::gr_scheduler(gr_flow_graph_sptr fg) :
- d_fg(fg)
+gr_scheduler::gr_scheduler(gr_flow_graph_sptr fg)
{
- // NOP
+ d_partitions = fg->calc_partitions();
}
gr_scheduler::~gr_scheduler()
Modified:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_scheduler.h
===================================================================
---
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_scheduler.h
2006-10-12 14:42:51 UTC (rev 3785)
+++
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_scheduler.h
2006-10-14 00:06:29 UTC (rev 3786)
@@ -22,25 +22,18 @@
#ifndef INCLUDED_GR_SCHEDULER_H
#define INCLUDED_GR_SCHEDULER_H
+#include <gr_flow_graph.h>
#include <vector>
#include <boost/shared_ptr.hpp>
class gr_scheduler;
typedef boost::shared_ptr<gr_scheduler> gr_scheduler_sptr;
-
-// Dupe to gr_flow_graph.h but we don't want to include it here
-class gr_flow_graph;
-typedef boost::shared_ptr<gr_flow_graph> gr_flow_graph_sptr;
-
gr_scheduler_sptr gr_make_scheduler(gr_flow_graph_sptr fg);
-typedef std::vector<gr_scheduler> gr_scheduler_vector_t;
-typedef std::vector<gr_scheduler>::iterator gr_scheduler_vector_iterator_t;
-
class gr_scheduler
{
private:
- gr_flow_graph_sptr d_fg;
+ gr_partitions_t d_partitions;
gr_scheduler(gr_flow_graph_sptr fg);
friend gr_scheduler_sptr gr_make_scheduler(gr_flow_graph_sptr fg);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r3786 - gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++,
jcorgan <=