X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Fblockallocator.h;h=6ad3891bc4e68fc91b84ba0cb695ffc5aecd239b;hb=57e0944ee8ed442e2d0aa7c9964cac00450af5e7;hp=c90b450bb52f11248ce1f8d016a0e73163e5b0a0;hpb=dda1e6c8716b6ac70d63a3f6ff95474a8b8b7336;p=r2c2.git diff --git a/source/libr2c2/blockallocator.h b/source/libr2c2/blockallocator.h index c90b450..6ad3891 100644 --- a/source/libr2c2/blockallocator.h +++ b/source/libr2c2/blockallocator.h @@ -3,8 +3,8 @@ #include #include -#include "block.h" #include "blockiter.h" +#include "sensor.h" namespace R2C2 { @@ -28,9 +28,12 @@ public: }; private: + struct BlockMatch; + typedef std::list BlockList; Train &train; + bool active; BlockList blocks; BlockList::iterator cur_blocks_end; Block *pending_block; @@ -40,7 +43,11 @@ private: public: BlockAllocator(Train &); + void set_active(bool); + bool is_active() const { return active; } + void start_from(const BlockIter &); + void rewind_to(const Block &); void clear(); bool empty() const { return blocks.empty(); } void stop_at(const Block *); @@ -52,18 +59,10 @@ 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: - void release_until(const Block &); - bool release_from(const Block &); - void release_noncurrent(); -private: void release_blocks_begin(const BlockList::iterator &); void release_blocks_end(const BlockList::iterator &); void release_block(const BlockList::iterator &); @@ -71,9 +70,10 @@ public: void reverse(); private: + void turnout_path_changing(Track &); void turnout_path_changed(Track &); void block_reserved(Block &, const Train *); - void block_state_changed(Block &, Block::State); + void sensor_state_changed(Sensor &, Sensor::State); public: void save(std::list &) const;