Possibility of dumping all contents ESP32's Queue or Ring Buffer
Possibility of dumping all contents ESP32's Queue or Ring Buffer
Hello, for context I am trying to using either a queue or ring buffer to store 24 arrays of image data which has been flattened to a size of 100. I would like to use the FIFO structure to push new images and pop old images but I would like to know if it is possible to grab all contents from either queue or ring buffer whenever a new image is pushed and popped(kind of like a "snapshot") of the 24 arrays and be able to read this data?
Re: Possibility of dumping all contents ESP32's Queue or Ring Buffer
Queues and ring buffers do no allow for traversal by nature of being strictly FIFO. I'm not sure if you can make a deep copy of a queue/buffer. If you can then that's your answer.
If you are not particularly constrained by time, I would suggest you pop each element off, make a copy and the push them back on until you reach back to the first element.
Pseudocode along the lines of:
If you are not particularly constrained by time, I would suggest you pop each element off, make a copy and the push them back on until you reach back to the first element.
Pseudocode along the lines of:
Code: Select all
first = peak queue()
do {
elem = pop queue()
copy elem
push queue (elem)
} while( peek queue() != first);
Who is online
Users browsing this forum: Google [Bot] and 128 guests