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 FG_HAVE_STD_INCLUDES
43 #elif defined( FG_HAVE_NATIVE_SGI_COMPILERS )
44 # include <iostream.h>
45 #elif defined( __BORLANDC__ )
54 #define NDEBUG // she don't work without it.
62 #if ! defined( FG_HAVE_NATIVE_SGI_COMPILERS )
63 FG_USING_STD(istream);
71 FGAirport( const string& name = "",
75 : id(name), longitude(lon), latitude(lat), elevation(ele) {}
77 bool operator < ( const FGAirport& a ) const {
91 operator >> ( istream& in, FGAirport& a )
93 return in >> a.id >> a.longitude >> a.latitude >> a.elevation;
107 FGAirports( const string& file );
112 // search for the specified id.
113 // Returns true if successful, otherwise returns false.
114 // On success, airport data is returned thru "airport" pointer.
115 // "airport" is not changed if "apt" is not found.
116 bool search( const string& id, FGAirport* airport ) const;
117 FGAirport search( const string& id ) const;
121 class FGAirportsUtil {
123 #ifdef FG_NO_DEFAULT_TEMPLATE_ARGS
124 typedef set< FGAirport, less< FGAirport > > container;
126 typedef set< FGAirport > container;
128 typedef container::iterator iterator;
129 typedef container::const_iterator const_iterator;
143 int load( const string& file );
145 // save the data in metakit format
146 bool dump_mk4( const string& file );
148 // search for the specified id.
149 // Returns true if successful, otherwise returns false.
150 // On success, airport data is returned thru "airport" pointer.
151 // "airport" is not changed if "id" is not found.
152 bool search( const string& id, FGAirport* airport ) const;
153 FGAirport search( const string& id ) const;
157 #endif // _SIMPLE_HXX