X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Fblockallocator.h;h=cd6dfd5949d58aa49ec346079fcf8624241f1fd0;hb=6eba064c477836843a2647d777e95823a96dda43;hp=6eecbd4e2c531eb0cbbcc49363a0910598fca774;hpb=59bae8acd679127602cf35d22bcd37e316a5a056;p=r2c2.git diff --git a/source/libr2c2/blockallocator.h b/source/libr2c2/blockallocator.h index 6eecbd4..cd6dfd5 100644 --- a/source/libr2c2/blockallocator.h +++ b/source/libr2c2/blockallocator.h @@ -27,20 +27,32 @@ public: void hint(unsigned); }; + sigc::signal signal_advanced; + sigc::signal signal_rear_advanced; + private: + struct BlockMatch; + typedef std::list BlockList; Train &train; + bool active; BlockList blocks; BlockList::iterator cur_blocks_end; + Sensor *next_sensor; Block *pending_block; const Block *stop_at_block; bool reserving; + bool advancing; public: BlockAllocator(Train &); - void start_from(const BlockIter &); + void set_active(bool); + bool is_active() const { return active; } + + bool start_from(const BlockIter &); + void rewind_to(const Block &); void clear(); bool empty() const { return blocks.empty(); } void stop_at(const Block *); @@ -52,17 +64,13 @@ public: bool has_block(const Block &) const; bool is_block_current(const Block &) const; -private: - BlockList::const_iterator find_block(const BlockList::const_iterator &, const BlockList::const_iterator &, const Block &) const; -public: - void reserve_more(); private: + void reserve_more(); bool reserve_block(const BlockIter &); -public: - bool release_from(const Block &); - void release_noncurrent(); -private: + 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 &); @@ -70,9 +78,11 @@ public: void reverse(); private: + void turnout_path_changing(Track &); void turnout_path_changed(Track &); void block_reserved(Block &, const Train *); void sensor_state_changed(Sensor &, Sensor::State); + void update_next_sensor(Sensor *); public: void save(std::list &) const;