OS  v1.7.5
Documentation
Loading...
Searching...
No Matches
prioqueue.hpp
1#ifndef QOS_CPP_PRIO_QUEUE
2#define QOS_CPP_PRIO_QUEUE
3
4#include "include/types.hpp"
5#include "include/task.hpp"
6
9namespace qOS {
10
11 namespace pq {
12 struct queueStack_t {
13 task *pTask{ nullptr };
14 void *qData{ nullptr };
15 };
16 }
17
18 class prioQueue {
19 private:
20 volatile base_t index{ -1 };
21 void *data{ nullptr };
22 pq::queueStack_t *stack{ nullptr };
23 size_t size{ 0U };
24 void clearIndex( const index_t indexToClear ) noexcept;
25 prioQueue( prioQueue const& ) = delete;
26 void operator=( prioQueue const& ) = delete;
27 protected:
28 prioQueue() = delete;
29 virtual ~prioQueue() {}
30 prioQueue( pq::queueStack_t *area, const size_t pq_size ) noexcept;
31 size_t count( void ) const noexcept;
32 task* get( void ) noexcept;
33 bool isTaskInside( const task &Task ) const noexcept;
34 bool insert( task &Task, void *pData ) noexcept;
35 void cleanUp( const task &Task ) noexcept;
36 inline bool hasElements( void ) const noexcept
37 {
38 return ( index >= 0 );
39 }
40 friend class core; /*only core can use this class*/
41 };
42
43}
44
47#endif /*QOS_CPP_PRIO_QUEUE*/
int base_t
A type to instantiate a integer-base variable. This size of this type is implementation-defined.
Definition types.hpp:62
OS/Kernel interfaces.
Definition bytebuffer.hpp:7