2 EIBD eib bus access and management daemon
3 Copyright (C) 2005-2008 Martin Koegler <mkoegler@auto.tuwien.ac.at>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 /** implement a generic LIFO stack*/
26 template < class T
> class Stack
29 /** elements in the stack*/
34 /** initialize stack */
39 /** copy constructer */
40 Stack (const Stack
< T
> &c
)
50 /** assignment operator */
51 const Stack
< T
> &operator = (const Stack
< T
> &c
)
57 /** adds a element to the queue end */
58 void push (const T
& el
)
60 data
.resize (data () + 1);
61 data
[data () - 1] = el
;
64 /** remove the element from the queue head and returns it */
67 T a
= data
[data () - 1];
68 data
.resize (data () - 1);
72 /** returns the element from the queue head */
73 const T
& top () const
75 return data
[data () - 1];
78 /** return true, if the queue is empty */