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;
38 BlockList::iterator cur_blocks_end;
40 const Block *stop_at_block;
45 BlockAllocator(Train &);
47 void set_active(bool);
48 bool is_active() const { return active; }
50 void start_from(const BlockIter &);
51 void rewind_to(const Block &);
53 bool empty() const { return blocks.empty(); }
54 void stop_at(const Block *);
56 const BlockIter &first() const;
57 const BlockIter &last() const;
58 const BlockIter &last_current() const;
59 const BlockIter &iter_for(const Block &) const;
61 bool has_block(const Block &) const;
62 bool is_block_current(const Block &) const;
66 bool reserve_block(const BlockIter &);
67 void release_blocks_begin(const BlockList::iterator &);
68 void release_blocks_end(const BlockList::iterator &);
69 void release_block(const BlockList::iterator &);
74 void turnout_path_changing(Track &);
75 void turnout_path_changed(Track &);
76 void block_reserved(Block &, const Train *);
77 void sensor_state_changed(Sensor &, Sensor::State);
80 void save(std::list<Msp::DataFile::Statement> &) const;