1 /* -*- Mode: C++ -*- *****************************************************
3 * Written by Durk Talsma. Started May 5, 2004
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.
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.
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.
20 **************************************************************************/
22 /**************************************************************************
23 * This file contains the class definitions for a (Top Level) traffic
24 * manager for FlightGear.
25 **************************************************************************/
27 #ifndef _TRAFFICMGR_HXX_
28 #define _TRAFFICMGR_HXX_
30 #include <simgear/structure/subsystem_mgr.hxx>
31 #include <simgear/xml/easyxml.hxx>
33 #include "SchedFlight.hxx"
34 #include "Schedule.hxx"
37 typedef vector<int> IdList;
38 typedef vector<int>::iterator IdListIterator;
41 class FGTrafficManager : public SGSubsystem, public XMLVisitor
44 ScheduleVector scheduledAircraft;
45 ScheduleVectorIterator currAircraft, currAircraftClosest;
46 vector<string> elementValueStack;
48 string mdl, livery, registration, callsign, fltrules,
49 port, timeString, departurePort, departureTime, arrivalPort, arrivalTime,
50 repeat, acType, airline, m_class, flighttype;
53 double radius, offset;
58 FGScheduledFlightVec flights;
64 void update(double time);
65 void release(int ref);
66 bool isReleased(int id);
68 // Some overloaded virtual XMLVisitor members
69 virtual void startXML ();
70 virtual void endXML ();
71 virtual void startElement (const char * name, const XMLAttributes &atts);
72 virtual void endElement (const char * name);
73 virtual void data (const char * s, int len);
74 virtual void pi (const char * target, const char * data);
75 virtual void warning (const char * message, int line, int column);
76 virtual void error (const char * message, int line, int column);