#include <string>
#include <vector>
+#include <list>
+class Block;
using std::string;
using std::vector;
+using std::list;
#include "gnnode.hxx"
#include "parking.hxx"
//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
**************************************************************************************/
SGGeod center;
bool isActive;
bool isPushBackRoute;
- time_t isBlocked;
+ BlockList blockTimes;
FGTaxiNode *start;
FGTaxiNode *end;
int index;
heading(0),
isActive(0),
isPushBackRoute(0),
- isBlocked(0),
start(0),
end(0),
index(0),
center (other.center),
isActive (other.isActive),
isPushBackRoute (other.isPushBackRoute),
- isBlocked (other.isBlocked),
+ blockTimes (other.blockTimes),
start (other.start),
end (other.end),
index (other.index),
center = other.center;
isActive = other.isActive;
isPushBackRoute = other.isPushBackRoute;
- isBlocked = other.isBlocked;
+ blockTimes = other.blockTimes;
start = other.start;
end = other.end;
index = other.index;
isPushBackRoute = val;
};
void setDimensions(double elevation);
- void block(time_t time) {
- if (isBlocked) {
- if (time < isBlocked) {
- isBlocked = time;
- }
- } else {
- isBlocked = time;
- }
- }
- void unblock(time_t now) {
- if ((now - isBlocked) > 60)
- isBlocked = 0;
- };
- bool hasBlock(time_t now) {
- return isBlocked ? (isBlocked < now) : 0;
- };
+ void block(int id, time_t blockTime, time_t now);
+ void unblock(time_t now);
+ bool hasBlock(time_t now);
FGTaxiNode * getEnd() {
return end;