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>
41 #ifdef SG_HAVE_STD_INCLUDES
43 #elif defined( FG_HAVE_NATIVE_SGI_COMPILERS )
44 # include <iostream.h>
45 #elif defined( __BORLANDC__ )
55 # define NDEBUG // she don't work without it.
66 #if ! defined( FG_HAVE_NATIVE_SGI_COMPILERS )
67 FG_USING_STD(istream);
75 FGAirport( const string& name = "",
79 : id(name), longitude(lon), latitude(lat), elevation(ele) {}
81 bool operator < ( const FGAirport& a ) const {
95 operator >> ( istream& in, FGAirport& a )
97 return in >> a.id >> a.latitude >> a.longitude >> a.elevation;
111 FGAirports( const string& file );
116 // search for the specified id.
117 // Returns true if successful, otherwise returns false.
118 // On success, airport data is returned thru "airport" pointer.
119 // "airport" is not changed if "apt" is not found.
120 bool search( const string& id, FGAirport* airport ) const;
121 FGAirport search( const string& id ) const;
125 class FGAirportsUtil {
127 #ifdef FG_NO_DEFAULT_TEMPLATE_ARGS
128 typedef set< FGAirport, less< FGAirport > > container;
130 typedef set< FGAirport > container;
132 typedef container::iterator iterator;
133 typedef container::const_iterator const_iterator;
147 int load( const string& file );
149 // save the data in metakit format
150 bool dump_mk4( const string& file );
152 // search for the specified id.
153 // Returns true if successful, otherwise returns false.
154 // On success, airport data is returned thru "airport" pointer.
155 // "airport" is not changed if "id" is not found.
156 bool search( const string& id, FGAirport* airport ) const;
157 FGAirport search( const string& id ) const;
161 #endif // _SIMPLE_HXX