1
0
Fork 0
flightgear/src/ATC/atislist.hxx
curt e35fffa035 David Luff writes:
Heres an update to the ATIS stuff.  In brief:

The possible buffer overflow in the display with wind should
hopefully be fixed.

Temperature is taken from the global temperature property instead
of being hardwired.

The display class now includes an implementation of the member
function to change the repeating message.

The message callsign is no longer hardwired.  The first message
from each station is generated with a random callsign.
Subsequent messages from the same station have the callsign
incremented every hour.  A map of airport-id vs. last callsign and
transmission time is kept for each station that has transmitted for
the duration of the FlightGear session.  The logic might be flaky if
FlightGear is run for more than 24 hours at a stretch between
visiting the same ATIS station though!  (ie I don't check the day.)
This map is kept in the atislist class.  This might not be the best
long-term place for it (in an ATC class of some sort might be
better), but it works for now.
2001-11-19 23:53:36 +00:00

89 lines
2.6 KiB
C++

// atislist.hxx -- atis management class
//
// Written by Curtis Olson, started April 2000.
//
// Copyright (C) 2000 Curtis L. Olson - curt@flightgear.org
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef _FG_ATISLIST_HXX
#define _FG_ATISLIST_HXX
#include <simgear/compiler.h>
#include <simgear/misc/sg_path.hxx>
#include <map>
#include <vector>
#include <string>
#include "atis.hxx"
SG_USING_STD(map);
SG_USING_STD(vector);
SG_USING_STD(string);
class FGATISList {
// convenience types
typedef vector < FGATIS > atis_list_type;
typedef atis_list_type::iterator atis_list_iterator;
typedef atis_list_type::const_iterator atis_list_const_iterator;
// typedef map < int, atis_list_type, less<int> > atis_map_type;
typedef map < int, atis_list_type > atis_map_type;
typedef atis_map_type::iterator atis_map_iterator;
typedef atis_map_type::const_iterator atis_map_const_iterator;
atis_map_type atislist;
// Add structure and map for storing a log of atis transmissions
// made in this session of FlightGear. This allows the callsign
// to be allocated correctly wrt time.
typedef struct {
int hours;
int mins;
int callsign;
} atis_transmission_type;
typedef map < string, atis_transmission_type > atis_log_type;
typedef atis_log_type::iterator atis_log_iterator;
typedef atis_log_type::const_iterator atis_log_const_iterator;
atis_log_type atislog;
public:
FGATISList();
~FGATISList();
// load all atis and build the map
bool init( SGPath path );
// query the database for the specified frequency, lon and lat are
// in degrees, elev is in meters
bool query( double lon, double lat, double elev, double freq, FGATIS *a );
// Return the callsign for a transmission given transmission time and airpord id
int GetCallSign( string apt_id, int hours, int mins );
};
extern FGATISList *current_atislist;
#endif // _FG_ATISLIST_HXX