X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FATC%2Ftrafficcontrol.hxx;h=26d40001584a387deb96fdfceac1a307dc46ba99;hb=7c8ad455a327276e09687b380fb4147ae90b6c8c;hp=e4ce4c6bb8e2a9be7289f0b5f38ab673fb2756c5;hpb=4640f5bb025f2466184083803a31dc0b742f3d9c;p=flightgear.git diff --git a/src/ATC/trafficcontrol.hxx b/src/ATC/trafficcontrol.hxx index e4ce4c6bb..26d400015 100644 --- a/src/ATC/trafficcontrol.hxx +++ b/src/ATC/trafficcontrol.hxx @@ -21,10 +21,9 @@ #ifndef _TRAFFIC_CONTROL_HXX_ #define _TRAFFIC_CONTROL_HXX_ - -#ifndef __cplusplus -# error This library requires C++ -#endif +#include +#include +#include #include #include @@ -38,18 +37,8 @@ #include #include - -#include -#include -#include - -using std::string; -using std::vector; -using std::list; - - -typedef vector intVec; -typedef vector::iterator intVecIterator; +typedef std::vector intVec; +typedef std::vector::iterator intVecIterator; class FGAIFlightPlan; // forward reference @@ -162,7 +151,7 @@ private: intVec intentions; FGATCInstruction instruction; double latitude, longitude, heading, speed, altitude, radius; - string runway; + std::string runway; //FGAISchedule *trafficRef; FGAIAircraft *aircraft; @@ -177,7 +166,7 @@ public: radius = rad; }; void setPositionAndIntentions(int pos, FGAIFlightPlan *route); - void setRunway(string rwy) { + void setRunway(const std::string& rwy) { runway = rwy; }; void setLeg(int lg) { @@ -264,7 +253,7 @@ public: instruction.setResolveCircularWait(false); }; - string getRunway() { + const std::string& getRunway() { return runway; }; //void setCallSign(string clsgn) { callsign = clsgn; }; @@ -317,14 +306,14 @@ public: int getPriority() { return priority; }; }; -typedef list TrafficVector; -typedef list::iterator TrafficVectorIterator; +typedef std::list TrafficVector; +typedef std::list::iterator TrafficVectorIterator; -typedef vector TimeVector; -typedef vector::iterator TimeVectorIterator; +typedef std::vector TimeVector; +typedef std::vector::iterator TimeVectorIterator; -typedef vector AircraftVec; -typedef vector::iterator AircraftVecIterator; +typedef std::vector AircraftVec; +typedef std::vector::iterator AircraftVecIterator; /*********************************************************************** * Active runway, a utility class to keep track of which aircraft has @@ -333,20 +322,20 @@ typedef vector::iterator AircraftVecIterator; class ActiveRunway { private: - string rwy; + std::string rwy; int currentlyCleared; double distanceToFinal; TimeVector estimatedArrivalTimes; AircraftVec departureCue; public: - ActiveRunway(string r, int cc) { + ActiveRunway(const std::string& r, int cc) { rwy = r; currentlyCleared = cc; distanceToFinal = 6.0 * SG_NM_TO_METER; }; - string getRunwayName() { + std::string getRunwayName() { return rwy; }; int getCleared () { @@ -372,13 +361,15 @@ public: FGAIAircraft* getFirstAircraftInDepartureCue() { return departureCue.size() ? *(departureCue.begin()) : NULL; }; + FGAIAircraft* getFirstOfStatus(int stat); void updateDepartureCue() { departureCue.erase(departureCue.begin()); } + void printDepartureCue(); }; -typedef vector ActiveRunwayVec; -typedef vector::iterator ActiveRunwayVecIterator; +typedef std::vector ActiveRunwayVec; +typedef std::vector::iterator ActiveRunwayVecIterator; /** * class FGATCController @@ -397,8 +388,8 @@ protected: double dt_count; osg::Group* group; - string formatATCFrequency3_2(int ); - string genTransponderCode(string fltRules); + std::string formatATCFrequency3_2(int ); + std::string genTransponderCode(const std::string& fltRules); bool isUserAircraft(FGAIAircraft*); public: @@ -451,10 +442,10 @@ public: void setDt(double dt) { dt_count = dt; }; - void transmit(FGTrafficRecord *rec, AtcMsgId msgId, AtcMsgDir msgDir, bool audible); - string getGateName(FGAIAircraft *aircraft); + void transmit(FGTrafficRecord *rec, FGAirportDynamics *parent, AtcMsgId msgId, AtcMsgDir msgDir, bool audible); + std::string getGateName(FGAIAircraft *aircraft); virtual void render(bool) = 0; - virtual string getName() = 0; + virtual std::string getName() = 0; virtual void update(double) = 0; @@ -488,7 +479,7 @@ public: virtual FGATCInstruction getInstruction(int id); virtual void render(bool); - virtual string getName(); + virtual std::string getName(); virtual void update(double dt); bool hasActiveTraffic() { return activeTraffic.size() != 0; @@ -524,7 +515,7 @@ public: virtual FGATCInstruction getInstruction(int id); virtual void render(bool); - virtual string getName(); + virtual std::string getName(); virtual void update(double dt); bool hasActiveTraffic() { @@ -564,10 +555,10 @@ public: virtual FGATCInstruction getInstruction(int id); virtual void render(bool); - virtual string getName(); + virtual std::string getName(); virtual void update(double dt); - ActiveRunway* getRunway(string name); + ActiveRunway* getRunway(const std::string& name); bool hasActiveTraffic() { return activeTraffic.size() != 0;