Use the new import feature of Ragel for bringing in defines from the parser
[ragel.git] / aapl / avlimel.h
blob9442a9972d786a79294bbb8af608f9935ca0593a
1 /*
2 * Copyright 2002 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_AVLIMEL_H
23 #define _AAPL_AVLIMEL_H
25 #include "compare.h"
26 #include "dlistmel.h"
28 /**
29 * \addtogroup avlitree
30 * @{
33 /**
34 * \class AvliMel
35 * \brief Linked AVL tree for element appearing in multiple trees.
37 * AvliMel allows for an element to simultaneously be in multiple trees without
38 * the trees interferring with one another. For each tree that the element is
39 * to appear in, there must be a distinct set of AVL Tree management data that
40 * can be unambiguously referenced with some base class name. This name
41 * is passed to the tree as a template parameter and is used in the tree
42 * algorithms.
44 * The element must use the same key type and value in each tree that it
45 * appears in. If distinct keys are required, the AvliMelKey structure is
46 * available.
48 * AvliMel does not assume ownership of elements in the tree. The destructor
49 * will not delete the elements. If the user wishes to explicitly deallocate
50 * all the items in the tree the empty() routine is available.
52 * \include ex_avlimel.cpp
55 /*@}*/
57 #define BASE_EL(name) BaseEl::name
58 #define BASEKEY(name) name
59 #define BASELIST DListMel< Element, BaseEl >
60 #define AVLMEL_CLASSDEF class Element, class Key, \
61 class BaseEl, class Compare = CmpOrd<Key>
62 #define AVLMEL_TEMPDEF class Element, class Key, \
63 class BaseEl, class Compare
64 #define AVLMEL_TEMPUSE Element, Key, BaseEl, Compare
65 #define AvlTree AvliMel
66 #define WALKABLE
68 #include "avlcommon.h"
70 #undef BASE_EL
71 #undef BASEKEY
72 #undef BASELIST
73 #undef AVLMEL_CLASSDEF
74 #undef AVLMEL_TEMPDEF
75 #undef AVLMEL_TEMPUSE
76 #undef AvlTree
77 #undef WALKABLE
79 #endif /* _AAPL_AVLIMEL_H */