5 changed files with 229 additions and 0 deletions
@ -0,0 +1,54 @@ |
|||||||
|
<?xml version="1.0"?> |
||||||
|
<block> |
||||||
|
<name>stream_router</name> |
||||||
|
<key>multirds_stream_router</key> |
||||||
|
<category>[multirds]</category> |
||||||
|
<import>import multirds</import> |
||||||
|
<make>multirds.stream_router($ninputs, $noutputs)</make> |
||||||
|
|
||||||
|
<param> |
||||||
|
<name>Type</name> |
||||||
|
<key>type</key> |
||||||
|
<value>float</value> |
||||||
|
<type>enum</type> |
||||||
|
<option><name>Complex</name><key>complex</key><opt>fcn:sink_c</opt></option> |
||||||
|
<option><name>Float</name><key>float</key><opt>fcn:sink_f</opt></option> |
||||||
|
</param> |
||||||
|
<param> |
||||||
|
<name>Number of inputs</name> |
||||||
|
<key>ninputs</key> |
||||||
|
<value>9</value> |
||||||
|
<type>int</type> |
||||||
|
</param> |
||||||
|
<param> |
||||||
|
<name>Number of outputs</name> |
||||||
|
<key>noutputs</key> |
||||||
|
<value>3</value> |
||||||
|
<type>int</type> |
||||||
|
</param> |
||||||
|
|
||||||
|
<!-- Make one 'sink' node per input. Sub-nodes: |
||||||
|
* name (an identifier for the GUI) |
||||||
|
* type |
||||||
|
* vlen |
||||||
|
* optional (set to 1 for optional inputs) --> |
||||||
|
<sink> |
||||||
|
<name>in</name> |
||||||
|
<type>$type</type> |
||||||
|
<nports>$ninputs</nports> |
||||||
|
</sink> |
||||||
|
<sink> |
||||||
|
<name>ctrl</name> |
||||||
|
<type>message</type> |
||||||
|
</sink> |
||||||
|
<!-- Make one 'source' node per output. Sub-nodes: |
||||||
|
* name (an identifier for the GUI) |
||||||
|
* type |
||||||
|
* vlen |
||||||
|
* optional (set to 1 for optional inputs) --> |
||||||
|
<source> |
||||||
|
<name>out</name> |
||||||
|
<type>$type</type> |
||||||
|
<nports>$noutputs</nports> |
||||||
|
</source> |
||||||
|
</block> |
||||||
@ -0,0 +1,56 @@ |
|||||||
|
/* -*- c++ -*- */ |
||||||
|
/*
|
||||||
|
* Copyright 2017 <+YOU OR YOUR COMPANY+>. |
||||||
|
*
|
||||||
|
* This 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 3, or (at your option) |
||||||
|
* any later version. |
||||||
|
*
|
||||||
|
* This software 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 this software; see the file COPYING. If not, write to |
||||||
|
* the Free Software Foundation, Inc., 51 Franklin Street, |
||||||
|
* Boston, MA 02110-1301, USA. |
||||||
|
*/ |
||||||
|
|
||||||
|
|
||||||
|
#ifndef INCLUDED_MULTIRDS_STREAM_ROUTER_H |
||||||
|
#define INCLUDED_MULTIRDS_STREAM_ROUTER_H |
||||||
|
|
||||||
|
#include <multirds/api.h> |
||||||
|
#include <gnuradio/sync_block.h> |
||||||
|
|
||||||
|
namespace gr { |
||||||
|
namespace multirds { |
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief <+description of block+> |
||||||
|
* \ingroup multirds |
||||||
|
* |
||||||
|
*/ |
||||||
|
class MULTIRDS_API stream_router : virtual public gr::sync_block |
||||||
|
{ |
||||||
|
public: |
||||||
|
typedef boost::shared_ptr<stream_router> sptr; |
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return a shared_ptr to a new instance of multirds::stream_router. |
||||||
|
* |
||||||
|
* To avoid accidental use of raw pointers, multirds::stream_router's |
||||||
|
* constructor is in a private implementation |
||||||
|
* class. multirds::stream_router::make is the public interface for |
||||||
|
* creating new instances. |
||||||
|
*/ |
||||||
|
static sptr make(int ninputs,int noutputs); |
||||||
|
}; |
||||||
|
|
||||||
|
} // namespace multirds
|
||||||
|
} // namespace gr
|
||||||
|
|
||||||
|
#endif /* INCLUDED_MULTIRDS_STREAM_ROUTER_H */ |
||||||
|
|
||||||
@ -0,0 +1,70 @@ |
|||||||
|
/* -*- c++ -*- */ |
||||||
|
/*
|
||||||
|
* Copyright 2017 <+YOU OR YOUR COMPANY+>. |
||||||
|
*
|
||||||
|
* This 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 3, or (at your option) |
||||||
|
* any later version. |
||||||
|
*
|
||||||
|
* This software 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 this software; 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 |
||||||
|
|
||||||
|
#include <gnuradio/io_signature.h> |
||||||
|
#include "stream_router_impl.h" |
||||||
|
|
||||||
|
namespace gr { |
||||||
|
namespace multirds { |
||||||
|
|
||||||
|
stream_router::sptr |
||||||
|
stream_router::make(int ninputs,int noutputs) |
||||||
|
{ |
||||||
|
return gnuradio::get_initial_sptr |
||||||
|
(new stream_router_impl(ninputs, noutputs)); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* The private constructor |
||||||
|
*/ |
||||||
|
stream_router_impl::stream_router_impl(int ninputs,int noutputs) |
||||||
|
: gr::sync_block("stream_router", |
||||||
|
gr::io_signature::make(1, 1, sizeof(float)), |
||||||
|
gr::io_signature::make(1, 1, sizeof(float))) |
||||||
|
{} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Our virtual destructor. |
||||||
|
*/ |
||||||
|
stream_router_impl::~stream_router_impl() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
int |
||||||
|
stream_router_impl::work(int noutput_items, |
||||||
|
gr_vector_const_void_star &input_items, |
||||||
|
gr_vector_void_star &output_items) |
||||||
|
{ |
||||||
|
const float *in = (const float *) input_items[0]; |
||||||
|
float *out = (float *) output_items[0]; |
||||||
|
|
||||||
|
// Do <+signal processing+>
|
||||||
|
|
||||||
|
// Tell runtime system how many output items we produced.
|
||||||
|
return noutput_items; |
||||||
|
} |
||||||
|
|
||||||
|
} /* namespace multirds */ |
||||||
|
} /* namespace gr */ |
||||||
|
|
||||||
@ -0,0 +1,48 @@ |
|||||||
|
/* -*- c++ -*- */ |
||||||
|
/*
|
||||||
|
* Copyright 2017 <+YOU OR YOUR COMPANY+>. |
||||||
|
*
|
||||||
|
* This 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 3, or (at your option) |
||||||
|
* any later version. |
||||||
|
*
|
||||||
|
* This software 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 this software; see the file COPYING. If not, write to |
||||||
|
* the Free Software Foundation, Inc., 51 Franklin Street, |
||||||
|
* Boston, MA 02110-1301, USA. |
||||||
|
*/ |
||||||
|
|
||||||
|
#ifndef INCLUDED_MULTIRDS_STREAM_ROUTER_IMPL_H |
||||||
|
#define INCLUDED_MULTIRDS_STREAM_ROUTER_IMPL_H |
||||||
|
|
||||||
|
#include <multirds/stream_router.h> |
||||||
|
|
||||||
|
namespace gr { |
||||||
|
namespace multirds { |
||||||
|
|
||||||
|
class stream_router_impl : public stream_router |
||||||
|
{ |
||||||
|
private: |
||||||
|
// Nothing to declare in this block.
|
||||||
|
|
||||||
|
public: |
||||||
|
stream_router_impl(int ninputs,int noutputs); |
||||||
|
~stream_router_impl(); |
||||||
|
|
||||||
|
// Where all the action really happens
|
||||||
|
int work(int noutput_items, |
||||||
|
gr_vector_const_void_star &input_items, |
||||||
|
gr_vector_void_star &output_items); |
||||||
|
}; |
||||||
|
|
||||||
|
} // namespace multirds
|
||||||
|
} // namespace gr
|
||||||
|
|
||||||
|
#endif /* INCLUDED_MULTIRDS_STREAM_ROUTER_IMPL_H */ |
||||||
|
|
||||||
Loading…
Reference in new issue