1 // simple.hxx -- a really simplistic class to manage airport ID,
2 // lat, lon of the center of one of it's runways, and
5 // Written by Curtis Olson, started April 1998.
7 // Copyright (C) 1998 Curtis L. Olson - curt@me.umn.edu
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License as
11 // published by the Free Software Foundation; either version 2 of the
12 // License, or (at your option) any later version.
14 // This program is distributed in the hope that it will be useful, but
15 // WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // General Public License for more details.
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the Free Software
21 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
31 # error This library requires C++
39 #include <simgear/compiler.h>
44 // Forward declarations.
55 FGAirport( const string& name = "",
59 : id(name), longitude(lon), latitude(lat), elevation(ele) {}
61 bool operator < ( const FGAirport& a ) const {
85 FGAirports( const string& file );
90 // search for the specified id.
91 // Returns true if successful, otherwise returns false.
92 // On success, airport data is returned thru "airport" pointer.
93 // "airport" is not changed if "apt" is not found.
94 bool search( const string& id, FGAirport* airport ) const;
95 FGAirport search( const string& id ) const;
99 class FGAirportsUtil {
101 #ifdef SG_NO_DEFAULT_TEMPLATE_ARGS
102 typedef set< FGAirport, less< FGAirport > > container;
104 typedef set< FGAirport > container;
106 typedef container::iterator iterator;
107 typedef container::const_iterator const_iterator;
121 int load( const string& file );
123 // save the data in metakit format
124 bool dump_mk4( const string& file );
126 // search for the specified id.
127 // Returns true if successful, otherwise returns false.
128 // On success, airport data is returned thru "airport" pointer.
129 // "airport" is not changed if "id" is not found.
130 bool search( const string& id, FGAirport* airport ) const;
131 FGAirport search( const string& id ) const;
135 #endif // _SIMPLE_HXX