]> git.mxchange.org Git - flightgear.git/blob - src/ATC/atislist.hxx
Attached is a reasonably large patch to add a proper ATC
[flightgear.git] / src / ATC / atislist.hxx
1 // atislist.hxx -- atis management class
2 //
3 // Written by David Luff, started October 2001.
4 // Based on navlist.hxx by Curtis Olson, started April 2000.
5 //
6 // Copyright (C) 2000  Curtis L. Olson - curt@flightgear.org
7 //
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 // General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
22
23 #ifndef _FG_ATISLIST_HXX
24 #define _FG_ATISLIST_HXX
25
26
27 #include <simgear/compiler.h>
28 #include <simgear/misc/sg_path.hxx>
29
30 #include <map>
31 #include <vector>
32 #include <string>
33
34 #include "atis.hxx"
35
36 SG_USING_STD(map);
37 SG_USING_STD(vector);
38 SG_USING_STD(string);
39
40
41 class FGATISList {
42
43     // convenience types
44     typedef vector < FGATIS > atis_list_type;
45     typedef atis_list_type::iterator atis_list_iterator;
46     typedef atis_list_type::const_iterator atis_list_const_iterator;
47
48     // typedef map < int, atis_list_type, less<int> > atis_map_type;
49     typedef map < int, atis_list_type > atis_map_type;
50     typedef atis_map_type::iterator atis_map_iterator;
51     typedef atis_map_type::const_iterator atis_map_const_iterator;
52
53     atis_map_type atislist;
54
55     // Add structure and map for storing a log of atis transmissions
56     // made in this session of FlightGear.  This allows the callsign
57     // to be allocated correctly wrt time.
58     typedef struct {
59         int hours;
60         int mins;
61         int callsign;
62     } atis_transmission_type;
63
64     typedef map < string, atis_transmission_type > atis_log_type;
65     typedef atis_log_type::iterator atis_log_iterator;
66     typedef atis_log_type::const_iterator atis_log_const_iterator;
67
68     atis_log_type atislog;
69
70 public:
71
72     FGATISList();
73     ~FGATISList();
74
75     // load all atis and build the map
76     bool init( SGPath path );
77
78     // query the database for the specified frequency, lon and lat are
79     // in degrees, elev is in meters
80     bool query( double lon, double lat, double elev, double freq, FGATIS *a );
81
82     // Return the callsign for a transmission given transmission time and airpord id
83     int GetCallSign( string apt_id, int hours, int mins );
84 };
85
86
87 extern FGATISList *current_atislist;
88
89
90 #endif // _FG_ATISLIST_HXX