#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <gnuradio/io_signature.h>
#include "block_name_impl.h"
#include "function.h"

namespace gr {
 namespace module {

   block_name::sptr
   block_name::make(float parameter)
   {
     return gnuradio::get_initial_sptr
(new block_name_impl(parameter));
   }

   /*
    * The private constructor
    */

*int myints[] = {4000,4000,4000,4000,4000,4000,4000,4000};*
*const std::vector<int> inputs (myints,
myints+sizeof(myints)/sizeof(float));*
*int myints2[] = {4000,4000,4,4};*
*const std::vector<int> outputs (myints2,
myints2+sizeof(myints2)/sizeof(float));*

 block_name_impl::block_name_impl(float parameter)
  : gr::block("block_name",
* gr::io_signature::makev(8,8,inputs),*
* gr::io_signature::makev(4,4,outputs)),*
parameter2(parameter)
 {}

   /*
    * Our virtual constructor
    */
   block_name::~block_name_impl()
   {
   }

   void
   block_name_impl::forecast(int noutput_items, gr_vector_int
&ninput_items_required)
   {
     /* <+forecast+> e.g. ninput_items_required[0] = noutput_items */
   }

   int
   block_name_impl::general_work (int noutput_items,
                            gr_vector_int &ninput_items,
                            gr_vector_const_void_star &input_items,
                            gr_vector_void_star &output_items)

   {
*     const float *in1 = (const float *) input_items[0];*
*     const float *in2 = (const float *) input_items[1];*
*     const float *in3 = (const float *) input_items[2];*
*     const float *in4 = (const float *) input_items[3];*
*     const float *in5 = (const float *) input_items[4];*
*     const float *in6 = (const float *) input_items[5];*
*     const float *in7 = (const float *) input_items[6];*
*     const float *in8 = (const float *) input_items[7];*
*     float *out1 = (float *) output_items[0];*
*     float *out2 = (float *) output_items[1];*
*     float *out3 = (float *) output_items[2];*
*     float *out4 = (float *) output_items[3];*

     // Do <+signal processing+>
     // Tell runtime system how many input items we consumed on
     // each input stream.

* function(in1,in2,in3,in4,in5,in6,in7,in8,parameter2,out1,out2,out3,out4);*

consume_each(noutput_items);
return noutput_items;
     }
  }
}


The "function line" may be inside a for, I am not sure. I am not sure of
the bold lines also. What is your overall comments?





2017-07-21 8:52 GMT+03:00 Ali <03do...@gmail.com>:

