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