The XML parser and scanner are now created in ragel/main.cpp. These structures
[ragel.git] / aapl / avlmelkey.h
blob9261cc830405a7dbd0a67aac818cc2fece84c1e1
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_AVLMELKEY_H
23 #define _AAPL_AVLMELKEY_H
25 #include "compare.h"
27 /**
28 * \addtogroup avltree
29 * @{
32 /**
33 * \class AvlMelKey
34 * \brief AVL tree for elements appearing in multiple trees with different keys.
36 * AvlMelKey is similar to AvlMel, except that an additional template
37 * parameter, BaseKey, is provided for resolving ambiguous references to
38 * getKey(). This means that if an element is stored in multiple trees, each
39 * tree can use a different key for ordering the elements in it. Using
40 * AvlMelKey an array of data structures can be indexed with an O(log(n))
41 * search on two or more of the values contained within it and without
42 * allocating any additional data.
44 * AvlMelKey does not assume ownership of elements in the tree. The destructor
45 * will not delete the elements. If the user wishes to explicitly deallocate
46 * all the items in the tree the empty() routine is available.
48 * \include ex_avlmelkey.cpp
51 /*@}*/
53 #define BASE_EL(name) BaseEl::name
54 #define BASEKEY(name) BaseKey::name
55 #define AVLMEL_CLASSDEF class Element, class Key, class BaseEl, \
56 class BaseKey, class Compare = CmpOrd<Key>
57 #define AVLMEL_TEMPDEF class Element, class Key, class BaseEl, \
58 class BaseKey, class Compare
59 #define AVLMEL_TEMPUSE Element, Key, BaseEl, BaseKey, Compare
60 #define AvlTree AvlMelKey
62 #include "avlcommon.h"
64 #undef BASE_EL
65 #undef BASEKEY
66 #undef AVLMEL_CLASSDEF
67 #undef AVLMEL_TEMPDEF
68 #undef AVLMEL_TEMPUSE
69 #undef AvlTree
71 #endif /* _AAPL_AVLMELKEY_H */