]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/blockallocator.h
Tighten safety measures
[r2c2.git] / source / libr2c2 / blockallocator.h
index 3ef3fa047796e2cceaaef10fb92dfd76558ab53b..39a327b9fa95810030267952a174cbd2073ffb02 100644 (file)
@@ -40,7 +40,7 @@ private:
 public:
        BlockAllocator(Train &);
 
-       void start_from(Block &, unsigned);
+       void start_from(const BlockIter &);
        void clear();
        bool empty() const { return blocks.empty(); }
        void stop_at(const Block *);
@@ -48,15 +48,24 @@ public:
        const BlockIter &first() const;
        const BlockIter &last() const;
        const BlockIter &last_current() const;
+       const BlockIter &iter_for(const Block &) const;
 
-       int get_entry_to_block(const Block &) const;
+       bool has_block(const Block &) const;
+       bool is_block_current(const Block &) const;
+private:
+       BlockList::const_iterator find_block(const BlockList::const_iterator &, const BlockList::const_iterator &, const Block &) const;
 
+public:
        void reserve_more();
-       void release_until(const Block &);
+private:
+       bool reserve_block(const BlockIter &);
+public:
        bool release_from(const Block &);
        void release_noncurrent();
 private:
-       void release_blocks(const BlockList::iterator &, const BlockList::iterator &);
+       void release_blocks_begin(const BlockList::iterator &);
+       void release_blocks_end(const BlockList::iterator &);
+       void release_block(const BlockList::iterator &);
 public:
        void reverse();