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