> Hi,
>
> Patrick's code does not work since I think I am using c++98. I dont know
> how to enable c++11. Anyway for c++98 I wrote the followings(I found on the
> internet):
>
> -->
> int myints[] = {4000,4000,4000,4000,4000,4000,4000,4000};
> const std::vector<int> inputs (myints, myints+sizeof(myints)/sizeof(
> float));
> int myints2[] = {4000,4000,4,4};
> const std::vector<int> outputs (myints2, myints2+sizeof(myints2)/
> sizeof(float));
> -->
> makev(8,8,inputs) and makev(4,4,outputs)
>
> It is compiled after "sudo make" command.
> But when I wrote "gr_modtool makexml function", I got the following
> error(... means I skipped writing these lines).
>
> ...
> Making GRC bindings for lib/function_impl.cc...
> tbi
> Error: Can't parse input signature.
> tbi
> Error: Can't parse output signature.
> ...
>  if iosig[inout]['max_ports'] == '-1':
> Key error: 'in'
>
> I will post my whole code later.
>
>
>
>
>
>
>
>
>
>
> 2017-07-21 1:14 GMT+03:00 Patrick Sathyanathan <wp...@hotmail.com>:
>
>> Try this instead:
>>
>>
>> const std::vector<int> inputs{4000,4000,4000,4000,4000,4000,4000,4000};
>>
>> and make sure you compile with c++11 enabled.
>>
>> --Patrick
>>
>> ------------------------------
>> *From:* Discuss-gnuradio <discuss-gnuradio-bounces+wpats=
>> hotmail....@gnu.org> on behalf of Ali <03do...@gmail.com>
>> *Sent:* Thursday, July 20, 2017 12:13 AM
>> *To:* discuss-gnuradio@gnu.org
>> *Subject:* Re: [Discuss-gnuradio] GNURadio OOT vector input/output with
>> different size
>>
>> Hi,
>>
>> I dont have any background about C++. So I could not generate the
>> std::vector<int> with the desired content and could not fınd anything on
>> the internet.
>>
>> const std::vector<int> inputs[] = {4000,4000,4000,4000,4000,40
>> 00,4000,4000};
>>
>> does not work. I am getting the following error:
>>
>> "conversion from 'int' to non-scalar type 'std::vector<int>' requested"
>>
>> Best,
>> Ali
>>
>>
>>
>>
>> 2017-07-18 11:51 GMT+03:00 Marcus Müller <muel...@kit.edu>:
>>
>>> Hi Ali,
>>>
>>> I think this should also work, shouldn't it?
>>>
>>> no, that's why I explained what you need to do (use makev).
>>>
>>> Does this part need to be changed since I am working with the vectors?
>>>
>>> No, not really. The vectors are still only consecutive numbers in
>>> memory.
>>>
>>> Best regards,
>>>
>>> Marcus
>>>
>>> On 18.07.2017 07:51, Ali wrote:
>>>
>>> Hi,
>>>
>>> 1- Actually I am using the followings
>>>
>>> make(8,8,1000*sizeof(float))
>>> make3(4,4,1000*sizeof(float),1000*sizeof(float),4*sizeof(float))
>>>
>>> I think this should also work, shouldn't it?
>>>
>>> 2- Under the general work function I am using the followings:
>>>
>>> const float *in1 = (const float *) input_items[0]
>>> ...
>>> float *out1 = (float *) output_items[0]
>>>
>>> Does this part need to be changed since I am working with the vectors?
>>>
>>> Thanks,
>>> Ali
>>>
>>>
>>>
>>>
>>> 2017-07-17 16:42 GMT+03:00 Marcus Müller <muel...@kit.edu>:
>>>
>>>> Hi Ali,
>>>>
>>>> So, you want one block with:
>>>>
>>>>    - 8 inputs, itemsize0…7 = 1000*4B = 4000B
>>>>    - 4 outputs, itemsize0=itemsize1=4000B, itemsize2=itemsize3=16B
>>>>
>>>> Correct?
>>>>
>>>> You need to generate two std::vector<int> with content
>>>>
>>>> {4000,4000,4000,4000,4000,4000,4000,4000}
>>>>
>>>> and
>>>>
>>>> {4000,4000,16,16}
>>>>
>>>> respectively, and use gr::io_signature::makev(int min_streams, int
>>>> max_streams, vector) to generate the io_signatures[1] that you use in your
>>>> block's constructor. The question whether your block should be a general,
>>>> or a sync block, is independent from the item sizes of the in and outputs,
>>>> but depends on whether there's always a fixed ratio of produced output
>>>> items to consumed input items, as explained in [2].
>>>>
>>>> Best regards,
>>>>
>>>> Marcus
>>>>
>>>> [1] https://gnuradio.org/doc/doxygen/classgr_1_1io__signature.ht
>>>> ml#a99e0f9e8de8e7ce16ed92d9f2655e66c
>>>> [2] https://wiki.gnuradio.org/index.php/Guided_Tutorial_GNU_Radi
>>>> o_in_C%2B%2B#4.3.2_Specific_block_categories
>>>>
>>>> On 07/17/2017 03:31 PM, Ali wrote:
>>>>
>>>> Hi to all,
>>>>
>>>> I want to design my own OOT module with the following I/O:
>>>>
>>>> 8 inputs (length of 1000 and each element is type of float)
>>>> 2 outputs (length of 1000 and each element is type of float)
>>>> 2 outputs (length of 4 and each element is type of float)
>>>>
>>>> I used general type block but I could not get the desired outputs. Do
>>>> you suggest other type of blocks? Is there any example similar to this work
>>>> that I can study on? Can you suggest a module name or a link?
>>>>
>>>> Best,
>>>> Ali
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Discuss-gnuradio mailing 
>>>> listDiscuss-gnuradio@gnu.orghttps://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Discuss-gnuradio mailing list
>>>> Discuss-gnuradio@gnu.org
>>>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>>>
>>>>
>>>
>>>
>>> _______________________________________________
>>> Discuss-gnuradio mailing 
>>> listDiscuss-gnuradio@gnu.orghttps://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>>
>>>
>>>
>>> _______________________________________________
>>> Discuss-gnuradio mailing list
>>> Discuss-gnuradio@gnu.org
>>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>>
>>>
>>
>
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to