User:Legoboyvdlp/genapts850 documentation

From FlightGear wiki
Jump to: navigation, search

Program Arguments

set SG_LOG priority by calling setLoggingPriority()
set work_dir
set input_file
set start_id
set nudge
set gSnap
set SGGeod min longitude
set SGGeod max longitude
set SGGeod min latitude
set SGGeod max latitude
set airport_id
empty elev_src vector
append to elev_src
set log level to BULK
set slope_max
set num_threads
--threads automatically 
set num_threads
output help text and exit


main.cxx is the main file, where execution of the program starts.


return type 


int argc 
default commandline argument handling
char **argv 
default commandline argument handling

Code Path

  1. Store current time from std::chrono::high_resolution_clock::now()
  2. Declare, clear, and fill the elev_src vector by calling setup_default_elevation_sources()
  3. Iterate through and parse commandline arguments
  4. Create a tgRectangle instance using the specified min / max; sanify input such that inverting it is detected and corrected automatically.
  5. Attempt to open the apt.dat or apt.dat.gz using sg_gzifstream in order to check apt.dat version
  6. Construct a Scheduler class instance wrapped in unique_ptr
  7. Add any debug items to the Scheduler
  8. If airport_id is set, add a single airport to the Scheduler with AddAirport() and invoke Schedule()
  9. Else, if start_id is set skip to start_id and add remaining airports with AddAirports() within the boundary and then invoke Schedule()
  10. Else add all airports with AddAirports() within boundary and then invoke Schedule()
  11. Call now() again and output elapsed time
  12. Exit program


Scheduler.cxx adds items to the queue and invokes threaded instances of class Parser to work through the queue.


Class Scheduler

Public Methods

long; search an input file to attempt to find a specified icao code and return its position in the file
void; iterate through an input file to attempt to find a specific airport and add it to the queue
bool; iterate through an input file, with a possible starting offset and return all airports which are wholly within the bounding box and add them to the queue
void; current unused
create threaded instances of Parser class and work through the airports

Private Methods

search a specific line for an ICAO code; if a match is found return true, else return false

Private Attributes

the input apt.dat file
the elevation source list
the working directory