]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/layout.h
Move block reservation signal serialization to Layout
[r2c2.git] / source / libr2c2 / layout.h
index 41de73d7dc11f9b46e3e209c318ff801a6c69851..5a0804fc77329b1c8714b3ce2d27112d1ff14b13 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef LIBR2C2_LAYOUT_H_
 #define LIBR2C2_LAYOUT_H_
 
+#include <deque>
 #include <set>
 #include <sigc++/sigc++.h>
 #include <msp/datafile/objectloader.h>
@@ -36,10 +37,10 @@ public:
                void beamgate();
                void clock();
                void route();
-               void signal(ArticleNumber);
-               void terrain(ArticleNumber);
-               void track(ArticleNumber);
-               void train(ArticleNumber, unsigned, const std::string &);
+               void signal(const std::string &);
+               void terrain(const std::string &);
+               void track(const std::string &);
+               void train(const std::string &, unsigned, const std::string &);
                void turnout(unsigned, unsigned);
                void zone();
        };
@@ -67,6 +68,14 @@ private:
                void del();
        };
 
+       struct BlockReservation
+       {
+               Block &block;
+               Train *train;
+
+               BlockReservation(Block &, Train *);
+       };
+
 public:
        typedef std::vector<Zone *> ZoneArray;
 
@@ -91,6 +100,8 @@ private:
        std::map<unsigned, Train *> trains;
        Msp::Time::TimeStamp last_tick;
        unsigned next_turnout_addr;
+       bool emitting_block_reserved;
+       std::deque<BlockReservation> block_reserve_queue;
 
 public:
        Layout(Catalogue &, Driver * = 0);
@@ -145,6 +156,7 @@ public:
        void save_dynamic(const std::string &) const;
 private:
        void sensor_state_changed(Sensor &, Sensor::State);
+       void block_reserved(Block &, Train *);
 };
 
 } // namespace R2C2