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
93template <typename E = void*>
95 /* *************************************************************************************
96 * Method
97 */
98
107 virtual bool offer(E const& element) abstract;
108
115 virtual E& poll(void) abstract;
116
123 virtual E& peek(void) abstract;
124
132 virtual bool isFull(void) const abstract;
133
142 static inline Queue<E>* type(void) {
143 return static_cast<Queue<E>*>(nullptr);
144 }
145};
146
147/* ***************************************************************************************
148 * End of file
149 */
150
151#endif /* MFRAME_BFC82B3D_EF2A_4C50_AC22_04B947DCE669 */
Definition Iterable.h:28
集合介面,定義集合層次結構的根介面。
Definition Collection.h:171
佇列介面,定義先進先出(FIFO)的容器操作。
Definition Queue.h:94
static Queue< E > * type(void)
獲取 Queue 類型
Definition Queue.h:142
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
檢查隊列是否已滿