[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r3999 - in gnuradio/branches/developers/jcorgan/hier/g
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r3999 - in gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src: lib/runtime python/gnuradio/gr |
Date: |
Thu, 16 Nov 2006 23:20:03 -0700 (MST) |
Author: jcorgan
Date: 2006-11-16 23:20:03 -0700 (Thu, 16 Nov 2006)
New Revision: 3999
Added:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h
Removed:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2_impl.cc
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2_impl.h
Modified:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/Makefile.am
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_basic_block.cc
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_basic_block.h
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2.cc
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2.h
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2.i
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.cc
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.h
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.i
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime_impl.cc
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime_impl.h
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py
Log:
Start of rewrite of hierarchical blocks using 'compiler' analogy
Modified:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/Makefile.am
===================================================================
---
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/Makefile.am
2006-11-17 06:05:14 UTC (rev 3998)
+++
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/Makefile.am
2006-11-17 06:20:03 UTC (rev 3999)
@@ -34,7 +34,7 @@
gr_block.cc \
gr_block_detail.cc \
gr_hier_block2.cc \
- gr_hier_block2_impl.cc \
+ gr_hier_block2_detail.cc \
gr_buffer.cc \
gr_dispatcher.cc \
gr_error_handler.cc \
@@ -70,7 +70,7 @@
gr_block.h \
gr_block_detail.h \
gr_hier_block2.h \
- gr_hier_block2_impl.h \
+ gr_hier_block2_detail.h \
gr_buffer.h \
gr_complex.h \
gr_dispatcher.h \
Modified:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_basic_block.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_basic_block.cc
2006-11-17 06:05:14 UTC (rev 3998)
+++
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_basic_block.cc
2006-11-17 06:20:03 UTC (rev 3999)
@@ -40,18 +40,15 @@
gr_io_signature_sptr input_signature,
gr_io_signature_sptr output_signature)
: d_name(name),
- d_parent(0),
d_input_signature(input_signature),
d_output_signature(output_signature),
- d_unique_id(s_next_id++),
- d_terminal(true)
+ d_unique_id(s_next_id++)
{
s_ncurrently_allocated++;
}
gr_basic_block::~gr_basic_block()
{
- d_parent = 0; // We don't own this, don't call delete
s_ncurrently_allocated--;
}
@@ -61,6 +58,7 @@
return shared_from_this();
}
+/*
bool
gr_basic_block::validate()
{
@@ -73,3 +71,4 @@
return check_topology(ninputs, noutputs);
}
+*/
Modified:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_basic_block.h
===================================================================
---
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_basic_block.h
2006-11-17 06:05:14 UTC (rev 3998)
+++
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_basic_block.h
2006-11-17 06:20:03 UTC (rev 3999)
@@ -54,18 +54,12 @@
class gr_basic_block : public boost::enable_shared_from_this<gr_basic_block>
{
protected:
- friend class gr_tree_visitor;
- friend class gr_runtime_impl;
- friend class validation_visitor;
- friend class connect_visitor;
std::string d_name;
- gr_basic_block *d_parent; // Temp until shared pointer method
works
gr_io_signature_sptr d_input_signature;
gr_io_signature_sptr d_output_signature;
long d_unique_id;
- bool d_terminal;
-
+
gr_basic_block(const std::string &name,
gr_io_signature_sptr input_signature,
gr_io_signature_sptr output_signature);
@@ -80,22 +74,6 @@
d_output_signature = iosig;
}
- // Adjusts arguments to reflect topology of passed child pointer
- // Overridden in gr_hier_block2 to calculate from connection database
- virtual void get_child_topology(gr_basic_block_sptr child, int *ninputs,
int *noutputs)
- { ninputs=0; noutputs=0; }
-
- /*! overridden in gr_hier_block2 to implement tree traversal
- * otherwise invoke callback with shared pointer to this object
- */
- virtual bool visit(gr_tree_visitor &visitor) { return
visitor(shared_from_this()); }
-
- /*! overriden in descendent classes to verify correct topology, etc. */
- virtual bool validate();
-
- /*! overriden in gr_hier_block2 to create and connect buffers for children
*/
- virtual void connect_children() { };
-
public:
virtual ~gr_basic_block();
long unique_id() const { return d_unique_id; }
@@ -103,10 +81,7 @@
gr_io_signature_sptr input_signature() const { return d_input_signature; }
gr_io_signature_sptr output_signature() const { return d_output_signature;
}
gr_basic_block_sptr basic_block(); // Needed for Python type coercion
- void set_parent(gr_basic_block *parent) { d_parent = parent; }
- gr_basic_block *parent() const { return d_parent; }
- bool is_terminal_p() { return d_terminal; }
-
+
/*!
* \brief Confirm that ninputs and noutputs is an acceptable combination.
*
Modified:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2.cc
2006-11-17 06:05:14 UTC (rev 3998)
+++
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2.cc
2006-11-17 06:20:03 UTC (rev 3999)
@@ -25,8 +25,8 @@
#endif
#include <gr_hier_block2.h>
-#include <gr_hier_block2_impl.h>
#include <gr_io_signature.h>
+#include <gr_hier_block2_detail.h>
#include <iostream>
#define GR_HIER_BLOCK2_DEBUG 1
@@ -42,93 +42,24 @@
gr_io_signature_sptr input_signature,
gr_io_signature_sptr output_signature)
: gr_basic_block(name, input_signature, output_signature),
- d_impl(new gr_hier_block2_impl())
+ d_detail(new gr_hier_block2_detail(this))
{
- d_terminal = false;
}
gr_hier_block2::~gr_hier_block2()
{
- delete d_impl;
+ delete d_detail;
}
void
gr_hier_block2::define_component(const std::string &name, gr_basic_block_sptr
block)
{
- d_impl->define_component(name, block);
- block->set_parent(this);
+ d_detail->define_component(name, block);
}
void
gr_hier_block2::connect(const std::string &src_name, int src_port,
const std::string &dst_name, int dst_port)
{
- gr_io_signature_sptr src_io_signature;
- gr_io_signature_sptr dst_io_signature;
-
- // Check against our *input_signature* if we're wiring from one of our
external inputs
- if (src_name == "self")
- src_io_signature = input_signature();
- else {
- gr_basic_block_sptr src_block = d_impl->get_block_by_name(src_name);
- if (!src_block)
- throw std::invalid_argument("Undefined src name");
- src_io_signature = src_block->output_signature();
- }
-
- // Check against our *output_signature* if we're wiring to one of our
external outputs
- if (dst_name == "self")
- dst_io_signature = output_signature();
- else {
- gr_basic_block_sptr dst_block = d_impl->get_block_by_name(dst_name);
- if (!dst_block)
- throw std::invalid_argument("Undefined dst name");
- dst_io_signature = dst_block->input_signature();
- }
-
- // Check port numbers are valid
- d_impl->check_valid_port(src_io_signature, src_port);
- d_impl->check_valid_port(dst_io_signature, dst_port);
-
- // Check destination port not already in use
- d_impl->check_dst_not_used(dst_name, dst_port);
-
- // Check endpoint types match
- d_impl->check_type_match(src_io_signature, src_port,
- dst_io_signature, dst_port);
-
- gr_connection connection(gr_endpoint(src_name, src_port),
- gr_endpoint(dst_name, dst_port));
- d_impl->d_connections.push_back(connection);
+ d_detail->connect(src_name, src_port, dst_name, dst_port);
}
-
-bool
-gr_hier_block2::visit(gr_tree_visitor &visitor)
-{
- if (!visitor(shared_from_this()))
- return false;
-
- return d_impl->visit(visitor);
-}
-
-bool
-gr_hier_block2::validate()
-{
- // Make sure base class is ok, then do my stuff
- return gr_basic_block::validate() &&
- d_impl->validate();
-}
-
-void
-gr_hier_block2::connect_children()
-{
- if (GR_HIER_BLOCK2_DEBUG)
- std::cout << "Wiring up children for block " << name() << std::endl;
- d_impl->connect_children();
-}
-
-void
-gr_hier_block2::get_child_topology(gr_basic_block_sptr child, int *ninputs,
int *noutputs)
-{
- d_impl->get_child_topology(child, ninputs, noutputs);
-}
Modified:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2.h
===================================================================
---
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2.h
2006-11-17 06:05:14 UTC (rev 3998)
+++
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2.h
2006-11-17 06:20:03 UTC (rev 3999)
@@ -31,7 +31,7 @@
gr_io_signature_sptr input_signature,
gr_io_signature_sptr output_signature);
-class gr_hier_block2_impl;
+class gr_hier_block2_detail;
/*!
* \brief gr_hier_block2 - Hierarchical container class for gr_block's
@@ -40,23 +40,14 @@
class gr_hier_block2 : public gr_basic_block
{
private:
- friend class gr_runtime_impl;
+ friend class gr_runtime_detail;
friend gr_hier_block2_sptr gr_make_hier_block2(const std::string &name,
gr_io_signature_sptr
input_signature,
gr_io_signature_sptr
output_signature);
-
/*!
* \brief Private implementation details of gr_hier_block2
*/
- gr_hier_block2_impl *d_impl;
-
- void get_child_topology(gr_basic_block_sptr child, int *ninputs, int
*noutputs);
-
- // Overrides gr_basic_block, invokes visitor call back on self and all
children
- virtual bool visit(gr_tree_visitor &visitor);
-
- // Overrides gr_basic_block, connects i/o on child components
- virtual void connect_children();
+ gr_hier_block2_detail *d_detail;
protected:
gr_hier_block2(const std::string &name,
@@ -69,9 +60,6 @@
void define_component(const std::string &name, gr_basic_block_sptr
basic_block);
void connect(const std::string &src_name, int src_port,
const std::string &dst_name, int dst_port);
-
- // Overrides gr_basic_block, checks validity of connection/component
databases
- virtual bool validate();
};
#endif /* INCLUDED_GR_HIER_BLOCK2_H */
Modified:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2.i
===================================================================
---
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2.i
2006-11-17 06:05:14 UTC (rev 3998)
+++
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2.i
2006-11-17 06:20:03 UTC (rev 3999)
@@ -52,5 +52,4 @@
void connect(const std::string &src_name, int src_port,
const std::string &dst_name, int dst_port)
throw (std::invalid_argument);
- bool validate();
};
Added:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc
(rev 0)
+++
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc
2006-11-17 06:20:03 UTC (rev 3999)
@@ -0,0 +1,153 @@
+/*
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define GR_HIER_BLOCK2_DETAIL_DEBUG 1
+
+#include <gr_hier_block2_detail.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <iostream>
+
+gr_hier_block2_detail::gr_hier_block2_detail(gr_hier_block2 *owner) :
+d_owner(owner)
+{
+}
+
+gr_hier_block2_detail::~gr_hier_block2_detail()
+{
+ d_owner = 0; // Don't use delete, we didn't allocate
+}
+
+void
+gr_hier_block2_detail::define_component(const std::string &name,
gr_basic_block_sptr block)
+{
+ if (name == "self")
+ throw std::invalid_argument("name is reserved");
+
+ if (get_block_by_name(name))
+ throw std::invalid_argument("name already in use");
+
+ if (get_name_by_block(block) != "")
+ throw std::invalid_argument("component already defined");
+
+ d_components.push_back(gr_hier_component(name, block));
+}
+
+gr_basic_block_sptr
+gr_hier_block2_detail::get_block_by_name(const std::string &name)
+{
+ for (gr_hier_component_viter_t p = d_components.begin();
+ p != d_components.end(); p++) {
+ if (name == p->name())
+ return p->block();
+ }
+
+ return gr_basic_block_sptr();
+}
+
+std::string
+gr_hier_block2_detail::get_name_by_block(gr_basic_block_sptr block)
+{
+ for (gr_hier_component_viter_t p = d_components.begin();
+ p != d_components.end(); p++) {
+ if (block == p->block())
+ return p->name();
+ }
+
+ return std::string("");
+}
+
+void
+gr_hier_block2_detail::connect(const std::string &src_name, int src_port,
+ const std::string &dst_name, int dst_port)
+{
+ gr_io_signature_sptr src_io_signature;
+ gr_io_signature_sptr dst_io_signature;
+
+ // Check against our *input_signature* if we're wiring from one of our
external inputs
+ if (src_name == "self")
+ src_io_signature = d_owner->input_signature();
+ else {
+ gr_basic_block_sptr src_block = get_block_by_name(src_name);
+ if (!src_block)
+ throw std::invalid_argument("undefined src name");
+ src_io_signature = src_block->output_signature();
+ }
+
+ // Check against our *output_signature* if we're wiring to one of our
external outputs
+ if (dst_name == "self")
+ dst_io_signature = d_owner->output_signature();
+ else {
+ gr_basic_block_sptr dst_block = get_block_by_name(dst_name);
+ if (!dst_block)
+ throw std::invalid_argument("undefined dst name");
+ dst_io_signature = dst_block->input_signature();
+ }
+
+ // Check port numbers are valid
+ check_valid_port(src_io_signature, src_port);
+ check_valid_port(dst_io_signature, dst_port);
+
+ // Check destination port not already in use
+ check_dst_not_used(dst_name, dst_port);
+
+ // Check endpoint types match
+ check_type_match(src_io_signature, src_port,
+ dst_io_signature, dst_port);
+
+ gr_connection connection(gr_endpoint(src_name, src_port),
+ gr_endpoint(dst_name, dst_port));
+ d_connections.push_back(connection);
+}
+
+void
+gr_hier_block2_detail::check_valid_port(gr_io_signature_sptr sig, int port)
+{
+ if (port < 0)
+ throw std::invalid_argument("port number must not be negative");
+
+ if (sig->max_streams() >= 0 && port >= sig->max_streams())
+ throw std::invalid_argument("port number exceeds max streams");
+}
+
+void
+gr_hier_block2_detail::check_dst_not_used(const std::string name, int port)
+{
+ for (gr_connection_viter_t p = d_connections.begin();
+ p != d_connections.end(); p++) {
+
+ if (p->dst().name() == name && p->dst().port() == port)
+ throw std::invalid_argument("destination port in use");
+ }
+}
+
+void
+gr_hier_block2_detail::check_type_match(gr_io_signature_sptr src_sig, int
src_port,
+ gr_io_signature_sptr dst_sig, int
dst_port)
+{
+ if (src_sig->sizeof_stream_item(src_port) !=
+ dst_sig->sizeof_stream_item(dst_port))
+ throw std::invalid_argument("type mismatch");
+}
Property changes on:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h
===================================================================
---
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h
(rev 0)
+++
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h
2006-11-17 06:20:03 UTC (rev 3999)
@@ -0,0 +1,104 @@
+/*
+ * 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_HIER_BLOCK2_DETAIL_H
+#define INCLUDED_GR_HIER_BLOCK2_DETAIL_H
+
+#include <gr_hier_block2.h>
+#include <boost/utility.hpp>
+
+class gr_hier_component
+{
+private:
+ std::string d_name;
+ gr_basic_block_sptr d_block;
+
+public:
+ gr_hier_component(const std::string name, gr_basic_block_sptr block)
+ : d_name(name), d_block(block) {}
+
+ std::string name() const { return d_name; }
+ gr_basic_block_sptr block() const { return d_block; }
+};
+
+typedef std::vector<gr_hier_component> gr_hier_component_vector_t;
+typedef std::vector<gr_hier_component>::iterator gr_hier_component_viter_t;
+
+class gr_endpoint
+{
+private:
+ std::string d_name;
+ int d_port;
+
+public:
+ gr_endpoint(const std::string &name, int port)
+ : d_name(name), d_port(port) {}
+
+ std::string name() const { return d_name; }
+ int port() const { return d_port; }
+};
+
+class gr_connection
+{
+private:
+ gr_endpoint d_src;
+ gr_endpoint d_dst;
+
+public:
+ gr_connection(gr_endpoint src, gr_endpoint dst)
+ : d_src(src), d_dst(dst) {}
+
+ gr_endpoint src() const { return d_src; }
+ gr_endpoint dst() const { return d_dst; }
+};
+
+typedef std::vector<gr_connection> gr_connection_vector_t;
+typedef std::vector<gr_connection>::iterator gr_connection_viter_t;
+
+class gr_hier_block2_detail : boost::noncopyable
+{
+private:
+ friend class gr_hier_block2;
+
+ // Constructor--it's private, only friends can instantiate
+ gr_hier_block2_detail(gr_hier_block2 *owner);
+
+ // Private implementation data
+ gr_hier_block2 *d_owner;
+ gr_hier_component_vector_t d_components;
+ gr_connection_vector_t d_connections;
+
+ // Private implementation methods
+ void define_component(const std::string &name, gr_basic_block_sptr block);
+ std::string get_name_by_block(gr_basic_block_sptr block);
+ gr_basic_block_sptr get_block_by_name(const std::string &name);
+
+ void connect(const std::string &src_name, int src_port,
+ const std::string &dst_name, int dst_port);
+ void check_valid_port(gr_io_signature_sptr sig, int port);
+ void check_dst_not_used(const std::string name, int port);
+ void check_type_match(gr_io_signature_sptr src_sig, int src_port,
+ gr_io_signature_sptr dst_sig, int dst_port);
+
+public:
+ ~gr_hier_block2_detail();
+};
+
+#endif /* INCLUDED_GR_HIER_BLOCK2_DETAIL_H */
Property changes on:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h
___________________________________________________________________
Name: svn:eol-style
+ native
Deleted:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2_impl.cc
Deleted:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2_impl.h
Modified:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.cc
2006-11-17 06:05:14 UTC (rev 3998)
+++
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.cc
2006-11-17 06:20:03 UTC (rev 3999)
@@ -44,12 +44,6 @@
delete d_impl;
}
-bool
-gr_runtime::validate()
-{
- d_impl->validate();
-}
-
void
gr_runtime::start()
{
Modified:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.h
===================================================================
---
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.h
2006-11-17 06:05:14 UTC (rev 3998)
+++
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.h
2006-11-17 06:20:03 UTC (rev 3999)
@@ -40,7 +40,6 @@
public:
~gr_runtime();
- bool validate();
void start();
void stop();
void wait();
Modified:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.i
===================================================================
---
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.i
2006-11-17 06:05:14 UTC (rev 3998)
+++
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.i
2006-11-17 06:20:03 UTC (rev 3999)
@@ -33,8 +33,6 @@
gr_runtime(gr_hier_block2_sptr top_block);
public:
- bool validate()
- throw (std::runtime_error);
void start();
void stop();
void wait();
Modified:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime_impl.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime_impl.cc
2006-11-17 06:05:14 UTC (rev 3998)
+++
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime_impl.cc
2006-11-17 06:20:03 UTC (rev 3999)
@@ -41,44 +41,6 @@
{
}
-class validation_visitor : public gr_tree_visitor
-{
-public:
- virtual bool visit(gr_basic_block_sptr block)
- {
- if (GR_RUNTIME_IMPL_DEBUG)
- std::cout << "Validating block: " << block << std::endl;
- return block->validate();
- }
-};
-
-bool
-gr_runtime_impl::validate()
-{
- // Visit every node in the tree and call validate() on it
- validation_visitor visitor;
- return d_top_block->visit(visitor);
-}
-
-class connect_visitor : public gr_tree_visitor
-{
-public:
- virtual bool visit(gr_basic_block_sptr block)
- {
- block->connect_children();
- return true; // failures are exceptions are this point
- }
-};
-
-void
-gr_runtime_impl::connect_blocks()
-{
- // Visit every node in the tree and wire inputs and outputs of
- // leaf nodes (gr_block's)
- connect_visitor visitor;
- d_top_block->visit(visitor);
-}
-
void
gr_runtime_impl::start()
{
@@ -89,11 +51,6 @@
throw std::runtime_error("already running");
else
d_running = true;
-
- if (!validate())
- throw std::runtime_error("tree failed validation");
-
- connect_blocks();
}
void
@@ -115,4 +72,3 @@
if (GR_RUNTIME_IMPL_DEBUG)
std::cout << "gr_runtime_impl::wait()" << std::endl;
}
-
Modified:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime_impl.h
===================================================================
---
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime_impl.h
2006-11-17 06:05:14 UTC (rev 3998)
+++
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime_impl.h
2006-11-17 06:20:03 UTC (rev 3999)
@@ -34,9 +34,6 @@
bool d_running;
gr_hier_block2_sptr d_top_block;
- bool validate();
- void connect_blocks();
-
void start();
void stop();
void wait();
Modified:
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py
===================================================================
---
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py
2006-11-17 06:05:14 UTC (rev 3998)
+++
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py
2006-11-17 06:20:03 UTC (rev 3999)
@@ -155,7 +155,7 @@
gr.io_signature(0,0,gr.sizeof_int),
gr.io_signature(0,0,gr.sizeof_int))
hblock.check_topology(0, 0);
-
+ """
def test_019_validate(self):
hblock = gr.hier_block2("test_block",
gr.io_signature(0,0,gr.sizeof_int),
@@ -241,6 +241,7 @@
# runtime.validate()
# self.assertRaises(ValueError,
# lambda: hblock.disconnect("src1", 0, "nop1", 1))
-
+ """
+
if __name__ == "__main__":
gr_unittest.main()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r3999 - in gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src: lib/runtime python/gnuradio/gr,
jcorgan <=