1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6 Purpose: Encapsulates the JSBBase object
8 ------------- Copyright (C) 2001 Jon S. Berndt (jsb@hal-pc.org) -------------
10 This program is free software; you can redistribute it and/or modify it under
11 the terms of the GNU General Public License as published by the Free Software
12 Foundation; either version 2 of the License, or (at your option) any later
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
20 You should have received a copy of the GNU General Public License along with
21 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
22 Place - Suite 330, Boston, MA 02111-1307, USA.
24 Further information about the GNU General Public License can also be found on
25 the world wide web at http://www.gnu.org.
27 FUNCTIONAL DESCRIPTION
28 --------------------------------------------------------------------------------
31 --------------------------------------------------------------------------------
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
36 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
38 #include "FGJSBBase.h"
42 static const char *IdSrc = "$Id$";
43 static const char *IdHdr = ID_JSBBASE;
45 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
50 char FGJSBBase::highint[5] = {27, '[', '1', 'm', '\0' };
51 char FGJSBBase::halfint[5] = {27, '[', '2', 'm', '\0' };
52 char FGJSBBase::normint[6] = {27, '[', '2', '2', 'm', '\0' };
53 char FGJSBBase::reset[5] = {27, '[', '0', 'm', '\0' };
54 char FGJSBBase::underon[5] = {27, '[', '4', 'm', '\0' };
55 char FGJSBBase::underoff[6] = {27, '[', '2', '4', 'm', '\0' };
56 char FGJSBBase::fgblue[6] = {27, '[', '3', '4', 'm', '\0' };
57 char FGJSBBase::fgcyan[6] = {27, '[', '3', '6', 'm', '\0' };
58 char FGJSBBase::fgred[6] = {27, '[', '3', '1', 'm', '\0' };
59 char FGJSBBase::fggreen[6] = {27, '[', '3', '2', 'm', '\0' };
60 char FGJSBBase::fgdef[6] = {27, '[', '3', '9', 'm', '\0' };
62 char FGJSBBase::highint[5] = {'\0' };
63 char FGJSBBase::halfint[5] = {'\0' };
64 char FGJSBBase::normint[6] = {'\0' };
65 char FGJSBBase::reset[5] = {'\0' };
66 char FGJSBBase::underon[5] = {'\0' };
67 char FGJSBBase::underoff[6] = {'\0' };
68 char FGJSBBase::fgblue[6] = {'\0' };
69 char FGJSBBase::fgcyan[6] = {'\0' };
70 char FGJSBBase::fgred[6] = {'\0' };
71 char FGJSBBase::fggreen[6] = {'\0' };
72 char FGJSBBase::fgdef[6] = {'\0' };
75 const double FGJSBBase::radtodeg = 57.29578;
76 const double FGJSBBase::degtorad = 1.745329E-2;
77 const double FGJSBBase::hptoftlbssec = 550.0;
78 const double FGJSBBase::psftoinhg = 0.014138;
79 const double FGJSBBase::psftopa = 47.88;
80 const double FGJSBBase::fpstokts = 0.592484;
81 const double FGJSBBase::ktstofps = 1.68781;
82 const double FGJSBBase::inchtoft = 0.08333333;
83 const double FGJSBBase::in3tom3 = 1.638706E-5;
84 double FGJSBBase::Reng = 1716.0;
85 const double FGJSBBase::SHRatio = 1.40;
87 // Note that definition of lbtoslug by the inverse of slugtolb and not
88 // to a different constant you can also get from some tables will make
89 // lbtoslug*slugtolb == 1 up to the magnitude of roundoff. So converting from
90 // slug to lb and back will yield to the original value you started with up
91 // to the magnitude of roundoff.
92 // Taken from units gnu commandline tool
93 const double FGJSBBase::slugtolb = 32.174049;
94 const double FGJSBBase::lbtoslug = 1.0/slugtolb;
96 const string FGJSBBase::needed_cfg_version = "2.0";
97 const string FGJSBBase::JSBSim_version = "0.9.10.111805";
99 std::queue <FGJSBBase::Message*> FGJSBBase::Messages;
100 FGJSBBase::Message FGJSBBase::localMsg;
101 unsigned int FGJSBBase::messageId = 0;
102 unsigned int FGJSBBase::frame = 0;
104 short FGJSBBase::debug_lvl = 1;
106 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
108 FGJSBBase::Message* FGJSBBase::PutMessage(Message* msg)
114 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
116 FGJSBBase::Message* FGJSBBase::PutMessage(const string& text)
118 Message *msg = new Message();
120 msg->messageId = messageId++;
121 msg->subsystem = "FDM";
122 msg->type = Message::eText;
127 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
129 FGJSBBase::Message* FGJSBBase::PutMessage(const string& text, bool bVal)
131 Message *msg = new Message();
133 msg->messageId = messageId++;
134 msg->subsystem = "FDM";
135 msg->type = Message::eBool;
141 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
143 FGJSBBase::Message* FGJSBBase::PutMessage(const string& text, int iVal)
145 Message *msg = new Message();
147 msg->messageId = messageId++;
148 msg->subsystem = "FDM";
149 msg->type = Message::eInteger;
150 msg->bVal = (iVal != 0);
155 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
157 FGJSBBase::Message* FGJSBBase::PutMessage(const string& text, double dVal)
159 Message *msg = new Message();
161 msg->messageId = messageId++;
162 msg->subsystem = "FDM";
163 msg->type = Message::eDouble;
164 msg->bVal = (dVal != 0.0);
169 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
171 FGJSBBase::Message* FGJSBBase::ReadMessage(void)
173 if (!Messages.empty()) return Messages.front();
177 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
179 FGJSBBase::Message* FGJSBBase::ProcessMessage(void)
181 if (!Messages.empty())
182 localMsg = *(Messages.front());
189 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
191 void FGJSBBase::disableHighLighting(void) {
205 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
207 } // namespace JSBSim