Alex Pirciu
/
BFMC
a
Diff: include/Queue/queue.hpp
- Revision:
- 1:ceee5a608e7c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/Queue/queue.hpp Thu Mar 28 07:44:42 2019 +0000 @@ -0,0 +1,61 @@ +/** + ****************************************************************************** + * @file Queue.hpp + * @author RBRO/PJ-IU + * @version V1.0.0 + * @date day-month-year + * @brief This file contains the class declaration for the queue + * functionality. + ****************************************************************************** + */ + +/* Include guard */ +#ifndef QUEUE_HPP +#define QUEUE_HPP + + +/** + * @brief It is used for executing queue container. + * + * @tparam T The type of the varieble + * @tparam N The size of the queue + */ +template <class T, unsigned int N> +class CQueue +{ +public: + /* Constructor */ + CQueue(); + /* Destructor */ + virtual ~CQueue(); + /* Is full method */ + inline bool isFull(); + /* Is full method */ + inline bool isEmpty(); + /* Peek */ + inline T peek(); + /* Pop */ + inline T pop(); + /* Get queue size */ + inline unsigned int getSize(); + /* Push single element */ + inline void push(T& f_char); + /* Push multiple elements */ + inline void push(T *f_char, unsigned int f_len); + /* Empty queue */ + inline void empty(); +private: + /* buffer */ + volatile T m_buffer[N]; + /* start */ + volatile unsigned int m_start; + /* end */ + volatile unsigned int m_end; + /* size */ + volatile unsigned int m_size; +}; + +#include "queue.inl" + +#endif +