-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStack.inc_h
69 lines (62 loc) · 3.05 KB
/
Stack.inc_h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
(*
* DGL(The Delphi Generic Library)
*
* Copyright (c) 2004
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*)
//------------------------------------------------------------------------------
// _TStack的声明
// Create by HouSisong, 2004.09.08
//------------------------------------------------------------------------------
{$ifndef __Stack_inc_h_}
{$define __Stack_inc_h_}
{$I DGLIntf.inc_h}
{$I Deque.inc_h}
_TDefaultStackBaseContainer = _TDeque; //默认使用_TDeque
//_TStack
//----------------------------------------------------------------------------
// 作用描述: 实现_IStack接口 ,内部使用_TDeque来实现
// 主要方法:参见_IStack接口的说明
// 使用方式:
// 注意事项:
// 作 者: HouSisong , 2004.09.08
// [相关资料]: (如果有的话)
// [维护记录]: (类发布后,其修改需要记录下来:修改人、时间、主要原因内容)
//----------------------------------------------------------------------------
_TStack = class(_TInterfacedObject,_IStack)
private
FBaseContainer : _TDefaultStackBaseContainer;
public
//实现_IStack接口
procedure Push(const Value: _ValueType); {$ifdef _DGL_Inline} inline; {$endif}
procedure Pop(); {$ifdef _DGL_Inline} inline; {$endif}
function GetTopValue():_ValueType; {$ifdef _DGL_Inline} inline; {$endif}
procedure SetTopValue(const aValue:_ValueType); {$ifdef _DGL_Inline} inline; {$endif}
property Top: _ValueType read GetTopValue write SetTopValue;
procedure Clear(); {$ifdef _DGL_Inline} inline; {$endif}
function Size(): Integer; {$ifdef _DGL_Inline} inline; {$endif}
function IsEmpty(): Boolean; {$ifdef _DGL_Inline} inline; {$endif}
function IsEquals(const AContainer: _IStack): Boolean; {$ifdef _DGL_Inline} inline; {$endif}
function Clone():_IStack; {$ifdef _DGL_Inline} inline; {$endif}
procedure Assign(const num:integer;const Value: _ValueType);overload; {$ifdef _DGL_Inline} inline; {$endif}
procedure Assign(const ItBegin,ItEnd:_IIterator);overload; //todo: Warning inline on if _ValueType if "object" then error!!!
function GetSelfObj():TObject; {$ifdef _DGL_Inline} inline; {$endif}
public
constructor Create(); overload;
constructor Create(const num:integer);overload;
constructor Create(const num:integer;const Value:_ValueType);overload;
constructor Create(const ItBegin,ItEnd:_IIterator);overload;
constructor Create(const AStack:_TStack);overload;
destructor Destroy(); override;
end;
{$endif } // __Stack_inc_h_