Files
gjm 164968b62e chore
把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
2026-10-04 00:04:20 +08:00

84 lines
1.4 KiB
C++

//-------------------------------------------------------------------------------------------------------+
// 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 T> 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<class T>
TQuene<T>::TQuene(long length)
{
maxLength=length;
}
template<class T>
TQuene<T>::~TQuene()
{
}
template<class T>
void TQuene<T>::SetMaxLength(long length)
{
maxLength=length;
}
template<class T>
long TQuene<T>::GetMaxLength()
{
return maxLength;
}
template<class T>
bool TQuene<T>::IsLengthLimited()
{
return maxLength >= 0;
}
template<class T>
bool TQuene<T>::IsEmpty()
{
return GetLength() == 0;
}
#endif