2 * Copyright 2002 Adrian Thurston <thurston@cs.queensu.ca>
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)
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
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_AVLMEL_H
23 #define _AAPL_AVLMEL_H
34 * \brief AVL tree for elements appearing in multiple trees.
36 * AvlMel allows for an element to simultaneously be in multiple trees without
37 * the trees interferring with one another. For each tree that the element is
38 * to appear in, there must be a distinct set of AVL Tree management data that
39 * can be unambiguously referenced with some base class name. This name
40 * is passed to the tree as a template parameter and is used in the tree
43 * The element must use the same key type and value in each tree that it
44 * appears in. If distinct keys are required, the AvlMelKey structure is
47 * AvlMel does not assume ownership of elements in the tree. The destructor
48 * will not delete the elements. If the user wishes to explicitly deallocate
49 * all the items in the tree the empty() routine is available.
51 * \include ex_avlmel.cpp
56 #define BASE_EL(name) BaseEl::name
57 #define BASEKEY(name) name
58 #define AVLMEL_CLASSDEF class Element, class Key, \
59 class BaseEl, class Compare = CmpOrd<Key>
60 #define AVLMEL_TEMPDEF class Element, class Key, \
61 class BaseEl, class Compare
62 #define AVLMEL_TEMPUSE Element, Key, BaseEl, Compare
63 #define AvlTree AvlMel
65 #include "avlcommon.h"
69 #undef AVLMEL_CLASSDEF
74 #endif /* _AAPL_AVLMEL_H */