Don't import ogdf namespace
[TortoiseGit.git] / ext / OGDF / ogdf / basic / HeapBase.h
blobc1b358e84aff9fffb1089097a171741c6c6fa9fc
1 /*
2 * $Revision: 2564 $
4 * last checkin:
5 * $Author:klein $
6 * $Date:2007-10-18 17:23:28 +0200 (Thu, 18 Oct 2007) $
7 ***************************************************************/
9 /** \file
10 * \brief Declaration of an abstract heap base class for
11 * priority queue implementation.
13 * \author Karsten Klein
15 * \par License:
16 * This file is part of the Open Graph Drawing Framework (OGDF).
18 * \par
19 * Copyright (C)<br>
20 * See README.txt in the root directory of the OGDF installation for details.
22 * \par
23 * This program is free software; you can redistribute it and/or
24 * modify it under the terms of the GNU General Public License
25 * Version 2 or 3 as published by the Free Software Foundation;
26 * see the file LICENSE.txt included in the packaging of this file
27 * for details.
29 * \par
30 * This program is distributed in the hope that it will be useful,
31 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 * GNU General Public License for more details.
35 * \par
36 * You should have received a copy of the GNU General Public
37 * License along with this program; if not, write to the Free
38 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
39 * Boston, MA 02110-1301, USA.
41 * \see http://www.gnu.org/copyleft/gpl.html
42 ***************************************************************/
45 #ifdef _MSC_VER
46 #pragma once
47 #endif
49 #ifndef OGDF_HEAP_BASE_H
50 #define OGDF_HEAP_BASE_H
53 #include <ogdf/basic/GraphCopy.h>
56 namespace ogdf {
58 /**
60 * \brief A data structure implementing the abstract data type
61 * priority queue
62 * A Heap is a data structure implementing the abstract data type
63 * priority queue, maintaining a set of elements each with an associated key value
64 * used for keeping the elements in a specific order.
66 * It supports the following operations:
67 * insert(element, key) insert element with key in set
68 * min return element with minimum key
69 * extractMin remove and return element with minimum key
70 * decreaseKey decrease the key of a given element to a given value
71 * delete remove a given element fromthe structure
74 * Running times and space requirements are depending on the actual
75 * implementation type (e.g., binary, binomial or fibonacci heaps)
80 class HeapEntry;
82 class HeapEntryPointer;
84 template <class Priority, class HeapObject>
85 class HeapBase {
87 public:
88 //! Constructor
89 HeapBase() { }
91 virtual ~HeapBase() { }
94 //! build a heap out of a given set of elements
95 virtual void makeHeap() = 0;
97 HeapObject minRet() { }
99 //*******************************************************
100 //Modification
102 //! insert a new element with priority key
103 virtual void insert(HeapObject, Priority /* key */) { }
104 //extractMin
105 //derived classes should decide themselves if they have
106 //a specific delete function
107 //virtual void delete() = 0;
109 //! update the data structure by decreasing the key of an object
110 //TODO: Does not make much sense without an object parameter
111 virtual void decreaseKey() { }
113 //*******************************************************
114 //constant functions
115 int size() const {return m_size;}
117 bool empty() const {return m_size==0;}
120 protected:
121 int m_size; //number of elements stored in heap
127 } //namespace ogdf
129 #endif