a

Dependencies:   mbed mbed-rtos

Committer:
alexpirciu
Date:
Thu Mar 28 07:44:42 2019 +0000
Revision:
1:ceee5a608e7c
assa

Who changed what in which revision?

UserRevisionLine numberNew contents of line
alexpirciu 1:ceee5a608e7c 1 /**
alexpirciu 1:ceee5a608e7c 2 ******************************************************************************
alexpirciu 1:ceee5a608e7c 3 * @file Queue.hpp
alexpirciu 1:ceee5a608e7c 4 * @author RBRO/PJ-IU
alexpirciu 1:ceee5a608e7c 5 * @version V1.0.0
alexpirciu 1:ceee5a608e7c 6 * @date day-month-year
alexpirciu 1:ceee5a608e7c 7 * @brief This file contains the class declaration for the queue
alexpirciu 1:ceee5a608e7c 8 * functionality.
alexpirciu 1:ceee5a608e7c 9 ******************************************************************************
alexpirciu 1:ceee5a608e7c 10 */
alexpirciu 1:ceee5a608e7c 11
alexpirciu 1:ceee5a608e7c 12 /* Include guard */
alexpirciu 1:ceee5a608e7c 13 #ifndef QUEUE_HPP
alexpirciu 1:ceee5a608e7c 14 #define QUEUE_HPP
alexpirciu 1:ceee5a608e7c 15
alexpirciu 1:ceee5a608e7c 16
alexpirciu 1:ceee5a608e7c 17 /**
alexpirciu 1:ceee5a608e7c 18 * @brief It is used for executing queue container.
alexpirciu 1:ceee5a608e7c 19 *
alexpirciu 1:ceee5a608e7c 20 * @tparam T The type of the varieble
alexpirciu 1:ceee5a608e7c 21 * @tparam N The size of the queue
alexpirciu 1:ceee5a608e7c 22 */
alexpirciu 1:ceee5a608e7c 23 template <class T, unsigned int N>
alexpirciu 1:ceee5a608e7c 24 class CQueue
alexpirciu 1:ceee5a608e7c 25 {
alexpirciu 1:ceee5a608e7c 26 public:
alexpirciu 1:ceee5a608e7c 27 /* Constructor */
alexpirciu 1:ceee5a608e7c 28 CQueue();
alexpirciu 1:ceee5a608e7c 29 /* Destructor */
alexpirciu 1:ceee5a608e7c 30 virtual ~CQueue();
alexpirciu 1:ceee5a608e7c 31 /* Is full method */
alexpirciu 1:ceee5a608e7c 32 inline bool isFull();
alexpirciu 1:ceee5a608e7c 33 /* Is full method */
alexpirciu 1:ceee5a608e7c 34 inline bool isEmpty();
alexpirciu 1:ceee5a608e7c 35 /* Peek */
alexpirciu 1:ceee5a608e7c 36 inline T peek();
alexpirciu 1:ceee5a608e7c 37 /* Pop */
alexpirciu 1:ceee5a608e7c 38 inline T pop();
alexpirciu 1:ceee5a608e7c 39 /* Get queue size */
alexpirciu 1:ceee5a608e7c 40 inline unsigned int getSize();
alexpirciu 1:ceee5a608e7c 41 /* Push single element */
alexpirciu 1:ceee5a608e7c 42 inline void push(T& f_char);
alexpirciu 1:ceee5a608e7c 43 /* Push multiple elements */
alexpirciu 1:ceee5a608e7c 44 inline void push(T *f_char, unsigned int f_len);
alexpirciu 1:ceee5a608e7c 45 /* Empty queue */
alexpirciu 1:ceee5a608e7c 46 inline void empty();
alexpirciu 1:ceee5a608e7c 47 private:
alexpirciu 1:ceee5a608e7c 48 /* buffer */
alexpirciu 1:ceee5a608e7c 49 volatile T m_buffer[N];
alexpirciu 1:ceee5a608e7c 50 /* start */
alexpirciu 1:ceee5a608e7c 51 volatile unsigned int m_start;
alexpirciu 1:ceee5a608e7c 52 /* end */
alexpirciu 1:ceee5a608e7c 53 volatile unsigned int m_end;
alexpirciu 1:ceee5a608e7c 54 /* size */
alexpirciu 1:ceee5a608e7c 55 volatile unsigned int m_size;
alexpirciu 1:ceee5a608e7c 56 };
alexpirciu 1:ceee5a608e7c 57
alexpirciu 1:ceee5a608e7c 58 #include "queue.inl"
alexpirciu 1:ceee5a608e7c 59
alexpirciu 1:ceee5a608e7c 60 #endif
alexpirciu 1:ceee5a608e7c 61