source: trunk/src/emx/include/Attic/cpp/gen/XPStack.hP@ 18

Last change on this file since 18 was 18, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 2.4 KB
Line 
1// This may look like C code, but it is really -*- C++ -*-
2/*
3Copyright (C) 1988 Free Software Foundation
4 written by Doug Lea ([email protected])
5 based on code by Marc Shapiro ([email protected])
6
7This file is part of the GNU C++ Library. This library is free
8software; you can redistribute it and/or modify it under the terms of
9the GNU Library General Public License as published by the Free
10Software Foundation; either version 2 of the License, or (at your
11option) any later version. This library is distributed in the hope
12that it will be useful, but WITHOUT ANY WARRANTY; without even the
13implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14PURPOSE. See the GNU Library General Public License for more details.
15You should have received a copy of the GNU Library General Public
16License along with this library; if not, write to the Free Software
17Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/
19
20
21#ifndef _<T>XPStack_h
22#ifdef __GNUG__
23#pragma interface
24#endif
25#define _<T>XPStack_h
26
27#include "<T>.XPlex.h"
28#include "<T>.Stack.h"
29
30class <T>XPStack : public <T>Stack
31{
32 <T>XPlex p;
33
34public:
35 <T>XPStack(int chunksize = DEFAULT_INITIAL_CAPACITY);
36 <T>XPStack(const <T>XPStack& s);
37 inline ~<T>XPStack();
38
39 void operator = (const <T>XPStack&);
40
41 inline void push(<T&> item);
42 inline <T> pop();
43 inline <T>& top();
44 inline void del_top();
45
46 inline int empty();
47 inline int full();
48 inline int length();
49
50 inline void clear();
51
52 inline int OK();
53
54};
55
56
57inline <T>XPStack::<T>XPStack(int chunksize)
58 : p(chunksize) {}
59inline <T>XPStack::<T>XPStack(const <T>XPStack& s) : p(s.p) {}
60
61inline <T>XPStack::~<T>XPStack() {}
62
63inline void <T>XPStack::push(<T&>item)
64{
65 p.add_high(item);
66}
67
68inline <T> <T>XPStack::pop()
69{
70 <T> res = p.high_element();
71 p.del_high();
72 return res;
73}
74
75inline <T>& <T>XPStack::top()
76{
77 return p.high_element();
78}
79
80inline void <T>XPStack::del_top()
81{
82 p.del_high();
83}
84
85inline void <T>XPStack::operator =(const <T>XPStack& s)
86{
87 p.operator = (s.p);
88}
89
90inline int <T>XPStack::empty()
91{
92 return p.empty();
93}
94
95inline int <T>XPStack::full()
96{
97 return p.full();
98}
99
100inline int <T>XPStack::length()
101{
102 return p.length();
103}
104
105inline int <T>XPStack::OK()
106{
107 return p.OK();
108}
109
110inline void <T>XPStack::clear()
111{
112 p.clear();
113}
114
115#endif
Note: See TracBrowser for help on using the repository browser.