{"id":22665048,"url":"https://github.com/smfsw/queue","last_synced_at":"2025-09-12T13:46:37.909Z","repository":{"id":46267102,"uuid":"85872102","full_name":"SMFSW/Queue","owner":"SMFSW","description":"Queue handling library (designed on Arduino)","archived":false,"fork":false,"pushed_at":"2025-04-30T21:19:43.000Z","size":6953,"stargazers_count":101,"open_issues_count":3,"forks_count":23,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-30T22:27:06.169Z","etag":null,"topics":["arduino-library","fifo","lifo","queue"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SMFSW.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-03-22T20:18:15.000Z","updated_at":"2025-04-30T21:19:46.000Z","dependencies_parsed_at":"2025-04-12T08:43:21.524Z","dependency_job_id":null,"html_url":"https://github.com/SMFSW/Queue","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/SMFSW/Queue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SMFSW%2FQueue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SMFSW%2FQueue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SMFSW%2FQueue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SMFSW%2FQueue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SMFSW","download_url":"https://codeload.github.com/SMFSW/Queue/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SMFSW%2FQueue/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274823228,"owners_count":25356644,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino-library","fifo","lifo","queue"],"created_at":"2024-12-09T13:18:57.331Z","updated_at":"2025-09-12T13:46:37.886Z","avatar_url":"https://github.com/SMFSW.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Queue\n\n[![author](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/SMFSW/a9a2b2a02fda1b33461d53ddfe69d649/raw/auth_SMFSW.json)](https://github.com/SMFSW)\n![badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/SMFSW/a9a2b2a02fda1b33461d53ddfe69d649/raw/Queue_status_badge.json)\n[![license](https://img.shields.io/badge/License-BSD3-darkred.svg)](LICENSE)\n[![CodeFactor](https://www.codefactor.io/repository/github/smfsw/queue/badge)](https://www.codefactor.io/repository/github/smfsw/queue)\n\n![platform](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/SMFSW/a9a2b2a02fda1b33461d53ddfe69d649/raw/ANY_platform.json)\n\n[![doxy](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/SMFSW/a9a2b2a02fda1b33461d53ddfe69d649/raw/tool_DOXY.json)](https://smfsw.github.io/Queue)\n[![re_note](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/SMFSW/a9a2b2a02fda1b33461d53ddfe69d649/raw/tool_RN.json)](ReleaseNotes.md)\n\n![badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/SMFSW/a9a2b2a02fda1b33461d53ddfe69d649/raw/Queue_custom_repo_badge.json)\n\nQueue handling library (designed on Arduino)\n\nThis library was designed for Arduino, yet may be compiled without change with gcc for other purposes/targets\n\nQueue class has since start been called `Queue`. Unfortunately, on some platforms or when using FreeRTOS, Queue is already declared.\nFor compatibility purposes, `Queue` class has been renamed to `cppQueue`. Sorry for the inconvenience...\n\n## Usage\n\n- Declare a `cppQueue` instance `(size_t size_rec, uint16_t nb_recs=20, QueueType type=FIFO, bool overwrite=false, void * pQDat=NULL, size_t lenQDat=0)` (called `q` below):\n  - `size_rec` - size of a record in the queue\n  - `nb_recs` - number of records in the queue\n  - `type` - queue implementation type: _FIFO_, _LIFO_\n  - `overwrite` - overwrite previous records when queue is full if set to _true_\n  - `pQDat` - pointer to static data queue\n  - `lenQDat` - length of static data queue (in bytes)\n- Push stuff to the queue using `q.push(void * rec)`\n  - returns `true` if successfully pushed into queue\n  - returns `false` is queue is full\n- Pop stuff from the queue using `q.pop(void * rec)` or `q.pull(void * rec)`\n  - returns `true` if successfully popped from queue\n  - returns `false` if queue is empty\n- Peek stuff from the queue using `q.peek(void * rec)`\n  - returns `true` if successfully peeked from queue\n  - returns `false` if queue is empty\n- Drop stuff from the queue using `q.drop(void)`\n  - returns `true` if successfully dropped from queue\n  - returns `false` if queue is empty\n- Peek stuff at index from the queue using `q.peekIdx(void * rec, uint16_t idx)`\n  - returns `true` if successfully peeked from queue\n  - returns `false` if index is out of range\n  - warning: no associated drop function, not to use with `q.drop`\n- Peek latest stored from the queue using `q.peekPrevious(void * rec)`\n  - returns `true` if successfully peeked from queue\n  - returns `false` if queue is empty\n  - warning: no associated drop function, not to use with `q.drop`\n  - note: only useful with FIFO implementation, use `q.peek` instead with a LIFO\n- Other methods:\n  - `q.isInitialized()`: `true` if initialized properly, `false` otherwise\n  - `q.isEmpty()`: `true` if empty, `false` otherwise\n  - `q.isFull()`: `true` if full, `false` otherwise\n  - `q.sizeOf()`: queue size in bytes (returns 0 in case queue allocation failed)\n  - `q.getCount()` or `q.nbRecs()`: number of records stored in the queue\n  - `q.getRemainingCount()`: number of records left in the queue\n  - `q.clean()` or `q.flush()`: remove all items in the queue\n\n## Notes\n\n- Interrupt safe automation is not implemented in the library. You have to manually disable/enable interrupts where required.\nNo implementation will be made as it would be an issue when using `peek`/`drop` methods with LIFO implementation:\nif an item is put to the queue through interrupt between `peek` and `drop` calls, the `drop` call would drop the wrong (newer) item.\nIn this particular case, dropping decision must be made before re-enabling interrupts.\n\n## Examples included\n\n- [SimpleQueue.ino](examples/SimpleQueue/SimpleQueue.ino): Simple queue example (both LIFO FIFO implementations can be tested)\n- [SimpleQueueStatic.ino](examples/SimpleQueueStatic/SimpleQueueStatic.ino): Simple queue example using static queue data array (both LIFO FIFO implementations can be tested)\n- [PointersQueue.ino](examples/PointersQueue/PointersQueue.ino): Queue of string pointers for string processing\n- [SerialQueue.ino](examples/SerialQueue/SerialQueue.ino): Print characters received from Serial to Serial after reception of EOT char\n- [QueueDuplicates.ino](examples/QueueDuplicates/QueueDuplicates.ino): Simple test to test queue duplicates before pushing to queue\n- [QueueIdxPeeking.ino](examples/QueueIdxPeeking/QueueIdxPeeking.ino): Simple test to test queue index picking\n- [RolloverTest.ino](examples/RolloverTest/RolloverTest.ino): Simple test to test queue rollover (for lib testing purposes mainly)\n- [LibTst.ino](examples/LibTst/LibTst.ino): flexible test (for lib testing purposes mainly)\n\n## See also\n\n[cQueue](https://github.com/SMFSW/cQueue) - C implementation of this library\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmfsw%2Fqueue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmfsw%2Fqueue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmfsw%2Fqueue/lists"}