comparison src/SLStack.h @ 240:a99f28f5e351

[project @ 1993-11-30 20:24:36 by jwe]
author jwe
date Tue, 30 Nov 1993 20:24:36 +0000
parents 78fd87e624cb
children 1a75146ef3bb
comparison
equal deleted inserted replaced
239:4f8134fa54a9 240:a99f28f5e351
14 You should have received a copy of the GNU Library General Public 14 You should have received a copy of the GNU Library General Public
15 License along with this library; if not, write to the Free Software 15 License along with this library; if not, write to the Free Software
16 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 16 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
17 */ 17 */
18 18
19 #if !defined (_SLStack_h)
20 #define _SLStack_h 1
19 21
20 #ifndef _SLStack_h 22 #if defined (__GNUG__) && defined (USE_EXTERNAL_TEMPLATES)
21 #ifdef __GNUG__ 23 #pragma interface
22 //#pragma interface
23 #endif 24 #endif
24 #define _SLStack_h 1
25 25
26 #include "SLList.h" 26 #include "SLList.h"
27 #include "Stack.h" 27 #include "Stack.h"
28 28
29 template <class T> 29 template <class T>
51 void clear (void); 51 void clear (void);
52 52
53 int OK (void); 53 int OK (void);
54 }; 54 };
55 55
56 template <class T> 56 #if defined (__GNUG__) && ! defined (USE_EXTERNAL_TEMPLATES)
57 inline SLStack<T>::SLStack (void) : p () { } 57 #include "SLStack.cc"
58 58 #endif
59 template <class T>
60 inline SLStack<T>::SLStack (const SLStack<T>& a) : p (a.p) { }
61
62 template <class T>
63 inline SLStack<T>::~SLStack (void) { }
64
65 template <class T>
66 inline void
67 SLStack<T>::push (const T& item)
68 {
69 p.prepend (item);
70 }
71
72 template <class T>
73 inline T
74 SLStack<T>::pop (void)
75 {
76 return p.remove_front ();
77 }
78
79 template <class T>
80 inline T&
81 SLStack<T>::top (void)
82 {
83 return p.front ();
84 }
85
86 template <class T>
87 inline void
88 SLStack<T>::del_top (void)
89 {
90 p.del_front ();
91 }
92
93 template <class T>
94 inline void
95 SLStack<T>::operator = (const SLStack<T>& s)
96 {
97 p = s.p;
98 }
99
100 template <class T>
101 inline int
102 SLStack<T>::empty (void)
103 {
104 return p.empty ();
105 }
106
107 template <class T>
108 inline int
109 SLStack<T>::full (void)
110 {
111 return 0;
112 }
113
114 template <class T>
115 inline int
116 SLStack<T>::length (void)
117 {
118 return p.length ();
119 }
120
121 template <class T>
122 inline int
123 SLStack<T>::OK (void)
124 {
125 return p.OK ();
126 }
127
128 template <class T>
129 inline void
130 SLStack<T>::clear (void)
131 {
132 p.clear ();
133 }
134 59
135 #endif 60 #endif
61
62 /*
63 ;;; Local Variables: ***
64 ;;; mode: C++ ***
65 ;;; page-delimiter: "^/\\*" ***
66 ;;; End: ***
67 */