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;
50 BlockAllocator(Train &);
52 void set_active(bool);
53 bool is_active() const { return active; }
55 bool start_from(const BlockIter &);
56 void rewind_to(const Block &);
58 bool empty() const { return blocks.empty(); }
59 void stop_at(const Block *);
61 const BlockIter &first() const;
62 const BlockIter &last() const;
63 const BlockIter &last_current() const;
64 const BlockIter &iter_for(const Block &) const;
66 bool has_block(const Block &) const;
67 bool is_block_current(const Block &) const;
73 bool reserve_block(const BlockIter &);
74 void advance_front(const Block *, bool);
75 void advance_front(const Sensor *);
77 void release_blocks_begin(const BlockList::iterator &);
78 void release_blocks_end(const BlockList::iterator &);
79 void release_block(const BlockList::iterator &);
84 void turnout_path_changing(Track &);
85 void turnout_path_changed(Track &);
86 void block_reserved(Block &, const Train *);
87 void sensor_state_changed(Sensor &, Sensor::State);
88 void update_next_sensor(Sensor *);
89 void halt_event(bool);
92 void save(std::list<Msp::DataFile::Statement> &) const;