tizen 2.3.1 release
[external/ragel.git] / aapl / avlimap.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_AVLIMAP_H
23 #define _AAPL_AVLIMAP_H
24
25 #include "compare.h"
26 #include "dlist.h"
27
28 /**
29  * \addtogroup avlitree 
30  * @{
31  */
32
33 /**
34  * \class AvliMap
35  * \brief Linked key and value oriented AVL tree. 
36  *
37  * AvliMap stores key and value pairs in elements that managed by the tree. It
38  * is intendend to be similar to map template found in the STL. AvliMap
39  * requires that a Key type, a Value type, and a class containing a compare()
40  * routine for Key be given. Items can be inserted with just a key or with a
41  * key and value pair.
42  *
43  * AvliMap assumes all elements in the tree are allocated on the heap and are
44  * to be managed by the tree. This means that the class destructor will delete
45  * the contents of the tree. A deep copy will cause existing elements to be
46  * deleted first.
47  *
48  * \include ex_avlimap.cpp
49  */
50
51 /*@}*/
52
53 #define AVLTREE_MAP
54 #define BASE_EL(name) name
55 #define BASEKEY(name) name
56 #define BASELIST DList< AvliMapEl<Key,Value> >
57 #define AVLMEL_CLASSDEF class Key, class Value, class Compare = CmpOrd<Key>
58 #define AVLMEL_TEMPDEF class Key, class Value, class Compare
59 #define AVLMEL_TEMPUSE Key, Value, Compare
60 #define AvlTree AvliMap
61 #define Element AvliMapEl<Key,Value>
62 #define WALKABLE
63
64 #include "avlcommon.h"
65
66 #undef AVLTREE_MAP
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 Element
75 #undef WALKABLE
76
77 #endif /* _AAPL_AVLIMAP_H */