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;
31 sigc::signal<void, Block &> signal_rear_advanced;
36 typedef std::list<BlockIter> BlockList;
41 BlockList::iterator cur_blocks_end;
44 const Block *stop_at_block;
49 BlockAllocator(Train &);
51 void set_active(bool);
52 bool is_active() const { return active; }
54 bool start_from(const BlockIter &);
55 void rewind_to(const Block &);
57 bool empty() const { return blocks.empty(); }
58 void stop_at(const Block *);
60 const BlockIter &first() const;
61 const BlockIter &last() const;
62 const BlockIter &last_current() const;
63 const BlockIter &iter_for(const Block &) const;
65 bool has_block(const Block &) const;
66 bool is_block_current(const Block &) const;
70 bool reserve_block(const BlockIter &);
71 void advance_front(const Block *, bool);
72 void advance_front(const Sensor *);
74 void release_blocks_begin(const BlockList::iterator &);
75 void release_blocks_end(const BlockList::iterator &);
76 void release_block(const BlockList::iterator &);
81 void turnout_path_changing(Track &);
82 void turnout_path_changed(Track &);
83 void block_reserved(Block &, const Train *);
84 void sensor_state_changed(Sensor &, Sensor::State);
85 void update_next_sensor(Sensor *);
88 void save(std::list<Msp::DataFile::Statement> &) const;