1 #ifndef LIBR2C2_BLOCKALLOCATOR_H_
2 #define LIBR2C2_BLOCKALLOCATOR_H_
5 #include <msp/datafile/objectloader.h>
16 class Loader: public Msp::DataFile::ObjectLoader<BlockAllocator>
23 Loader(BlockAllocator &);
33 typedef std::list<BlockIter> BlockList;
37 BlockList::iterator cur_blocks_end;
39 const Block *stop_at_block;
43 BlockAllocator(Train &);
45 void start_from(const BlockIter &);
47 bool empty() const { return blocks.empty(); }
48 void stop_at(const Block *);
50 const BlockIter &first() const;
51 const BlockIter &last() const;
52 const BlockIter &last_current() const;
53 const BlockIter &iter_for(const Block &) const;
55 bool has_block(const Block &) const;
56 bool is_block_current(const Block &) const;
60 bool reserve_block(const BlockIter &);
62 bool release_from(const Block &);
63 void release_noncurrent();
65 void release_blocks_begin(const BlockList::iterator &);
66 void release_blocks_end(const BlockList::iterator &);
67 void release_block(const BlockList::iterator &);
72 void turnout_path_changed(Track &);
73 void block_reserved(Block &, const Train *);
74 void sensor_state_changed(Sensor &, Sensor::State);
77 void save(std::list<Msp::DataFile::Statement> &) const;