Code Monkey home page Code Monkey logo

queue's Introduction

Queue Build Status

Queue handling library (designed on Arduino)

This library was designed for Arduino, yet may be compiled without change with gcc for other purposes/targets

Usage

  • Declare a Queue 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
  • Other methods:
    • q.IsInitialized(): true if initialized properly, false otherwise
    • q.isEmpty(): true if full, false otherwise
    • q.isFull(): true if empty, 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

Examples included

  • SimpleQueue.ino: Simple queue example (both LIFO FIFO implementations can be tested)
  • PointersQueue.ino: Queue of string pointers for string processing
  • RolloverTest.ino: Simple test to test queue rollover (for lib testing purposes mainly)
  • LibTst.ino: flexible test (for lib testing purposes mainly)

Documentation

Doxygen doc can be generated using "Doxyfile".

See generated documentation

Release Notes

See release notes

See also

cQueue - C implementation of this library

queue's People

Contributors

smfsw avatar per1234 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.