Initialize Tizen 2.3
[external/ragel.git] / aapl / avlitree.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_AVLITREE_H
23 #define _AAPL_AVLITREE_H
24
25 #include "compare.h"
26 #include "dlistmel.h"
27
28 /**
29  * \addtogroup avlitree
30  * @{
31  */
32
33 /**
34  * \class AvliTree
35  * \brief Linked AVL tree.
36  *
37  * AvliTree is the standard linked by-structure AVL tree. To use this
38  * structure the user must define an element type and give it the necessary
39  * properties. At the very least it must have a getKey() function that will be
40  * used to compare the relative ordering of elements and tree management data
41  * necessary for the AVL algorithm. An element type can acquire the management
42  * data by inheriting the AvliTreeEl class.
43  *
44  * AvliTree does not presume to manage the allocation of elements in the tree.
45  * The destructor will not delete the items in the tree, instead the elements
46  * must be explicitly de-allocated by the user if necessary and when it is
47  * safe to do so. The empty() routine will traverse the tree and delete all
48  * items. 
49  *
50  * Since the tree does not manage the elements, it can contain elements that
51  * are allocated statically or that are part of another data structure.
52  *
53  * \include ex_avlitree.cpp
54  */
55
56 /*@}*/
57
58 #define BASE_EL(name) name
59 #define BASEKEY(name) name
60 #define BASELIST DListMel< Element, AvliTreeEl<Element> >
61 #define AVLMEL_CLASSDEF class Element, class Key, class Compare = CmpOrd<Key>
62 #define AVLMEL_TEMPDEF class Element, class Key, class Compare
63 #define AVLMEL_TEMPUSE Element, Key, Compare
64 #define AvlTree AvliTree
65 #define WALKABLE
66
67 #include "avlcommon.h"
68
69 #undef BASE_EL
70 #undef BASEKEY
71 #undef BASELIST
72 #undef AVLMEL_CLASSDEF
73 #undef AVLMEL_TEMPDEF
74 #undef AVLMEL_TEMPUSE
75 #undef AvlTree
76 #undef WALKABLE
77
78 #endif /* _AAPL_AVLITREE_H */