1// This may look like C code, but it is really -*- C++ -*- 2/* 3Copyright (C) 1988 Free Software Foundation 4 written by Doug Lea (dl@rocky.oswego.edu) 5 based on code by Marc Shapiro (shapiro@sor.inria.fr) 6 7This file is part of GNU CC. 8 9GNU CC is distributed in the hope that it will be useful, 10but WITHOUT ANY WARRANTY. No author or distributor 11accepts responsibility to anyone for the consequences of using it 12or for whether it serves any particular purpose or works at all, 13unless he says so in writing. Refer to the GNU CC General Public 14License for full details. 15 16Everyone is granted permission to copy, modify and redistribute 17GNU CC, but only under the conditions described in the 18GNU CC General Public License. A copy of this license is 19supposed to have been given to you along with GNU CC so you 20can know your rights and responsibilities. It should be in a 21file named COPYING. Among other things, the copyright notice 22and this notice must be preserved on all copies. 23*/ 24 25 26#ifndef _<T>FPStack_h 27#ifdef __GNUG__ 28#pragma once 29#pragma interface 30#endif 31#define _<T>FPStack_h 32 33#include "<T>.FPlex.h" 34#include "<T>.Stack.h" 35 36class <T>FPStack : public <T>Stack 37{ 38 <T>FPlex p; 39 40public: 41 <T>FPStack(int chunksize = DEFAULT_<T>PLEX_CHUNK_SIZE); 42 <T>FPStack(const <T>FPStack& s); 43 ~<T>FPStack(); 44 45 void operator = (const <T>FPStack&); 46 47 void push(<T&> item); 48 <T> pop(); 49 <T>& top(); 50 void del_top(); 51 52 int empty(); 53 int full(); 54 int length(); 55 56 void clear(); 57 58 int OK(); 59 60}; 61 62#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) 63 64inline <T>FPStack::<T>FPStack(int chunksize) : p(chunksize) {} 65inline <T>FPStack::<T>FPStack(const <T>FPStack& s) : p(s.p) {} 66 67inline <T>FPStack::~<T>FPStack() {} 68 69inline void <T>FPStack::push(<T&>item) 70{ 71 p.add_high(item); 72} 73 74inline <T> <T>FPStack::pop() 75{ 76 <T> res = p.high_element(); 77 p.del_high(); 78 return res; 79} 80 81inline <T>& <T>FPStack::top() 82{ 83 return p.high_element(); 84} 85 86inline void <T>FPStack::del_top() 87{ 88 p.del_high(); 89} 90 91inline void <T>FPStack::operator =(const <T>FPStack& s) 92{ 93 p = s.p; 94} 95 96inline int <T>FPStack::empty() 97{ 98 return p.empty(); 99} 100 101inline int <T>FPStack::full() 102{ 103 return p.full(); 104} 105 106inline int <T>FPStack::length() 107{ 108 return p.length(); 109} 110 111inline int <T>FPStack::OK() 112{ 113 return p.OK(); 114} 115 116inline void <T>FPStack::clear() 117{ 118 p.clear(); 119} 120 121 122#endif 123#endif 124