]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/runwayprefs.hxx
commradio: improvements for atis speech
[flightgear.git] / src / Airports / runwayprefs.hxx
index e45a057ea1db88fd8d14d2939a816e87406a933e..7e2eced2f39ead331c71b76cc060f2ef73e298e1 100644 (file)
 #ifndef _RUNWAYPREFS_HXX_
 #define _RUNWAYPREFS_HXX_
 
-#include <simgear/xml/easyxml.hxx>
+#include "airports_fwd.hxx"
 
-typedef vector<time_t> timeVec;
-typedef vector<time_t>::const_iterator timeVecConstIterator;
+#include <simgear/compiler.h>
+#include <time.h>
 
-typedef vector<string> stringVec;
-typedef vector<string>::iterator stringVecIterator;
-typedef vector<string>::const_iterator stringVecConstIterator;
+typedef std::vector<time_t> timeVec;
+typedef std::vector<time_t>::const_iterator timeVecConstIterator;
+
+typedef std::vector<std::string> stringVec;
+typedef std::vector<std::string>::iterator stringVecIterator;
+typedef std::vector<std::string>::const_iterator stringVecConstIterator;
 
 
 /***************************************************************************/
@@ -46,12 +49,12 @@ public:
   ScheduleTime() : tailWind(0), crssWind(0) {};
   ScheduleTime(const ScheduleTime &other);
   ScheduleTime &operator= (const ScheduleTime &other);
-  string getName(time_t dayStart);
+  std::string getName(time_t dayStart);
 
   void clear();
   void addStartTime(time_t time)     { start.push_back(time);            };
   void addEndTime  (time_t time)     { end.  push_back(time);            };
-  void addScheduleName(const string& sched) { scheduleNames.push_back(sched);   };
+  void addScheduleName(const std::string& sched) { scheduleNames.push_back(sched);   };
   void setTailWind(double wnd)  { tailWind = wnd;                        };
   void setCrossWind(double wnd) { tailWind = wnd;                        };
 
@@ -65,95 +68,85 @@ public:
 class RunwayList
 {
 private:
-  string type;
+  std::string type;
   stringVec preferredRunways;
 public:
   RunwayList() {};
   RunwayList(const RunwayList &other);
   RunwayList& operator= (const RunwayList &other);
 
-  void set(const string&, const string&);
+  void set(const std::string&, const std::string&);
   void clear();
 
-  string getType() { return type; };
+  std::string getType() { return type; };
   stringVec *getRwyList() { return &preferredRunways;    };
-  string getRwyList(int j) { return preferredRunways[j]; };
+  std::string getRwyList(int j) { return preferredRunways[j]; };
 };
 
-typedef vector<RunwayList> RunwayListVec;
-typedef vector<RunwayList>::iterator RunwayListVectorIterator;
-typedef vector<RunwayList>::const_iterator RunwayListVecConstIterator;
-
-
 /*****************************************************************************/
 
 class RunwayGroup
 {
 private:
-  string name;
+  std::string name;
   RunwayListVec rwyList;
   int active;
   //stringVec runwayNames;
   int choice[2];
   int nrActive;
+
 public:
   RunwayGroup() {};
   RunwayGroup(const RunwayGroup &other);
   RunwayGroup &operator= (const RunwayGroup &other);
 
-  void setName(const string& nm) { name = nm;                };
+  void setName(const std::string& nm) { name = nm;                };
   void add(const RunwayList& list) { rwyList.push_back(list);};
-  void setActive(const string& aptId, double windSpeed, double windHeading, double maxTail, double maxCross);
+  void setActive(const FGAirport* airport, double windSpeed, double windHeading, double maxTail, double maxCross, stringVec *curr);
 
   int getNrActiveRunways() { return nrActive;};
-  void getActive(int i, string& name, string& type);
+  void getActive(int i, std::string& name, std::string& type);
 
-  string getName() { return name; };
+  std::string getName() { return name; };
   void clear() { rwyList.clear(); }; 
   //void add(string, string);
 };
 
-typedef vector<RunwayGroup> PreferenceList;
-typedef vector<RunwayGroup>::iterator PreferenceListIterator;
-typedef vector<RunwayGroup>::const_iterator PreferenceListConstIterator;
-
 /******************************************************************************/
 
-class FGRunwayPreference  : public XMLVisitor {
+class FGRunwayPreference {
 private:
-  string value;
-  string scheduleName;
+  FGAirport* _ap;
 
   ScheduleTime comTimes; // Commercial Traffic;
   ScheduleTime genTimes; // General Aviation;
   ScheduleTime milTimes; // Military Traffic;
-  ScheduleTime currTimes; // Needed for parsing;
+  ScheduleTime ulTimes;  // Ultralight Traffic
 
-  RunwayList  rwyList;
-  RunwayGroup rwyGroup;
   PreferenceList preferences;
-
-  time_t processTime(const string&);
+  
   bool initialized;
 
 public:
-  FGRunwayPreference();
+  FGRunwayPreference(FGAirport* ap);
   FGRunwayPreference(const FGRunwayPreference &other);
   
   FGRunwayPreference & operator= (const FGRunwayPreference &other);
+
   ScheduleTime *getSchedule(const char *trafficType);
-  RunwayGroup *getGroup(const string& groupName);
+  RunwayGroup *getGroup(const std::string& groupName);
+
+  std::string getId();
+
   bool available() { return initialized; };
+  void setInitialized(bool state) { initialized = state; };
+
+  void setMilTimes(ScheduleTime& t) { milTimes = t; };
+  void setGenTimes(ScheduleTime& t) { genTimes = t; };
+  void setComTimes(ScheduleTime& t) { comTimes = t; };
+  void setULTimes (ScheduleTime& t) { ulTimes  = t; };
 
- // Some overloaded virtual XMLVisitor members
-  virtual void startXML (); 
-  virtual void endXML   ();
-  virtual void startElement (const char * name, const XMLAttributes &atts);
-  virtual void endElement (const char * name);
-  virtual void data (const char * s, int len);
-  virtual void pi (const char * target, const char * data);
-  virtual void warning (const char * message, int line, int column);
-  virtual void error (const char * message, int line, int column);
+  void addRunwayGroup(RunwayGroup& g) { preferences.push_back(g); };
 };
 
 #endif