1 // transmission.hxx -- Transmission class
3 // Written by Alexander Kappes, started March 2002.
4 // Based on nav.hxx by Curtis Olson, started April 2000.
6 // Copyright (C) 2001 David C. Luff - david.luff@nottingham.ac.uk
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #ifndef _FG_TRANSMISSION_HXX
24 #define _FG_TRANSMISSION_HXX
28 #include <simgear/compiler.h>
29 #include <simgear/math/sg_geodesy.hxx>
30 #include <simgear/misc/sgstream.hxx>
31 #include <simgear/magvar/magvar.hxx>
32 #include <simgear/timing/sg_time.hxx>
33 #include <simgear/bucket/newbucket.hxx>
35 #include <Main/fg_props.hxx>
37 #ifdef SG_HAVE_STD_INCLUDES
40 #elif defined( SG_HAVE_NATIVE_SGI_COMPILERS )
41 # include <iostream.h>
42 #elif defined( __BORLANDC__ )
51 #if ! defined( SG_HAVE_NATIVE_SGI_COMPILERS )
52 SG_USING_STD(istream);
63 // TransPar - a representation of the logic of a parsed speech transmission
68 string intention; // landing, crossing
69 string intid; // (airport) ID for intention
70 bool request; // is the transmission a request or an answer?
71 int tdir; // turning direction: 1=left, 2=right
73 int VDir; // vertical direction: 1=descent, 2=maintain, 3=climb
81 // FGTransmission - a class to encapsulate a speech transmission
82 class FGTransmission {
84 //int StationType; // Type of ATC station: 1 Approach
86 TransCode Code; // DCL - no idea what this is.
87 string TransText; // The text of the spoken transmission
88 string MenuText; // An abbreviated version of the text for the menu entry
93 ~FGTransmission(void);
97 inline atc_type get_station() const { return StationType; }
98 inline TransCode get_code() { return Code; }
99 inline string get_transtext() { return TransText; }
100 inline string get_menutext() { return MenuText; }
102 // Return the parsed logic of the transmission
107 friend istream& operator>> ( istream&, FGTransmission& );
113 operator >> ( istream& in, FGTransmission& a ) {
117 static bool first_time = true;
118 static double julian_date = 0;
119 static const double MJD0 = 2415020.0;
121 julian_date = sgTimeCurrentMJD(0, 0) + MJD0;
124 // Ugly hack alert - eventually we'll use xml format for the transmissions file
127 a.StationType = APPROACH;
129 a.StationType = INVALID;
136 if ( ch != '"' ) a.TransText += ch;
139 in.unsetf(ios::skipws);
141 if ( ch != '"' ) a.TransText += ch;
142 if((ch == '"') || (ch == 0x0A)) {
144 } // we shouldn't need the 0x0A but it makes a nice safely in case someone leaves off the "
146 in.setf(ios::skipws);
150 if ( ch != '"' ) a.MenuText += ch;
153 in.unsetf(ios::skipws);
155 if ( ch != '"' ) a.MenuText += ch;
156 if((ch == '"') || (ch == 0x0A)) {
158 } // we shouldn't need the 0x0A but it makes a nice safely in case someone leaves off the "
160 in.setf(ios::skipws);
162 //cout << "Code = " << a.Code << " Transmission text = " << a.TransText
163 // << " Menu text = " << a.MenuText << endl;
165 return in >> skipeol;
169 #endif // _FG_TRANSMISSION_HXX