Initialize Tizen 2.3
[external/ragel.git] / aapl / avlimelkey.h
1 /*
2  *  Copyright 2002 Adrian Thurston <thurston@complang.org>
3  */
4
5 /*  This file is part of Aapl.
6  *
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.
11  *
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.
16  *
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
20  */
21
22 #ifndef _AAPL_AVLIMELKEY_H
23 #define _AAPL_AVLIMELKEY_H
24
25 #include "compare.h"
26 #include "dlistmel.h"
27
28 /**
29  * \addtogroup avlitree 
30  * @{
31  */
32
33 /**
34  * \class AvliMelKey
35  * \brief Linked AVL tree for element appearing in multiple trees with different keys.
36  *
37  * AvliMelKey is similar to AvliMel, except that an additional template
38  * parameter, BaseKey, is provided for resolving ambiguous references to
39  * getKey(). This means that if an element is stored in multiple trees, each
40  * tree can use a different key for ordering the elements in it. Using
41  * AvliMelKey an array of data structures can be indexed with an O(log(n))
42  * search on two or more of the values contained within it and without
43  * allocating any additional data.
44  *
45  * AvliMelKey does not assume ownership of elements in the tree. The destructor
46  * will not delete the elements. If the user wishes to explicitly deallocate
47  * all the items in the tree the empty() routine is available. 
48  *
49  * \include ex_avlimelkey.cpp
50  */
51
52 /*@}*/
53
54 #define BASE_EL(name) BaseEl::name
55 #define BASEKEY(name) BaseKey::name
56 #define BASELIST DListMel< Element, BaseEl >
57 #define AVLMEL_CLASSDEF class Element, class Key, class BaseEl, \
58                 class BaseKey, class Compare = CmpOrd<Key>
59 #define AVLMEL_TEMPDEF class Element, class Key, class BaseEl, \
60                 class BaseKey, class Compare
61 #define AVLMEL_TEMPUSE Element, Key, BaseEl, BaseKey, Compare
62 #define AvlTree AvliMelKey
63 #define WALKABLE
64
65 #include "avlcommon.h"
66
67 #undef BASE_EL
68 #undef BASEKEY
69 #undef BASELIST
70 #undef AVLMEL_CLASSDEF
71 #undef AVLMEL_TEMPDEF
72 #undef AVLMEL_TEMPUSE
73 #undef AvlTree
74 #undef WALKABLE
75
76 #endif /* _AAPL_AVLIMELKEY_H */