Jump to content
Effiong

Read from buffer without removing content

Recommended Posts

Hi all,

 

I want to be able to read an element from a "buffer-like" data structure without removing it. Is there a systemc structure for that ?

 

sc_fifo "nb_read() and read()" methods removes the element from the buffer. I want to be able to decide when to remove or not remove the data.

 

Thanks

Share this post


Link to post
Share on other sites

Hi all,

 

I want to be able to read an element from a "buffer-like" data structure without removing it. Is there a systemc structure for that ?

 

sc_fifo "nb_read() and read()" methods removes the element from the buffer. I want to be able to decide when to remove or not remove the data.

 

Thanks

 

As I remember, sc_fifo does not have that. But you can create a derived class from sc_fifo with a method to pick value w/o modifying data pointers:

something like:

T pick() {..}

Share this post


Link to post
Share on other sites

Hi all,

 

I want to be able to read an element from a "buffer-like" data structure without removing it. Is there a systemc structure for that ?

 

sc_fifo "nb_read() and read()" methods removes the element from the buffer. I want to be able to decide when to remove or not remove the data.

 

Thanks

Hello Sir,

A separate buffer nay be created, and the contents of the first buffer copied to the second for examining the 

contents. In fact, a remarkable core C language function "memcpy" can used to copy any number of bytes

from the source to the destination. On any Linux box, type 'man memcpy' at the command prompt, for more

details. Buffers may be cleared with the "memset" function. Maybe this might work for you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×