//-------------------------------------------------------------------------------------------------------+ // Copyright (C), 1998-2007, SH Software Co. Ltd. // = FileName : Quene 模板类 // = Version : ver2.0 // = Author : zjq // = CreateDate : 2002-09-09 // = Description: Quene 声明 队列抽象类 // = Maintainers: // //-------------------------------------------------------------------------------------------------------+ #ifndef _QUENE_H_ #define _QUENE_H_ template class Quene { public: Quene(long length = -1); virtual ~Quene(); 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 Quene::Quene(long length) { maxLength=length; } template Quene::~Quene() { } template void Quene::SetMaxLength(long length) { maxLength=length; } template long Quene::GetMaxLength() { return maxLength; } template bool Quene::IsLengthLimited() { return maxLength >= 0; } template bool Quene::IsEmpty() { return GetLength() == 0; } #endif