#ifndef _TRAFFIC_CONTROL_HXX_
#define _TRAFFIC_CONTROL_HXX_
-
-#ifndef __cplusplus
-# error This library requires C++
-#endif
+#include <Airports/airports_fwd.hxx>
#include <osg/Geode>
#include <osg/Geometry>
#include <simgear/structure/SGReferenced.hxx>
#include <simgear/structure/SGSharedPtr.hxx>
+class FGAIAircraft;
+typedef std::vector<FGAIAircraft*> AircraftVec;
+typedef std::vector<FGAIAircraft*>::iterator AircraftVecIterator;
-#include <string>
-#include <vector>
-#include <list>
-
-using std::string;
-using std::vector;
-using std::list;
+class FGAIFlightPlan;
+typedef std::vector<FGAIFlightPlan*> FlightPlanVec;
+typedef std::vector<FGAIFlightPlan*>::iterator FlightPlanVecIterator;
+typedef std::map<std::string, FlightPlanVec> FlightPlanVecMap;
+class FGTrafficRecord;
+typedef std::list<FGTrafficRecord> TrafficVector;
+typedef std::list<FGTrafficRecord>::iterator TrafficVectorIterator;
-typedef vector<int> intVec;
-typedef vector<int>::iterator intVecIterator;
+class ActiveRunway;
+typedef std::vector<ActiveRunway> ActiveRunwayVec;
+typedef std::vector<ActiveRunway>::iterator ActiveRunwayVecIterator;
-
-class FGAIFlightPlan; // forward reference
-class FGGroundNetwork; // forward reference
-class FGAIAircraft; // forward reference
-class FGAirportDynamics;
+typedef std::vector<int> intVec;
+typedef std::vector<int>::iterator intVecIterator;
/**************************************************************************************
* class FGATCInstruction
public:
FGATCInstruction();
- bool hasInstruction ();
- bool getHoldPattern () {
+ bool hasInstruction () const;
+ bool getHoldPattern () const {
return holdPattern;
};
- bool getHoldPosition () {
+ bool getHoldPosition () const {
return holdPosition;
};
- bool getChangeSpeed () {
+ bool getChangeSpeed () const {
return changeSpeed;
};
- bool getChangeHeading () {
+ bool getChangeHeading () const {
return changeHeading;
};
- bool getChangeAltitude() {
+ bool getChangeAltitude() const {
return changeAltitude;
};
- double getSpeed () {
+ double getSpeed () const {
return speed;
};
- double getHeading () {
+ double getHeading () const {
return heading;
};
- double getAlt () {
+ double getAlt () const {
return alt;
};
- bool getCheckForCircularWait() {
+ bool getCheckForCircularWait() const {
return resolveCircularWait;
};
intVec intentions;
FGATCInstruction instruction;
double latitude, longitude, heading, speed, altitude, radius;
- string runway;
+ std::string runway;
//FGAISchedule *trafficRef;
FGAIAircraft *aircraft;
radius = rad;
};
void setPositionAndIntentions(int pos, FGAIFlightPlan *route);
- void setRunway(string rwy) {
+ void setRunway(const std::string& rwy) {
runway = rwy;
};
void setLeg(int lg) {
int crosses (FGGroundNetwork *, FGTrafficRecord &other);
bool isOpposing (FGGroundNetwork *, FGTrafficRecord &other, int node);
- bool isActive(int margin);
+ bool isActive(int margin) const;
bool onRoute(FGGroundNetwork *, FGTrafficRecord &other);
- bool getSpeedAdjustment() {
+ bool getSpeedAdjustment() const {
return instruction.getChangeSpeed();
};
- double getLatitude () {
+ double getLatitude () const {
return latitude ;
};
- double getLongitude() {
+ double getLongitude() const {
return longitude;
};
- double getHeading () {
+ double getHeading () const {
return heading ;
};
- double getSpeed () {
+ double getSpeed () const {
return speed ;
};
- double getAltitude () {
+ double getAltitude () const {
return altitude ;
};
- double getRadius () {
+ double getRadius () const {
return radius ;
};
- int getWaitsForId () {
+ int getWaitsForId () const {
return waitsForId;
};
instruction.setChangeHeading(false);
};
- bool hasHeadingAdjustment() {
+ bool hasHeadingAdjustment() const {
return instruction.getChangeHeading();
};
- bool hasHoldPosition() {
+ bool hasHoldPosition() const {
return instruction.getHoldPosition();
};
void setHoldPosition (bool inst) {
instruction.setResolveCircularWait(false);
};
- string getRunway() {
+ const std::string& getRunway() const {
return runway;
};
//void setCallSign(string clsgn) { callsign = clsgn; };
allowTransmission=true;
};
//string getCallSign() { return callsign; };
- FGAIAircraft *getAircraft() {
+ FGAIAircraft *getAircraft() const {
return aircraft;
};
- int getTime() {
+ int getTime() const {
return timer;
};
- int getLeg() {
+ int getLeg() const {
return leg;
};
void setTime(time_t time) {
timer = time;
};
- bool pushBackAllowed();
- bool allowTransmissions() {
+ bool pushBackAllowed() const;
+ bool allowTransmissions() const {
return allowTransmission;
};
void allowPushBack() { allowPushback =true;};
void nextFrequency() {
frequencyId++;
};
- int getNextFrequency() {
+ int getNextFrequency() const {
return frequencyId;
};
intVec& getIntentions() {
return intentions;
};
- int getCurrentPosition() {
+ int getCurrentPosition() const {
return currentPos;
};
void setPriority(int p) { priority = p; };
- int getPriority() { return priority; };
+ int getPriority() const { return priority; };
};
-typedef list<FGTrafficRecord> TrafficVector;
-typedef list<FGTrafficRecord>::iterator TrafficVectorIterator;
-
-typedef vector<time_t> TimeVector;
-typedef vector<time_t>::iterator TimeVectorIterator;
-
-typedef vector<FGAIAircraft*> AircraftVec;
-typedef vector<FGAIAircraft*>::iterator AircraftVecIterator;
-
/***********************************************************************
* Active runway, a utility class to keep track of which aircraft has
* clearance for a given runway.
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 () {
void printDepartureCue();
};
-typedef vector<ActiveRunway> ActiveRunwayVec;
-typedef vector<ActiveRunway>::iterator ActiveRunwayVecIterator;
-
/**
* class FGATCController
* NOTE: this class serves as an abstraction layer for all sorts of ATC controllers.
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:
dt_count = dt;
};
void transmit(FGTrafficRecord *rec, FGAirportDynamics *parent, AtcMsgId msgId, AtcMsgDir msgDir, bool audible);
- string getGateName(FGAIAircraft *aircraft);
+ std::string getGateName(FGAIAircraft *aircraft);
virtual void render(bool) = 0;
- virtual string getName() = 0;
+ virtual std::string getName() = 0;
virtual void update(double) = 0;
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;
+ return ! activeTraffic.empty();
};
TrafficVector &getActiveTraffic() {
return activeTraffic;
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;
+ return ! activeTraffic.empty();
};
TrafficVector &getActiveTraffic() {
return activeTraffic;
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;
+ return ! activeTraffic.empty();
};
TrafficVector &getActiveTraffic() {
return activeTraffic;