{"id":22665038,"url":"https://github.com/smfsw/cqueue","last_synced_at":"2025-06-22T04:33:13.028Z","repository":{"id":45664381,"uuid":"100182630","full_name":"SMFSW/cQueue","owner":"SMFSW","description":"Queue handling library (written in plain c)","archived":false,"fork":false,"pushed_at":"2025-05-06T21:58:10.000Z","size":4107,"stargazers_count":66,"open_issues_count":0,"forks_count":16,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-06T22:36:06.666Z","etag":null,"topics":["fifo","lifo","queue"],"latest_commit_sha":null,"homepage":null,"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-08-13T14:34:31.000Z","updated_at":"2025-05-06T21:58:13.000Z","dependencies_parsed_at":"2025-05-06T22:30:05.907Z","dependency_job_id":"42048c34-5556-4ca6-80fc-5a4c6f7f3fb7","html_url":"https://github.com/SMFSW/cQueue","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/SMFSW/cQueue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SMFSW%2FcQueue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SMFSW%2FcQueue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SMFSW%2FcQueue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SMFSW%2FcQueue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SMFSW","download_url":"https://codeload.github.com/SMFSW/cQueue/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SMFSW%2FcQueue/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261237749,"owners_count":23128844,"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","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":["fifo","lifo","queue"],"created_at":"2024-12-09T13:18:53.848Z","updated_at":"2025-06-22T04:33:08.014Z","avatar_url":"https://github.com/SMFSW.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cQueue [![Build Status](https://travis-ci.com/SMFSW/cQueue.svg?branch=master)](https://travis-ci.com/SMFSW/cQueue)\n\nQueue handling library (written in plain c)\n\nThis library is designed for a c implementation on embedded devices, yet may be compiled without change with gcc for other purposes/targets.\nDesigned as a library to be compatible with Arduino LibManager specifications (yet rather use Queue instead - https://github.com/SMFSW/Queue).\n\n## Usage\n\n- Initialize a Queue using `q_init(Queue_t * pQ, size_t size_rec, uint16_t nb_recs, QueueType type, bool overwrite)`:\n  - `pQ` - pointer to the queue struct\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- OR a statically allocated Queue using `q_init_static(Queue_t * pQ, size_t size_rec, uint16_t nb_recs, QueueType type, bool overwrite, void * pQDat, size_t lenQDat)`:\n  - `pQ` - pointer to the queue struct\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(Queue_t * pQ, 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(Queue_t * pQ, void * rec)` or `q_pull(Queue_t * pQ, 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(Queue_t * pQ, 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(Queue_t * pQ)`\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(Queue_t * pQ, 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(Queue_t * pQ, 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(Queue_t * pQ)`: `true` if initialized properly, `false` otherwise\n  - `q_isEmpty(Queue_t * pQ)`: `true` if empty, `false` otherwise\n  - `q_isFull(Queue_t * pQ)`: `true` if full, `false` otherwise\n  - `q_sizeof(Queue_t * pQ)`: queue size in bytes (returns 0 in case queue allocation failed)\n  - `q_getCount(Queue_t * pQ)` or `q_nbRecs(Queue_t * pQ)`: number of records stored in the queue\n  - `q_getRemainingCount(Queue_t * pQ)`: number of records left in the queue\n  - `q_clean(Queue_t * pQ)` or `q_flush(Queue_t * pQ)`: 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 function pointers performing queued actions\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## Documentation\n\nDoxygen doc can be generated using \"Doxyfile\".\n\nSee [generated documentation](https://smfsw.github.io/cQueue/)\n\n## Release Notes\n\nSee [release notes](ReleaseNotes.md)\n\n## See also\n\n[Queue](https://github.com/SMFSW/Queue) - Cpp implementation of this library\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmfsw%2Fcqueue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmfsw%2Fcqueue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmfsw%2Fcqueue/lists"}