]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/blockallocator.h
Redesign the train activation system
[r2c2.git] / source / libr2c2 / blockallocator.h
index 3c974f21975b06933317eb4c068ae408ae4fce80..6ad3891bc4e68fc91b84ba0cb695ffc5aecd239b 100644 (file)
@@ -33,6 +33,7 @@ private:
        typedef std::list<BlockIter> BlockList;
 
        Train &train;
+       bool active;
        BlockList blocks;
        BlockList::iterator cur_blocks_end;
        Block *pending_block;
@@ -42,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 *);
@@ -55,13 +60,9 @@ public:
        bool has_block(const Block &) const;
        bool is_block_current(const Block &) const;
 
-       void reserve_more();
 private:
+       void reserve_more();
        bool reserve_block(const BlockIter &);
-public:
-       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 &);
@@ -69,6 +70,7 @@ 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);