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

66 lines
1.1 KiB
C++

//-------------------------------------------------------------------------------------------------------+
// Copyright (C), 1998-2007, SH Software Co. Ltd.
// = FileName : DStack 模板类
// = Version : ver2.0
// = Author : zjq
// = CreateDate : 2002-09-09
// = Description: DStack 声明
// = Maintainers:
//
//-------------------------------------------------------------------------------------------------------+
#ifndef _DSTACK_H_
#define _DSTACK_H_
#ifndef _DLIST_H_
#include "DList.h"
#endif
template <class R> class DStack : public DList< R >
{
public:
DStack(int dFlag = 0);
void Push(R *dat);
R * Pop();
R * Top();
};
template<class R>
DStack<R>::DStack(int dFlag)
: DList<R> (dFlag)
{
}
template<class R>
void DStack<R>::Push(R *dat)
{
this->MoveEnd();
this->Insert(dat);
}
template<class R>
R* DStack<R>::Pop()
{
R* res = this->Tail();
if(this->tail != NULL)
{
this->tail->data = NULL;
}
if(this->Length())
{
this->Remove(this->Length() - 1);
}
return res;
}
template<class R>
R* DStack<R>::Top()
{
return this->Tail();
}
#endif