1
0
Fork 0

std namespace fixes in headers.

This commit is contained in:
James Turner 2012-09-24 08:39:30 +01:00
parent 59f6f330c2
commit fd99e9fdfb
5 changed files with 40 additions and 48 deletions

View file

@ -52,6 +52,7 @@
#include <signal.h> #include <signal.h>
using std::sort; using std::sort;
using std::string;
/*************************************************************************** /***************************************************************************
* ActiveRunway * ActiveRunway
@ -768,7 +769,7 @@ string FGATCController::formatATCFrequency3_2(int freq)
// TODO: Set transponder codes according to real-world routes. // TODO: Set transponder codes according to real-world routes.
// The current version just returns a random string of four octal numbers. // The current version just returns a random string of four octal numbers.
string FGATCController::genTransponderCode(string fltRules) string FGATCController::genTransponderCode(const string& fltRules)
{ {
if (fltRules == "VFR") { if (fltRules == "VFR") {
return string("1200"); return string("1200");
@ -1687,7 +1688,7 @@ FGATCInstruction FGApproachController::getInstruction(int id)
} }
ActiveRunway *FGApproachController::getRunway(string name) ActiveRunway *FGApproachController::getRunway(const string& name)
{ {
ActiveRunwayVecIterator rwy = activeRunways.begin(); ActiveRunwayVecIterator rwy = activeRunways.begin();
if (activeRunways.size()) { if (activeRunways.size()) {

View file

@ -21,10 +21,9 @@
#ifndef _TRAFFIC_CONTROL_HXX_ #ifndef _TRAFFIC_CONTROL_HXX_
#define _TRAFFIC_CONTROL_HXX_ #define _TRAFFIC_CONTROL_HXX_
#include <string>
#ifndef __cplusplus #include <vector>
# error This library requires C++ #include <list>
#endif
#include <osg/Geode> #include <osg/Geode>
#include <osg/Geometry> #include <osg/Geometry>
@ -38,18 +37,8 @@
#include <simgear/structure/SGReferenced.hxx> #include <simgear/structure/SGReferenced.hxx>
#include <simgear/structure/SGSharedPtr.hxx> #include <simgear/structure/SGSharedPtr.hxx>
typedef std::vector<int> intVec;
#include <string> typedef std::vector<int>::iterator intVecIterator;
#include <vector>
#include <list>
using std::string;
using std::vector;
using std::list;
typedef vector<int> intVec;
typedef vector<int>::iterator intVecIterator;
class FGAIFlightPlan; // forward reference class FGAIFlightPlan; // forward reference
@ -162,7 +151,7 @@ private:
intVec intentions; intVec intentions;
FGATCInstruction instruction; FGATCInstruction instruction;
double latitude, longitude, heading, speed, altitude, radius; double latitude, longitude, heading, speed, altitude, radius;
string runway; std::string runway;
//FGAISchedule *trafficRef; //FGAISchedule *trafficRef;
FGAIAircraft *aircraft; FGAIAircraft *aircraft;
@ -177,7 +166,7 @@ public:
radius = rad; radius = rad;
}; };
void setPositionAndIntentions(int pos, FGAIFlightPlan *route); void setPositionAndIntentions(int pos, FGAIFlightPlan *route);
void setRunway(string rwy) { void setRunway(const std::string& rwy) {
runway = rwy; runway = rwy;
}; };
void setLeg(int lg) { void setLeg(int lg) {
@ -264,7 +253,7 @@ public:
instruction.setResolveCircularWait(false); instruction.setResolveCircularWait(false);
}; };
string getRunway() { const std::string& getRunway() {
return runway; return runway;
}; };
//void setCallSign(string clsgn) { callsign = clsgn; }; //void setCallSign(string clsgn) { callsign = clsgn; };
@ -317,14 +306,14 @@ public:
int getPriority() { return priority; }; int getPriority() { return priority; };
}; };
typedef list<FGTrafficRecord> TrafficVector; typedef std::list<FGTrafficRecord> TrafficVector;
typedef list<FGTrafficRecord>::iterator TrafficVectorIterator; typedef std::list<FGTrafficRecord>::iterator TrafficVectorIterator;
typedef vector<time_t> TimeVector; typedef std::vector<time_t> TimeVector;
typedef vector<time_t>::iterator TimeVectorIterator; typedef std::vector<time_t>::iterator TimeVectorIterator;
typedef vector<FGAIAircraft*> AircraftVec; typedef std::vector<FGAIAircraft*> AircraftVec;
typedef vector<FGAIAircraft*>::iterator AircraftVecIterator; typedef std::vector<FGAIAircraft*>::iterator AircraftVecIterator;
/*********************************************************************** /***********************************************************************
* Active runway, a utility class to keep track of which aircraft has * Active runway, a utility class to keep track of which aircraft has
@ -333,20 +322,20 @@ typedef vector<FGAIAircraft*>::iterator AircraftVecIterator;
class ActiveRunway class ActiveRunway
{ {
private: private:
string rwy; std::string rwy;
int currentlyCleared; int currentlyCleared;
double distanceToFinal; double distanceToFinal;
TimeVector estimatedArrivalTimes; TimeVector estimatedArrivalTimes;
AircraftVec departureCue; AircraftVec departureCue;
public: public:
ActiveRunway(string r, int cc) { ActiveRunway(const std::string& r, int cc) {
rwy = r; rwy = r;
currentlyCleared = cc; currentlyCleared = cc;
distanceToFinal = 6.0 * SG_NM_TO_METER; distanceToFinal = 6.0 * SG_NM_TO_METER;
}; };
string getRunwayName() { std::string getRunwayName() {
return rwy; return rwy;
}; };
int getCleared () { int getCleared () {
@ -379,8 +368,8 @@ public:
void printDepartureCue(); void printDepartureCue();
}; };
typedef vector<ActiveRunway> ActiveRunwayVec; typedef std::vector<ActiveRunway> ActiveRunwayVec;
typedef vector<ActiveRunway>::iterator ActiveRunwayVecIterator; typedef std::vector<ActiveRunway>::iterator ActiveRunwayVecIterator;
/** /**
* class FGATCController * class FGATCController
@ -399,8 +388,8 @@ protected:
double dt_count; double dt_count;
osg::Group* group; osg::Group* group;
string formatATCFrequency3_2(int ); std::string formatATCFrequency3_2(int );
string genTransponderCode(string fltRules); std::string genTransponderCode(const std::string& fltRules);
bool isUserAircraft(FGAIAircraft*); bool isUserAircraft(FGAIAircraft*);
public: public:
@ -454,9 +443,9 @@ public:
dt_count = dt; dt_count = dt;
}; };
void transmit(FGTrafficRecord *rec, FGAirportDynamics *parent, AtcMsgId msgId, AtcMsgDir msgDir, bool audible); 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 void render(bool) = 0;
virtual string getName() = 0; virtual std::string getName() = 0;
virtual void update(double) = 0; virtual void update(double) = 0;
@ -490,7 +479,7 @@ public:
virtual FGATCInstruction getInstruction(int id); virtual FGATCInstruction getInstruction(int id);
virtual void render(bool); virtual void render(bool);
virtual string getName(); virtual std::string getName();
virtual void update(double dt); virtual void update(double dt);
bool hasActiveTraffic() { bool hasActiveTraffic() {
return activeTraffic.size() != 0; return activeTraffic.size() != 0;
@ -526,7 +515,7 @@ public:
virtual FGATCInstruction getInstruction(int id); virtual FGATCInstruction getInstruction(int id);
virtual void render(bool); virtual void render(bool);
virtual string getName(); virtual std::string getName();
virtual void update(double dt); virtual void update(double dt);
bool hasActiveTraffic() { bool hasActiveTraffic() {
@ -566,10 +555,10 @@ public:
virtual FGATCInstruction getInstruction(int id); virtual FGATCInstruction getInstruction(int id);
virtual void render(bool); virtual void render(bool);
virtual string getName(); virtual std::string getName();
virtual void update(double dt); virtual void update(double dt);
ActiveRunway* getRunway(string name); ActiveRunway* getRunway(const std::string& name);
bool hasActiveTraffic() { bool hasActiveTraffic() {
return activeTraffic.size() != 0; return activeTraffic.size() != 0;

View file

@ -9,6 +9,7 @@
#include <Scenery/scenery.hxx> #include <Scenery/scenery.hxx>
using std::sort; using std::sort;
using std::string;
/***************************************************************************** /*****************************************************************************
* Helper function for parsing position string * Helper function for parsing position string

View file

@ -53,6 +53,7 @@
#include "groundnetwork.hxx" #include "groundnetwork.hxx"
using std::string;
/*************************************************************************** /***************************************************************************
* FGTaxiSegment * FGTaxiSegment

View file

@ -47,8 +47,8 @@ class FGTaxiSegment; // forward reference
class FGAIFlightPlan; // forward reference class FGAIFlightPlan; // forward reference
class FGAirport; // forward reference class FGAirport; // forward reference
typedef vector<FGTaxiSegment*> FGTaxiSegmentVector; typedef std::vector<FGTaxiSegment*> FGTaxiSegmentVector;
typedef vector<FGTaxiSegment*>::iterator FGTaxiSegmentVectorIterator; typedef std::vector<FGTaxiSegment*>::iterator FGTaxiSegmentVectorIterator;
//typedef vector<FGTaxiSegment*> FGTaxiSegmentPointerVector; //typedef vector<FGTaxiSegment*> FGTaxiSegmentPointerVector;
//typedef vector<FGTaxiSegment*>::iterator FGTaxiSegmentPointerVectorIterator; //typedef vector<FGTaxiSegment*>::iterator FGTaxiSegmentPointerVectorIterator;
@ -69,7 +69,7 @@ public:
bool operator< (const Block &other) const { return blocktime < other.blocktime; }; bool operator< (const Block &other) const { return blocktime < other.blocktime; };
}; };
typedef vector<Block> BlockList; typedef std::vector<Block> BlockList;
typedef BlockList::iterator BlockListIterator; typedef BlockList::iterator BlockListIterator;
/*************************************************************************************** /***************************************************************************************
@ -213,8 +213,8 @@ public:
typedef vector<int> intVec; typedef std::vector<int> intVec;
typedef vector<int>::iterator intVecIterator; typedef std::vector<int>::iterator intVecIterator;
@ -289,8 +289,8 @@ public:
// int getDepth() { return depth; }; // int getDepth() { return depth; };
}; };
typedef vector<FGTaxiRoute> TaxiRouteVector; typedef std::vector<FGTaxiRoute> TaxiRouteVector;
typedef vector<FGTaxiRoute>::iterator TaxiRouteVectorIterator; typedef std::vector<FGTaxiRoute>::iterator TaxiRouteVectorIterator;
/************************************************************************************** /**************************************************************************************
* class FGGroundNetWork * class FGGroundNetWork
@ -377,7 +377,7 @@ public:
AtcMsgDir msgDir); AtcMsgDir msgDir);
bool checkForCircularWaits(int id); bool checkForCircularWaits(int id);
virtual void render(bool); virtual void render(bool);
virtual string getName(); virtual std::string getName();
virtual void update(double dt); virtual void update(double dt);
void saveElevationCache(); void saveElevationCache();