X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Fblockallocator.h;h=b401233593793a52743ef9bfb0967e4f27005197;hb=d0881a98a6240758ac1aeceaa9443d718ab1ad5c;hp=c0c265ae0bdf6bb03f0d8e1aa7c45d58b43007d2;hpb=83c2811157e9861a72e1ece34160cb014ef35fb5;p=r2c2.git diff --git a/source/libr2c2/blockallocator.h b/source/libr2c2/blockallocator.h index c0c265a..b401233 100644 --- a/source/libr2c2/blockallocator.h +++ b/source/libr2c2/blockallocator.h @@ -27,6 +27,9 @@ public: void hint(unsigned); }; + sigc::signal signal_advanced; + sigc::signal signal_rear_advanced; + private: struct BlockMatch; @@ -36,10 +39,12 @@ private: bool active; BlockList blocks; BlockList::iterator cur_blocks_end; + Sensor *next_sensor; Block *pending_block; const Block *stop_at_block; bool reserving; bool advancing; + bool reserve_pending; public: BlockAllocator(Train &); @@ -47,7 +52,7 @@ public: void set_active(bool); bool is_active() const { return active; } - void start_from(const BlockIter &); + bool start_from(const BlockIter &); void rewind_to(const Block &); void clear(); bool empty() const { return blocks.empty(); } @@ -61,9 +66,14 @@ public: bool has_block(const Block &) const; bool is_block_current(const Block &) const; + void tick(); + private: void reserve_more(); bool reserve_block(const BlockIter &); + void advance_front(const Block *, bool); + void advance_front(const Sensor *); + void advance_back(); void release_blocks_begin(const BlockList::iterator &); void release_blocks_end(const BlockList::iterator &); void release_block(const BlockList::iterator &); @@ -75,6 +85,8 @@ private: void turnout_path_changed(Track &); void block_reserved(Block &, const Train *); void sensor_state_changed(Sensor &, Sensor::State); + void update_next_sensor(Sensor *); + void halt_event(bool); public: void save(std::list &) const;