summaryrefslogtreecommitdiff
path: root/lib/hier_block.cpp
diff options
context:
space:
mode:
authorJosh Blum2012-08-19 00:33:23 -0700
committerJosh Blum2012-08-26 16:03:50 -0700
commit87be8242fd5855a8e8f6a76fddf40275b711c784 (patch)
tree18700039d8a711815fb06d7f632118e0216b2484 /lib/hier_block.cpp
parent1d23019d422c35ba0a653a31bda2066919243c6c (diff)
downloadsandhi-87be8242fd5855a8e8f6a76fddf40275b711c784.tar.gz
sandhi-87be8242fd5855a8e8f6a76fddf40275b711c784.tar.bz2
sandhi-87be8242fd5855a8e8f6a76fddf40275b711c784.zip
runtime: a lot more is compiling/linking
Diffstat (limited to 'lib/hier_block.cpp')
-rw-r--r--lib/hier_block.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/hier_block.cpp b/lib/hier_block.cpp
index 5d5c891..e915a23 100644
--- a/lib/hier_block.cpp
+++ b/lib/hier_block.cpp
@@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with io_sig program. If not, see <http://www.gnu.org/licenses/>.
+#include "element_impl.hpp"
#include <gnuradio/hier_block.hpp>
using namespace gnuradio;
@@ -22,3 +23,47 @@ HierBlock::HierBlock(void)
{
//NOP
}
+
+HierBlock::HierBlock(const std::string &name)
+{
+ this->reset(new ElementImpl());
+ (*this)->name = name;
+ tsbe::TopologyConfig config;
+ (*this)->topology = tsbe::Topology(config);
+}
+
+void HierBlock::connect(const Element &elem)
+{
+ (*this)->topology.add_topology(elem->topology);
+}
+
+void HierBlock::disconnect(const Element &elem)
+{
+ (*this)->topology.remove_topology(elem->topology);
+}
+
+void HierBlock::connect(
+ const Element &src,
+ const size_t src_index,
+ const Element &sink,
+ const size_t sink_index
+){
+ const tsbe::Connection conn(
+ tsbe::Port(src->get_elem(), src_index),
+ tsbe::Port(sink->get_elem(), sink_index)
+ );
+ (*this)->topology.connect(conn);
+}
+
+void HierBlock::disconnect(
+ const Element &src,
+ const size_t src_index,
+ const Element &sink,
+ const size_t sink_index
+){
+ const tsbe::Connection conn(
+ tsbe::Port(src->get_elem(), src_index),
+ tsbe::Port(sink->get_elem(), sink_index)
+ );
+ (*this)->topology.disconnect(conn);
+}