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

72 lines
935 B
C++

#pragma once
template<class T> class SHQuene
{
public:
SHQuene(long length = -1);
virtual ~SHQuene();
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>
SHQuene<T>::SHQuene(long length)
{
maxLength=length;
}
template<class T>
SHQuene<T>::~SHQuene()
{
}
template<class T>
void SHQuene<T>::SetMaxLength(long length)
{
maxLength=length;
}
template<class T>
long SHQuene<T>::GetMaxLength()
{
return maxLength;
}
template<class T>
bool SHQuene<T>::IsLengthLimited()
{
return maxLength >= 0;
}
template<class T>
bool SHQuene<T>::IsEmpty()
{
return GetLength() == 0;
}