discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Initialize a pointer - object


From: Ben Hilburn
Subject: Re: [Discuss-gnuradio] Initialize a pointer - object
Date: Thu, 4 Oct 2012 11:28:29 -0700

Your error message states that the issue isn't your _impl function, but rather the fact that you haven't implemented 'work'

cannot allocate an object of abstract type 'asrp_fec_encoder'
because the following virtual functions are pure within 'asrp_fec_encoder':
/usr/local/include/gnuradio/block.h:236:17: note:     virtual int gnuradio::block::work(const InputItems&, const OutputItems&)
asrp_fec_encoder.cc: In constructor 'asrp_fec_encoder::asrp_fec_encoder(const char*)':

You may find reading up on virtual inheritance helpful:
http://www.cplusplus.com/doc/tutorial/polymorphism/
http://www.learncpp.com/cpp-tutorial/118-virtual-base-classes/

Cheers,
Ben

 


Regards,

Jose




On Wed, Oct 3, 2012 at 3:03 PM, Jose Torres Diaz <address@hidden> wrote:
Hi,

I'm modifying the block BLOB_TO_STREAM and I would like to pass a pointer to that function. The original file (blob_to_stream.cc) is like this:

class blob_to_stream_impl : public blob_to_stream{
public:
    blob_to_stream_impl(const size_t item_size):
        block(
            "blob_to_stream",
            gr_make_io_signature(0, 0, 0),
            gr_make_io_signature(1, 1, item_size),
            msg_signature(true, 0)
        ),
        _item_size(item_size)
    {
        _offset = 0;
    }

//Work function here
       
private:
    const size_t _item_size;
    gr_tag_t _msg;
    size_t _offset;
};

My new version, it will be something like this:

class blob_to_stream_impl : public blob_to_stream{
public:
    blob_to_stream_impl(const size_t *file):
        block(
            "blob_to_stream",
            gr_make_io_signature(0, 0, 0),
            gr_make_io_signature(1, 1, item_size),
            msg_signature(true, 0)
        ),
    
    {
        _offset = 0;
    }

But my question is, how can I initialize the pointer *file here?. I tried different methods, but I always get an error.

Any comment will be highly appreciate it,

Cheers,

Jose




_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio



reply via email to

[Prev in Thread] Current Thread [Next in Thread]