6 Copyright (C) 2000-2003 Kern Sibbald and John Walker
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 of
11 the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but 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
19 License along with this program; if not, write to the Free
20 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
26 * Array list -- much like a simplified STL vector
27 * array of pointers to inserted items
36 alist(int num = 1, bool own=true);
37 void init(int num = 1, bool own=true);
38 void append(void *item);
40 void * operator [](int index) const;
44 void * operator new(size_t);
45 void operator delete(void *);
48 inline void * alist::operator [](int index) const {
49 if (index < 0 || index >= num_items) {
56 * This allows us to do explicit initialization,
57 * allowing us to mix C++ classes inside malloc'ed
58 * C structures. Define before called in constructor.
60 inline void alist::init(int num, bool own) {
69 inline alist::alist(int num, bool own) {
75 /* Current size of list */
76 inline int alist::size()
81 /* How much to grow by each time */
82 inline void alist::grow(int num)
87 inline void * alist::operator new(size_t)
89 return malloc(sizeof(alist));
92 inline void alist::operator delete(void *item)
94 ((alist *)item)->destroy();