//-------------------------------------------------------------------------------------------------------+ // Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd. // = FileName : TQuene 模板类 // = Version : ver2.0 // = Author : wlw // = CreateDate : 2002-09-09 // = Description: TQuene 声明 队列抽象类 // = Maintainers: // //-------------------------------------------------------------------------------------------------------+ #ifndef _TQUENE_H_ #define _TQUENE_H_ template class TQuene { public: TQuene(long length = -1); virtual ~TQuene(); virtual T& operator[](long i) = 0; virtual void Clear() = 0; virtual long GetLength() = 0; virtual bool DeQuene(T&t) = 0; virtual bool EnQuene(T const&t) = 0; virtual bool GetHeadData(T&t) = 0; virtual bool GetTailData(T&t) = 0; bool IsLengthLimited(); long GetMaxLength(); bool IsEmpty(); void SetMaxLength(long length); protected: long maxLength; }; template TQuene::TQuene(long length) { maxLength=length; } template TQuene::~TQuene() { } template void TQuene::SetMaxLength(long length) { maxLength=length; } template long TQuene::GetMaxLength() { return maxLength; } template bool TQuene::IsLengthLimited() { return maxLength >= 0; } template bool TQuene::IsEmpty() { return GetLength() == 0; } #endif