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 &);
30 sigc::signal<void, Block &, Sensor *> signal_advanced;
35 typedef std::list<BlockIter> BlockList;
40 BlockList::iterator cur_blocks_end;
43 const Block *stop_at_block;
48 BlockAllocator(Train &);
50 void set_active(bool);
51 bool is_active() const { return active; }
53 bool start_from(const BlockIter &);
54 void rewind_to(const Block &);
56 bool empty() const { return blocks.empty(); }
57 void stop_at(const Block *);
59 const BlockIter &first() const;
60 const BlockIter &last() const;
61 const BlockIter &last_current() const;
62 const BlockIter &iter_for(const Block &) const;
64 bool has_block(const Block &) const;
65 bool is_block_current(const Block &) const;
69 bool reserve_block(const BlockIter &);
70 void advance_front(const Block *, bool);
71 void advance_front(const Sensor *);
73 void release_blocks_begin(const BlockList::iterator &);
74 void release_blocks_end(const BlockList::iterator &);
75 void release_block(const BlockList::iterator &);
80 void turnout_path_changing(Track &);
81 void turnout_path_changed(Track &);
82 void block_reserved(Block &, const Train *);
83 void sensor_state_changed(Sensor &, Sensor::State);
84 void update_next_sensor(Sensor *);
87 void save(std::list<Msp::DataFile::Statement> &) const;