circular buffer component "Flush" & "Peek"

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 493 times
Been thanked: 187 times

circular buffer component "Flush" & "Peek"

Post by Rudi »

Hi
is there a way to make a "flush" to the buffer?
Thank you!
Rudi
;-)

Edit...
And a way to make "Peek" a byte
;-)))
Last edited by Rudi on Thu Mar 27, 2014 7:40 pm, edited 1 time in total.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: circular buffer component "Flush"

Post by Benj »

Hi Rudi,

Nice idea, Should be a quick thing to add, bear with me...

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: circular buffer component "Flush"

Post by Benj »

Here you go, flush function simply resets the start and end pointers.
Attachments
CircularBuffer.fcpx
(4.01 KiB) Downloaded 247 times

Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 493 times
Been thanked: 187 times

Re: circular buffer component "Flush"

Post by Rudi »

Benj wrote:Here you go, flush function simply resets the start and end pointers.
Great!!!! Benj,

thank you! ...
ll
ok..
only a ask ok ;-))


how look circular buffer wíth "peek" function ;-))))..
( without ´taken ( del) from the buffer...
any idea?

;-))
yeah!

Rudi ;-)

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: circular buffer component "Flush" & "Peek"

Post by Benj »

Hi Rudi,

Would the peek function just look at the pending next get output or would you want it to be able to look at any value in the buffer?

Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 493 times
Been thanked: 187 times

Re: circular buffer component "Flush" & "Peek"

Post by Rudi »

Benj wrote:Hi Rudi,

Would the peek function just look at the pending next get output or would you want it to be able to look at any value in the buffer?

Hi Benj,
i hope my translate is ok.. ( "at the pending next get output" google translate this not 100 procent clear.. )
but i will ask to your ask for better understand... what is the advantage and / or disadvantage what you mean..?.

I think..
byte comes -> goes to buffer ... byte pos is 1 ( or zero if you start idx with 0 )
with
byte = peek(1)
i get the byte(1) from buffer without "delete" from buffer.. only peek...

if a "Task"

bytes=GetByte

comes before i peek(1)

so the byte is empty...

so peek(1) is empty too..
this right..


example

i can "preview" with peek(9) to the buffer with a loop...

peek(9) to get from buffer the byte(idx) without the buffer is delete the byte(idx)

what you thinking about this?

a other thinking was, to "possible replace" it if the byte wrong with right byte... but i think this is not "Task of a buffer"...
but would be nice too ( replace(idx) ) ;-)) why not.. ;-)) so buffering goes multiBuffer ,-)))

if the buffer is flushed...and new bytes comes..peek is only possible to the next actual bytes in buffer at idx.

! ;-)
ahhh-.. i think i have understand what you mean with your ask...
! ;-)

if buffer full...the buffering will start from 0 right?
and will it overwrite the bytes in the buffer or flush the buffer?

mhmm.. will it flush the buffer if start again or only overwrite byte to next byte ?
i am honest, i do not know just in Time - i will read in Compo instruction after this write..


start buffering..

abcdefghi
123456789....128


buffer full start from begin...

ABCdefghi
123456789....128

or clear the buffer and start from begin

ABC
123456789.....128


.. so i think the peek function would be nice same task like the buffer function...
peek(9) allways peek buffer(9) with a old byte from first run or newer byte in second run..
this is what you mean? i hope my english you can understand ;-))

// ;-)
btw a peek(9,213)... peek(idx,i) is future thing...;-)))))
;-) //

if i will peek to all buffer bytes i would make a second Buffer or a LOG in RAM...
Log in RAM... whow... RAMLOG... Benj ;-)... is it possible to make a virtual RAMLOG in RAM ;-)))...
so it can write out over port to a extern RAM.. ;-)) this will be a next Thread ;-))

Thank you for your great Service Benj!!!
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Best wishes!!

Rudi
;-)

Post Reply