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

70 lines
1.2 KiB
C++

//-------------------------------------------------------------------------------------------------------+
// Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd.
// = FileName : TDPtrStack Ä£°åÀà
// = Version : ver2.0
// = Author : wlw
// = CreateDate : 2002-09-09
// = Description: TDPtrStack ÉùÃ÷
// = Maintainers:
//
//-------------------------------------------------------------------------------------------------------+
#ifndef _TDPTRSTACK_H_
#define _TDPTRSTACK_H_
#ifndef _TDPTRLIST_H_
#include "TDPtrList.h"
#endif
template <class R> class TDPtrStack : public TDPtrList< R >
{
public:
TDPtrStack(int dFlag = 0);
void Push(R *dat);
R * Pop();
R * Top();
};
template<class R>
TDPtrStack<R>::TDPtrStack(int dFlag)
: TDPtrList<R> (dFlag)
{
}
template<class R>
void TDPtrStack<R>::Push(R *dat)
{
this->MoveEnd();
this->Insert(dat);
}
template<class R>
R* TDPtrStack<R>::Pop()
{
R* res = this->Tail();
if(this->tail != NULL)
{
#ifdef SUPERLST
this->tail = NULL;
#else
this->tail->data = NULL;
#endif
}
if(this->Length())
{
this->Remove(this->Length() - 1);
}
return res;
}
template<class R>
R* TDPtrStack<R>::Top()
{
return this->Tail();
}
#endif