?? queue.h
字號:
/*****************************
* _Queue_h_ *
* Queue *
* class template *
* create by si.si *
* 2007.10.3 *
******************************/
#ifndef _Queue_h_
#define _Queue_h_
#include "DList.h"
//namespace sisi's data structure
namespace SSDataS
{
/*
*Queue class template
*/
template<class T>
class Queue : private DList<T>
{
public:
//constructor and destructor
Queue();
~Queue();
//Queue method
/*
*func In : bool
*add a new item into this queue
*@param newItem : T the new item
*@return : bool return true if success
*/
bool In(const T newItem);
/*
*func Out : bool
*let the first item out of queue
*@param outItem : T& return the out item
*return : bool return true if success
*/
bool Out(T& outItem);
/*
*func getQLength : int const
*get the length of this queue
*@return : int the length of this queue
*/
int getQLength() const;
/*
*func isQEmpty : bool
*get the EMPTY inf. of this queue
*@return : bool return true if empty
*/
bool isQEmpty();
/*
*func getFirstItem : T const
*get the first item in this queue
*@return : T the first item
*/
T getFirstItem() const;
/*
*func getLastItem : T const
*get the last item in this queue
*@return : T the last item
*/
T getLastItem() const;
};
};
using namespace SSDataS;
template<class T>
Queue<T>::Queue()
{
}
template<class T>
Queue<T>::~Queue()
{
}
template<class T>
int Queue<T>::getQLength() const
{
return getLength();
}
template<class T>
bool Queue<T>::In(const T newItem)
{
return insertAtHead(newItem);
}
template<class T>
bool Queue<T>::Out(T &outItem)
{
return removeFromTail(outItem);
}
template<class T>
bool Queue<T>::isQEmpty()
{
return isEmpty();
}
template<class T>
T Queue<T>::getFirstItem() const
{
return getTailData();
}
template<class T>
T Queue<T>::getLastItem() const
{
return getHeadData();
}
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -