while ( in ) {
in >> a;
airports[a.id] = a;
+ airports2.push_back(&airports[a.id]);
}
+
}
// Destructor
FGAirportList::~FGAirportList( void ) {
}
+
+int
+FGAirportList::size () const
+{
+ return airports2.size();
+}
+
+const FGAirport *
+FGAirportList::getAirport (int index) const
+{
+ return airports2[index];
+}
#include STL_STRING
#include <map>
+#include <vector>
SG_USING_STD(string);
SG_USING_STD(map);
+SG_USING_STD(vector);
struct FGAirport {
typedef airport_map::iterator airport_map_iterator;
typedef airport_map::const_iterator const_airport_map_iterator;
+typedef vector < FGAirport * > airport_list;
+
class FGAirportList {
private:
airport_map airports;
+ airport_list airports2;
public:
// On success, airport data is returned thru "airport" pointer.
// "airport" is not changed if "apt" is not found.
FGAirport search( const string& id );
+
+ /**
+ * Return the number of airports in the list.
+ */
+ int size () const;
+
+
+ /**
+ * Return a specific airport, by position.
+ */
+ const FGAirport * getAirport (int index) const;
+
};