]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGJSBBase.cpp
Rob Deters: UIUC updates from March 1, 2004.
[flightgear.git] / src / FDM / JSBSim / FGJSBBase.cpp
index f3188b54e99633007c9d8bf8aecd9dc4cf1e33f5..4ed156854ff6eb019f019ba4c432363eb2b0ae8e 100644 (file)
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-\r
- Module:       FGJSBBase.cpp\r
- Author:       Jon S. Berndt\r
- Date started: 07/01/01\r
- Purpose:      Encapsulates the JSBBase object\r
-\r
- ------------- Copyright (C) 2001  Jon S. Berndt (jsb@hal-pc.org) -------------\r
-\r
- This program is free software; you can redistribute it and/or modify it under\r
- the terms of the GNU General Public License as published by the Free Software\r
- Foundation; either version 2 of the License, or (at your option) any later\r
- version.\r
-\r
- This program is distributed in the hope that it will be useful, but WITHOUT\r
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
- FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\r
- details.\r
-\r
- You should have received a copy of the GNU General Public License along with\r
- this program; if not, write to the Free Software Foundation, Inc., 59 Temple\r
- Place - Suite 330, Boston, MA  02111-1307, USA.\r
-\r
- Further information about the GNU General Public License can also be found on\r
- the world wide web at http://www.gnu.org.\r
-\r
-FUNCTIONAL DESCRIPTION\r
---------------------------------------------------------------------------------\r
-\r
-HISTORY\r
---------------------------------------------------------------------------------\r
-07/01/01  JSB  Created\r
-\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-INCLUDES\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
-\r
-#include "FGJSBBase.h"\r
-\r
-namespace JSBSim {\r
-\r
-static const char *IdSrc = "$Id$";\r
-static const char *IdHdr = ID_JSBBASE;\r
-\r
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-CLASS IMPLEMENTATION\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
-\r
-char FGJSBBase::highint[5]  = {27, '[', '1', 'm', '\0'      };\r
-char FGJSBBase::halfint[5]  = {27, '[', '2', 'm', '\0'      };\r
-char FGJSBBase::normint[6]  = {27, '[', '2', '2', 'm', '\0' };\r
-char FGJSBBase::reset[5]    = {27, '[', '0', 'm', '\0'      };\r
-char FGJSBBase::underon[5]  = {27, '[', '4', 'm', '\0'      };\r
-char FGJSBBase::underoff[6] = {27, '[', '2', '4', 'm', '\0' };\r
-char FGJSBBase::fgblue[6]   = {27, '[', '3', '4', 'm', '\0' };\r
-char FGJSBBase::fgcyan[6]   = {27, '[', '3', '6', 'm', '\0' };\r
-char FGJSBBase::fgred[6]    = {27, '[', '3', '1', 'm', '\0' };\r
-char FGJSBBase::fggreen[6]  = {27, '[', '3', '2', 'm', '\0' };\r
-char FGJSBBase::fgdef[6]    = {27, '[', '3', '9', 'm', '\0' };\r
-\r
-const double FGJSBBase::radtodeg = 57.29578;\r
-const double FGJSBBase::degtorad = 1.745329E-2;\r
-const double FGJSBBase::hptoftlbssec = 550.0;\r
-const double FGJSBBase::psftoinhg = 0.014138;\r
-const double FGJSBBase::fpstokts = 0.592484;\r
-const double FGJSBBase::ktstofps = 1.68781;\r
-const double FGJSBBase::inchtoft = 0.08333333;\r
-const double FGJSBBase::in3tom3 = 1.638706E-5;\r
-double FGJSBBase::Reng = 1716.0;\r
-const double FGJSBBase::SHRatio = 1.40;\r
-\r
-// Note that definition of lbtoslug by the inverse of slugtolb and not\r
-// to a different constant you can also get from some tables will make\r
-// lbtoslug*slugtolb == 1 up to the magnitude of roundoff. So converting from\r
-// slug to lb and back will yield to the original value you started with up\r
-// to the magnitude of roundoff.\r
-// Taken from units gnu commandline tool\r
-const double FGJSBBase::slugtolb = 32.174049;\r
-const double FGJSBBase::lbtoslug = 1.0/slugtolb;\r
-\r
-const string FGJSBBase::needed_cfg_version = "1.61";\r
-const string FGJSBBase::JSBSim_version = "0.9.5";\r
-\r
-std::queue <FGJSBBase::Message*> FGJSBBase::Messages;\r
-FGJSBBase::Message FGJSBBase::localMsg;\r
-unsigned int FGJSBBase::messageId = 0;\r
-unsigned int FGJSBBase::frame = 0;\r
-\r
-short FGJSBBase::debug_lvl  = 1;\r
-\r
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-\r
-FGJSBBase::FGJSBBase()\r
-{\r
-}\r
-\r
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-\r
-FGJSBBase::Message* FGJSBBase::PutMessage(Message* msg)\r
-{\r
-  Messages.push(msg);\r
-  return msg;\r
-}\r
-\r
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-\r
-FGJSBBase::Message* FGJSBBase::PutMessage(string text)\r
-{\r
-  Message *msg = new Message();\r
-  msg->text = text;\r
-  msg->messageId = messageId++;\r
-  msg->subsystem = "FDM";\r
-  msg->type = Message::eText;\r
-  Messages.push(msg);\r
-  return msg;\r
-}\r
-\r
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-\r
-FGJSBBase::Message* FGJSBBase::PutMessage(string text, bool bVal)\r
-{\r
-  Message *msg = new Message();\r
-  msg->text = text;\r
-  msg->messageId = messageId++;\r
-  msg->subsystem = "FDM";\r
-  msg->type = Message::eBool;\r
-  msg->bVal = bVal;\r
-  Messages.push(msg);\r
-  return msg;\r
-}\r
-\r
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-\r
-FGJSBBase::Message* FGJSBBase::PutMessage(string text, int iVal)\r
-{\r
-  Message *msg = new Message();\r
-  msg->text = text;\r
-  msg->messageId = messageId++;\r
-  msg->subsystem = "FDM";\r
-  msg->type = Message::eInteger;\r
-  msg->bVal = (iVal != 0);\r
-  Messages.push(msg);\r
-  return msg;\r
-}\r
-\r
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-\r
-FGJSBBase::Message* FGJSBBase::PutMessage(string text, double dVal)\r
-{\r
-  Message *msg = new Message();\r
-  msg->text = text;\r
-  msg->messageId = messageId++;\r
-  msg->subsystem = "FDM";\r
-  msg->type = Message::eDouble;\r
-  msg->bVal = (dVal != 0.0);\r
-  Messages.push(msg);\r
-  return msg;\r
-}\r
-\r
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-\r
-FGJSBBase::Message* FGJSBBase::ReadMessage(void)\r
-{\r
-  if (!Messages.empty()) return Messages.front();\r
-  else                   return NULL;\r
-}\r
-\r
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-\r
-FGJSBBase::Message* FGJSBBase::ProcessMessage(void)\r
-{\r
-  if (!Messages.empty())\r
-    localMsg = *(Messages.front());\r
-  else\r
-    return NULL;\r
-  Messages.pop();\r
-  return &localMsg;\r
-}\r
-\r
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-\r
-void FGJSBBase::disableHighLighting(void) {\r
-  highint[0]='\0';\r
-  halfint[0]='\0';\r
-  normint[0]='\0';\r
-  reset[0]='\0';\r
-  underon[0]='\0';\r
-  underoff[0]='\0';\r
-  fgblue[0]='\0';\r
-  fgcyan[0]='\0';\r
-  fgred[0]='\0';\r
-  fggreen[0]='\0';\r
-  fgdef[0]='\0';\r
-}\r
-\r
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-\r
-} // namespace JSBSim\r
-\r
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ Module:       FGJSBBase.cpp
+ Author:       Jon S. Berndt
+ Date started: 07/01/01
+ Purpose:      Encapsulates the JSBBase object
+
+ ------------- Copyright (C) 2001  Jon S. Berndt (jsb@hal-pc.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., 59 Temple
+ Place - Suite 330, Boston, MA  02111-1307, USA.
+
+ Further information about the GNU General Public License can also be found on
+ the world wide web at http://www.gnu.org.
+
+FUNCTIONAL DESCRIPTION
+--------------------------------------------------------------------------------
+
+HISTORY
+--------------------------------------------------------------------------------
+07/01/01  JSB  Created
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+INCLUDES
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+#include "FGJSBBase.h"
+
+namespace JSBSim {
+
+static const char *IdSrc = "$Id$";
+static const char *IdHdr = ID_JSBBASE;
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS IMPLEMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+char FGJSBBase::highint[5]  = {27, '[', '1', 'm', '\0'      };
+char FGJSBBase::halfint[5]  = {27, '[', '2', 'm', '\0'      };
+char FGJSBBase::normint[6]  = {27, '[', '2', '2', 'm', '\0' };
+char FGJSBBase::reset[5]    = {27, '[', '0', 'm', '\0'      };
+char FGJSBBase::underon[5]  = {27, '[', '4', 'm', '\0'      };
+char FGJSBBase::underoff[6] = {27, '[', '2', '4', 'm', '\0' };
+char FGJSBBase::fgblue[6]   = {27, '[', '3', '4', 'm', '\0' };
+char FGJSBBase::fgcyan[6]   = {27, '[', '3', '6', 'm', '\0' };
+char FGJSBBase::fgred[6]    = {27, '[', '3', '1', 'm', '\0' };
+char FGJSBBase::fggreen[6]  = {27, '[', '3', '2', 'm', '\0' };
+char FGJSBBase::fgdef[6]    = {27, '[', '3', '9', 'm', '\0' };
+
+const double FGJSBBase::radtodeg = 57.29578;
+const double FGJSBBase::degtorad = 1.745329E-2;
+const double FGJSBBase::hptoftlbssec = 550.0;
+const double FGJSBBase::psftoinhg = 0.014138;
+const double FGJSBBase::fpstokts = 0.592484;
+const double FGJSBBase::ktstofps = 1.68781;
+const double FGJSBBase::inchtoft = 0.08333333;
+const double FGJSBBase::in3tom3 = 1.638706E-5;
+double FGJSBBase::Reng = 1716.0;
+const double FGJSBBase::SHRatio = 1.40;
+
+// Note that definition of lbtoslug by the inverse of slugtolb and not
+// to a different constant you can also get from some tables will make
+// lbtoslug*slugtolb == 1 up to the magnitude of roundoff. So converting from
+// slug to lb and back will yield to the original value you started with up
+// to the magnitude of roundoff.
+// Taken from units gnu commandline tool
+const double FGJSBBase::slugtolb = 32.174049;
+const double FGJSBBase::lbtoslug = 1.0/slugtolb;
+
+const string FGJSBBase::needed_cfg_version = "1.61";
+const string FGJSBBase::JSBSim_version = "0.9.5";
+
+std::queue <FGJSBBase::Message*> FGJSBBase::Messages;
+FGJSBBase::Message FGJSBBase::localMsg;
+unsigned int FGJSBBase::messageId = 0;
+unsigned int FGJSBBase::frame = 0;
+
+short FGJSBBase::debug_lvl  = 1;
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+FGJSBBase::FGJSBBase()
+{
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+FGJSBBase::Message* FGJSBBase::PutMessage(Message* msg)
+{
+  Messages.push(msg);
+  return msg;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+FGJSBBase::Message* FGJSBBase::PutMessage(string text)
+{
+  Message *msg = new Message();
+  msg->text = text;
+  msg->messageId = messageId++;
+  msg->subsystem = "FDM";
+  msg->type = Message::eText;
+  Messages.push(msg);
+  return msg;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+FGJSBBase::Message* FGJSBBase::PutMessage(string text, bool bVal)
+{
+  Message *msg = new Message();
+  msg->text = text;
+  msg->messageId = messageId++;
+  msg->subsystem = "FDM";
+  msg->type = Message::eBool;
+  msg->bVal = bVal;
+  Messages.push(msg);
+  return msg;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+FGJSBBase::Message* FGJSBBase::PutMessage(string text, int iVal)
+{
+  Message *msg = new Message();
+  msg->text = text;
+  msg->messageId = messageId++;
+  msg->subsystem = "FDM";
+  msg->type = Message::eInteger;
+  msg->bVal = (iVal != 0);
+  Messages.push(msg);
+  return msg;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+FGJSBBase::Message* FGJSBBase::PutMessage(string text, double dVal)
+{
+  Message *msg = new Message();
+  msg->text = text;
+  msg->messageId = messageId++;
+  msg->subsystem = "FDM";
+  msg->type = Message::eDouble;
+  msg->bVal = (dVal != 0.0);
+  Messages.push(msg);
+  return msg;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+FGJSBBase::Message* FGJSBBase::ReadMessage(void)
+{
+  if (!Messages.empty()) return Messages.front();
+  else                   return NULL;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+FGJSBBase::Message* FGJSBBase::ProcessMessage(void)
+{
+  if (!Messages.empty())
+    localMsg = *(Messages.front());
+  else
+    return NULL;
+  Messages.pop();
+  return &localMsg;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+void FGJSBBase::disableHighLighting(void) {
+  highint[0]='\0';
+  halfint[0]='\0';
+  normint[0]='\0';
+  reset[0]='\0';
+  underon[0]='\0';
+  underoff[0]='\0';
+  fgblue[0]='\0';
+  fgcyan[0]='\0';
+  fgred[0]='\0';
+  fggreen[0]='\0';
+  fgdef[0]='\0';
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+} // namespace JSBSim
+