summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib
diff options
context:
space:
mode:
authorEric Blossom2010-10-30 18:17:12 -0700
committerEric Blossom2010-11-10 12:15:42 -0800
commitc34cf20f501dea19385cb42bf31e92ad889e7040 (patch)
tree02379688d72269e569fef3e6db464fdc0f55b80f /gnuradio-core/src/lib
parent2c54f4a56304b3dba7a66ed1baf06dc0bd8393e8 (diff)
downloadgnuradio-c34cf20f501dea19385cb42bf31e92ad889e7040.tar.gz
gnuradio-c34cf20f501dea19385cb42bf31e92ad889e7040.tar.bz2
gnuradio-c34cf20f501dea19385cb42bf31e92ad889e7040.zip
Rename basic_block coersion method to to_basic_block. Add to_hier_block2 and to_top_block.
basic_block was renamed because the number of guile generic methods on basic_block was getting large and confusing. to_hier_block2 and to_top_block were added to support coercion to those types in guile (and python). This change simplifies the handling of "connect" in guile.
Diffstat (limited to 'gnuradio-core/src/lib')
-rw-r--r--gnuradio-core/src/lib/runtime/gr_basic_block.cc2
-rw-r--r--gnuradio-core/src/lib/runtime/gr_basic_block.h2
-rw-r--r--gnuradio-core/src/lib/runtime/gr_basic_block.i2
-rw-r--r--gnuradio-core/src/lib/runtime/gr_hier_block2.cc5
-rw-r--r--gnuradio-core/src/lib/runtime/gr_hier_block2.h2
-rw-r--r--gnuradio-core/src/lib/runtime/gr_hier_block2.i2
-rw-r--r--gnuradio-core/src/lib/runtime/gr_top_block.cc6
-rw-r--r--gnuradio-core/src/lib/runtime/gr_top_block.h7
-rw-r--r--gnuradio-core/src/lib/runtime/gr_top_block.i2
9 files changed, 27 insertions, 3 deletions
diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.cc b/gnuradio-core/src/lib/runtime/gr_basic_block.cc
index 2fa1066cb..0e0dad16b 100644
--- a/gnuradio-core/src/lib/runtime/gr_basic_block.cc
+++ b/gnuradio-core/src/lib/runtime/gr_basic_block.cc
@@ -56,7 +56,7 @@ gr_basic_block::~gr_basic_block()
}
gr_basic_block_sptr
-gr_basic_block::basic_block()
+gr_basic_block::to_basic_block()
{
return shared_from_this();
}
diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.h b/gnuradio-core/src/lib/runtime/gr_basic_block.h
index b8797fdc6..d059a4bd3 100644
--- a/gnuradio-core/src/lib/runtime/gr_basic_block.h
+++ b/gnuradio-core/src/lib/runtime/gr_basic_block.h
@@ -81,7 +81,7 @@ public:
std::string name() const { return d_name; }
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
+ gr_basic_block_sptr to_basic_block(); // Needed for Python/Guile type coercion
/*!
* \brief Confirm that ninputs and noutputs is an acceptable combination.
diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.i b/gnuradio-core/src/lib/runtime/gr_basic_block.i
index f1de9e08a..9b360e5ab 100644
--- a/gnuradio-core/src/lib/runtime/gr_basic_block.i
+++ b/gnuradio-core/src/lib/runtime/gr_basic_block.i
@@ -40,7 +40,7 @@ public:
gr_io_signature_sptr input_signature() const;
gr_io_signature_sptr output_signature() const;
long unique_id() const;
- gr_basic_block_sptr basic_block();
+ gr_basic_block_sptr to_basic_block();
bool check_topology (int ninputs, int noutputs);
};
diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2.cc b/gnuradio-core/src/lib/runtime/gr_hier_block2.cc
index e3a25e1a8..d6e317136 100644
--- a/gnuradio-core/src/lib/runtime/gr_hier_block2.cc
+++ b/gnuradio-core/src/lib/runtime/gr_hier_block2.cc
@@ -61,6 +61,11 @@ gr_hier_block2::self()
return shared_from_this();
}
+gr_hier_block2_sptr
+gr_hier_block2::to_hier_block2()
+{
+ return cast_to_hier_block2_sptr(shared_from_this());
+}
void
gr_hier_block2::connect(gr_basic_block_sptr block)
diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2.h b/gnuradio-core/src/lib/runtime/gr_hier_block2.h
index f50b1cb94..0a40c36b7 100644
--- a/gnuradio-core/src/lib/runtime/gr_hier_block2.h
+++ b/gnuradio-core/src/lib/runtime/gr_hier_block2.h
@@ -147,6 +147,8 @@ public:
// This is a public method for ease of code organization, but should be
// ignored by the user.
gr_flat_flowgraph_sptr flatten() const;
+
+ gr_hier_block2_sptr to_hier_block2(); // Needed for Python/Guile type coercion
};
inline gr_hier_block2_sptr cast_to_hier_block2_sptr(gr_basic_block_sptr block) {
diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2.i b/gnuradio-core/src/lib/runtime/gr_hier_block2.i
index a62f50e84..1b974fd6b 100644
--- a/gnuradio-core/src/lib/runtime/gr_hier_block2.i
+++ b/gnuradio-core/src/lib/runtime/gr_hier_block2.i
@@ -57,4 +57,6 @@ public:
void disconnect_all();
void lock();
void unlock();
+
+ gr_hier_block2_sptr to_hier_block2(); // Needed for Python/Guile type coercion
};
diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.cc b/gnuradio-core/src/lib/runtime/gr_top_block.cc
index 09e46dfbb..f341525c0 100644
--- a/gnuradio-core/src/lib/runtime/gr_top_block.cc
+++ b/gnuradio-core/src/lib/runtime/gr_top_block.cc
@@ -95,3 +95,9 @@ gr_top_block::dump()
{
d_impl->dump();
}
+
+gr_top_block_sptr
+gr_top_block::to_top_block()
+{
+ return cast_to_top_block_sptr(shared_from_this());
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.h b/gnuradio-core/src/lib/runtime/gr_top_block.h
index 8052954e3..ed244cb7c 100644
--- a/gnuradio-core/src/lib/runtime/gr_top_block.h
+++ b/gnuradio-core/src/lib/runtime/gr_top_block.h
@@ -105,6 +105,13 @@ public:
* Displays flattened flowgraph edges and block connectivity
*/
void dump();
+
+ gr_top_block_sptr to_top_block(); // Needed for Python/Guile type coercion
};
+inline gr_top_block_sptr cast_to_top_block_sptr(gr_basic_block_sptr block) {
+ return boost::dynamic_pointer_cast<gr_top_block, gr_basic_block>(block);
+}
+
+
#endif /* INCLUDED_GR_TOP_BLOCK_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.i b/gnuradio-core/src/lib/runtime/gr_top_block.i
index 579ef8f70..d9adf1e18 100644
--- a/gnuradio-core/src/lib/runtime/gr_top_block.i
+++ b/gnuradio-core/src/lib/runtime/gr_top_block.i
@@ -47,6 +47,8 @@ public:
void lock();
void unlock() throw (std::runtime_error);
void dump();
+
+ gr_top_block_sptr to_top_block(); // Needed for Python/Guile type coercion
};
#ifdef SWIGPYTHON