[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r3774 - in gnuradio/branches/developers/jcorgan/cppwra
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r3774 - in gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples: . c++ |
Date: |
Wed, 11 Oct 2006 10:24:01 -0600 (MDT) |
Author: jcorgan
Date: 2006-10-11 10:24:01 -0600 (Wed, 11 Oct 2006)
New Revision: 3774
Added:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/Makefile.am
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/dialtone.cc
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
Removed:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/Makefile.am
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/dialtone.cc
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/native/
Log:
Renamed examples directory.
Copied: gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++
(from rev 3764,
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/native)
Deleted:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/Makefile.am
Copied:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/Makefile.am
(from rev 3773,
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/native/Makefile.am)
===================================================================
---
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/Makefile.am
(rev 0)
+++
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/Makefile.am
2006-10-11 16:24:01 UTC (rev 3774)
@@ -0,0 +1,37 @@
+#
+# Copyright 2006 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+include $(top_srcdir)/Makefile.common
+
+INCLUDES=$(STD_DEFINES_AND_INCLUDES)
+
+noinst_PROGRAMS = \
+ dialtone
+
+dialtone_SOURCES = \
+ dialtone.cc \
+ gr_flow_graph.cc \
+ gr_scheduler.cc
+
+dialtone_LDADD = $(GNURADIO_CORE_LIBS) \
+ $(top_builddir)/gr-audio-alsa/src/libgr_audio_alsa.la
+
+MOSTLYCLEANFILES = *~
Deleted:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/dialtone.cc
Copied:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/dialtone.cc
(from rev 3773,
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/native/dialtone.cc)
===================================================================
---
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/dialtone.cc
(rev 0)
+++
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/dialtone.cc
2006-10-11 16:24:01 UTC (rev 3774)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gnuradio/gr_sig_source_f.h>
+#include <gnuradio/audio_alsa_sink.h>
+#include <gr_flow_graph.h>
+
+int main()
+{
+ gr_sig_source_f_sptr src0, src1;
+ audio_alsa_sink_sptr sink;
+ gr_flow_graph_sptr fg;
+
+ src0 = gr_make_sig_source_f(48000, GR_SIN_WAVE, 350, 0.5);
+ src1 = gr_make_sig_source_f(48000, GR_SIN_WAVE, 440, 0.5);
+ sink = audio_alsa_make_sink(48000);
+
+ fg = gr_make_flow_graph();
+ fg->connect(src0, 0, sink, 0);
+ fg->connect(src1, 0, sink, 1);
+
+ fg->run();
+
+ return 0;
+}
Deleted:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_flow_graph.cc
Copied:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_flow_graph.cc
(from rev 3773,
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/native/gr_flow_graph.cc)
===================================================================
---
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_flow_graph.cc
(rev 0)
+++
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_flow_graph.cc
2006-10-11 16:24:01 UTC (rev 3774)
@@ -0,0 +1,314 @@
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gr_flow_graph.h>
+#include <gr_block_detail.h>
+#include <gr_io_signature.h>
+#include <gr_buffer.h>
+
+#include <utility>
+#include <algorithm>
+
+gr_flow_graph_sptr gr_make_flow_graph()
+{
+ return gr_flow_graph_sptr(new gr_flow_graph());
+}
+
+gr_flow_graph::gr_flow_graph()
+{
+ // NOP
+}
+
+gr_flow_graph::~gr_flow_graph()
+{
+ // NOP
+}
+
+void gr_flow_graph::connect(gr_block_sptr src_block, int src_port,
+ gr_block_sptr dst_block, int dst_port)
+{
+ connect_prim(gr_endpoint_t(src_block, src_port),
+ gr_endpoint_t(dst_block, dst_port));
+}
+
+// More connect convenience functions (that resolve into calls to
+// connect_prim) go here
+
+void gr_flow_graph::connect_prim(gr_endpoint_t src, gr_endpoint_t dst)
+{
+ check_valid_port(src.first->output_signature(), src.second);
+ check_valid_port(dst.first->input_signature(), dst.second);
+ check_dst_not_used(dst);
+ check_type_match(src, dst);
+
+ d_edges.push_back(gr_edge_t(src, dst));
+}
+
+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");
+
+ if (sig->max_streams() >= 0 && port >= sig->max_streams())
+ throw std::out_of_range("gr_flow_graph::check_valid_port");
+}
+
+void gr_flow_graph::check_dst_not_used(gr_endpoint_t dst)
+{
+ gr_edge_vector_iterator_t edge_iter;
+ 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");
+ }
+}
+
+void gr_flow_graph::check_type_match(gr_endpoint_t src, gr_endpoint_t dst)
+{
+ gr_io_signature_sptr src_sig = src.first->output_signature();
+ gr_io_signature_sptr dst_sig = dst.first->input_signature();
+ int src_size = src_sig->sizeof_stream_item(src.second);
+ int dst_size = dst_sig->sizeof_stream_item(dst.second);
+
+ if (src_size != dst_size)
+ throw std::invalid_argument("gr_flow_graph::check_type_match");
+}
+
+void gr_flow_graph::disconnect(gr_block_sptr src_block, int src_port,
+ gr_block_sptr dst_block, int dst_port)
+{
+ disconnect_prim(gr_endpoint_t(src_block, src_port),
+ gr_endpoint_t(dst_block, dst_port));
+}
+
+// More disconnect convenience functions (that resolve into calls to
+// disconnect_prim) go here
+
+void gr_flow_graph::disconnect_prim(gr_endpoint_t src, gr_endpoint_t dst)
+{
+ gr_edge_vector_iterator_t edge_iter;
+ edge_iter = find(d_edges.begin(), d_edges.end(), gr_edge_t(src, dst));
+ if (edge_iter != d_edges.end())
+ d_edges.erase(edge_iter);
+ else
+ throw std::invalid_argument("gr_flow_graph::disconnect_prim");
+}
+
+void gr_flow_graph::disconnect_all()
+{
+ d_edges.clear();
+}
+
+void gr_flow_graph::create_block_list()
+{
+ gr_block_vector_iterator_t block_iter;
+ gr_edge_vector_iterator_t edge_iter;
+
+ // TODO: use sort() and unique() instead
+ for(edge_iter = d_edges.begin(); edge_iter != d_edges.end(); edge_iter++) {
+ gr_block_sptr src_block = edge_iter->first.first;
+ gr_block_sptr dst_block = edge_iter->second.first;
+
+ block_iter = find(d_blocks.begin(), d_blocks.end(), src_block);
+ if (block_iter == d_blocks.end())
+ d_blocks.push_back(src_block);
+
+ block_iter = find(d_blocks.begin(), d_blocks.end(), dst_block);
+ if (block_iter == d_blocks.end())
+ d_blocks.push_back(dst_block);
+ }
+}
+
+void gr_flow_graph::connect_blocks()
+{
+ gr_block_vector_iterator_t block_iter;
+ for(block_iter = d_blocks.begin(); block_iter != d_blocks.end();
block_iter++) {
+ std::vector<int> used_inputs = calc_used_ports(*block_iter, false);
+ std::vector<int> used_outputs = calc_used_ports(*block_iter, true);
+
+ check_contiguity(*block_iter, (*block_iter)->input_signature(),
used_inputs);
+ check_contiguity(*block_iter, (*block_iter)->output_signature(),
used_outputs);
+
+ int ninputs = used_inputs.size();
+ int noutputs = used_outputs.size();
+
+ 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++)
+ detail->set_output(i, allocate_buffer(*block_iter, i));
+ (*block_iter)->set_detail(detail);
+ }
+
+ // '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)
+{
+ gr_edge_vector_iterator_t edge_iter;
+ std::vector<int> result;
+ gr_block_sptr cmp_block;
+
+ for(edge_iter = d_edges.begin(); edge_iter != d_edges.end(); edge_iter++) {
+ if (!direction) { // inputs
+ cmp_block = edge_iter->second.first;
+ if (cmp_block == block)
+ result.push_back(edge_iter->second.second);
+ }
+ else { // outputs
+ cmp_block = edge_iter->first.first;
+ if (cmp_block == block)
+ result.push_back(edge_iter->first.second);
+ }
+ }
+
+ // Remove duplicates
+ sort(result.begin(), result.end());
+ unique(result.begin(), result.end());
+ return result;
+}
+
+void gr_flow_graph::check_contiguity(gr_block_sptr block, gr_io_signature_sptr
sig,
+ std::vector<int> &used_ports)
+{
+ int min_s = sig->min_streams();
+ int l = used_ports.size();
+
+ if (l == 0) {
+ if (min_s == 0)
+ return;
+ else
+ throw std::invalid_argument("gr_flow_graph::check_contiguity");
+ }
+
+ if (used_ports[l-1]+1 < min_s)
+ throw std::invalid_argument("gr_flow_graph::check_contiguity");
+
+ if (used_ports[l-1]+1 != l) {
+ for (int i = 0; i < l; i++)
+ if (used_ports[i] != i)
+ throw std::invalid_argument("gr_flow_graph::check_contiguity");
+ }
+}
+
+gr_buffer_sptr gr_flow_graph::allocate_buffer(gr_block_sptr block, int port)
+{
+ // Start by allocating at least number of items in fixed block size
+ int item_size = block->output_signature()->sizeof_stream_item(port);
+ int nitems = s_fixed_buffer_size/item_size;
+
+ // Make sure there are at least twice the output_multiple no. of items
+ if (nitems < 2*block->output_multiple()) // Note: this means
output_multiple()
+ nitems = 2*block->output_multiple(); // can't be changed by block
dynamically
+
+ // If any downstream blocks are decimators and/or have a large
output_multiple,
+ // ensure we have a buffer at least twice their decimation
factor*output_multiple
+ gr_block_vector_t blocks = calc_downstream_blocks(gr_endpoint_t(block,
port));
+ gr_block_vector_iterator_t block_iter;
+ for(block_iter = blocks.begin(); block_iter != blocks.end(); block_iter++)
{
+ int decimation = (int)(1.0/(*block_iter)->relative_rate());
+ int multiple = (*block_iter)->output_multiple();
+ int history = (*block_iter)->history();
+ 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);
+}
+
+gr_block_vector_t gr_flow_graph::calc_downstream_blocks(gr_endpoint_t src)
+{
+ gr_block_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->first == src)
+ result.push_back(edge_iter->second.first);
+
+ sort(result.begin(), result.end());
+ unique(result.begin(), result.end());
+ 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()
+{
+ if (d_scheduler)
+ throw std::runtime_error("Scheduler already running!");
+
+ create_block_list();
+ connect_blocks();
+
+ d_scheduler = gr_make_scheduler(shared_from_this());
+ d_scheduler->start();
+
+ printf("If this were a real program, something interesting would have just
happened.\n");
+}
+
+void gr_flow_graph::stop()
+{
+ if (!d_scheduler)
+ throw std::runtime_error("Scheduler not running!");
+
+ d_scheduler->stop();
+ d_scheduler.reset();
+}
+
+void gr_flow_graph::wait()
+{
+ if (!d_scheduler)
+ throw std::runtime_error("Scheduler not running!");
+ d_scheduler->wait();
+ d_scheduler.reset();
+}
+
+void gr_flow_graph::run()
+{
+ start();
+ wait();
+}
+
+// Topological sort and partition functions here
Deleted:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_flow_graph.h
Copied:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_flow_graph.h
(from rev 3773,
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/native/gr_flow_graph.h)
===================================================================
---
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_flow_graph.h
(rev 0)
+++
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_flow_graph.h
2006-10-11 16:24:01 UTC (rev 3774)
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_FLOW_GRAPH_H
+#define INCLUDED_GR_FLOW_GRAPH_H
+
+#include <gr_block.h>
+#include <gr_scheduler.h>
+#include <boost/enable_shared_from_this.hpp>
+
+typedef std::vector<gr_block_sptr> gr_block_vector_t;
+typedef std::vector<gr_block_sptr>::iterator gr_block_vector_iterator_t;
+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>
+{
+private:
+ gr_flow_graph();
+ friend gr_flow_graph_sptr gr_make_flow_graph();
+
+ void connect_prim(gr_endpoint_t src, gr_endpoint_t dst);
+ void check_valid_port(gr_io_signature_sptr sig, int port);
+ void check_dst_not_used(gr_endpoint_t dst);
+ void check_type_match(gr_endpoint_t src, gr_endpoint_t dst);
+ void disconnect_prim(gr_endpoint_t src, gr_endpoint_t dst);
+
+ void create_block_list();
+ void connect_blocks();
+ std::vector<int> calc_used_ports(gr_block_sptr block, bool direction);
+ void check_contiguity(gr_block_sptr block, gr_io_signature_sptr sig,
+ std::vector<int> &used_ports);
+
+ 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;
+ gr_scheduler_sptr d_scheduler;
+
+ // Topological sort and partition functions here
+
+public:
+ ~gr_flow_graph();
+ void connect(gr_block_sptr src_block, int src_port,
+ gr_block_sptr dst_block, int dst_port);
+ // more connect convenience functions go here
+
+ void disconnect(gr_block_sptr src_block, int src_port,
+ gr_block_sptr dst_block, int dst_port);
+ void disconnect_all();
+
+ // more disconnect convenience functions go here
+
+ void start();
+ void stop();
+ void wait();
+ void run();
+};
+
+#endif
Copied:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_scheduler.cc
(from rev 3773,
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/native/gr_scheduler.cc)
===================================================================
---
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_scheduler.cc
(rev 0)
+++
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_scheduler.cc
2006-10-11 16:24:01 UTC (rev 3774)
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gr_scheduler.h>
+#include <gr_flow_graph.h>
+
+gr_scheduler_sptr gr_make_scheduler(gr_flow_graph_sptr fg)
+{
+ return gr_scheduler_sptr(new gr_scheduler(fg));
+}
+
+gr_scheduler::gr_scheduler(gr_flow_graph_sptr fg) :
+ d_fg(fg)
+{
+ // NOP
+}
+
+gr_scheduler::~gr_scheduler()
+{
+ // NOP
+}
+
+void gr_scheduler::start()
+{
+}
+
+void gr_scheduler::stop()
+{
+}
+
+void gr_scheduler::wait()
+{
+}
Copied:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_scheduler.h
(from rev 3773,
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/native/gr_scheduler.h)
===================================================================
---
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_scheduler.h
(rev 0)
+++
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples/c++/gr_scheduler.h
2006-10-11 16:24:01 UTC (rev 3774)
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_SCHEDULER_H
+#define INCLUDED_GR_SCHEDULER_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_scheduler(gr_flow_graph_sptr fg);
+ friend gr_scheduler_sptr gr_make_scheduler(gr_flow_graph_sptr fg);
+
+public:
+ ~gr_scheduler();
+
+ void start();
+ void stop();
+ void wait();
+};
+
+#endif /* INCLUDED_GR_SCHEDULER_H */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r3774 - in gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-examples: . c++,
jcorgan <=