Page 1 of 1

circular buffer component "Flush" & "Peek"

Posted: Thu Mar 27, 2014 6:01 pm
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
;-)))

Re: circular buffer component "Flush"

Posted: Thu Mar 27, 2014 6:08 pm
by Benj
Hi Rudi,

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

Re: circular buffer component "Flush"

Posted: Thu Mar 27, 2014 6:15 pm
by Benj
Here you go, flush function simply resets the start and end pointers.

Re: circular buffer component "Flush"

Posted: Thu Mar 27, 2014 6:43 pm
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 ;-)

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

Posted: Fri Mar 28, 2014 3:49 pm
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?

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

Posted: Fri Mar 28, 2014 6:44 pm
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
;-)