Files
envi-code/SourceCode/Code2026/inc/AdsXRx/Quene.h
T
2026-09-28 15:28:50 +08:00

85 lines
1.4 KiB
C++

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