]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/groundnetwork.hxx
Expose more things to Nasal for FMSs in particular - still work in progress.
[flightgear.git] / src / Airports / groundnetwork.hxx
index c80829a3b65d1a6c5ed89ead027b42b74a67ddaf..78f1282d6d1b35ba298519e43afd404c32fb5f80 100644 (file)
 
 #include <string>
 #include <vector>
+#include <list>
 
+class Block;
 using std::string;
 using std::vector;
+using std::list;
 
 #include "gnnode.hxx"
 #include "parking.hxx"
@@ -54,6 +57,25 @@ typedef vector<FGTaxiSegment*>::iterator FGTaxiSegmentVectorIterator;
 //typedef vector<FGTaxiSegment*> FGTaxiSegmentPointerVector;
 //typedef vector<FGTaxiSegment*>::iterator FGTaxiSegmentPointerVectorIterator;
 
+class Block
+{
+private:
+    int id;
+    time_t blocktime;
+    time_t touch;
+public:
+    Block(int i, time_t bt, time_t curr) { id = i; blocktime= bt; touch = curr; };
+    ~Block() {};
+    int getId() { return id; };
+    void updateTimeStamps(time_t bt, time_t now) { blocktime = (bt < blocktime) ? bt : blocktime; touch = now; };
+    const time_t getBlockTime() const { return blocktime; };
+    time_t getTimeStamp() { return touch; };
+    bool operator< (const Block &other) const { return blocktime < other.blocktime; };
+};
+
+typedef vector<Block> BlockList;
+typedef BlockList::iterator BlockListIterator;
+
 /***************************************************************************************
  * class FGTaxiSegment
  **************************************************************************************/
@@ -67,7 +89,7 @@ private:
     SGGeod center;
     bool isActive;
     bool isPushBackRoute;
-    bool isBlocked;
+    BlockList blockTimes;
     FGTaxiNode *start;
     FGTaxiNode *end;
     int index;
@@ -83,7 +105,6 @@ public:
             heading(0),
             isActive(0),
             isPushBackRoute(0),
-            isBlocked(0),
             start(0),
             end(0),
             index(0),
@@ -99,7 +120,7 @@ public:
             center            (other.center),
             isActive          (other.isActive),
             isPushBackRoute   (other.isPushBackRoute),
-            isBlocked         (other.isBlocked),
+            blockTimes        (other.blockTimes),
             start             (other.start),
             end               (other.end),
             index             (other.index),
@@ -116,7 +137,7 @@ public:
         center             = other.center;
         isActive           = other.isActive;
         isPushBackRoute    = other.isPushBackRoute;
-        isBlocked          = other.isBlocked;
+        blockTimes         = other.blockTimes;
         start              = other.start;
         end                = other.end;
         index              = other.index;
@@ -144,15 +165,9 @@ public:
         isPushBackRoute = val;
     };
     void setDimensions(double elevation);
-    void block() {
-        isBlocked = true;
-    }
-    void unblock() {
-        isBlocked = false;
-    };
-    bool hasBlock() {
-        return isBlocked;
-    };
+    void block(int id, time_t blockTime, time_t now);
+    void unblock(time_t now); 
+    bool hasBlock(time_t now);
 
     FGTaxiNode * getEnd() {
         return end;