Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • src-vorago-common src-vorago-common
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Activity
  • Graph
  • Commits
Collapse sidebar
  • source
  • src-vorago-commonsrc-vorago-common
  • Merge requests
  • !32

Added queue class

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Tim Halach requested to merge halach into develop May 16, 2023
  • Overview 2
  • Commits 12
  • Changes 1

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.

Edited Jun 06, 2023 by Tim Halach
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: halach