]> git.mxchange.org Git - flightgear.git/blob - src/Traffic/TrafficMgr.hxx
new FSF address
[flightgear.git] / src / Traffic / TrafficMgr.hxx
1 /* -*- Mode: C++ -*- *****************************************************
2  * TrafficMgr.hxx
3  * Written by Durk Talsma. Started May 5, 2004
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of the
8  * License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18  *
19  *
20  **************************************************************************/
21
22 /**************************************************************************
23  * This file contains the class definitions for a (Top Level) traffic
24  * manager for FlightGear. 
25  **************************************************************************/
26
27 #ifndef _TRAFFICMGR_HXX_
28 #define _TRAFFICMGR_HXX_
29
30 #include <simgear/structure/subsystem_mgr.hxx>
31 #include <simgear/xml/easyxml.hxx>
32
33 #include "SchedFlight.hxx"
34 #include "Schedule.hxx"
35
36
37 typedef vector<int> IdList;
38 typedef vector<int>::iterator IdListIterator;
39
40
41 class FGTrafficManager : public SGSubsystem, public XMLVisitor
42 {
43 private:
44   ScheduleVector scheduledAircraft;
45   ScheduleVectorIterator currAircraft, currAircraftClosest;
46   string value;
47
48   string mdl, livery, registration, callsign, fltrules, 
49     port, timeString, departurePort, departureTime, arrivalPort, arrivalTime,
50     repeat, acType, airline, m_class, flighttype;
51   int cruiseAlt;
52   double radius, offset;
53   bool heavy;
54
55   IdList releaseList;
56     
57   FGScheduledFlightVec flights;
58
59 public:
60   FGTrafficManager();
61   
62   void init();
63   void update(double time);
64   void release(int ref);
65   bool isReleased(int id);
66
67   // Some overloaded virtual XMLVisitor members
68   virtual void startXML (); 
69   virtual void endXML   ();
70   virtual void startElement (const char * name, const XMLAttributes &atts);
71   virtual void endElement (const char * name);
72   virtual void data (const char * s, int len);
73   virtual void pi (const char * target, const char * data);
74   virtual void warning (const char * message, int line, int column);
75   virtual void error (const char * message, int line, int column);
76 };
77
78 #endif