00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef SPOT_MISC_FREELIST_HH
00024 # define SPOT_MISC_FREELIST_HH
00025
00026 #include <list>
00027 #include <utility>
00028
00029 namespace spot
00030 {
00031
00034 class free_list
00035 {
00036 public:
00037 virtual ~free_list();
00038
00044 int register_n(int n);
00045
00047 void release_n(int base, int n);
00048
00050 std::ostream& dump_free_list(std::ostream& os) const;
00051
00053 void insert(int base, int n);
00054
00056 void remove(int base, int n = 0);
00057
00058 protected:
00059
00067 virtual int extend(int n) = 0;
00068
00070 typedef std::pair<int, int> pos_lenght_pair;
00071 typedef std::list<pos_lenght_pair> free_list_type;
00072 free_list_type fl;
00073
00075 void remove(free_list_type::iterator i, int base, int n);
00076 };
00077
00078 }
00079
00080 #endif // SPOT_MISC_FREELIST_HH