1 // transmission.hxx -- Transmission class
\r
3 // Written by Alexander Kappes, started March 2002.
\r
4 // Based on nav.hxx by Curtis Olson, started April 2000.
\r
6 // Copyright (C) 2001 David C. Luff - david.luff@nottingham.ac.uk
\r
8 // This program is free software; you can redistribute it and/or
\r
9 // modify it under the terms of the GNU General Public License as
\r
10 // published by the Free Software Foundation; either version 2 of the
\r
11 // License, or (at your option) any later version.
\r
13 // This program is distributed in the hope that it will be useful, but
\r
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
\r
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
\r
16 // General Public License for more details.
\r
18 // You should have received a copy of the GNU General Public License
\r
19 // along with this program; if not, write to the Free Software
\r
20 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
\r
23 #ifndef _FG_TRANSMISSION_HXX
\r
24 #define _FG_TRANSMISSION_HXX
\r
28 #include <simgear/compiler.h>
\r
29 #include <simgear/math/sg_geodesy.hxx>
\r
30 #include <simgear/misc/sgstream.hxx>
\r
31 #include <simgear/magvar/magvar.hxx>
\r
32 #include <simgear/timing/sg_time.hxx>
\r
33 #include <simgear/bucket/newbucket.hxx>
\r
35 #include <Main/fg_props.hxx>
\r
37 #ifdef SG_HAVE_STD_INCLUDES
\r
40 #elif defined( SG_HAVE_NATIVE_SGI_COMPILERS )
\r
41 # include <iostream.h>
\r
42 #elif defined( __BORLANDC__ )
\r
43 # include <iostream>
\r
45 # include <istream.h>
\r
46 #include <iomanip.h>
\r
49 #if ! defined( SG_HAVE_NATIVE_SGI_COMPILERS )
\r
50 SG_USING_STD(istream);
\r
53 SG_USING_STD(string);
\r
61 // TransPar - a representation of the logic of a parsed speech transmission
\r
66 string intention; // landing, crossing
\r
67 string intid; // (airport) ID for intention
\r
68 bool request; // is the transmission a request or an answer?
\r
69 int tdir; // turning direction: 1=left, 2=right
\r
71 int VDir; // vertical direction: 1=descent, 2=maintain, 3=climb
\r
79 // FGTransmission - a class to encapsulate a speech transmission
\r
80 class FGTransmission {
\r
82 int StationType; // Type of ATC station: 1 Approach
\r
89 FGTransmission(void);
\r
90 ~FGTransmission(void);
\r
94 inline int get_station() const { return StationType; }
\r
95 inline TransCode get_code() { return Code; }
\r
96 inline string get_transtext() { return TransText; }
\r
97 inline string get_menutext() { return MenuText; }
\r
99 // Return the parsed logic of the transmission
\r
104 friend istream& operator>> ( istream&, FGTransmission& );
\r
110 operator >> ( istream& in, FGTransmission& a ) {
\r
113 static bool first_time = true;
\r
114 static double julian_date = 0;
\r
115 static const double MJD0 = 2415020.0;
\r
116 if ( first_time ) {
\r
117 julian_date = sgTimeCurrentMJD(0, 0) + MJD0;
\r
118 first_time = false;
\r
120 in >> a.StationType;
\r
126 if ( ch != '"' ) a.TransText += ch;
\r
129 in.unsetf(ios::skipws);
\r
131 if ( ch != '"' ) a.TransText += ch;
\r
132 if((ch == '"') || (ch == 0x0A)) {
\r
134 } // we shouldn't need the 0x0A but it makes a nice safely in case someone leaves off the "
\r
136 in.setf(ios::skipws);
\r
140 if ( ch != '"' ) a.MenuText += ch;
\r
143 in.unsetf(ios::skipws);
\r
145 if ( ch != '"' ) a.MenuText += ch;
\r
146 if((ch == '"') || (ch == 0x0A)) {
\r
148 } // we shouldn't need the 0x0A but it makes a nice safely in case someone leaves off the "
\r
150 in.setf(ios::skipws);
\r
152 //cout << "Code = " << a.Code << " Transmission text = " << a.TransText
\r
153 // << " Menu text = " << a.MenuText << endl;
\r
155 return in >> skipeol;
\r
159 #endif // _FG_TRANSMISSION_HXX
\r