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;
41 const Block *stop_at_block;
46 BlockAllocator(Train &);
48 void set_active(bool);
49 bool is_active() const { return active; }
51 void start_from(const BlockIter &);
52 void rewind_to(const Block &);
54 bool empty() const { return blocks.empty(); }
55 void stop_at(const Block *);
57 const BlockIter &first() const;
58 const BlockIter &last() const;
59 const BlockIter &last_current() const;
60 const BlockIter &iter_for(const Block &) const;
62 bool has_block(const Block &) const;
63 bool is_block_current(const Block &) const;
67 bool reserve_block(const BlockIter &);
68 void advance_to(const Block *);
69 void release_blocks_begin(const BlockList::iterator &);
70 void release_blocks_end(const BlockList::iterator &);
71 void release_block(const BlockList::iterator &);
76 void turnout_path_changing(Track &);
77 void turnout_path_changed(Track &);
78 void block_reserved(Block &, const Train *);
79 void sensor_state_changed(Sensor &, Sensor::State);
80 void update_next_sensor(Sensor *);
83 void save(std::list<Msp::DataFile::Statement> &) const;