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;
44 BlockAllocator(Train &);
46 void set_active(bool);
47 bool is_active() const { return active; }
49 void start_from(const BlockIter &);
50 void rewind_to(const Block &);
52 bool empty() const { return blocks.empty(); }
53 void stop_at(const Block *);
55 const BlockIter &first() const;
56 const BlockIter &last() const;
57 const BlockIter &last_current() const;
58 const BlockIter &iter_for(const Block &) const;
60 bool has_block(const Block &) const;
61 bool is_block_current(const Block &) const;
65 bool reserve_block(const BlockIter &);
66 void release_blocks_begin(const BlockList::iterator &);
67 void release_blocks_end(const BlockList::iterator &);
68 void release_block(const BlockList::iterator &);
73 void turnout_path_changing(Track &);
74 void turnout_path_changed(Track &);
75 void block_reserved(Block &, const Train *);
76 void sensor_state_changed(Sensor &, Sensor::State);
79 void save(std::list<Msp::DataFile::Statement> &) const;