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_AVLIMEL_H
23 #define _AAPL_AVLIMEL_H
29 * \addtogroup avlitree
35 * \brief Linked AVL tree for element appearing in multiple trees.
37 * AvliMel allows for an element to simultaneously be in multiple trees without
38 * the trees interferring with one another. For each tree that the element is
39 * to appear in, there must be a distinct set of AVL Tree management data that
40 * can be unambiguously referenced with some base class name. This name
41 * is passed to the tree as a template parameter and is used in the tree
44 * The element must use the same key type and value in each tree that it
45 * appears in. If distinct keys are required, the AvliMelKey structure is
48 * AvliMel does not assume ownership of elements in the tree. The destructor
49 * will not delete the elements. If the user wishes to explicitly deallocate
50 * all the items in the tree the empty() routine is available.
52 * \include ex_avlimel.cpp
57 #define BASE_EL(name) BaseEl::name
58 #define BASEKEY(name) name
59 #define BASELIST DListMel< Element, BaseEl >
60 #define AVLMEL_CLASSDEF class Element, class Key, \
61 class BaseEl, class Compare = CmpOrd<Key>
62 #define AVLMEL_TEMPDEF class Element, class Key, \
63 class BaseEl, class Compare
64 #define AVLMEL_TEMPUSE Element, Key, BaseEl, Compare
65 #define AvlTree AvliMel
68 #include "avlcommon.h"
73 #undef AVLMEL_CLASSDEF
79 #endif /* _AAPL_AVLIMEL_H */