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"
40 static const char *IdSrc = "$Id$";
41 static const char *IdHdr = ID_JSBBASE;
43 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
45 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
47 char FGJSBBase::highint[5] = {27, '[', '1', 'm', '\0' };
48 char FGJSBBase::halfint[5] = {27, '[', '2', 'm', '\0' };
49 char FGJSBBase::normint[6] = {27, '[', '2', '2', 'm', '\0' };
50 char FGJSBBase::reset[5] = {27, '[', '0', 'm', '\0' };
51 char FGJSBBase::underon[5] = {27, '[', '4', 'm', '\0' };
52 char FGJSBBase::underoff[6] = {27, '[', '2', '4', 'm', '\0' };
53 char FGJSBBase::fgblue[6] = {27, '[', '3', '4', 'm', '\0' };
54 char FGJSBBase::fgcyan[6] = {27, '[', '3', '6', 'm', '\0' };
55 char FGJSBBase::fgred[6] = {27, '[', '3', '1', 'm', '\0' };
56 char FGJSBBase::fggreen[6] = {27, '[', '3', '2', 'm', '\0' };
57 char FGJSBBase::fgdef[6] = {27, '[', '3', '9', 'm', '\0' };
59 const double FGJSBBase::radtodeg = 57.29578;
60 const double FGJSBBase::degtorad = 1.745329E-2;
61 const double FGJSBBase::hptoftlbssec = 550.0;
62 const double FGJSBBase::fpstokts = 0.592484;
63 const double FGJSBBase::ktstofps = 1.68781;
64 const double FGJSBBase::inchtoft = 0.08333333;
65 const double FGJSBBase::Reng = 1716.0;
66 const double FGJSBBase::SHRatio = 1.40;
67 const string FGJSBBase::needed_cfg_version = "1.55";
68 const string FGJSBBase::JSBSim_version = "0.9.1";
70 queue <struct FGJSBBase::Message*> FGJSBBase::Messages;
71 struct FGJSBBase::Message FGJSBBase::localMsg;
72 unsigned int FGJSBBase::messageId = 0;
74 short FGJSBBase::debug_lvl = 0;
76 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
78 FGJSBBase::FGJSBBase()
82 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
84 struct FGJSBBase::Message* FGJSBBase::PutMessage(struct Message* msg)
90 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92 struct FGJSBBase::Message* FGJSBBase::PutMessage(string text)
94 struct Message *msg = new Message();
96 msg->messageId = messageId++;
97 msg->subsystem = "FDM";
98 msg->type = Message::eText;
103 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
105 struct FGJSBBase::Message* FGJSBBase::PutMessage(string text, bool bVal)
107 struct Message *msg = new Message();
109 msg->messageId = messageId++;
110 msg->subsystem = "FDM";
111 msg->type = Message::eBool;
117 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
119 struct FGJSBBase::Message* FGJSBBase::PutMessage(string text, int iVal)
121 struct Message *msg = new Message();
123 msg->messageId = messageId++;
124 msg->subsystem = "FDM";
125 msg->type = Message::eInteger;
131 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
133 struct FGJSBBase::Message* FGJSBBase::PutMessage(string text, double dVal)
135 struct Message *msg = new Message();
137 msg->messageId = messageId++;
138 msg->subsystem = "FDM";
139 msg->type = Message::eDouble;
145 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
147 struct FGJSBBase::Message* FGJSBBase::ReadMessage(void)
149 if (!Messages.empty()) return Messages.front();
153 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
155 struct FGJSBBase::Message* FGJSBBase::ProcessMessage(void)
157 if (!Messages.empty())
158 localMsg = *(Messages.front());
165 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%