These now live in rlgen-dot.
[ragel.git] / aapl / dlistmel.h
blob3433139337fc578fc9dc61b9545d70304cad5937
1 /*
2 * Copyright 2001 Adrian Thurston <thurston@cs.queensu.ca>
3 */
5 /* This file is part of Aapl.
7 * Aapl is free software; you can redistribute it and/or modify it under the
8 * terms of the GNU Lesser General Public License as published by the Free
9 * Software Foundation; either version 2.1 of the License, or (at your option)
10 * any later version.
12 * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY
13 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
15 * more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with Aapl; if not, write to the Free Software Foundation, Inc., 59
19 * Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifndef _AAPL_DLISTMEL_H
23 #define _AAPL_DLISTMEL_H
25 /**
26 * \addtogroup dlist
27 * @{
30 /**
31 * \class DListMel
32 * \brief Doubly linked list for elements that may appear in multiple lists.
34 * This class is similar to DList, except that the user defined list element
35 * can inherit from multple DListEl classes and consequently be an element in
36 * multiple lists. In other words, DListMel allows a single instance of a data
37 * structure to be an element in multiple lists without the lists interfereing
38 * with one another.
40 * For each list that an element class is to appear in, the element must have
41 * unique next and previous pointers that can be unambiguously refered to with
42 * some base class name. This name is given to DListMel as a template argument
43 * so it can use the correct next and previous pointers in its list
44 * operations.
46 * DListMel does not assume ownership of elements in the list. If the elements
47 * are known to reside on the heap and are not contained in any other list or
48 * data structure, the provided empty() routine can be used to delete all
49 * elements, however the destructor will not call this routine, it will simply
50 * abandon all the elements. It is up to the programmer to explicitly
51 * de-allocate items when it is safe to do so.
53 * \include ex_dlistmel.cpp
56 /*@}*/
58 #define BASE_EL(name) BaseEl::name
59 #define DLMEL_TEMPDEF class Element, class BaseEl
60 #define DLMEL_TEMPUSE Element, BaseEl
61 #define DList DListMel
63 #include "dlcommon.h"
65 #undef BASE_EL
66 #undef DLMEL_TEMPDEF
67 #undef DLMEL_TEMPUSE
68 #undef DList
70 #endif /* _AAPL_DLISTMEL_H */