72 lines
935 B
C++
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;
|
|
}
|