WXK
2025-02-05 961c1174bbf1aaae5fa2f672806ed4eaf2f917be
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/**
 *******************************************************************************
 * @FileName  : x_queue.h
 * @Author    : GaoQiu
 * @CreateDate: 2020-02-18
 * @Copyright : Copyright(C) GaoQiu
 *              All Rights Reserved.
 *******************************************************************************
 *
 * The information contained herein is confidential and proprietary property of
 * GaoQiu and is available under the terms of Commercial License Agreement
 * between GaoQiu and the licensee in separate contract or the terms described
 * here-in.
 *
 * This heading MUST NOT be removed from this file.
 *
 * Licensees are granted free, non-transferable use of the information in this
 * file under Mutual Non-Disclosure Agreement. NO WARRENTY of ANY KIND is provided.
 *
 *******************************************************************************
 */
#ifndef X_QUEUE_H_
#define X_QUEUE_H_
 
#include "defs_types.h"
 
/*!   Initialize a queue */
#define QUEUE_INIT(pQuene)  do{(pQuene)->pHead = NULL;  (pQuene)->pTail = NULL;}while(0)
 
/*!   Queue type */
typedef struct{
    void *pHead;
    void *pTail;
}queue_t;
 
 
/**
 * @brief : Check if queue is empty.
 * @param : pQueue    pointer to queue.
 * @return: None.
 */
bool_t QUEUE_IsEmty(queue_t *pQueue);
 
/**
 * @brief: Enqueue and element to the tail of a queue.
 * @param: pQueue    pointer to queue
 * @oaram: pElem     pointer to element
 * @return: none
 */
void QUEUE_Enquene(queue_t *pQueue, void *pElem);
 
/**
 * @brief: Dequeue and element to the head of a queue.
 * @param: pQueue    pointer to queue
 * @return: none
 */
void *QUEUE_Dequeue(queue_t *pQueue);
 
/**
 * @brief: Push and element to the head of a queue.
 * @param: pQueue    pointer to queue
 * @oaram: pElem     pointer to element
 * @return: none
 */
void QUEUE_PushElement(queue_t *pQueue, void *pElem);
 
/**
 * @brief: Insert and element to a queue.
 * @param: pQueue    pointer to queue
 * @param: pElem     pointer to element to be inserted.
 * @param: pPrev     Pointer to previous element in the queue before element to be inserted.
 * @return: none
 */
void QUEUE_InsertElement(queue_t *pQueue, void *pElem, void *pPrev);
 
/**
 * @brief: Remove and element from a queue.
 * @param: pQueue    pointer to queue
 * @param: pElem     pointer to element to be inserted.
 * @param: pPrev     Pointer to previous element in the queue before element to be inserted.
 * @return: none
 */
void QUEUE_RemoveElement(queue_t *pQueue, void *pElem, void *pPrev);
 
#endif /* QUEUE_H_ */