Rewrote simple airport loader so it can deal with comments and blank lines.
This commit is contained in:
parent
747bc7c6b4
commit
f2254bfbb7
1 changed files with 16 additions and 0 deletions
|
@ -38,12 +38,15 @@
|
||||||
#include STL_FUNCTIONAL
|
#include STL_FUNCTIONAL
|
||||||
#include STL_ALGORITHM
|
#include STL_ALGORITHM
|
||||||
|
|
||||||
|
|
||||||
fgAIRPORTS::fgAIRPORTS() {
|
fgAIRPORTS::fgAIRPORTS() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// load the data
|
// load the data
|
||||||
int fgAIRPORTS::load( const string& file ) {
|
int fgAIRPORTS::load( const string& file ) {
|
||||||
|
fgAIRPORT a;
|
||||||
|
|
||||||
// build the path name to the airport file
|
// build the path name to the airport file
|
||||||
string path = current_options.get_fg_root() + "/Airports/" + file;
|
string path = current_options.get_fg_root() + "/Airports/" + file;
|
||||||
StopWatch t;
|
StopWatch t;
|
||||||
|
@ -57,11 +60,21 @@ int fgAIRPORTS::load( const string& file ) {
|
||||||
|
|
||||||
t.start();
|
t.start();
|
||||||
|
|
||||||
|
/*
|
||||||
// We can use the STL copy algorithm because the input
|
// We can use the STL copy algorithm because the input
|
||||||
// file doesn't contain and comments or blank lines.
|
// file doesn't contain and comments or blank lines.
|
||||||
copy( istream_iterator<fgAIRPORT,ptrdiff_t>(in.stream()),
|
copy( istream_iterator<fgAIRPORT,ptrdiff_t>(in.stream()),
|
||||||
istream_iterator<fgAIRPORT,ptrdiff_t>(),
|
istream_iterator<fgAIRPORT,ptrdiff_t>(),
|
||||||
inserter( airports, airports.begin() ) );
|
inserter( airports, airports.begin() ) );
|
||||||
|
*/
|
||||||
|
|
||||||
|
// read in each line of the file
|
||||||
|
while ( ! in.eof() )
|
||||||
|
{
|
||||||
|
in.eat_comments();
|
||||||
|
in.stream() >> a.id >> a.longitude >> a.latitude >> a.elevation;
|
||||||
|
airports.insert(a);
|
||||||
|
}
|
||||||
|
|
||||||
t.stop();
|
t.stop();
|
||||||
|
|
||||||
|
@ -120,6 +133,9 @@ fgAIRPORTS::~fgAIRPORTS( void ) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.5 1998/09/02 14:35:38 curt
|
||||||
|
// Rewrote simple airport loader so it can deal with comments and blank lines.
|
||||||
|
//
|
||||||
// Revision 1.4 1998/09/01 19:02:53 curt
|
// Revision 1.4 1998/09/01 19:02:53 curt
|
||||||
// Changes contributed by Bernie Bright <bbright@c031.aone.net.au>
|
// Changes contributed by Bernie Bright <bbright@c031.aone.net.au>
|
||||||
// - The new classes in libmisc.tgz define a stream interface into zlib.
|
// - The new classes in libmisc.tgz define a stream interface into zlib.
|
||||||
|
|
Loading…
Add table
Reference in a new issue