*Issue solved by defining the constructor as given below.*

############################################################
    copy_bb_impl::copy_bb_impl(int block_length)
      : gr::sync_block("copy_bb",
              gr::io_signature::make(0, 0, 0),
              gr::io_signature::make(0, 0, 0)),
      d_block_length(block_length)
    {
        set_input_signature(gr::io_signature::make(1, 1, sizeof(char) *
d_block_length));
        set_output_signature(gr::io_signature::make(1, 1, sizeof(char) *
d_block_length));
    }
#############################################################



On Sun, Sep 8, 2013 at 6:41 PM, Manu T S <[email protected]> wrote:

> *Hi,
>
> *
> *I have a block which copies a block of input to output. The constructor
> is defined as shown below.
> *
> #######################################################################
>     copy_bb_impl::copy_bb_impl(int block_length)
>     {
>         d_block_length = block_length;
>         set_input_signature(gr::io_signature::make(1, 1, sizeof(char) *
> d_block_length));
>         set_output_signature(gr::io_signature::make(1, 1, sizeof(char) *
> d_block_length));
>     }
> #######################################################################
>
> *make runs. Given below is the output for ctest -V*
>
>
> ----------------------------------------------------------------------------------------------------------------------------
> manu@iota build $ ctest -V
> UpdateCTestConfiguration  from
> :/home/manu/gr-ldpc/build/DartConfiguration.tcl
> UpdateCTestConfiguration  from
> :/home/manu/gr-ldpc/build/DartConfiguration.tcl
> Test project /home/manu/gr-ldpc/build
> Constructing a list of tests
> Done constructing a list of tests
> Checking test dependency graph...
> Checking test dependency graph end
> test 1
>     Start 1: test_ldpc
>
> 1: Test command: /bin/sh "/home/manu/gr-ldpc/build/lib/test_ldpc_test.sh"
> 1: Test timeout computed to be: 9.99988e+06
> 1:
> 1:
> 1/2 Test #1: test_ldpc ........................   Passed    0.00 sec
> test 2
>     Start 2: qa_copy_bb
>
> 2: Test command: /bin/sh
> "/home/manu/gr-ldpc/build/python/qa_copy_bb_test.sh"
> 2: Test timeout computed to be: 9.99988e+06
> 2: gr::vmcircbuf_sysv_shm: shmget(1): Invalid argument
> 2: gr::buffer::allocate_buffer: failed to allocate buffer of size 5894500
> KB
> 2: terminate called after throwing an instance of 'std::bad_alloc'
> 2:   what():  std::bad_alloc
> 2: Aborted
> 2/2 Test #2: qa_copy_bb .......................***Failed    0.22 sec
>
> 50% tests passed, 1 tests failed out of 2
>
> Total Test time (real) =   0.23 sec
>
> The following tests FAILED:
>       2 - qa_copy_bb (Failed)
> Errors while running CTest
>
> ---------------------------------------------------------------------------------------------------------------------------------
>
> *While if I define the constructor as given below, ctest run without
> failures.*
>
> #########################################################################
>     copy_bb_impl::copy_bb_impl(int block_length)
>       : gr::sync_block("copy_bb",
>               gr::io_signature::make(1, 1, sizeof(char) * block_length),
>               gr::io_signature::make(1, 1, sizeof(char) * block_length)),
> d_block_length(block_length)
>     {
>     }
> #########################################################################
>
> *Any suggestion why the first constructor is running into errors?*
>
>
>
> On Sun, Sep 8, 2013 at 3:02 PM, Manu T S <[email protected]> wrote:
>
>> Hey Marcus,
>>
>> Thanks a lot.
>>
>>
>> On Sun, Sep 8, 2013 at 1:28 PM, Marcus Müller <[email protected]> wrote:
>>
>>> Hi Manu!
>>>
>>>  Suppose I don't know the block size before hand, and I want to pass a
>>>> parameter "x" to toe constructor such that block size can be obtained from
>>>> x using certain computation (that will be defined inside the constructor).
>>>> Can I do this? If so how?
>>>>
>>>  Yes, that's possible *inside the constructor only*. See the
>>> gr::basic_block::set_{in,out}**put_signature(gr::io_**signature::sptr)
>>> doxygen.
>>
>>
>> That worked!
>>
>>
>>>
>>>  When I add a new block "encoder", to the module "ldpc", modtool add
>>>> files "include/ldpc/encoder.h", "lib/encoder_impl.cc", and
>>>> "lib/encoder_impl.h". And the work function is to be declared and defined
>>>> in encoder_impl.h and encoder_impl.cc respectively. Consider that I have
>>>> the function "encode" defined and declared in ldpc.h and ldpc.cc
>>>> respectively. ldpc.* does not define any signal processing block, so I
>>>> don't add them using modtool. But they are required as they have the
>>>> definition for the "encode" function and inside the work function in
>>>> encoder_impl.cc I just want to call the encode function defined inside this
>>>> ldpc class.
>>>>
>>>> Am I supposed to put ldpc.h in inlclude/ldpc/ and ldpc.cc in lib/? Or
>>>> should I put both of them inside lib/ ? Which section of CMakeLists.txt am
>>>> I supposed to modify?
>>>>
>>> Yes, that would be the correct structure.
>>> Just add ldpc.cc to lib/CMakeLists.txt:
>>>
>>
>> It is not clear which option you meant. Both ldpc.h and ldpc.cc inside
>> lib *OR* should I put .h inside include/ldpc/ ?
>>
>>
>>>
>>> list_append (APPEND projectname_sources
>>> encoder_impl.cc
>>> ...
>>> ldpc.cc )
>>>
>>> Happy Hacking!
>>>
>>> PS:You should also the include_directuries(${library_**INCLUDE_DIR})
>>> for each external library you use to that file if you haven't done so; same
>>> applies for target_link_libraries)
>>>
>>> ______________________________**_________________
>>> Discuss-gnuradio mailing list
>>> [email protected]
>>> https://lists.gnu.org/mailman/**listinfo/discuss-gnuradio<https://lists.gnu.org/mailman/listinfo/discuss-gnuradio>
>>>
>>
>>
>>
>> --
>> Manu T S
>>
>
>
>
> --
> Manu T S
>



-- 
Manu T S
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to