spot
0.8.1
|
00001 // Copyright (C) 2004, 2006 Laboratoire d'Informatique de Paris 6 (LIP6), 00002 // département Systèmes Répartis Coopératifs (SRC), Université Pierre 00003 // et Marie Curie. 00004 // 00005 // This file is part of Spot, a model checking library. 00006 // 00007 // Spot is free software; you can redistribute it and/or modify it 00008 // under the terms of the GNU General Public License as published by 00009 // the Free Software Foundation; either version 2 of the License, or 00010 // (at your option) any later version. 00011 // 00012 // Spot is distributed in the hope that it will be useful, but WITHOUT 00013 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00014 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 00015 // License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with Spot; see the file COPYING. If not, write to the Free 00019 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00020 // 02111-1307, USA. 00021 00022 #ifndef SPOT_TGBAALGOS_GTEC_NSHEAP_HH 00023 # define SPOT_TGBAALGOS_GTEC_NSHEAP_HH 00024 00025 #include "tgba/state.hh" 00026 #include "misc/hash.hh" 00027 00028 namespace spot 00029 { 00031 class numbered_state_heap_const_iterator 00032 { 00033 public: 00034 virtual ~numbered_state_heap_const_iterator() {} 00035 00037 00038 virtual void first() = 0; 00039 virtual void next() = 0; 00040 virtual bool done() const = 0; 00042 00044 00045 virtual const state* get_state() const = 0; 00046 virtual int get_index() const = 0; 00048 }; 00049 00051 class numbered_state_heap 00052 { 00053 public: 00054 typedef std::pair<const state*, int*> state_index_p; 00055 typedef std::pair<const state*, int> state_index; 00056 00057 virtual ~numbered_state_heap() {} 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 virtual state_index find(const state* s) const = 0; 00074 virtual state_index_p find(const state* s) = 0; 00076 00078 00079 00080 00081 00082 00083 00084 00085 virtual state_index index(const state* s) const = 0; 00086 virtual state_index_p index(const state* s) = 0; 00088 00090 virtual void insert(const state* s, int index) = 0; 00091 00093 virtual int size() const = 0; 00094 00096 virtual numbered_state_heap_const_iterator* iterator() const = 0; 00097 }; 00098 00100 class numbered_state_heap_factory 00101 { 00102 public: 00103 virtual ~numbered_state_heap_factory() {} 00104 virtual numbered_state_heap* build() const = 0; 00105 }; 00106 00108 class numbered_state_heap_hash_map : public numbered_state_heap 00109 { 00110 public: 00111 virtual ~numbered_state_heap_hash_map(); 00112 00113 virtual state_index find(const state* s) const; 00114 virtual state_index_p find(const state* s); 00115 virtual state_index index(const state* s) const; 00116 virtual state_index_p index(const state* s); 00117 00118 virtual void insert(const state* s, int index); 00119 virtual int size() const; 00120 00121 virtual numbered_state_heap_const_iterator* iterator() const; 00122 00123 typedef Sgi::hash_map<const state*, int, 00124 state_ptr_hash, state_ptr_equal> hash_type; 00125 protected: 00126 hash_type h; 00127 }; 00128 00132 class numbered_state_heap_hash_map_factory: 00133 public numbered_state_heap_factory 00134 { 00135 public: 00136 virtual numbered_state_heap_hash_map* build() const; 00137 00139 static const numbered_state_heap_hash_map_factory* instance(); 00140 protected: 00141 virtual ~numbered_state_heap_hash_map_factory() {} 00142 numbered_state_heap_hash_map_factory(); 00143 }; 00144 00145 } 00146 00147 #endif // SPOT_TGBAALGOS_GTEC_NSHEAP_HH