X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FJSBSim%2FFGJSBBase.cpp;h=4ed156854ff6eb019f019ba4c432363eb2b0ae8e;hb=fbee3d10f0aafd4178fc1313edb8593c156b2874;hp=1b8a36d494c2b9711beb5c40fd5009269d4842bf;hpb=2297c706e8c707c050f75696d5e399798b103434;p=flightgear.git diff --git a/src/FDM/JSBSim/FGJSBBase.cpp b/src/FDM/JSBSim/FGJSBBase.cpp index 1b8a36d49..4ed156854 100644 --- a/src/FDM/JSBSim/FGJSBBase.cpp +++ b/src/FDM/JSBSim/FGJSBBase.cpp @@ -37,6 +37,8 @@ INCLUDES #include "FGJSBBase.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_JSBBASE; @@ -56,5 +58,142 @@ 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' }; -short FGJSBBase::debug_lvl = 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::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