Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

heap.h

Go to the documentation of this file.
00001 /* -*- C++ -*-
00002  * lemon/concept/heap.h - Part of LEMON, a generic C++ optimization library
00003  *
00004  * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
00005  * (Egervary Research Group on Combinatorial Optimization, EGRES).
00006  *
00007  * Permission to use, modify and distribute this software is granted
00008  * provided that this copyright notice appears in all copies. For
00009  * precise terms see the accompanying LICENSE file.
00010  *
00011  * This software is provided "AS IS" with no warranty of any kind,
00012  * express or implied, and with no claim as to its suitability for any
00013  * purpose.
00014  *
00015  */
00016 
00021 
00022 #ifndef LEMON_CONCEPT_HEAP_H
00023 #define LEMON_CONCEPT_HEAP_H
00024 
00025 #include <lemon/invalid.h>
00026 
00027 namespace lemon {
00028   namespace concept {
00031 
00032 
00037     template <typename Item, typename Prio, typename ItemIntMap>
00038     class Heap {
00039     public:
00040   
00041 
00050       enum state_enum {
00051         IN_HEAP = 0,
00052         PRE_HEAP = -1,
00053         POST_HEAP = -2
00054       };
00055       
00062       explicit Heap(ItemIntMap &_iim) {}
00063 
00067       int size() const { return 0; }
00071       bool empty() const { return false; }
00072 
00078       void push(const Item &i, const Prio &p) {}
00079 
00084       Item top() const {}
00085 
00090       Prio prio() const {}
00091 
00096       void pop() {}
00097 
00103       void erase(const Item &i) {}
00104 
00110       Prio operator[](const Item &i) const {}
00111 
00120       void set(const Item &i, const Prio &p) {}
00121       
00128       void decrease(const Item &i, const Prio &p) {}
00129 
00137       void increase(const Item &i, const Prio &p) {}
00138 
00147       state_enum state(const Item &i) const {}
00148 
00149 
00150       template <typename _Heap>
00151       struct Constraints {
00152       public:
00153     
00154         void constraints() {
00155           Item item;
00156           Prio prio;
00157 
00158           item=Item();
00159           prio=Prio();
00160 
00161           ignore_unused_variable_warning(item);
00162           ignore_unused_variable_warning(prio);
00163 
00164           typedef typename _Heap::state_enum state_enum;
00165           state_enum state;
00166 
00167           ignore_unused_variable_warning(state);
00168       
00169           _Heap heap1 = _Heap(map);
00170 
00171           ignore_unused_variable_warning(heap1);
00172       
00173           heap.push(item, prio);
00174 
00175           prio = heap.prio();
00176           item = heap.top();
00177 
00178           heap.pop();
00179 
00180           heap.set(item, prio);
00181           heap.decrease(item, prio);
00182           heap.increase(item, prio);
00183           prio = heap[item];
00184 
00185           heap.erase(item);
00186 
00187           state = heap.state(item);
00188 
00189           state = _Heap::PRE_HEAP;
00190           state = _Heap::IN_HEAP;
00191           state = _Heap::POST_HEAP;
00192         }
00193     
00194         _Heap& heap;
00195         ItemIntMap& map;
00196 
00197         Constraints() : heap(0), map(0) {}
00198       };
00199     };
00200 
00202   } // namespace lemon
00203 }
00204 #endif // LEMON_CONCEPT_PATH_H

Generated on Sat Aug 27 14:14:50 2005 for LEMON by  doxygen 1.4.4