# Queue [![Build Status](https://travis-ci.com/SMFSW/Queue.svg?branch=master)](https://travis-ci.com/SMFSW/Queue)
Queue handling library (designed on Arduino)
This library was designed for Arduino, yet may be compiled without change with gcc for other purposes/targets
Queue class has since start been called `Queue`. Unfortunately, on some platforms or when using FreeRTOS, Queue is already declared.
For compatibility purposes, `Queue` class has been renamed to `cppQueue`. Sorry for the inconvenience...
## Usage
- Declare a `cppQueue` instance `(uint16_t size_rec, uint16_t nb_recs=20, QueueType type=FIFO, overwrite=false)` (called `q` below):
- `size_rec` - size of a record in the queue
- `nb_recs` - number of records in the queue
- `type` - Queue implementation type: _FIFO_, _LIFO_
- `overwrite` - Overwrite previous records when queue is full if set to _true_
- Push stuff to the queue using `q.push(void * rec)`
- returns `true` if successfully pushed into queue
- returns `false` is queue is full
- Pop stuff from the queue using `q.pop(void * rec)` or `q.pull(void * rec)`
- returns `true` if successfully popped from queue
- returns `false` if queue is empty
- Peek stuff from the queue using `q.peek(void * rec)`
- returns `true` if successfully peeked from queue
- returns `false` if queue is empty
- Drop stuff from the queue using `q.drop(void)`
- returns `true` if successfully dropped from queue
- returns `false` if queue is empty
- Peek stuff at index from the queue using `q.peekIdx(void * rec, uint16_t idx)`
- returns `true` if successfully peeked from queue
- returns `false` if index is out of range
- warning: no associated drop function, not to use with `q.drop`
- Peek latest stored from the queue using `q.peekPrevious(void * rec)`
- returns `true` if successfully peeked from queue
- returns `false` if queue is empty
- warning: no associated drop function, not to use with `q.drop`
- note: only useful with FIFO implementation, use `q.peek` instead with a LIFO
- Other methods:
- `q.isInitialized()`: `true` if initialized properly, `false` otherwise
- `q.isEmpty()`: `true` if empty, `false` otherwise
- `q.isFull()`: `true` if full, `false` otherwise
- `q.sizeOf()`: queue size in bytes (returns 0 in case queue allocation failed)
- `q.getCount()` or `q.nbRecs()`: number of records stored in the queue
- `q.getRemainingCount()`: number of records left in the queue
- `q.clean()` or `q.flush()`: remove all items in the queue
## Notes
- Interrupt safe automation is not implemented in the library. You have to manually disable/enable interrupts where required.
No implementation will be made as it would be an issue when using `peek`/`drop` methods with LIFO implementation:
if an item is put to the queue through interrupt between `peek` and `drop` calls, the `drop` call would drop the wrong (newer) item.
In this particular case, dropping decision must be made before re-enabling interrupts.
## Examples included
- [SimpleQueue.ino](examples/SimpleQueue/SimpleQueue.ino): Simple queue example (both LIFO FIFO implementations can be tested)
- [PointersQueue.ino](examples/PointersQueue/PointersQueue.ino): Queue of string pointers for string processing
- [SerialQueue.ino](examples/SerialQueue/SerialQueue.ino): Print characters received from Serial to Serial after reception of EOT char
- [QueueDuplicates.ino](examples/QueueDuplicates/QueueDuplicates.ino): Simple test to test queue duplicates before pushing to queue
- [QueueIdxPeeking.ino](examples/QueueIdxPeeking/QueueIdxPeeking.ino): Simple test to test queue index picking
- [RolloverTest.ino](examples/RolloverTest/RolloverTest.ino): Simple test to test queue rollover (for lib testing purposes mainly)
- [LibTst.ino](examples/LibTst/LibTst.ino): flexible test (for lib testing purposes mainly)
## Documentation
Doxygen doc can be generated using "Doxyfile".
See [generated documentation](https://smfsw.github.io/Queue/)
## Release Notes
See [release notes](ReleaseNotes.md)
## See also
[cQueue](https://github.com/SMFSW/cQueue) - C implementation of this library
没有合适的资源?快使用搜索试试~ 我知道了~
Queue:队列处理库(在Arduino上设计)
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共18个文件
ino:7个
md:2个
yml:1个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
![star](https://csdnimg.cn/release/downloadcmsfe/public/img/star.98a08eaa.png)
温馨提示
队列 队列处理库(在Arduino上设计) 该库是为Arduino设计的,但可以为其他目的/目标使用gcc进行编译而无需更改 从此开始,Queue类就被称为Queue 。 不幸的是,在某些平台上或使用FreeRTOS时,已经声明了Queue。 出于兼容性目的, Queue类已重命名为cppQueue 。 带来不便敬请谅解... 用法 声明一个cppQueue实例(uint16_t size_rec, uint16_t nb_recs=20, QueueType type=FIFO, overwrite=false) (以下称为q ): size_rec队列中记录的大小 nb_recs队列中的记录数 type -队列实现类型:先进先出,后进先出 overwrite -如果设置为true,则在队列已满时覆盖以前的记录 使用q.push(void * rec)内容推送到队列 如果成功推入队
资源详情
资源评论
资源推荐
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/TXT.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 18 条
- 1
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083646.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![avatar](https://profile-avatar.csdnimg.cn/14c575a5d16747ec973f57b6ef0a99e1_weixin_42125867.jpg!1)
PaytonSun
- 粉丝: 21
- 资源: 4577
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
- 打包和分发Rust工具.pdf
- SQL中的CREATE LOGFILE GROUP 语句.pdf
- C语言-leetcode题解之第172题阶乘后的零.zip
- C语言-leetcode题解之第171题Excel列表序号.zip
- C语言-leetcode题解之第169题多数元素.zip
- ocr-图像识别资源ocr-图像识别资源
- 图像识别:基于Resnet50 + VGG16模型融合的人体细胞癌症分类模型实现-图像识别资源
- C语言-leetcode题解之第168题Excel列表名称.zip
- C语言-leetcode题解之第167题两数之和II-输入有序数组.zip
- C语言-leetcode题解之第166题分数到小数.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)
评论1