1 /* src/toolbox/list.hpp - linked list
3 Copyright (C) 1996-2005, 2006, 2007, 2008
4 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
6 This file is part of CACAO.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2, or (at
11 your option) any later version.
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
38 * List implementation.
40 template<class T> class List : protected std::list<T> {
42 // make iterator of std::list visible
43 using std::list<T>::iterator;
44 using std::list<T>::reverse_iterator;
46 // make functions of std::list visible
47 using std::list<T>::back;
48 using std::list<T>::begin;
49 using std::list<T>::clear;
50 using std::list<T>::empty;
51 using std::list<T>::end;
52 using std::list<T>::front;
53 using std::list<T>::push_back;
54 using std::list<T>::push_front;
55 using std::list<T>::rbegin;
56 using std::list<T>::remove;
57 using std::list<T>::rend;
58 using std::list<T>::size;
62 // Required by LockedList.
63 #include "threads/mutex.hpp"
67 * List implementation with a Mutex.
69 template<class T> class LockedList : public List<T> {
74 virtual ~LockedList() {}
76 void lock () { _mutex.lock(); }
77 void unlock() { _mutex.unlock(); }
81 // Required by DumpList.
82 #include "mm/dumpmemory.hpp"
86 * List implementation with dump memory.
88 template<class T> class DumpList :
90 protected std::list<T, DumpMemoryAllocator<T> > {
92 virtual ~DumpList() {}
94 // make iterator of std::list visible
95 using std::list<T, DumpMemoryAllocator<T> >::iterator;
96 using std::list<T, DumpMemoryAllocator<T> >::reverse_iterator;
98 // make functions of std::list visible
99 using std::list<T, DumpMemoryAllocator<T> >::back;
100 using std::list<T, DumpMemoryAllocator<T> >::begin;
101 using std::list<T, DumpMemoryAllocator<T> >::clear;
102 using std::list<T, DumpMemoryAllocator<T> >::empty;
103 using std::list<T, DumpMemoryAllocator<T> >::end;
104 using std::list<T, DumpMemoryAllocator<T> >::front;
105 using std::list<T, DumpMemoryAllocator<T> >::push_back;
106 using std::list<T, DumpMemoryAllocator<T> >::push_front;
107 using std::list<T, DumpMemoryAllocator<T> >::rbegin;
108 using std::list<T, DumpMemoryAllocator<T> >::remove;
109 using std::list<T, DumpMemoryAllocator<T> >::rend;
110 using std::list<T, DumpMemoryAllocator<T> >::size;
111 using std::list<T, DumpMemoryAllocator<T> >::sort;
116 typedef struct List List;
117 typedef struct LockedList LockedList;
118 typedef struct DumpList DumpList;
126 * These are local overrides for various environment variables in Emacs.
127 * Please do not remove this and leave it at the end of the file, where
128 * Emacs will automagically detect them.
129 * ---------------------------------------------------------------------
132 * indent-tabs-mode: t
136 * vim:noexpandtab:sw=4:ts=4: