mFrame
載入中...
搜尋中...
無符合項目
Queue.h
1
8#ifndef MFRAME_BFC82B3D_EF2A_4C50_AC22_04B947DCE669
9#define MFRAME_BFC82B3D_EF2A_4C50_AC22_04B947DCE669
10
11/* ***************************************************************************************
12 * Include
13 */
14
15//----------------------------------------------------------------------------------------
16
17//----------------------------------------------------------------------------------------
18#include "./../util/Collection.h"
19#include "./../util/Iterator.h"
20
21/* ***************************************************************************************
22 * Namespace
23 */
24namespace ufm::util {
25 template <typename E>
26 struct Queue;
27} // namespace ufm::util
28
29/* ***************************************************************************************
30 * Class/Interface/Struct
31 */
32
43template <typename E = void*>
45 /* *************************************************************************************
46 * Method
47 */
48
57 virtual bool offer(E const& element) abstract;
58
65 virtual E& poll(void) abstract;
66
73 virtual E& peek(void) abstract;
74
82 virtual bool isFull(void) const abstract;
83
92 static inline Queue<E>* type(void) {
93 return static_cast<Queue<E>*>(nullptr);
94 }
95};
96
97/* ***************************************************************************************
98 * End of file
99 */
100
101#endif /* MFRAME_BFC82B3D_EF2A_4C50_AC22_04B947DCE669 */
Definition Iterable.h:28
[Interface] 集合介面
Definition Collection.h:46
[Interface] 佇列介面
Definition Queue.h:44
static Queue< E > * type(void)
獲取 Queue 類型
Definition Queue.h:92
virtual E & poll(void) override
檢索並刪除此隊列的頭,如果此隊列為空,則返回null。
virtual E & peek(void) override
檢索但不刪除此隊列的頭部,如果此隊列為空,則返回 null 。
virtual bool offer(E const &element) override
如果在不違反容量限制的情況下立即執行,則將指定的元素插入到此隊列中。 當使用容量限制隊列時,此方法通常優於 add(E) ,這可能無法僅通過拋出異常來插入元素。
virtual bool isFull(void) const override
檢查隊列是否已滿