XWOS API  4.0
XWOS C/C++ API参考手册
载入中...
搜索中...
未找到
Xwcq.hxx
浏览该文件的文档.
1
13#ifndef __xwmd_isc_xwcq_cxx_XwcqProxy_hxx__
14#define __xwmd_isc_xwcq_cxx_XwcqProxy_hxx__
15
16extern "C" {
17#include "xwmd/isc/xwcq/mif.h"
18}
19
20namespace xwisc {
21
32template<xwsz_t TSlotNum, typename T>
33class Xwcq
34{
35 private:
36 struct xwcq mCq;
37 __xwcc_alignl1cache xwu8_t mPool[sizeof(T) * TSlotNum];
38
39 public:
40 Xwcq() { xwcq_init(&mCq, sizeof(T), TSlotNum, mPool); }
41 ~Xwcq() {}
42
46 struct xwcq * get() { return &mCq; }
47
48 /******** 查询 ********/
56 xwsz_t cap;
57 xwcq_get_capacity(&mCq, &cap);
58 return cap;
59 }
60
70 return size;
71 }
72
82 return availability;
83 }
84
85 /******** 维护 ********/
91 void flush() { xwcq_flush(&mCq); }
92
93 /******** 发送 ********/
112 xwer_t eq(T * data, xwsz_t * size) {
113 return xwcq_eq(&mCq, (const xwu8_t *)data, size);
114 }
115
132 xwer_t jq(T * data, xwsz_t * size) {
133 return xwcq_jq(&mCq, (const xwu8_t *)data, size);
134 }
135
136 /******** 接收 ********/
137
159 xwer_t dq(T * data, xwsz_t * size) {
160 return xwcq_dq(&mCq, (xwu8_t *)data, size);
161 }
162
190 xwer_t dq(T * data, xwsz_t * size, xwtm_t to) {
191 return xwcq_dq_to(&mCq, (xwu8_t *)data, size, to);
192 }
193
214 xwer_t dqUnintr(T * data, xwsz_t * size) {
215 return xwcq_dq_unintr(&mCq, (xwu8_t *)data, size);
216 }
217
234 xwer_t tryDq(T * data, xwsz_t * size) {
235 return xwcq_trydq(&mCq, (xwu8_t *)data, size);
236 }
237
259 xwer_t rq(T * data, xwsz_t * size) {
260 return xwcq_rq(&mCq, (xwu8_t *)data, size);
261 }
262
290 xwer_t rq(T * data, xwsz_t * size, xwtm_t to) {
291 return xwcq_rq_to(&mCq, (xwu8_t *)data, size, to);
292 }
293
315 xwer_t rqUnintr(T * data, xwsz_t * size) {
316 return xwcq_rq_unintr(&mCq, (xwu8_t *)data, size);
317 }
318
334 xwer_t tryRq(T * data, xwsz_t * size) {
335 return xwcq_tryrq(&mCq, (xwu8_t *)data, size);
336 }
337
360 xwer_t pfq(T * data, xwsz_t * size) {
361 return xwcq_pfq(&mCq, (xwu8_t *)data, size);
362 }
363
392 xwer_t pfq(T * data, xwsz_t * size, xwtm_t to) {
393 return xwcq_pfq_to(&mCq, (xwu8_t *)data, size, to);
394 }
395
419 return xwcq_pfq_unintr(&mCq, (xwu8_t *)data, size);
420 }
421
438 xwer_t tryPfq(T * data, xwsz_t * size) {
439 return xwcq_trypfq(&mCq, (xwu8_t *)data, size);
440 }
441
464 xwer_t prq(T * data, xwsz_t * size) {
465 return xwcq_prq(&mCq, (xwu8_t *)data, size);
466 }
467
496 xwer_t prq(T * data, xwsz_t * size, xwtm_t to) {
497 return xwcq_prq_to(&mCq, (xwu8_t *)data, size, to);
498 }
499
523 return xwcq_prq_unintr(&mCq, (xwu8_t *)data, size);
524 }
525
542 xwer_t tryPrq(T * data, xwsz_t * size) {
543 return xwcq_tryprq(&mCq, (xwu8_t *)data, size);
544 }
545};
546
551} // namespace xwisc
552
553#endif /* xwmd/isc/xwcq/cxx/Xwcq.hxx */
XWCQ C++ 对象
Definition Xwcq.hxx:34
struct xwcq mCq
Definition Xwcq.hxx:36
xwer_t tryDq(T *data, xwsz_t *size)
尝试从循环队列的 首端 接收数据 (离队,DeQueue)
Definition Xwcq.hxx:234
xwer_t pfq(T *data, xwsz_t *size, xwtm_t to)
限时等待从循环队列 头端 拷贝数据 (Peek at the Front of Queue)
Definition Xwcq.hxx:392
xwsz_t size()
XWCQ API: 获取循环队列的单个数据槽的大小 sizeof(T)
Definition Xwcq.hxx:67
void flush()
清空循环队列
Definition Xwcq.hxx:91
xwer_t dqUnintr(T *data, xwsz_t *size)
等待从循环队列的 首端 接收数据 (离队,DeQueue), 并且等待不可被中断
Definition Xwcq.hxx:214
xwer_t rqUnintr(T *data, xwsz_t *size)
等待从循环队列的 尾端 接收数据 (反向离队,Reversely deQueue), 并且等待不可被中断
Definition Xwcq.hxx:315
xwsz_t availability()
XWCQ API: 获取循环队列中有效数据槽的数量
Definition Xwcq.hxx:79
xwer_t pfqUnintr(T *data, xwsz_t *size)
等待从循环队列 头端 拷贝数据 (Peek at the Front of Queue), 并且等待不可被中断
Definition Xwcq.hxx:418
struct xwcq * get()
获取循环队列内部对象指针
Definition Xwcq.hxx:46
xwer_t rq(T *data, xwsz_t *size, xwtm_t to)
限时等待从循环队列的 尾端 接收数据 (反向离队,Reversely deQueue)
Definition Xwcq.hxx:290
xwer_t rq(T *data, xwsz_t *size)
等待从循环队列的 尾端 接收数据 (反向离队,Reversely deQueue)
Definition Xwcq.hxx:259
xwer_t prq(T *data, xwsz_t *size)
等待从循环队列 尾端 拷贝数据 (Peek at the Rear of Queue)
Definition Xwcq.hxx:464
xwer_t prqUnintr(T *data, xwsz_t *size)
等待从循环队列 尾端 拷贝数据 (Peek at the Rear of Queue), 并且等待不可被中断
Definition Xwcq.hxx:522
xwer_t eq(T *data, xwsz_t *size)
将数据发送到循环队列的 尾端 (入队,EnQueue)
Definition Xwcq.hxx:112
xwsz_t capacity()
XWCQ API: 获取循环队列的容量 TSlotNum
Definition Xwcq.hxx:55
xwer_t dq(T *data, xwsz_t *size)
等待从循环队列的 首端 接收数据 (离队,DeQueue)
Definition Xwcq.hxx:159
xwer_t tryRq(T *data, xwsz_t *size)
尝试从循环队列的 尾端 接收数据 (反向离队,Reversely deQueue)
Definition Xwcq.hxx:334
xwer_t pfq(T *data, xwsz_t *size)
等待从循环队列 头端 拷贝数据 (Peek at the Front of Queue)
Definition Xwcq.hxx:360
xwer_t tryPfq(T *data, xwsz_t *size)
尝试从循环队列 头端 拷贝数据 (Peek at the Front of Queue)
Definition Xwcq.hxx:438
xwu8_t mPool[sizeof(T) *TSlotNum]
Definition Xwcq.hxx:37
xwer_t dq(T *data, xwsz_t *size, xwtm_t to)
限时等待从循环队列的 首端 接收数据 (离队,DeQueue)
Definition Xwcq.hxx:190
xwer_t prq(T *data, xwsz_t *size, xwtm_t to)
限时等待从循环队列 尾端 拷贝数据 (Peek at the Rear of Queue)
Definition Xwcq.hxx:496
xwer_t tryPrq(T *data, xwsz_t *size)
尝试从循环队列 尾端 拷贝数据 (Peek at the Rear of Queue)
Definition Xwcq.hxx:542
xwer_t jq(T *data, xwsz_t *size)
将数据发送循环队列的 首端 (插队,Jump the Queue)
Definition Xwcq.hxx:132
xwer_t xwcq_get_availability(struct xwcq *cq, xwsz_t *avbbuf)
XWCQ API: 获取循环队列中有效数据槽的数量
Definition xwcq.c:662
xwer_t xwcq_init(struct xwcq *cq, xwsz_t slotsize, xwsz_t slotnum, xwu8_t *mem)
XWCQ API:初始化循环队列
Definition xwcq.c:94
xwer_t xwcq_dq_to(struct xwcq *cq, xwu8_t *data, xwsz_t *size, xwtm_t to)
XWCQ API: 限时等待从循环队列的 首端 接收数据 (离队,DeQueue)
Definition xwcq.c:223
xwer_t xwcq_get_capacity(struct xwcq *cq, xwsz_t *capbuf)
XWCQ API: 获取循环队列的容量
Definition xwcq.c:644
xwer_t xwcq_prq(struct xwcq *cq, xwu8_t *data, xwsz_t *size)
XWCQ API: 等待从循环队列 尾端 拷贝数据 (Peek at the Rear of Queue)
Definition xwcq.c:523
xwer_t xwcq_pfq_unintr(struct xwcq *cq, xwu8_t *data, xwsz_t *size)
XWCQ API: 等待从循环队列 头端 拷贝数据 (Peek at the Front of Queue), 并且等待不可被中断
Definition xwcq.c:463
xwer_t xwcq_tryrq(struct xwcq *cq, xwu8_t *data, xwsz_t *size)
XWCQ API: 尝试从循环队列的 尾端 接收数据 (反向离队,Reversely deQueue)
Definition xwcq.c:394
xwer_t xwcq_trydq(struct xwcq *cq, xwu8_t *data, xwsz_t *size)
XWCQ API: 尝试从循环队列的 首端 接收数据 (离队,DeQueue)
Definition xwcq.c:289
xwer_t xwcq_pfq_to(struct xwcq *cq, xwu8_t *data, xwsz_t *size, xwtm_t to)
XWCQ API: 限时等待从循环队列 头端 拷贝数据 (Peek at the Front of Queue)
Definition xwcq.c:433
xwer_t xwcq_dq_unintr(struct xwcq *cq, xwu8_t *data, xwsz_t *size)
XWCQ API: 等待从循环队列的 首端 接收数据 (离队,DeQueue), 并且等待不可被中断
Definition xwcq.c:256
xwer_t xwcq_prq_to(struct xwcq *cq, xwu8_t *data, xwsz_t *size, xwtm_t to)
XWCQ API: 限时等待从循环队列 尾端 拷贝数据 (Peek at the Rear of Queue)
Definition xwcq.c:529
xwer_t xwcq_jq(struct xwcq *cq, const xwu8_t *data, xwsz_t *size)
XWCQ API:将数据发送循环队列的 首端 (插队,Jump the Queue)
Definition xwcq.c:185
xwer_t xwcq_rq(struct xwcq *cq, xwu8_t *data, xwsz_t *size)
XWCQ API: 等待从循环队列的 尾端 接收数据 (反向离队,Reversely deQueue)
Definition xwcq.c:322
xwer_t xwcq_tryprq(struct xwcq *cq, xwu8_t *data, xwsz_t *size)
XWCQ API: 尝试从循环队列 尾端 拷贝数据 (Peek at the Rear of Queue)
Definition xwcq.c:599
xwer_t xwcq_get_size(struct xwcq *cq, xwsz_t *szbuf)
XWCQ API: 获取循环队列的单个数据槽的大小
Definition xwcq.c:653
xwer_t xwcq_prq_unintr(struct xwcq *cq, xwu8_t *data, xwsz_t *size)
XWCQ API: 等待从循环队列 尾端 拷贝数据 (Peek at the Rear of Queue), 并且等待不可被中断
Definition xwcq.c:564
xwer_t xwcq_dq(struct xwcq *cq, xwu8_t *data, xwsz_t *size)
XWCQ API: 等待从循环队列的 首端 接收数据 (离队,DeQueue)
Definition xwcq.c:217
xwer_t xwcq_eq(struct xwcq *cq, const xwu8_t *data, xwsz_t *size)
XWCQ API:将数据发送到循环队列的 尾端 (入队,EnQueue)
Definition xwcq.c:153
xwer_t xwcq_rq_unintr(struct xwcq *cq, xwu8_t *data, xwsz_t *size)
XWCQ API: 等待从循环队列的 尾端 接收数据 (反向离队,Reversely deQueue), 并且等待不可被中断
Definition xwcq.c:361
xwer_t xwcq_flush(struct xwcq *cq)
XWCQ API: 清空循环队列
Definition xwcq.c:633
xwer_t xwcq_rq_to(struct xwcq *cq, xwu8_t *data, xwsz_t *size, xwtm_t to)
XWCQ API: 限时等待从循环队列的 尾端 接收数据 (反向离队,Reversely deQueue)
Definition xwcq.c:328
xwer_t xwcq_trypfq(struct xwcq *cq, xwu8_t *data, xwsz_t *size)
XWCQ API: 尝试从循环队列 头端 拷贝数据 (Peek at the Front of Queue)
Definition xwcq.c:493
xwer_t xwcq_pfq(struct xwcq *cq, xwu8_t *data, xwsz_t *size)
XWCQ API: 等待从循环队列 头端 拷贝数据 (Peek at the Front of Queue)
Definition xwcq.c:427
#define __xwcc_alignl1cache
Definition compiler.h:123
xws64_t xwtm_t
XWOS系统时间 (有符号)
Definition type.h:742
signed long xwer_t
Definition type.h:554
unsigned long xwsz_t
Definition type.h:339
uint8_t xwu8_t
Definition type.h:194
Definition Xwcq.hxx:20
循环队列对象
Definition mif.h:124
循环队列:模块接口