Hi
is there a way to make a "flush" to the buffer?
Thank you!
Rudi
Edit...
And a way to make "Peek" a byte
))
circular buffer component "Flush" & "Peek"
- 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"
Hi Rudi,
Nice idea, Should be a quick thing to add, bear with me...
Nice idea, Should be a quick thing to add, bear with me...
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- 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"
Here you go, flush function simply resets the start and end pointers.
- Attachments
-
- CircularBuffer.fcpx
- (4.01 KiB) Downloaded 247 times
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: circular buffer component "Flush"
Great!!!! Benj,Benj wrote:Here you go, flush function simply resets the start and end pointers.
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
- 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"
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?
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?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: circular buffer component "Flush" & "Peek"
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