The queue class is actually a double ended queue (deque) enabling pushing and popping to and from the back and front of it. Its aim is to do so in a minimal fashion to avoid code bloat.
The queue has a constant size to avoid it eating up more and more RAM. This size can be set upon creation, other wise the default size of 10 is used and it can later never be changed. This helps with static analysis of RAM requirements. The copy and move constructors exist.
Putting items into the queue is done with PushFront/Back()
; removing items with PopFront/Back()
; inspecting items without removing them from the queue with PeekFront/Back()
.
When the queue is full no more elements can be inserted, meaning new elements are dropped.
Peeking and popping on an empty queue returns an undefined value but importantly does not break the queue.
Pushing to a queue which has been moved does nothing, peeking and popping returns undefined values.
Clear()
empties the queue and resets the internal front and back pointers (important if you want to write tests).
I have noticed that the etl repo also has a queue implementation. Therefore this implementation is a sort of minimal backup which should be a bit smaller and faster than that implementation, should we need it.