spot
0.8.2
|
00001 // Copyright (C) 2008 Laboratoire de Recherche et Développement 00002 // de l'Epita (LRDE). 00003 // Copyright (C) 2004, 2006 Laboratoire d'Informatique de Paris 6 (LIP6), 00004 // département Systèmes Répartis Coopératifs (SRC), Université Pierre 00005 // et Marie Curie. 00006 // 00007 // This file is part of Spot, a model checking library. 00008 // 00009 // Spot is free software; you can redistribute it and/or modify it 00010 // under the terms of the GNU General Public License as published by 00011 // the Free Software Foundation; either version 2 of the License, or 00012 // (at your option) any later version. 00013 // 00014 // Spot is distributed in the hope that it will be useful, but WITHOUT 00015 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00016 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 00017 // License for more details. 00018 // 00019 // You should have received a copy of the GNU General Public License 00020 // along with Spot; see the file COPYING. If not, write to the Free 00021 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00022 // 02111-1307, USA. 00023 00024 00025 #ifndef SPOT_MISC_FREELIST_HH 00026 # define SPOT_MISC_FREELIST_HH 00027 00028 #include <list> 00029 #include <utility> 00030 #include <iosfwd> 00031 00032 namespace spot 00033 { 00034 00037 class free_list 00038 { 00039 public: 00040 virtual ~free_list(); 00041 00047 int register_n(int n); 00048 00050 void release_n(int base, int n); 00051 00053 std::ostream& dump_free_list(std::ostream& os) const; 00054 00056 void insert(int base, int n); 00057 00059 void remove(int base, int n = 0); 00060 00062 int free_count() const; 00063 00064 protected: 00065 00073 virtual int extend(int n) = 0; 00074 00076 typedef std::pair<int, int> pos_lenght_pair; 00077 typedef std::list<pos_lenght_pair> free_list_type; 00078 free_list_type fl; 00079 00081 void remove(free_list_type::iterator i, int base, int n); 00082 }; 00083 00084 } 00085 00086 #endif // SPOT_MISC_FREELIST_HH