icepriorityqueue.h
来自「使用stl技术,(还没看,是听说的)」· C头文件 代码 · 共 47 行
H
47 行
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Contains a simple priority queue.
* \file IcePriorityQueue.h
* \author Pierre Terdiman
* \date February, 5, 2000
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Include Guard
#ifndef __ICEPRIORITYQUEUE_H__
#define __ICEPRIORITYQUEUE_H__
enum PriorityMode
{
PM_SMALL_FIRST, //!< Small priorities should be served first
PM_BIG_FIRST, //!< Big priorities should be served first
};
class ICECORE_API PriorityQueue : public Pairs
{
public:
//! Constructor
PriorityQueue() : mPriorityMode(PM_BIG_FIRST) {}
//! Destructor
~PriorityQueue() {}
void Push(udword value, udword priority);
bool Pop(Pair& next_pair);
inline_ const Pair* NextPair()
{
if(!HasPairs()) return null;
return (const Pair*)GetPairs();
}
inline_ PriorityMode GetPriorityMode() const { return mPriorityMode; }
inline_ void SetPriorityMode(PriorityMode mode) { mPriorityMode = mode; }
protected:
PriorityMode mPriorityMode;
};
#endif // __ICEPRIORITYQUEUE_H__
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?