]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/blockallocator.h
Avoid nested block reservations completely
[r2c2.git] / source / libr2c2 / blockallocator.h
index ba939f7e2be6139bfcd219ad9b2b85b230958e98..b401233593793a52743ef9bfb0967e4f27005197 100644 (file)
@@ -27,6 +27,9 @@ public:
                void hint(unsigned);
        };
 
+       sigc::signal<void, Block &, Sensor *> signal_advanced;
+       sigc::signal<void, Block &> signal_rear_advanced;
+
 private:
        struct BlockMatch;
 
@@ -41,6 +44,7 @@ private:
        const Block *stop_at_block;
        bool reserving;
        bool advancing;
+       bool reserve_pending;
 
 public:
        BlockAllocator(Train &);
@@ -48,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(); }
@@ -62,10 +66,12 @@ 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 *);
+       void advance_front(const Block *, bool);
        void advance_front(const Sensor *);
        void advance_back();
        void release_blocks_begin(const BlockList::iterator &);
@@ -80,6 +86,7 @@ private:
        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<Msp::DataFile::Statement> &) const;