{"id":26787399,"url":"https://github.com/einararnason/arduinoqueue","last_synced_at":"2025-04-19T19:34:36.604Z","repository":{"id":195576553,"uuid":"146665101","full_name":"EinarArnason/ArduinoQueue","owner":"EinarArnason","description":"A lightweight linked list type queue implementation, meant for microcontrollers.","archived":false,"fork":false,"pushed_at":"2021-07-19T01:53:43.000Z","size":58,"stargazers_count":46,"open_issues_count":0,"forks_count":14,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-29T12:19:54.343Z","etag":null,"topics":["arduino","cpp","microcontrollers","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EinarArnason.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["paypal.me/EinarArnason"]}},"created_at":"2018-08-29T22:19:13.000Z","updated_at":"2024-11-10T07:46:40.000Z","dependencies_parsed_at":"2023-09-18T20:54:20.353Z","dependency_job_id":null,"html_url":"https://github.com/EinarArnason/ArduinoQueue","commit_stats":null,"previous_names":["einararnason/arduinoqueue"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EinarArnason%2FArduinoQueue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EinarArnason%2FArduinoQueue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EinarArnason%2FArduinoQueue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EinarArnason%2FArduinoQueue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EinarArnason","download_url":"https://codeload.github.com/EinarArnason/ArduinoQueue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249780520,"owners_count":21324561,"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":["arduino","cpp","microcontrollers","queue"],"created_at":"2025-03-29T12:19:42.853Z","updated_at":"2025-04-19T19:34:36.579Z","avatar_url":"https://github.com/EinarArnason.png","language":"C++","readme":"# ArduinoQueue\n\n[![Build Status](https://travis-ci.org/EinarArnason/ArduinoQueue.svg?branch=dev)](https://travis-ci.org/EinarArnason/ArduinoQueue)\n\nA lightweight linked list type queue implementation, meant for microcontrollers.\nWritten as a C++ template class.\n\n## Constructors\n\nCreates a queue up to _\u003cmaximum_number_of_items\u003e_ items:\n\n```C++\nArduinoQueue\u003cT\u003e intQueue(maximum_number_of_items);\n```\n\nCreates a queue up to _\u003cmaximum_size_in_bytes\u003e_ bytes:\n\n```C++\nArduinoQueue\u003cT\u003e intQueue(0, maximum_size_in_bytes);\n```\n\nCreates a queue up to _\u003cmaximum_number_of_items\u003e_ items or _\u003cmaximum_size_in_bytes\u003e_ bytes, whatever comes first:\n\n```C++\nArduinoQueue\u003cT\u003e intQueue(maximum_number_of_items, maximum_size_in_bytes);\n```\n\n## How to use\n\nInclude the header file on your code:\n\n```C++\n#include \u003cArduinoQueue.h\u003e\n```\n\nThen create the queue according to your needs, examples:\n\n- To create a queue of **_int_**, capable of holding 20 items:\n\n```C++\nArduinoQueue\u003cint\u003e intQueue(20);\n```\n\n- To create a queue of **_int_**, capable of holding 20 items or a maximum size of 10 bytes _(whatever comes first)_:\n\n```C++\nArduinoQueue\u003cint\u003e intQueue(20, 10);\n```\n\n- To create a queue of your **_defined structure_**, capable of holding 50 items:\n\n```C++\nstruct car {\n    char brand[10];\n    char model[10];\n    int nr_doors;\n};\nArduinoQueue\u003ccar\u003e myCarsQueue(50);\n```\n\nFinally use the following functions:\n\n```C++\nintQueue.enqueue(1);    // Adds number 1 to the queue\nintQueue.enqueue(123);    // Adds number 123 to the queue\nint number = intQueue.dequeue();    // Will return number 1 and remove it from the queue\nint number = intQueue.getHead();    // Will return number 123 but leave it still in the queue\nint number = intQueue.dequeue();    // Will return number 123 and remove it from the queue\n```\n\nYou can use also the following functions to get more queue properties:\n\n```C++\nbool state = intQueue.isEmpty();    // Returns true if the queue is empty, false otherwise\nbool state = intQueue.isFull();    // Returns true if the queue is full, false otherwise\nunsigned int n = intQueue.itemCount();    // Returns the number of items currently on the queue\nunsigned int n = intQueue.itemSize();    // Returns the size of the item being stored (bytes)\nunsigned int n = intQueue.maxQueueSize();    // Returns the maximum possible size of the queue (items)*\nunsigned int n = intQueue.maxMemorySize();    // Returns the maximum possible size of the queue (bytes)*\n```\n\n## Thread safety\n\nThis library is **not** thread safe. Mutexes are often hardware specific on the way they are optimized to operate. So for the sake of performance and portability, it is left out.\n\n## Memory safety\n\nThe memory for the queue nodes are dynamically allocated. Note that while the Queue class cleans up the nodes in memory after destructor or dequeue is called, it keeps a copy of the item being queued. So for example if you are queuing pointers, you will need to keep track of the memory behind them.\n\n## Performance\n\nCPU: Intel i7-6500U  \nRAM: DDR4L\n\nBenchmark result (1000 samples):  \nEnqueued 1000000 ints in average 0.018749799 seconds  \nDequeued 1000000 ints in average 0.016496857 seconds  \nAllocated 15.2588 MB (16 bytes per item)\n","funding_links":["paypal.me/EinarArnason"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feinararnason%2Farduinoqueue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feinararnason%2Farduinoqueue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feinararnason%2Farduinoqueue/lists"}