]> git.mxchange.org Git - flightgear.git/commitdiff
Sync. w. JSBSim cvs
authorehofman <ehofman>
Mon, 26 Oct 2009 13:29:58 +0000 (13:29 +0000)
committerTim Moore <timoore@redhat.com>
Mon, 26 Oct 2009 17:56:23 +0000 (18:56 +0100)
105 files changed:
src/FDM/JSBSim/FGFDMExec.cpp
src/FDM/JSBSim/FGJSBBase.cpp
src/FDM/JSBSim/FGJSBBase.h
src/FDM/JSBSim/FGState.cpp
src/FDM/JSBSim/JSBSim.cxx
src/FDM/JSBSim/initialization/FGInitialCondition.cpp
src/FDM/JSBSim/initialization/FGTrim.cpp
src/FDM/JSBSim/initialization/FGTrimAxis.cpp
src/FDM/JSBSim/input_output/FGPropertyManager.h
src/FDM/JSBSim/input_output/FGScript.cpp
src/FDM/JSBSim/input_output/FGXMLElement.cpp
src/FDM/JSBSim/input_output/FGXMLElement.h
src/FDM/JSBSim/input_output/FGXMLFileRead.h
src/FDM/JSBSim/input_output/FGXMLParse.cpp
src/FDM/JSBSim/input_output/FGXMLParse.h
src/FDM/JSBSim/input_output/FGfdmSocket.cpp
src/FDM/JSBSim/input_output/FGfdmSocket.h
src/FDM/JSBSim/input_output/string_utilities.h
src/FDM/JSBSim/math/FGColumnVector3.cpp
src/FDM/JSBSim/math/FGColumnVector3.h
src/FDM/JSBSim/math/FGCondition.cpp
src/FDM/JSBSim/math/FGCondition.h
src/FDM/JSBSim/math/FGFunction.cpp
src/FDM/JSBSim/math/FGFunction.h
src/FDM/JSBSim/math/FGMatrix33.cpp
src/FDM/JSBSim/math/FGMatrix33.h
src/FDM/JSBSim/math/FGTable.cpp
src/FDM/JSBSim/math/FGTable.h
src/FDM/JSBSim/models/FGAerodynamics.cpp
src/FDM/JSBSim/models/FGAerodynamics.h
src/FDM/JSBSim/models/FGAircraft.cpp
src/FDM/JSBSim/models/FGAircraft.h
src/FDM/JSBSim/models/FGAtmosphere.cpp
src/FDM/JSBSim/models/FGAuxiliary.cpp
src/FDM/JSBSim/models/FGAuxiliary.h
src/FDM/JSBSim/models/FGBuoyantForces.cpp
src/FDM/JSBSim/models/FGExternalForce.cpp
src/FDM/JSBSim/models/FGExternalReactions.cpp
src/FDM/JSBSim/models/FGExternalReactions.h
src/FDM/JSBSim/models/FGFCS.cpp
src/FDM/JSBSim/models/FGFCS.h
src/FDM/JSBSim/models/FGGasCell.cpp
src/FDM/JSBSim/models/FGGasCell.h
src/FDM/JSBSim/models/FGGroundReactions.cpp
src/FDM/JSBSim/models/FGInertial.cpp
src/FDM/JSBSim/models/FGInput.cpp
src/FDM/JSBSim/models/FGInput.h
src/FDM/JSBSim/models/FGLGear.cpp
src/FDM/JSBSim/models/FGLGear.h
src/FDM/JSBSim/models/FGMassBalance.cpp
src/FDM/JSBSim/models/FGMassBalance.h
src/FDM/JSBSim/models/FGModel.cpp
src/FDM/JSBSim/models/FGModel.h
src/FDM/JSBSim/models/FGOutput.cpp
src/FDM/JSBSim/models/FGOutput.h
src/FDM/JSBSim/models/FGPropagate.cpp
src/FDM/JSBSim/models/FGPropulsion.cpp
src/FDM/JSBSim/models/FGPropulsion.h
src/FDM/JSBSim/models/atmosphere/FGMSIS.cpp
src/FDM/JSBSim/models/atmosphere/FGMars.cpp
src/FDM/JSBSim/models/flight_control/FGAccelerometer.cpp
src/FDM/JSBSim/models/flight_control/FGActuator.cpp
src/FDM/JSBSim/models/flight_control/FGDeadBand.cpp
src/FDM/JSBSim/models/flight_control/FGDeadBand.h
src/FDM/JSBSim/models/flight_control/FGFCSComponent.cpp
src/FDM/JSBSim/models/flight_control/FGFCSComponent.h
src/FDM/JSBSim/models/flight_control/FGFCSFunction.cpp
src/FDM/JSBSim/models/flight_control/FGFilter.cpp
src/FDM/JSBSim/models/flight_control/FGFilter.h
src/FDM/JSBSim/models/flight_control/FGGain.cpp
src/FDM/JSBSim/models/flight_control/FGGain.h
src/FDM/JSBSim/models/flight_control/FGGradient.cpp
src/FDM/JSBSim/models/flight_control/FGGyro.cpp
src/FDM/JSBSim/models/flight_control/FGKinemat.cpp
src/FDM/JSBSim/models/flight_control/FGKinemat.h
src/FDM/JSBSim/models/flight_control/FGMagnetometer.cpp
src/FDM/JSBSim/models/flight_control/FGPID.cpp
src/FDM/JSBSim/models/flight_control/FGPID.h
src/FDM/JSBSim/models/flight_control/FGSensor.cpp
src/FDM/JSBSim/models/flight_control/FGSensor.h
src/FDM/JSBSim/models/flight_control/FGSensorOrientation.h
src/FDM/JSBSim/models/flight_control/FGSummer.cpp
src/FDM/JSBSim/models/flight_control/FGSummer.h
src/FDM/JSBSim/models/flight_control/FGSwitch.cpp
src/FDM/JSBSim/models/propulsion/FGElectric.cpp
src/FDM/JSBSim/models/propulsion/FGElectric.h
src/FDM/JSBSim/models/propulsion/FGEngine.cpp
src/FDM/JSBSim/models/propulsion/FGEngine.h
src/FDM/JSBSim/models/propulsion/FGForce.cpp
src/FDM/JSBSim/models/propulsion/FGNozzle.cpp
src/FDM/JSBSim/models/propulsion/FGNozzle.h
src/FDM/JSBSim/models/propulsion/FGPiston.cpp
src/FDM/JSBSim/models/propulsion/FGPiston.h
src/FDM/JSBSim/models/propulsion/FGPropeller.cpp
src/FDM/JSBSim/models/propulsion/FGRocket.cpp
src/FDM/JSBSim/models/propulsion/FGRocket.h
src/FDM/JSBSim/models/propulsion/FGRotor.cpp
src/FDM/JSBSim/models/propulsion/FGTank.cpp
src/FDM/JSBSim/models/propulsion/FGTank.h
src/FDM/JSBSim/models/propulsion/FGThruster.cpp
src/FDM/JSBSim/models/propulsion/FGThruster.h
src/FDM/JSBSim/models/propulsion/FGTurbine.cpp
src/FDM/JSBSim/models/propulsion/FGTurbine.h
src/FDM/JSBSim/models/propulsion/FGTurboProp.cpp
src/FDM/JSBSim/models/propulsion/FGTurboProp.h

index c62dafa6a4cd428f114bb4b1388c20a3054b5db3..227c0267fc6d8b07152b7841dbced7d461aa7751 100644 (file)
@@ -66,6 +66,9 @@ INCLUDES
 
 #include <iostream>
 #include <iterator>
+#include <cstdlib>
+
+using namespace std;
 
 namespace JSBSim {
 
@@ -713,13 +716,13 @@ void FGFDMExec::BuildPropertyCatalog(struct PropertyCatalogStructure* pcs)
 {
   struct PropertyCatalogStructure* pcsNew = new struct PropertyCatalogStructure;
   int node_idx = 0;
-  char int_buf[10];
 
   for (int i=0; i<pcs->node->nChildren(); i++) {
     pcsNew->base_string = pcs->base_string + "/" + pcs->node->getChild(i)->getName();
     node_idx = pcs->node->getChild(i)->getIndex();
-    sprintf(int_buf, "[%d]", node_idx);
-    if (node_idx != 0) pcsNew->base_string += string(int_buf);
+    if (node_idx != 0) {
+      pcsNew->base_string = CreateIndexedPropertyName(pcsNew->base_string, node_idx);
+    }
     if (pcs->node->getChild(i)->nChildren() == 0) {
       if (pcsNew->base_string.substr(0,11) == string("/fdm/jsbsim")) {
         pcsNew->base_string = pcsNew->base_string.erase(0,12);
index 4e02407a41025ba1262d0fae46be7fbdb3029c0a..f07a4f08158fecbd18c6718e3926a2a995bc9be3 100644 (file)
@@ -39,6 +39,8 @@ INCLUDES
 
 #include "FGJSBBase.h"
 #include <iostream>
+#include <sstream>
+#include <cstdlib>
 
 namespace JSBSim {
 
@@ -240,5 +242,43 @@ void FGJSBBase::disableHighLighting(void) {
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+string FGJSBBase::CreateIndexedPropertyName(const string& Property, int index)
+{
+  std::ostringstream buf;
+  buf << Property << '[' << index << ']';
+  return buf.str();
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+double FGJSBBase::GaussianRandomNumber(void)
+{
+  static double V1, V2, S;
+  static int phase = 0;
+  double X;
+
+  if (phase == 0) {
+    V1 = V2 = S = X = 0.0;
+
+    do {
+      double U1 = (double)rand() / RAND_MAX;
+      double U2 = (double)rand() / RAND_MAX;
+
+      V1 = 2 * U1 - 1;
+      V2 = 2 * U2 - 1;
+      S = V1 * V1 + V2 * V2;
+    } while(S >= 1 || S == 0);
+
+    X = V1 * sqrt(-2 * log(S) / S);
+  } else
+    X = V2 * sqrt(-2 * log(S) / S);
+
+  phase = 1 - phase;
+
+  return X;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 } // namespace JSBSim
 
index 6ed8832f87347b54833fda6503854d60082b316c..d4ceb2c97ad3f59de484d340e28f13ea780031f6 100644 (file)
@@ -41,21 +41,22 @@ INCLUDES
 #include <float.h>
 #include <queue>
 #include <string>
-#include <sstream>
 #include <cmath>
-#include <cstdlib>
 
 #include "input_output/string_utilities.h"
 
-using std::fabs;
-using std::string;
-
 #ifndef M_PI
 #  define M_PI 3.14159265358979323846
 #endif
 
-#if !defined(WIN32) || defined(__GNUC__) || (defined(_MSC_VER) && (_MSC_VER >= 1300))
-  using std::max;
+#if defined(_MSC_VER) && (_MSC_VER < 1300)
+namespace std
+{
+  template <class T> inline T max(const T& a, const T& b)
+  {
+    return (a > b) ? a : b;
+  }
+}
 #endif
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -98,8 +99,8 @@ public:
   public:
     unsigned int fdmId;
     unsigned int messageId;
-    string text;
-    string subsystem;
+    std::string text;
+    std::string subsystem;
     enum mType {eText, eInteger, eDouble, eBool} type;
     bool bVal;
     int  iVal;
@@ -162,22 +163,22 @@ public:
   /** Creates a message with the given text and places it on the queue.
       @param text message text
       @return pointer to a Message structure */
-  void PutMessage(const string& text);
+  void PutMessage(const std::string& text);
   /** Creates a message with the given text and boolean value and places it on the queue.
       @param text message text
       @param bVal boolean value associated with the message
       @return pointer to a Message structure */
-  void PutMessage(const string& text, bool bVal);
+  void PutMessage(const std::string& text, bool bVal);
   /** Creates a message with the given text and integer value and places it on the queue.
       @param text message text
       @param iVal integer value associated with the message
       @return pointer to a Message structure */
-  void PutMessage(const string& text, int iVal);
+  void PutMessage(const std::string& text, int iVal);
   /** Creates a message with the given text and double value and places it on the queue.
       @param text message text
       @param dVal double value associated with the message
       @return pointer to a Message structure */
-  void PutMessage(const string& text, double dVal);
+  void PutMessage(const std::string& text, double dVal);
   /** Reads the message on the queue (but does not delete it).
       @return 1 if some messages */
   int SomeMessages(void);
@@ -192,7 +193,7 @@ public:
 
   /** Returns the version number of JSBSim.
   *   @return The version number of JSBSim. */
-  string GetVersion(void) {return JSBSim_version;}
+  std::string GetVersion(void) {return JSBSim_version;}
 
   /// Disables highlighting in the console output.
   void disableHighLighting(void);
@@ -268,7 +269,7 @@ public:
       @return if the two values can be considered equal up to roundoff */
   static bool EqualToRoundoff(double a, double b) {
     double eps = 2.0*DBL_EPSILON;
-    return fabs(a - b) <= eps*max(fabs(a), fabs(b));
+    return std::fabs(a - b) <= eps*std::max(std::fabs(a), std::fabs(b));
   }
 
   /** Finite precision comparison.
@@ -277,7 +278,7 @@ public:
       @return if the two values can be considered equal up to roundoff */
   static bool EqualToRoundoff(float a, float b) {
     float eps = 2.0*FLT_EPSILON;
-    return fabs(a - b) <= eps*max(fabs(a), fabs(b));
+    return std::fabs(a - b) <= eps*std::max(std::fabs(a), std::fabs(b));
   }
 
   /** Finite precision comparison.
@@ -331,44 +332,12 @@ protected:
   static const double slugtolb;
   static const double kgtolb;
   static const double kgtoslug;
-  static const string needed_cfg_version;
-  static const string JSBSim_version;
-
-  static string CreateIndexedPropertyName(string Property, int index)
-  {
-    std::stringstream str;
-    str << index;
-    string tmp;
-    str >> tmp;
-    return Property + "[" + tmp + "]";
-  }
+  static const std::string needed_cfg_version;
+  static const std::string JSBSim_version;
 
-  static double GaussianRandomNumber(void)
-  {
-    static double V1, V2, S;
-    static int phase = 0;
-    double X;
-
-    if (phase == 0) {
-      V1 = V2 = S = X = 0.0;
-
-      do {
-        double U1 = (double)rand() / RAND_MAX;
-        double U2 = (double)rand() / RAND_MAX;
-
-        V1 = 2 * U1 - 1;
-        V2 = 2 * U2 - 1;
-        S = V1 * V1 + V2 * V2;
-      } while(S >= 1 || S == 0);
+  static std::string CreateIndexedPropertyName(const std::string& Property, int index);
 
-      X = V1 * sqrt(-2 * log(S) / S);
-    } else
-      X = V2 * sqrt(-2 * log(S) / S);
-
-    phase = 1 - phase;
-
-    return X;
-  }
+  static double GaussianRandomNumber(void);
 
 public:
 /// Moments L, M, N
index f9c19d37f88e693936ecaa563bb8230959d4bfb6..372d01e79b4fd2f931a63f61a76a255b6e55f0e8 100644 (file)
@@ -37,9 +37,12 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include <cmath>
+#include <iostream>
 
 #include "FGState.h"
 
+using namespace std;
+
 namespace JSBSim {
 
 static const char *IdSrc = "$Id$";
index cc7232fc08780a6b2d43cfa160683b1223e6ca06..15daa8e22953ae67fbe69e106f4d254df3b738c1 100644 (file)
@@ -755,9 +755,7 @@ bool FGJSBsim::copy_from_JSBsim()
     // Copy the engine values from JSBSim.
     for ( i=0; i < Propulsion->GetNumEngines(); i++ ) {
       SGPropertyNode * node = fgGetNode("engines/engine", i, true);
-      char buf[30];
-      sprintf(buf, "engines/engine[%d]/thruster", i);
-      SGPropertyNode * tnode = fgGetNode(buf, true);
+      SGPropertyNode * tnode = node->getChild("thruster", 0, true);
       FGThruster * thruster = Propulsion->GetEngine(i)->GetThruster();
 
       switch (Propulsion->GetEngine(i)->GetType()) {
index 295033d50d3808915713a7a181f9941c16ec56af..7eb3f7f6661b01346b66a01d38c083b415ac1d15 100644 (file)
@@ -49,10 +49,15 @@ INCLUDES
 #include "models/FGAerodynamics.h"
 #include "models/FGPropagate.h"
 #include "input_output/FGPropertyManager.h"
+#include "input_output/FGXMLElement.h"
 #include "models/FGPropulsion.h"
 #include "input_output/FGXMLParse.h"
 #include "math/FGQuaternion.h"
+#include <iostream>
 #include <fstream>
+#include <cstdlib>
+
+using namespace std;
 
 namespace JSBSim {
 
index 4257e90d3d6ec5df100a41e78880a0f8766500cd..2f425b769c920f1374cf95f22cec6f59429404a5 100644 (file)
@@ -57,6 +57,8 @@ INCLUDES
 #pragma warning (disable : 4786 4788)
 #endif
 
+using namespace std;
+
 namespace JSBSim {
 
 static const char *IdSrc = "$Id$";
index d9da4669b5daf2c265fafa9769e929260aa2f093..186b9b1df354abf8c67fc3472a486f2735f62628 100644 (file)
@@ -38,6 +38,7 @@ INCLUDES
 
 #include <string>
 #include <cstdlib>
+#include <iomanip>
 #include "FGFDMExec.h"
 #include "models/FGAtmosphere.h"
 #include "FGInitialCondition.h"
@@ -45,6 +46,12 @@ INCLUDES
 #include "models/FGAircraft.h"
 #include "models/FGPropulsion.h"
 #include "models/FGAerodynamics.h"
+#include "models/FGFCS.h"
+#include "models/propulsion/FGEngine.h"
+#include "models/FGAuxiliary.h"
+#include "models/FGGroundReactions.h"
+
+using namespace std;
 
 namespace JSBSim {
 
@@ -427,13 +434,11 @@ void FGTrimAxis::setThrottlesPct(void) {
 /*****************************************************************************/
 
 void FGTrimAxis::AxisReport(void) {
-
-  char out[80];
-
-  sprintf(out,"  %20s: %6.2f %5s: %9.2e Tolerance: %3.0e",
-           GetControlName().c_str(), GetControl()*control_convert,
-           GetStateName().c_str(), GetState()+state_target, GetTolerance());
-  cout << out;
+  cout << "  " << setw(20) << GetControlName() << ": ";
+  cout << setw(6) << setprecision(2) << GetControl()*control_convert << ' ';
+  cout << setw(5) << GetStateName() << ": ";
+  cout << setw(9) << setprecision(2) << scientific << GetState()+state_target;
+  cout << " Tolerance: " << setw(3) << setprecision(0) << scientific << GetTolerance();
 
   if( fabs(GetState()+state_target) < fabs(GetTolerance()) )
      cout << "  Passed" << endl;
index f775d435c1b9c26108836a2e4cbeba7bd6c91fc0..2db5408e33806115cf077c9d6d5336b8ea58d5e1 100644 (file)
@@ -42,7 +42,6 @@ INCLUDES
 #endif
 
 #include <string>
-#include <iostream>
 #include "simgear/props/props.hxx"
 #if !PROPS_STANDALONE
 # include "simgear/math/SGMath.hxx"
@@ -60,8 +59,6 @@ DEFINITIONS
 FORWARD DECLARATIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-using namespace std;
-
 namespace JSBSim {
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -93,7 +90,7 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      *  NOTE: this function changes its argument and thus relies
      *  on pass by value
      */
-    string mkPropertyName(string name, bool lowercase);
+    std::string mkPropertyName(std::string name, bool lowercase);
 
     /**
      * Get a property node.
@@ -103,10 +100,10 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      * @return The node, or 0 if none exists and none was created.
      */
     FGPropertyManager*
-    GetNode (const string &path, bool create = false);
+    GetNode (const std::string &path, bool create = false);
 
     FGPropertyManager*
-    GetNode (const string &relpath, int index, bool create = false);
+    GetNode (const std::string &relpath, int index, bool create = false);
 
     /**
      * Test whether a given node exists.
@@ -114,23 +111,23 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      * @param path The path of the node, relative to root.
      * @return true if the node exists, false otherwise.
      */
-    bool HasNode (const string &path);
+    bool HasNode (const std::string &path);
 
     /**
      * Get the name of a node
      */
-    string GetName( void );
+    std::string GetName( void );
 
     /**
      * Get the name of a node without underscores, etc.
      */
-    string GetPrintableName( void );
+    std::string GetPrintableName( void );
 
     /**
      * Get the fully qualified name of a node
      * This function is very slow, so is probably useful for debugging only.
      */
-    string GetFullyQualifiedName(void);
+    std::string GetFullyQualifiedName(void);
 
     /**
      * Get a bool value for a property.
@@ -146,7 +143,7 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      *        does not exist.
      * @return The property's value as a bool, or the default value provided.
      */
-    bool GetBool (const string &name, bool defaultValue = false);
+    bool GetBool (const std::string &name, bool defaultValue = false);
 
 
     /**
@@ -163,7 +160,7 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      *        does not exist.
      * @return The property's value as an int, or the default value provided.
      */
-    int GetInt (const string &name, int defaultValue = 0);
+    int GetInt (const std::string &name, int defaultValue = 0);
 
 
     /**
@@ -180,7 +177,7 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      *        does not exist.
      * @return The property's value as a long, or the default value provided.
      */
-    int GetLong (const string &name, long defaultValue = 0L);
+    int GetLong (const std::string &name, long defaultValue = 0L);
 
 
     /**
@@ -197,7 +194,7 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      *        does not exist.
      * @return The property's value as a float, or the default value provided.
      */
-    float GetFloat (const string &name, float defaultValue = 0.0);
+    float GetFloat (const std::string &name, float defaultValue = 0.0);
 
 
     /**
@@ -214,7 +211,7 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      *        does not exist.
      * @return The property's value as a double, or the default value provided.
      */
-    double GetDouble (const string &name, double defaultValue = 0.0);
+    double GetDouble (const std::string &name, double defaultValue = 0.0);
 
 
     /**
@@ -231,7 +228,7 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      *        does not exist.
      * @return The property's value as a string, or the default value provided.
      */
-    string GetString (const string &name, string defaultValue = "");
+    std::string GetString (const std::string &name, std::string defaultValue = "");
 
 
     /**
@@ -247,7 +244,7 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      * @param val The new value for the property.
      * @return true if the assignment succeeded, false otherwise.
      */
-    bool SetBool (const string &name, bool val);
+    bool SetBool (const std::string &name, bool val);
 
 
     /**
@@ -263,7 +260,7 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      * @param val The new value for the property.
      * @return true if the assignment succeeded, false otherwise.
      */
-    bool SetInt (const string &name, int val);
+    bool SetInt (const std::string &name, int val);
 
 
     /**
@@ -279,7 +276,7 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      * @param val The new value for the property.
      * @return true if the assignment succeeded, false otherwise.
      */
-    bool SetLong (const string &name, long val);
+    bool SetLong (const std::string &name, long val);
 
 
     /**
@@ -295,7 +292,7 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      * @param val The new value for the property.
      * @return true if the assignment succeeded, false otherwise.
      */
-    bool SetFloat (const string &name, float val);
+    bool SetFloat (const std::string &name, float val);
 
 
     /**
@@ -311,7 +308,7 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      * @param val The new value for the property.
      * @return true if the assignment succeeded, false otherwise.
      */
-    bool SetDouble (const string &name, double val);
+    bool SetDouble (const std::string &name, double val);
 
 
     /**
@@ -327,7 +324,7 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      * @param val The new value for the property.
      * @return true if the assignment succeeded, false otherwise.
      */
-    bool SetString (const string &name, const string &val);
+    bool SetString (const std::string &name, const std::string &val);
 
 
     ////////////////////////////////////////////////////////////////////////
@@ -347,7 +344,7 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      * @param name The property name.
      * @param state The state of the archive attribute (defaults to true).
      */
-    void SetArchivable (const string &name, bool state = true);
+    void SetArchivable (const std::string &name, bool state = true);
 
 
     /**
@@ -362,7 +359,7 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      * @param name The property name.
      * @param state The state of the read attribute (defaults to true).
      */
-    void SetReadable (const string &name, bool state = true);
+    void SetReadable (const std::string &name, bool state = true);
 
 
     /**
@@ -377,7 +374,7 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      * @param name The property name.
      * @param state The state of the write attribute (defaults to true).
      */
-    void SetWritable (const string &name, bool state = true);
+    void SetWritable (const std::string &name, bool state = true);
 
 
     ////////////////////////////////////////////////////////////////////////
@@ -391,7 +388,7 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      * Classes should use this function to release control of any
      * properties they are managing.
      */
-    void Untie (const string &name);
+    void Untie (const std::string &name);
 
 
         // Templates cause ambiguity here
@@ -409,7 +406,7 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      *        be modified; defaults to true.
      */
     void
-    Tie (const string &name, bool *pointer, bool useDefault = true);
+    Tie (const std::string &name, bool *pointer, bool useDefault = true);
 
 
     /**
@@ -425,7 +422,7 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      *        be modified; defaults to true.
      */
     void
-    Tie (const string &name, int *pointer, bool useDefault = true);
+    Tie (const std::string &name, int *pointer, bool useDefault = true);
 
 
     /**
@@ -441,7 +438,7 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      *        be modified; defaults to true.
      */
     void
-    Tie (const string &name, long *pointer, bool useDefault = true);
+    Tie (const std::string &name, long *pointer, bool useDefault = true);
 
 
     /**
@@ -457,7 +454,7 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      *        be modified; defaults to true.
      */
     void
-    Tie (const string &name, float *pointer, bool useDefault = true);
+    Tie (const std::string &name, float *pointer, bool useDefault = true);
 
     /**
      * Tie a property to an external double variable.
@@ -472,7 +469,7 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      *        be modified; defaults to true.
      */
     void
-    Tie (const string &name, double *pointer, bool useDefault = true);
+    Tie (const std::string &name, double *pointer, bool useDefault = true);
 
 //============================================================================
 //
@@ -482,19 +479,19 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
 //============================================================================
 
     /* template <class V> void
-    Tie (const string &name, V (*getter)(), void (*setter)(V) = 0,
+    Tie (const std::string &name, V (*getter)(), void (*setter)(V) = 0,
            bool useDefault = true);
 
     template <class V> void
-    Tie (const string &name, int index, V (*getter)(int),
+    Tie (const std::string &name, int index, V (*getter)(int),
            void (*setter)(int, V) = 0, bool useDefault = true);
 
     template <class T, class V> void
-    Tie (const string &name, T * obj, V (T::*getter)() const,
+    Tie (const std::string &name, T * obj, V (T::*getter)() const,
            void (T::*setter)(V) = 0, bool useDefault = true);
 
     template <class T, class V> void
-    Tie (const string &name, T * obj, int index,
+    Tie (const std::string &name, T * obj, int index,
            V (T::*getter)(int) const, void (T::*setter)(int, V) = 0,
            bool useDefault = true); */
 
@@ -516,12 +513,12 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      */
 
     template <class V> inline void
-    Tie (const string &name, V (*getter)(), void (*setter)(V) = 0, bool useDefault = true)
+    Tie (const std::string &name, V (*getter)(), void (*setter)(V) = 0, bool useDefault = true)
     {
       if (!tie(name.c_str(), SGRawValueFunctions<V>(getter, setter), useDefault))
-        cout << "Failed to tie property " << name << " to functions" << endl;
+        std::cout << "Failed to tie property " << name << " to functions" << std::endl;
       else if (debug_lvl & 0x20)
-        cout << name << endl;
+        std::cout << name << std::endl;
     }
 
 
@@ -543,13 +540,13 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      *        property value should there be one; false if the old value should be
      *        discarded; defaults to true.
      */
-    template <class V> inline void Tie (const string &name, int index, V (*getter)(int),
+    template <class V> inline void Tie (const std::string &name, int index, V (*getter)(int),
                                 void (*setter)(int, V) = 0, bool useDefault = true)
     {
       if (!tie(name.c_str(), SGRawValueFunctionsIndexed<V>(index, getter, setter), useDefault))
-        cout << "Failed to tie property " << name << " to indexed functions" << endl;
+        std::cout << "Failed to tie property " << name << " to indexed functions" << std::endl;
       else if (debug_lvl & 0x20)
-        cout << name << endl;
+        std::cout << name << std::endl;
     }
 
 
@@ -573,13 +570,13 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      *        discarded; defaults to true.
      */
     template <class T, class V> inline void
-    Tie (const string &name, T * obj, V (T::*getter)() const,
+    Tie (const std::string &name, T * obj, V (T::*getter)() const,
            void (T::*setter)(V) = 0, bool useDefault = true)
     {
       if (!tie(name.c_str(), SGRawValueMethods<T,V>(*obj, getter, setter), useDefault))
-        cout << "Failed to tie property " << name << " to object methods" << endl;
+        std::cout << "Failed to tie property " << name << " to object methods" << std::endl;
       else if (debug_lvl & 0x20)
-        cout << name << endl;
+        std::cout << name << std::endl;
     }
 
     /**
@@ -602,13 +599,13 @@ class FGPropertyManager : public SGPropertyNode, public FGJSBBase
      *        discarded; defaults to true.
      */
     template <class T, class V> inline void
-    Tie (const string &name, T * obj, int index, V (T::*getter)(int) const,
+    Tie (const std::string &name, T * obj, int index, V (T::*getter)(int) const,
                          void (T::*setter)(int, V) = 0, bool useDefault = true)
     {
       if (!tie(name.c_str(), SGRawValueMethodsIndexed<T,V>(*obj, index, getter, setter), useDefault))
-        cout << "Failed to tie property " << name << " to indexed object methods" << endl;
+        std::cout << "Failed to tie property " << name << " to indexed object methods" << std::endl;
       else if (debug_lvl & 0x20)
-        cout << name << endl;
+        std::cout << name << std::endl;
    }
 };
 }
index 6c49b4f15a35bc692f74e83d09ee7d53414c20b7..dde76de95828c5e904bf4684ac9d44e2dc9857d6 100755 (executable)
@@ -46,6 +46,9 @@ INCLUDES
 #include "initialization/FGTrim.h"
 
 #include <iostream>
+#include <cstdlib>
+
+using namespace std;
 
 namespace JSBSim {
 
index 044ead516b96112da36c820916f8a98b5dac82e2..df541fa3aaee1b8af04d9adc0b2c464d3a32d24e 100755 (executable)
@@ -32,6 +32,9 @@ INCLUDES
 
 #include <cmath>
 #include <cstdlib>
+#include <iostream>
+
+using namespace std;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -49,7 +52,7 @@ map <string, map <string, double> > Element::convert;
 CLASS IMPLEMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-Element::Element(string nm)
+Element::Element(const string& nm)
 {
   name   = nm;
   parent = 0L;
@@ -221,7 +224,7 @@ Element::~Element(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string Element::GetAttributeValue(string attr)
+string Element::GetAttributeValue(const string& attr)
 {
   int select=-1;
   for (unsigned int i=0; i<attribute_key.size(); i++) {
@@ -233,7 +236,7 @@ string Element::GetAttributeValue(string attr)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-double Element::GetAttributeValueAsNumber(string attr)
+double Element::GetAttributeValueAsNumber(const string& attr)
 {
   string attribute = GetAttributeValue(attr);
 
@@ -292,7 +295,7 @@ double Element::GetDataAsNumber(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-unsigned int Element::GetNumElements(string element_name)
+unsigned int Element::GetNumElements(const string& element_name)
 {
   unsigned int number_of_elements=0;
   Element* el=FindElement(element_name);
@@ -305,7 +308,7 @@ unsigned int Element::GetNumElements(string element_name)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-Element* Element::FindElement(string el)
+Element* Element::FindElement(const string& el)
 {
   if (el.empty() && children.size() >= 1) {
     element_index = 1;
@@ -323,7 +326,7 @@ Element* Element::FindElement(string el)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-Element* Element::FindNextElement(string el)
+Element* Element::FindNextElement(const string& el)
 {
   if (el.empty()) {
     if (element_index < children.size()) {
@@ -345,7 +348,7 @@ Element* Element::FindNextElement(string el)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-double Element::FindElementValueAsNumber(string el)
+double Element::FindElementValueAsNumber(const string& el)
 {
   Element* element = FindElement(el);
   if (element) {
@@ -358,7 +361,7 @@ double Element::FindElementValueAsNumber(string el)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string Element::FindElementValue(string el)
+string Element::FindElementValue(const string& el)
 {
   Element* element = FindElement(el);
   if (element) {
@@ -370,7 +373,7 @@ string Element::FindElementValue(string el)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-double Element::FindElementValueAsNumberConvertTo(string el, string target_units)
+double Element::FindElementValueAsNumberConvertTo(const string& el, const string& target_units)
 {
   Element* element = FindElement(el);
 
@@ -404,9 +407,9 @@ double Element::FindElementValueAsNumberConvertTo(string el, string target_units
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-double Element::FindElementValueAsNumberConvertFromTo( string el,
-                                                       string supplied_units,
-                                                       string target_units)
+double Element::FindElementValueAsNumberConvertFromTo( const string& el,
+                                                       const string& supplied_units,
+                                                       const string& target_units)
 {
   Element* element = FindElement(el);
 
@@ -438,7 +441,7 @@ double Element::FindElementValueAsNumberConvertFromTo( string el,
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-FGColumnVector3 Element::FindElementTripletConvertTo( string target_units)
+FGColumnVector3 Element::FindElementTripletConvertTo( const string& target_units)
 {
   FGColumnVector3 triplet;
   Element* item;
@@ -518,7 +521,7 @@ void Element::Print(unsigned int level)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-void Element::AddAttribute(string name, string value)
+void Element::AddAttribute(const string& name, const string& value)
 {
   attribute_key.push_back(name);
   attributes[name] = value;
@@ -528,8 +531,8 @@ void Element::AddAttribute(string name, string value)
 
 void Element::AddData(string d)
 {
-  unsigned int string_start = (unsigned int)d.find_first_not_of(" \t");
-  if (string_start > 0) {
+  string::size_type string_start = d.find_first_not_of(" \t");
+  if (string_start != string::npos && string_start > 0) {
     d.erase(0,string_start);
   }
   data_lines.push_back(d);
index e4cac49d253fae01737701a8a0c5220e5ddf5bf1..75add86b77d83ab441d31d25b2d50931a278c06d 100755 (executable)
@@ -36,15 +36,8 @@ INCLUDES
 
 #include <string>
 #include <map>
-#include <iostream>
 #include <vector>
 
-using std::string;
-using std::map;
-using std::vector;
-using std::cout;
-using std::endl;
-
 #include "math/FGColumnVector3.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -155,7 +148,7 @@ public:
   /** Constructor
       @param nm the name of this element (if given)
       */
-  Element(string nm);
+  Element(const std::string& nm);
   /// Destructor
   ~Element(void);
 
@@ -163,23 +156,23 @@ public:
       @param key specifies the attribute key to retrieve the value of.
       @return the key value (as a string), or the empty string if no such
               attribute exists. */
-  string GetAttributeValue(string key);
+  std::string GetAttributeValue(const std::string& key);
 
   /** Retrieves an attribute value as a double precision real number.
       @param key specifies the attribute key to retrieve the value of.
       @return the key value (as a number), or the HUGE_VAL if no such
               attribute exists. */
-  double GetAttributeValueAsNumber(string key);
+  double GetAttributeValueAsNumber(const std::string& key);
 
   /** Retrieves the element name.
       @return the element name, or the empty string if no name has been set.*/
-  string GetName(void) {return name;}
+  const std::string& GetName(void) const {return name;}
 
   /** Gets a line of data belonging to an element.
       @param i the index of the data line to return (0 by default).
       @return a string representing the data line requested, or the empty string
               if none exists.*/
-  string GetDataLine(unsigned int i=0);
+  std::string GetDataLine(unsigned int i=0);
 
   /// Returns the number of lines of data stored
   unsigned int GetNumDataLines(void) {return (unsigned int)data_lines.size();}
@@ -188,7 +181,7 @@ public:
   unsigned int GetNumElements(void) {return (unsigned int)children.size();}
 
   /// Returns the number of named child elements for this element.
-  unsigned int GetNumElements(string);
+  unsigned int GetNumElements(const std::string& element_name);
 
   /** Converts the element data to a number.
       This function attempts to convert the first (and presumably only) line of
@@ -226,7 +219,7 @@ public:
       element counter to the first element.
       @param el the search string (empty string by default).
       @return a pointer to the first element that matches the supplied search string. */
-  Element* FindElement(string el="");
+  Element* FindElement(const std::string& el="");
 
   /** Searches for the next element as specified.
       This function would be called after FindElement() is first called (in order to
@@ -237,7 +230,7 @@ public:
       @param el the name of the next element to find.
       @return the pointer to the found element, or 0 if no appropriate element us
               found.*/
-  Element* FindNextElement(string el="");
+  Element* FindNextElement(const std::string& el="");
 
   /** Searches for the named element and returns the string data belonging to it.
       This function allows the data belonging to a named element to be returned
@@ -247,7 +240,7 @@ public:
       default)
       @return the data value for the named element as a string, or the empty
               string if the element cannot be found. */
-  string FindElementValue(string el="");
+  std::string FindElementValue(const std::string& el="");
 
   /** Searches for the named element and returns the data belonging to it as a number.
       This function allows the data belonging to a named element to be returned
@@ -257,7 +250,7 @@ public:
       default)
       @return the data value for the named element as a double, or HUGE_VAL if the
               data is missing. */
-  double FindElementValueAsNumber(string el="");
+  double FindElementValueAsNumber(const std::string& el="");
 
   /** Searches for the named element and converts and returns the data belonging to it.
       This function allows the data belonging to a named element to be returned
@@ -274,7 +267,7 @@ public:
              to which the value returned will be converted.
       @return the unit-converted data value for the named element as a double,
               or HUGE_VAL if the data is missing. */
-  double FindElementValueAsNumberConvertTo(string el, string target_units);
+  double FindElementValueAsNumberConvertTo(const std::string& el, const std::string& target_units);
 
   /** Searches for the named element and converts and returns the data belonging to it.
       This function allows the data belonging to a named element to be returned
@@ -293,9 +286,9 @@ public:
              to which the value returned will be converted.
       @return the unit-converted data value for the named element as a double,
               or HUGE_VAL if the data is missing. */
-  double FindElementValueAsNumberConvertFromTo( string el,
-                                                string supplied_units,
-                                                string target_units);
+  double FindElementValueAsNumberConvertFromTo( const std::string& el,
+                                                const std::string& supplied_units,
+                                                const std::string& target_units);
 
   /** Composes a 3-element column vector for the supplied location or orientation.
       This function processes a LOCATION or ORIENTATION construct, returning a
@@ -306,7 +299,7 @@ public:
       @param target_units the string representing the native units used by JSBSim
              to which the value returned will be converted.
       @return a column vector object built from the LOCATION or ORIENT components. */
-  FGColumnVector3 FindElementTripletConvertTo( string target_units);
+  FGColumnVector3 FindElementTripletConvertTo( const std::string& target_units);
 
   /** This function sets the value of the parent class attribute to the supplied
       Element pointer.
@@ -320,11 +313,11 @@ public:
   /** Stores an attribute belonging to this element.
   *   @param name The string name of the attribute.
   *   @param value The string value of the attribute. */
-  void AddAttribute(string name, string value);
+  void AddAttribute(const std::string& name, const std::string& value);
 
   /** Stores data belonging to this element.
   *   @param d the data to store. */
-  void AddData(string d);
+  void AddData(std::string d);
 
   /** Prints the element.
   *   Prints this element and calls the Print routine for child elements.
@@ -332,14 +325,14 @@ public:
   void Print(unsigned int level=0);
 
 private:
-  string name;
-  map <string, string> attributes;
-  vector <string> data_lines;
-  vector <Element*> children;
-  vector <string> attribute_key;
+  std::string name;
+  std::map <std::string, std::string> attributes;
+  std::vector <std::string> data_lines;
+  std::vector <Element*> children;
+  std::vector <std::string> attribute_key;
   Element *parent;
   unsigned int element_index;
-  typedef map <string, map <string, double> > tMapConvert;
+  typedef std::map <std::string, std::map <std::string, double> > tMapConvert;
   static tMapConvert convert;
   static bool converterIsInitialized;
 };
index 39323daf285121ddc63eb65e91f98dc8a6d1aae5..472a79adc36377d27f3eb9b6401d90422c753872 100755 (executable)
@@ -36,6 +36,8 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "input_output/FGXMLParse.h"
+#include <iostream>
+#include <fstream>
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
@@ -56,19 +58,19 @@ public:
 
 protected:
   Element* document;
-  Element* LoadXMLDocument(string XML_filename)
+  Element* LoadXMLDocument(std::string XML_filename)
   {
-    ifstream infile;
+    std::ifstream infile;
 
     if ( !XML_filename.empty() ) {
-      if (XML_filename.find(".xml") == string::npos) XML_filename += ".xml";
+      if (XML_filename.find(".xml") == std::string::npos) XML_filename += ".xml";
       infile.open(XML_filename.c_str());
       if ( !infile.is_open()) {
-        cerr << "Could not open file: " << XML_filename << endl;
+        std::cerr << "Could not open file: " << XML_filename << std::endl;
         return 0L;
       }
     } else {
-      cerr << "No filename given." << endl;
+      std::cerr << "No filename given." << std::endl;
       return 0L;
     }
 
index ffc3d173bc1dea36634e967ce170cc2409b777e5..7eefba94f8f5e3b93fa5e41e3bf348145e266d51 100755 (executable)
@@ -30,9 +30,14 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGXMLParse.h"
+#include "FGXMLElement.h"
+#include <string>
+#include <iostream>
 #include <cstdlib>
 #include "input_output/string_utilities.h"
 
+using namespace std;
+
 namespace JSBSim {
 
 static const char *IdSrc = "$Id$";
index 74580060b8dff8924a5bcd767b8513ac4e43704c..5fdd92b06dd8a15b50e1b1b2cf56fb19699bbcfd 100755 (executable)
@@ -34,15 +34,6 @@ SENTRY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#include <string>
-#include <iostream>
-
-using std::string;
-using std::cout;
-using std::cerr;
-using std::endl;
-
-#include "FGXMLElement.h"
 #include "simgear/xml/easyxml.hxx"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -58,6 +49,8 @@ FORWARD DECLARATIONS
 
 namespace JSBSim {
 
+class Element;
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
index 365c1916fe9e901686556d139d83ba33cadfc2b7..1eb7859d4012d8f5a63efcc2757989e136365bc4 100644 (file)
@@ -38,8 +38,16 @@ HISTORY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#include "FGfdmSocket.h"
+#include <iostream>
+#include <iomanip>
 #include <cstring>
+#include "FGfdmSocket.h"
+#include "string_utilities.h"
+
+using std::cout;
+using std::cerr;
+using std::endl;
+using std::string;
 
 namespace JSBSim {
 
@@ -50,9 +58,9 @@ static const char *IdHdr = ID_FDMSOCKET;
 CLASS IMPLEMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-FGfdmSocket::FGfdmSocket(string address, int port, int protocol)
+FGfdmSocket::FGfdmSocket(const string& address, int port, int protocol)
 {
-  sckt = sckt_in = size = 0;
+  sckt = sckt_in = 0;
   connected = false;
 
   #if defined(_MSC_VER) || defined(__MINGW32__)
@@ -104,9 +112,9 @@ FGfdmSocket::FGfdmSocket(string address, int port, int protocol)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-FGfdmSocket::FGfdmSocket(string address, int port)
+FGfdmSocket::FGfdmSocket(const string& address, int port)
 {
-  sckt = sckt_in = size = 0;
+  sckt = sckt_in = 0;
   connected = false;
 
   #if defined(_MSC_VER) || defined(__MINGW32__)
@@ -158,7 +166,6 @@ FGfdmSocket::FGfdmSocket(string address, int port)
 
 FGfdmSocket::FGfdmSocket(int port)
 {
-  size = 0;
   connected = false;
   unsigned long NoBlock = true;
 
@@ -217,9 +224,8 @@ string FGfdmSocket::Receive(void)
   char buf[1024];
   int len = sizeof(struct sockaddr_in);
   int num_chars=0;
-  int total_chars = 0;
   unsigned long NoBlock = true;
-  string data = ""; // todo: should allocate this with a standard size as a
+  string data;      // todo: should allocate this with a standard size as a
                     // class attribute and pass as a reference?
 
   if (sckt_in <= 0) {
@@ -239,9 +245,8 @@ string FGfdmSocket::Receive(void)
   }
 
   if (sckt_in > 0) {
-    while ((num_chars = recv(sckt_in, buf, 1024, 0)) > 0) {
-      data += string(buf).substr(0,num_chars);
-      total_chars += num_chars;
+    while ((num_chars = recv(sckt_in, buf, sizeof buf, 0)) > 0) {
+      data.append(buf, num_chars);
     }
 
 #if defined(_MSC_VER)
@@ -258,12 +263,12 @@ string FGfdmSocket::Receive(void)
 #endif
   }
 
-  return data.substr(0, total_chars);
+  return data;
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-int FGfdmSocket::Reply(string text)
+int FGfdmSocket::Reply(const string& text)
 {
   int num_chars_sent=0;
 
@@ -288,71 +293,58 @@ void FGfdmSocket::Close(void)
 
 void FGfdmSocket::Clear(void)
 {
-  buffer = "";
-  size = 0;
+  buffer.str(string());
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-void FGfdmSocket::Clear(string s)
+void FGfdmSocket::Clear(const string& s)
 {
-  buffer = s + " ";
-  size = buffer.size();
+  Clear();
+  buffer << s << ' ';
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 void FGfdmSocket::Append(const char* item)
 {
-  if (size == 0) buffer += string(item);
-  else buffer += string(",") + string(item);
-  size++;
+  if (buffer.tellp() > 0) buffer << ',';
+  buffer << item;
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 void FGfdmSocket::Append(double item)
 {
-  char s[25];
-
-  sprintf(s,"%12.7f",item);
-
-  if (size == 0) buffer += string(s);
-  else buffer += string(",") + string(s);
-  size++;
+  if (buffer.tellp() > 0) buffer << ',';
+  buffer << std::setw(12) << std::setprecision(7) << item;
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 void FGfdmSocket::Append(long item)
 {
-  char s[25];
-
-  sprintf(s,"%12ld",item);
-
-  if (size == 0) buffer += string(s);
-  else buffer += string(",") + string(s);
-  size++;
+  if (buffer.tellp() > 0) buffer << ',';
+  buffer << std::setw(12) << item;
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 void FGfdmSocket::Send(void)
 {
-  buffer += string("\n");
-  if ((send(sckt,buffer.c_str(),buffer.size(),0)) <= 0) {
+  buffer << '\n';
+  string str = buffer.str();
+  if ((send(sckt,str.c_str(),str.size(),0)) <= 0) {
     perror("send");
-  } else {
   }
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-void FGfdmSocket::Send(char *data, int length)
+void FGfdmSocket::Send(const char *data, int length)
 {
   if ((send(sckt,data,length,0)) <= 0) {
     perror("send");
-  } else {
   }
 }
 
index fc133473d90724f255392a89005672d5a4e33fdd..46b41ad56f5f8c93f91df468e1ee6cbaeac895c1 100644 (file)
@@ -39,16 +39,11 @@ SENTRY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#include <cstdio>
 #include <string>
-#include <iostream>
-#include <fstream>
+#include <sstream>
 #include <sys/types.h>
 #include "FGJSBBase.h"
 
-using std::cout;
-using std::endl;
-
 #if defined(_MSC_VER) || defined(__MINGW32__)
   #include <winsock.h>
   #include <io.h>
@@ -90,27 +85,24 @@ CLASS DOCUMENTATION
 CLASS DECLARATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-using std::string;
-using std::cerr;
-
 class FGfdmSocket : public FGJSBBase
 {
 public:
-  FGfdmSocket(string, int);
-  FGfdmSocket(string, int, int);
+  FGfdmSocket(const std::string&, int);
+  FGfdmSocket(const std::string&, int, int);
   FGfdmSocket(int);
   ~FGfdmSocket();
   void Send(void);
-  void Send(char *data, int length);
+  void Send(const char *data, int length);
 
-  string Receive(void);
-  int Reply(string text);
-  void Append(const string s) {Append(s.c_str());}
+  std::string Receive(void);
+  int Reply(const std::string& text);
+  void Append(const std::string& s) {Append(s.c_str());}
   void Append(const char*);
   void Append(double);
   void Append(long);
   void Clear(void);
-  void Clear(string s);
+  void Clear(const std::string& s);
   void Close(void);
   bool GetConnectStatus(void) {return connected;}
 
@@ -119,10 +111,9 @@ public:
 private:
   int sckt;
   int sckt_in;
-  int size;
   struct sockaddr_in scktName;
   struct hostent *host;
-  string buffer;
+  std::ostringstream buffer;
   bool connected;
   void Debug(int from);
 };
index 38ab806282d783d09575776c5419d61900f52294..bc3a152a9e105df37b06c890254c61862156cab8 100644 (file)
@@ -4,7 +4,7 @@
  Author:       Jon S. Berndt
  Date started: 06/01/09
 
- ------------- Copyright (C) 2009  Jon S. Berndt (jsb@hal-pc.org) -------------
+ ------------- Copyright (C) 2009  Jon S. Berndt (jon@jsbsim.org) -------------
 
  This program is free software; you can redistribute it and/or modify it under
  the terms of the GNU Lesser General Public License as published by the Free Software
@@ -38,8 +38,8 @@ SENTRY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
+#include <string>
 #include <vector>
-#include <ctype.h>
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
@@ -51,8 +51,6 @@ DEFINITIONS
 FORWARD DECLARATIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-using namespace std;
-
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -63,29 +61,30 @@ CLASS DECLARATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #if !defined(BASE)
-  extern string& trim_left(string& str);
-  extern string& trim_right(string& str);
-  extern string& trim(string& str);
-  extern string& to_upper(string& str);
-  extern string& to_lower(string& str);
-  extern bool is_number(string& str);
-  vector <string> split(string str, char d);
+  extern std::string& trim_left(std::string& str);
+  extern std::string& trim_right(std::string& str);
+  extern std::string& trim(std::string& str);
+  extern std::string& to_upper(std::string& str);
+  extern std::string& to_lower(std::string& str);
+  extern bool is_number(const std::string& str);
+  std::vector <std::string> split(std::string str, char d);
 #else
+  #include <ctype.h>
+
+  using namespace std;
 
   string& trim_left(string& str)
   {
-    while ( !isgraph(str[0]) ) {
+    while (str.size() && !isgraph(str[0])) {
       str = str.erase(0,1);
-      if (str.size() == 0) break;
     }
     return str;
   }
 
   string& trim_right(string& str)
   {
-    while (!isgraph(str[str.size()-1])) {
+    while (str.size() && !isgraph(str[str.size()-1])) {
       str = str.erase(str.size()-1,1);
-      if (str.size() == 0) break;
     }
     return str;
   }
@@ -99,17 +98,17 @@ CLASS DECLARATION
 
   string& to_upper(string& str)
   {
-    for (int i=0; i<str.size(); i++) str[i] = toupper(str[i]);
+    for (size_t i=0; i<str.size(); i++) str[i] = toupper(str[i]);
     return str;
   }
 
   string& to_lower(string& str)
   {
-    for (int i=0; i<str.size(); i++) str[i] = tolower(str[i]);
+    for (size_t i=0; i<str.size(); i++) str[i] = tolower(str[i]);
     return str;
   }
 
-  bool is_number(string& str)
+  bool is_number(const string& str)
   {
     return (str.find_first_not_of("+-.0123456789Ee") == string::npos);
   }
@@ -117,7 +116,7 @@ CLASS DECLARATION
   vector <string> split(string str, char d)
   {
     vector <string> str_array;
-    int index=0;
+    size_t index=0;
     string temp = "";
 
     trim(str);
@@ -142,3 +141,4 @@ CLASS DECLARATION
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 #endif
+
index fc7b80595d536c9482513456fa0c1ad3a3daccbc..8a85454e2ce5bb322500905e268f799cd75f3d05 100644 (file)
@@ -38,7 +38,12 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGColumnVector3.h"
-#include <cstdio>
+#include <iostream>
+#include <sstream>
+#include <iomanip>
+#include <cmath>
+
+using namespace std;
 
 namespace JSBSim {
 
@@ -57,11 +62,13 @@ FGColumnVector3::FGColumnVector3(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGColumnVector3::Dump(string delimeter) const
+string FGColumnVector3::Dump(const string& delimiter) const
 {
-  char buffer[256];
-  sprintf(buffer, "%18.16f%s%18.16f%s%18.16f", Entry(1), delimeter.c_str(), Entry(2), delimeter.c_str(), Entry(3));
-  return string(buffer);
+  ostringstream buffer;
+  buffer << std::setw(18) << std::setprecision(16) << Entry(1) << delimiter;
+  buffer << std::setw(18) << std::setprecision(16) << Entry(2) << delimiter;
+  buffer << std::setw(18) << std::setprecision(16) << Entry(3);
+  return buffer.str();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 9b16a6df11036dac18ffdd9e94fd657af85068be..2817f9571fd880a11fb910107a62225279a1c2e2 100644 (file)
@@ -39,20 +39,8 @@ SENTRY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#include <cstdlib>
+#include <iosfwd>
 #include <string>
-#include <fstream>
-#include <iostream>
-#include <cmath>
-
-using std::ostream;
-using std::istream;
-using std::cerr;
-using std::cout;
-using std::endl;
-using std::sqrt;
-using std::string;
-
 #include "FGJSBBase.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -149,7 +137,7 @@ public:
   /** Prints the contents of the vector
       @param delimeter the item separator (tab or comma)
       @return a string with the delimeter-separated contents of the vector  */
-  string Dump(string delimeter) const;
+  std::string Dump(const std::string& delimeter) const;
 
   /** Assignment operator.
       @param b source vector.
@@ -291,7 +279,7 @@ inline FGColumnVector3 operator*(double scalar, const FGColumnVector3& A) {
     @param os Stream to write to.
     @param M Matrix to write.
     Write the matrix to a stream.*/
-ostream& operator<<(ostream& os, const FGColumnVector3& col);
+std::ostream& operator<<(std::ostream& os, const FGColumnVector3& col);
 
 } // namespace JSBSim
 
index 6f40a72dff8d77ba52d5460dfcc0d478e7fc8911..ff2f77543b89f92a9b3dc917a0519942efafda5f 100644 (file)
@@ -35,7 +35,12 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGCondition.h"
-#include <vector>
+#include "input_output/FGXMLElement.h"
+#include "input_output/FGPropertyManager.h"
+#include <iostream>
+#include <cstdlib>
+
+using namespace std;
 
 namespace JSBSim {
 
@@ -91,7 +96,7 @@ FGCondition::FGCondition(Element* element, FGPropertyManager* PropertyManager) :
 // This constructor is called when there are no nested test groups inside the
 // condition
 
-FGCondition::FGCondition(string test, FGPropertyManager* PropertyManager) :
+FGCondition::FGCondition(const string& test, FGPropertyManager* PropertyManager) :
   PropertyManager(PropertyManager), isGroup(false)
 {
   string property1, property2, compare_string;
index 3becca592ef0858318a2752a49d3ac65d4803d0b..6272a8371cfa98add3f50e167d59bb0a8b9e4f97 100644 (file)
@@ -39,8 +39,6 @@ INCLUDES
 
 #include <map>
 #include "FGJSBBase.h"
-#include "input_output/FGXMLElement.h"
-#include "input_output/FGPropertyManager.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
@@ -54,6 +52,9 @@ FORWARD DECLARATIONS
 
 namespace JSBSim {
 
+class FGPropertyManager;
+class Element;
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -69,7 +70,7 @@ class FGCondition : public FGJSBBase
 {
 public:
   FGCondition(Element* element, FGPropertyManager* PropertyManager);
-  FGCondition(string test, FGPropertyManager* PropertyManager);
+  FGCondition(const std::string& test, FGPropertyManager* PropertyManager);
   ~FGCondition(void);
 
   bool Evaluate(void);
@@ -78,18 +79,18 @@ public:
 private:
   enum eComparison {ecUndef=0, eEQ, eNE, eGT, eGE, eLT, eLE};
   enum eLogic {elUndef=0, eAND, eOR};
-  map <string, eComparison> mComparison;
+  std::map <std::string, eComparison> mComparison;
   eLogic Logic;
 
   FGPropertyManager *TestParam1, *TestParam2, *PropertyManager;
   double TestValue;
   eComparison Comparison;
   bool isGroup;
-  string conditional;
+  std::string conditional;
 
-  static string indent;
+  static std::string indent;
 
-  vector <FGCondition*> conditions;
+  std::vector <FGCondition*> conditions;
   void InitializeConditionals(void);
 
   void Debug(int from);
index 597fe2f2fae7af59b7bde6a00f8365cdc9f3aa96..1db1e6aecc7228930911009e350ad9317e990767 100755 (executable)
@@ -28,12 +28,17 @@ Purpose: Stores various parameter types for functions
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#include <stdio.h>
-
+#include <sstream>
+#include <iomanip>
+#include <cstdlib>
 #include "FGFunction.h"
 #include "FGTable.h"
 #include "FGPropertyValue.h"
 #include "FGRealValue.h"
+#include "input_output/FGXMLElement.h"
+#include "input_output/FGPropertyManager.h"
+
+using namespace std;
 
 namespace JSBSim {
 
@@ -44,7 +49,7 @@ static const char *IdHdr = ID_FUNCTION;
 CLASS IMPLEMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-FGFunction::FGFunction(FGPropertyManager* propMan, Element* el, string prefix)
+FGFunction::FGFunction(FGPropertyManager* propMan, Element* el, const string& prefix)
                                       : PropertyManager(propMan), Prefix(prefix)
 {
   Element* element;
@@ -319,12 +324,10 @@ double FGFunction::GetValue(void) const
 
 string FGFunction::GetValueAsString(void) const
 {
-  char buffer[20];
-  string value;
+  ostringstream buffer;
 
-  sprintf(buffer,"%9.6f",GetValue());
-  value = string(buffer);
-  return value;
+  buffer << setw(9) << setprecision(6) << GetValue();
+  return buffer.str();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index e946ab60a66a37841d1b3c95eb64504392e0f412..4c67ba46e851a9af672bdddd32eea38c0514794e 100755 (executable)
@@ -37,8 +37,6 @@ INCLUDES
 #include <vector>
 #include <string>
 #include "FGParameter.h"
-#include "input_output/FGXMLElement.h"
-#include "input_output/FGPropertyManager.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
@@ -52,6 +50,9 @@ FORWARD DECLARATIONS
 
 namespace JSBSim {
 
+class FGPropertyManager;
+class Element;
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -165,7 +166,7 @@ public:
     @param prefix an optional prefix to prepend to the name given to the property
            that represents this function (if given).
 */
-  FGFunction(FGPropertyManager* PropertyManager, Element* element, string prefix="");
+  FGFunction(FGPropertyManager* PropertyManager, Element* element, const std::string& prefix="");
   /// Destructor.
   virtual ~FGFunction();
 
@@ -175,10 +176,10 @@ public:
 
 /** The value that the function evaluates to, as a string.
   @return the value of the function as a string. */
-  string GetValueAsString(void) const;
+  std::string GetValueAsString(void) const;
 
 /// Retrieves the name of the function.
-  string GetName(void) const {return Name;}
+  std::string GetName(void) const {return Name;}
 
 /** Specifies whether to cache the value of the function, so it is calculated only
     once per frame.
@@ -189,44 +190,44 @@ public:
   void cacheValue(bool shouldCache);
 
 private:
-  vector <FGParameter*> Parameters;
+  std::vector <FGParameter*> Parameters;
   FGPropertyManager* const PropertyManager;
   bool cached;
-  string Prefix;
-  string description_string;
-  string property_string;
-  string value_string;
-  string table_string;
-  string p_string;
-  string v_string;
-  string t_string;
-  string function_string;
-  string sum_string;
-  string difference_string;
-  string product_string;
-  string quotient_string;
-  string pow_string;
-  string exp_string;
-  string abs_string;
-  string sin_string;
-  string cos_string;
-  string tan_string;
-  string asin_string;
-  string acos_string;
-  string atan_string;
-  string atan2_string;
-  string min_string;
-  string max_string;
-  string avg_string;
-  string fraction_string;
-  string mod_string;
-  string random_string;
-  string integer_string;
+  std::string Prefix;
+  std::string description_string;
+  std::string property_string;
+  std::string value_string;
+  std::string table_string;
+  std::string p_string;
+  std::string v_string;
+  std::string t_string;
+  std::string function_string;
+  std::string sum_string;
+  std::string difference_string;
+  std::string product_string;
+  std::string quotient_string;
+  std::string pow_string;
+  std::string exp_string;
+  std::string abs_string;
+  std::string sin_string;
+  std::string cos_string;
+  std::string tan_string;
+  std::string asin_string;
+  std::string acos_string;
+  std::string atan_string;
+  std::string atan2_string;
+  std::string min_string;
+  std::string max_string;
+  std::string avg_string;
+  std::string fraction_string;
+  std::string mod_string;
+  std::string random_string;
+  std::string integer_string;
   double cachedValue;
   enum functionType {eTopLevel=0, eProduct, eDifference, eSum, eQuotient, ePow,
                      eExp, eAbs, eSin, eCos, eTan, eASin, eACos, eATan, eATan2,
                      eMin, eMax, eAvg, eFrac, eInteger, eMod, eRandom} Type;
-  string Name;
+  std::string Name;
   void bind(void);
   void Debug(int from);
 };
index 91976f100244e5fafeb9dcb3f2d8319d2c423cae..8f27e88a54c2a8e5696d3710d55a0763cb531e8b 100644 (file)
@@ -40,6 +40,10 @@ INCLUDES
 #include "FGMatrix33.h"
 #include "FGColumnVector3.h"
 
+#include <iostream>
+
+using namespace std;
+
 namespace JSBSim {
 
 static const char *IdSrc = "$Id$";
index 98babfcd0d2b4287d0ec76441a9deb0df233212c..a31e05d88f3e6e6304051c263c894f993d1db8b7 100644 (file)
@@ -40,18 +40,8 @@ SENTRY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#include <cstdlib>
 #include <string>
-#include <fstream>
-#include <iostream>
-#include <cmath>
-
-using std::ostream;
-using std::istream;
-using std::cerr;
-using std::cout;
-using std::endl;
-using std::string;
+#include <iosfwd>
 
 #include "FGColumnVector3.h"
 #include "FGJSBBase.h"
@@ -84,7 +74,7 @@ DECLARATION: MatrixException
 class MatrixException : public FGJSBBase
 {
 public:
-  string Message;
+  std::string Message;
 };
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -450,7 +440,7 @@ inline FGMatrix33 operator*(double scalar, const FGMatrix33& A) {
 
     Write the matrix to a stream.
 */
-ostream& operator<<(ostream& os, const FGMatrix33& M);
+std::ostream& operator<<(std::ostream& os, const FGMatrix33& M);
 
 /** Read matrix from a stream.
 
@@ -459,7 +449,7 @@ ostream& operator<<(ostream& os, const FGMatrix33& M);
 
     Read matrix from a stream.
 */
-istream& operator>>(istream& is, FGMatrix33& M);
+std::istream& operator>>(std::istream& is, FGMatrix33& M);
 
 } // namespace JSBSim
 
index d0027aec3b22e53daac2e720011dc3c534ff716c..f19669191c00f8d8fe725fa0317106d218886d7e 100644 (file)
@@ -37,7 +37,11 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGTable.h"
-#include <iomanip>
+#include "input_output/FGXMLElement.h"
+#include "input_output/FGPropertyManager.h"
+#include <iostream>
+#include <sstream>
+#include <cstdlib>
 
 using namespace std;
 
@@ -307,7 +311,7 @@ FGTable::~FGTable()
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-unsigned int FGTable::FindNumColumns(string test_line)
+unsigned int FGTable::FindNumColumns(const string& test_line)
 {
   // determine number of data columns in table (first column is row lookup - don't count)
   size_t position=0;
@@ -466,7 +470,7 @@ double FGTable::GetValue(double rowKey, double colKey, double tableKey) const
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-void FGTable::operator<<(stringstream& in_stream)
+void FGTable::operator<<(istream& in_stream)
 {
   int startRow=0;
   int startCol=0;
index 600f08d4b2bae84d57291841d5687a605dfe80b9..1b0d22e16e5f4ca8cbb3c9d5ae48aadbbfc292f5 100644 (file)
@@ -38,11 +38,10 @@ SENTRY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#include "input_output/FGXMLElement.h"
 #include "FGParameter.h"
-#include "input_output/FGPropertyManager.h"
-#include <sstream>
+#include <iosfwd>
 #include <vector>
+#include <string>
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
@@ -54,11 +53,11 @@ DEFINITIONS
 FORWARD DECLARATIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-using std::vector;
-using std::stringstream;
-
 namespace JSBSim {
 
+class FGPropertyManager;
+class Element;
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -280,7 +279,7 @@ public:
        </pre>
        */
 
-  void operator<<(stringstream&);
+  void operator<<(std::istream&);
   FGTable& operator<<(const double n);
   FGTable& operator<<(const int n);
 
@@ -298,16 +297,16 @@ private:
   bool internal;
   FGPropertyManager *lookupProperty[3];
   double** Data;
-  vector <FGTable*> Tables;
-  unsigned int FindNumColumns(string);
+  std::vector <FGTable*> Tables;
   unsigned int nRows, nCols, nTables, dimension;
   int colCounter, rowCounter, tableCounter;
   mutable int lastRowIndex, lastColumnIndex, lastTableIndex;
   double** Allocate(void);
   FGPropertyManager* const PropertyManager;
-  string Name;
+  std::string Name;
   void bind(void);
 
+  unsigned int FindNumColumns(const std::string&);
   void Debug(int from);
 };
 }
index cc7fd0d561ab3d81ce4323a6493c740c02e890f0..5083bf7bc5f4c02d7c5823f1dc6566d32e987115 100644 (file)
@@ -36,6 +36,10 @@ HISTORY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
+#include <iostream>
+#include <sstream>
+#include <iomanip>
+#include <cstdlib>
 #include <FGFDMExec.h>
 #include "FGAerodynamics.h"
 #include "FGPropagate.h"
@@ -44,6 +48,8 @@ INCLUDES
 #include "FGMassBalance.h"
 #include "input_output/FGPropertyManager.h"
 
+using namespace std;
+
 namespace JSBSim {
 
 static const char *IdSrc = "$Id$";
@@ -415,7 +421,7 @@ void FGAerodynamics::DetermineAxisSystem()
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGAerodynamics::GetCoefficientStrings(string delimeter)
+string FGAerodynamics::GetCoefficientStrings(const string& delimeter) const
 {
   string CoeffStrings = "";
   bool firstime = true;
@@ -445,33 +451,24 @@ string FGAerodynamics::GetCoefficientStrings(string delimeter)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGAerodynamics::GetCoefficientValues(string delimeter)
+string FGAerodynamics::GetCoefficientValues(const string& delimeter) const
 {
-  string SDValues = "";
-  bool firstime = true;
-  unsigned int sd;
+  ostringstream buf;
 
-  for (sd = 0; sd < variables.size(); sd++) {
-    if (firstime) {
-      firstime = false;
-    } else {
-      SDValues += delimeter;
-    }
-    SDValues += variables[sd]->GetValueAsString();
+  buf.precision(6);
+  for (unsigned int sd = 0; sd < variables.size(); sd++) {
+    if (buf.tellp() > 0) buf << delimeter;
+    buf << setw(9) << variables[sd]->GetValue();
   }
 
   for (unsigned int axis = 0; axis < 6; axis++) {
     for (unsigned int sd = 0; sd < Coeff[axis].size(); sd++) {
-      if (firstime) {
-        firstime = false;
-      } else {
-        SDValues += delimeter;
-      }
-      SDValues += Coeff[axis][sd]->GetValueAsString();
+      if (buf.tellp() > 0) buf << delimeter;
+      buf << setw(9) << Coeff[axis][sd]->GetValue();
     }
   }
 
-  return SDValues;
+  return buf.str();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index fce51a1015111d35eb7b6524605b21ef8efad78c..8c26e527729d5d35e10668e05b6abe992f58a361 100644 (file)
@@ -38,6 +38,7 @@ SENTRY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
+#include <string>
 #include <vector>
 #include <map>
 
@@ -188,13 +189,13 @@ public:
   /** Gets the strings for the current set of coefficients.
       @param delimeter either a tab or comma string depending on output type
       @return a string containing the descriptive names for all coefficients */
-  string GetCoefficientStrings(string delimeter);
+  std::string GetCoefficientStrings(const std::string& delimeter) const;
 
   /** Gets the coefficient values.
       @param delimeter either a tab or comma string depending on output type
       @return a string containing the numeric values for the current set of
       coefficients */
-  string GetCoefficientValues(string delimeter);
+  std::string GetCoefficientValues(const std::string& delimeter) const;
 
   /** Calculates and returns the wind-to-body axis transformation matrix.
       @return a reference to the wind-to-body transformation matrix.
@@ -206,14 +207,14 @@ public:
       */
   FGMatrix33& GetTb2w(void);
 
-  vector <FGFunction*> * GetCoeff(void) const { return Coeff; }
+  std::vector <FGFunction*> * GetCoeff(void) const { return Coeff; }
 
 private:
   enum eAxisType {atNone, atLiftDrag, atAxialNormal, atBodyXYZ} axisType;
-  typedef map<string,int> AxisIndex;
+  typedef std::map<std::string,int> AxisIndex;
   AxisIndex AxisIdx;
   FGFunction* AeroRPShift;
-  vector <FGFunction*> variables;
+  std::vector <FGFunction*> variables;
   typedef vector <FGFunction*> CoeffArray;
   CoeffArray* Coeff;
   FGColumnVector3 vFnative;
index 2e65dc021a62d8e052eaed52557556c069966891..83a1bf1779b9f8feff5e401f7bb35115bf2f800e 100644 (file)
@@ -52,7 +52,11 @@ INCLUDES
 #include "FGAerodynamics.h"
 #include "FGFDMExec.h"
 #include "FGPropagate.h"
+#include "FGPropulsion.h"
 #include "input_output/FGPropertyManager.h"
+#include <iostream>
+
+using namespace std;
 
 namespace JSBSim {
 
index 10f75aa0ba267f8e3d83d3b92b6f86f236dad2d4..a66665c061c7df63305609752f7f9921dd983f7d 100644 (file)
@@ -38,6 +38,7 @@ SENTRY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
+#include <string>
 #include <vector>
 
 #include "FGModel.h"
@@ -131,7 +132,7 @@ public:
 
   /** Gets the aircraft name
       @return the name of the aircraft as a string type */
-  inline string GetAircraftName(void) { return AircraftName; }
+  const std::string& GetAircraftName(void) const { return AircraftName; }
 
   /// Gets the wing area
   double GetWingArea(void) const { return WingArea; }
@@ -163,7 +164,7 @@ public:
   inline double GetXYZrp(int idx) const { return vXYZrp(idx); }
   inline double GetXYZvrp(int idx) const { return vXYZvrp(idx); }
   inline double GetXYZep(int idx) const { return vXYZep(idx); }
-  inline void SetAircraftName(string name) {AircraftName = name;}
+  inline void SetAircraftName(const std::string& name) {AircraftName = name;}
   inline void SetHoldDown(int hd) {HoldDown = hd;}
   inline int GetHoldDown(void) const {return HoldDown;}
 
@@ -193,7 +194,7 @@ private:
   double HTailArea, VTailArea, HTailArm, VTailArm;
   double lbarh,lbarv,vbarh,vbarv;
   int HoldDown;
-  string AircraftName;
+  std::string AircraftName;
 
   void Debug(int from);
 };
index e1daeb0f9e3d317483f9c5b0c0b51df25164a0fd..c21e45cbc1dff8ee0a5bce9bc0122440d0c5d7f4 100644 (file)
@@ -54,6 +54,10 @@ INCLUDES
 #include "FGPropagate.h"
 #include "FGInertial.h"
 #include "input_output/FGPropertyManager.h"
+#include <iostream>
+#include <cstdlib>
+
+using namespace std;
 
 namespace JSBSim {
 
index 465c2468ffc8fead2e462f1ef22638a27fffcbdc..d8a8d77c0f2ce22d40e3356e607865d12b465bff 100755 (executable)
@@ -51,7 +51,11 @@ INCLUDES
 #include "FGBuoyantForces.h"
 #include "FGGroundReactions.h"
 #include "FGPropulsion.h"
+#include "FGMassBalance.h"
 #include "input_output/FGPropertyManager.h"
+#include <iostream>
+
+using namespace std;
 
 namespace JSBSim {
 
@@ -392,6 +396,13 @@ void FGAuxiliary::CalculateRelativePosition(void)
   relative_position = sqrt(lat_relative_position*lat_relative_position + lon_relative_position*lon_relative_position);
 };
 
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+double FGAuxiliary::BadUnits(void) const
+{
+  cerr << "Bad units" << endl; return 0.0;
+}
+
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 //    The bitmasked value choices are as follows:
 //    unset: In this case (the default) JSBSim would only print
index 751dd14f116929cce070417584a61831ae67ce72..e3baa49117a8d1e64fe9741302d6b56009a1d370 100644 (file)
@@ -40,7 +40,6 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGModel.h"
-#include "FGFDMExec.h"
 #include "math/FGColumnVector3.h"
 #include "math/FGLocation.h"
 #include "FGPropagate.h"
@@ -172,15 +171,15 @@ public:
   double GetMagBeta (void) const { return fabs(beta); }
 
   double Getalpha   (int unit) const { if (unit == inDegrees) return alpha*radtodeg;
-                                       else cerr << "Bad units" << endl; return 0.0;}
+                                       else return BadUnits(); }
   double Getbeta    (int unit) const { if (unit == inDegrees) return beta*radtodeg;
-                                       else cerr << "Bad units" << endl; return 0.0;}
+                                       else return BadUnits(); }
   double Getadot    (int unit) const { if (unit == inDegrees) return adot*radtodeg;
-                                       else cerr << "Bad units" << endl; return 0.0;}
+                                       else return BadUnits(); }
   double Getbdot    (int unit) const { if (unit == inDegrees) return bdot*radtodeg;
-                                       else cerr << "Bad units" << endl; return 0.0;}
+                                       else return BadUnits(); }
   double GetMagBeta (int unit) const { if (unit == inDegrees) return fabs(beta)*radtodeg;
-                                       else cerr << "Bad units" << endl; return 0.0;}
+                                       else return BadUnits(); }
 
   double Getqbar          (void) const { return qbar;       }
   double GetqbarUW        (void) const { return qbarUW;     }
@@ -281,6 +280,7 @@ private:
   void CalculateRelativePosition(void);
 
   void bind(void);
+  double BadUnits(void) const;
   void Debug(int from);
 };
 
index 4827793ca271acc7bc7d5e9370f839cffe785847..44ecd65959a5f09f60d84165446d3ceca46430f4 100644 (file)
@@ -39,6 +39,9 @@ INCLUDES
 #include "FGBuoyantForces.h"
 #include "FGMassBalance.h"
 #include "input_output/FGPropertyManager.h"  // Need?
+#include <iostream>
+
+using namespace std;
 
 namespace JSBSim {
 
index 48884c4d198da135ea4d18170697bf5e21ee02f5..fa1d35d22fe90fc2dc07e9b7e08ee93ab0845195 100755 (executable)
 */
 
 #include "FGExternalForce.h"
+#include "input_output/FGXMLElement.h"
+#include <iostream>
+
+using namespace std;
 
 namespace JSBSim {
 
index 6bff2bb46184e6fd05d5e6f9c1c3ef8f182221a1..58a334364e08362028ffba877ffe2c89eac36a13 100755 (executable)
@@ -37,8 +37,12 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGExternalReactions.h"
+#include "input_output/FGXMLElement.h"
+#include <iostream>
 #include <string>
 
+using namespace std;
+
 namespace JSBSim {
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 08e2e6cc1c663e4a588b29b73b2e01796ebac96b..c6f65fe1048bcb6bb5423a38e563cadb8974070c 100755 (executable)
@@ -40,7 +40,7 @@ INCLUDES
 
 #include "FGModel.h"
 #include "FGExternalForce.h"
-#include "input_output/FGXMLElement.h"
+#include <vector>
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
@@ -54,6 +54,8 @@ FORWARD DECLARATIONS
 
 namespace JSBSim {
 
+class Element;
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -154,7 +156,7 @@ public:
 
 private:
 
-  vector <FGExternalForce*> Forces;
+  std::vector <FGExternalForce*> Forces;
   unsigned int numForces;
   FGColumnVector3 vTotalForces;
   FGColumnVector3 vTotalMoments;
index aaca68478d4639e0cf439d5ced5e23cc9355542b..3ee95811085376eb6889581641e9677a16c4d38d 100644 (file)
@@ -39,6 +39,7 @@ INCLUDES
 
 #include "FGFCS.h"
 #include "FGFDMExec.h"
+#include "FGGroundReactions.h"
 #include "input_output/FGPropertyManager.h"
 #include <fstream>
 #include <sstream>
@@ -58,6 +59,8 @@ INCLUDES
 #include "models/flight_control/FGMagnetometer.h"
 #include "models/flight_control/FGGyro.h"
 
+using namespace std;
+
 namespace JSBSim {
 
 static const char *IdSrc = "$Id$";
@@ -685,7 +688,7 @@ double FGFCS::GetBrake(FGLGear::BrakeGroup bg)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGFCS::FindSystemFullPathname(string system_filename)
+string FGFCS::FindSystemFullPathname(const string& system_filename)
 {
   string fullpath, localpath;
   string systemPath = FDMExec->GetSystemsPath();
@@ -713,7 +716,7 @@ string FGFCS::FindSystemFullPathname(string system_filename)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-ifstream* FGFCS::FindSystemFile(string system_filename)
+ifstream* FGFCS::FindSystemFile(const string& system_filename)
 {
   string fullpath, localpath;
   string systemPath = FDMExec->GetSystemsPath();
@@ -738,7 +741,7 @@ ifstream* FGFCS::FindSystemFile(string system_filename)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGFCS::GetComponentStrings(string delimeter)
+string FGFCS::GetComponentStrings(const string& delimiter)
 {
   unsigned int comp;
   string CompStrings = "";
@@ -747,7 +750,7 @@ string FGFCS::GetComponentStrings(string delimeter)
 
   for (unsigned int i=0; i<Systems.size(); i++) {
     if (firstime) firstime = false;
-    else          CompStrings += delimeter;
+    else          CompStrings += delimiter;
 
     CompStrings += Systems[i]->GetName();
     total_count++;
@@ -756,7 +759,7 @@ string FGFCS::GetComponentStrings(string delimeter)
   for (comp = 0; comp < APComponents.size(); comp++)
   {
     if (firstime) firstime = false;
-    else          CompStrings += delimeter;
+    else          CompStrings += delimiter;
 
     CompStrings += APComponents[comp]->GetName();
     total_count++;
@@ -764,7 +767,7 @@ string FGFCS::GetComponentStrings(string delimeter)
 
   for (comp = 0; comp < FCSComponents.size(); comp++) {
     if (firstime) firstime = false;
-    else          CompStrings += delimeter;
+    else          CompStrings += delimiter;
 
     CompStrings += FCSComponents[comp]->GetName();
     total_count++;
@@ -775,7 +778,7 @@ string FGFCS::GetComponentStrings(string delimeter)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGFCS::GetComponentValues(string delimeter)
+string FGFCS::GetComponentValues(const string& delimiter)
 {
   std::ostringstream buf;
 
@@ -785,7 +788,7 @@ string FGFCS::GetComponentValues(string delimeter)
 
   for (unsigned int i=0; i<Systems.size(); i++) {
     if (firstime) firstime = false;
-    else          buf << delimeter;
+    else          buf << delimiter;
 
     buf << setprecision(9) << Systems[i]->GetOutput();
     total_count++;
@@ -793,7 +796,7 @@ string FGFCS::GetComponentValues(string delimeter)
 
   for (comp = 0; comp < APComponents.size(); comp++) {
     if (firstime) firstime = false;
-    else          buf << delimeter;
+    else          buf << delimiter;
 
     buf << setprecision(9) << APComponents[comp]->GetOutput();
     total_count++;
@@ -801,7 +804,7 @@ string FGFCS::GetComponentValues(string delimeter)
 
   for (comp = 0; comp < FCSComponents.size(); comp++) {
     if (firstime) firstime = false;
-    else          buf << delimeter;
+    else          buf << delimiter;
 
     buf << setprecision(9) << FCSComponents[comp]->GetOutput();
     total_count++;
index 8d4f521c123572eef87ee88afbc170994d927a22..b00c037a9ef447dc464406c084504b55a63d5c31 100644 (file)
@@ -38,6 +38,7 @@ SENTRY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
+#include <iosfwd>
 #include <vector>
 
 #include <string>
@@ -352,15 +353,15 @@ public:
   FGState* GetState(void) { return State; }
 
   /** Retrieves all component names for inclusion in output stream
-      @param delimeter either a tab or comma string depending on output type
+      @param delimiter either a tab or comma string depending on output type
       @return a string containing the descriptive names for all components */
-  string GetComponentStrings(string delimeter);
+  std::string GetComponentStrings(const std::string& delimiter);
 
   /** Retrieves all component outputs for inclusion in output stream
-      @param delimeter either a tab or comma string depending on output type
+      @param delimiter either a tab or comma string depending on output type
       @return a string containing the numeric values for the current set of
       component outputs */
-  string GetComponentValues(string delimeter);
+  std::string GetComponentValues(const std::string& delimiter);
 
   /// @name Pilot input command setting
   //@{
@@ -537,8 +538,8 @@ public:
       @return true if succesful */
   bool Load(Element* el, SystemType systype);
 
-  ifstream* FindSystemFile(string system_filename);
-  string FindSystemFullPathname(string system_filename);
+  std::ifstream* FindSystemFile(const std::string& system_filename);
+  std::string FindSystemFullPathname(const std::string& system_filename);
 
   void AddThrottle(void);
   void AddGear(void);
@@ -551,20 +552,20 @@ private:
   double DePos[NForms], DaLPos[NForms], DaRPos[NForms], DrPos[NForms];
   double DfPos[NForms], DsbPos[NForms], DspPos[NForms];
   double PTrimCmd, YTrimCmd, RTrimCmd;
-  vector <double> ThrottleCmd;
-  vector <double> ThrottlePos;
-  vector <double> MixtureCmd;
-  vector <double> MixturePos;
-  vector <double> PropAdvanceCmd;
-  vector <double> PropAdvance;
-  vector <bool> PropFeatherCmd;
-  vector <bool> PropFeather;
-  vector <double> SteerPosDeg;
+  std::vector <double> ThrottleCmd;
+  std::vector <double> ThrottlePos;
+  std::vector <double> MixtureCmd;
+  std::vector <double> MixturePos;
+  std::vector <double> PropAdvanceCmd;
+  std::vector <double> PropAdvance;
+  std::vector <bool> PropFeatherCmd;
+  std::vector <bool> PropFeather;
+  std::vector <double> SteerPosDeg;
   double LeftBrake, RightBrake, CenterBrake; // Brake settings
   double GearCmd,GearPos;
   double TailhookPos, WingFoldPos;
 
-  typedef vector <FGFCSComponent*> FCSCompVec;
+  typedef std::vector <FGFCSComponent*> FCSCompVec;
   FCSCompVec Systems;
   FCSCompVec FCSComponents;
   FCSCompVec APComponents;
index 3b1278fa4bd1b9332663f7445f854e61a9482a8d..73c5091dd0659aeac38e140d005678291042206e 100644 (file)
@@ -41,10 +41,15 @@ INCLUDES
 #include "models/FGInertial.h"
 #include "models/FGMassBalance.h"
 #include "FGGasCell.h"
+#include "input_output/FGXMLElement.h"
+#include <iostream>
+#include <cstdlib>
 
 using std::cerr;
 using std::endl;
 using std::cout;
+using std::string;
+using std::max;
 
 namespace JSBSim {
 
index 0ad485cee3928530fec98ce46a86ce543a17d180..0aae911b1076033d7bd620f17c622dd20d3558b1 100644 (file)
@@ -40,16 +40,11 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGJSBBase.h"
-#include "input_output/FGXMLElement.h"
 #include "math/FGColumnVector3.h"
 #include "models/propulsion/FGForce.h"
 #include "math/FGFunction.h"
 
 #include <string>
-using std::string;
-using std::cerr;
-using std::endl;
-using std::cout;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
@@ -64,6 +59,7 @@ FORWARD DECLARATIONS
 namespace JSBSim {
 
 class FGBallonet;
+class Element;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
@@ -230,7 +226,7 @@ private:
   enum GasType {ttUNKNOWN, ttHYDROGEN, ttHELIUM, ttAIR};
 
   GasType Type;
-  string type;
+  std::string type;
   int CellNum;
   // Structural constants
   double MaxVolume;                 // [ft�]
index 36837004a6a387a682c019391ddefd0e0c59070f..4de1c1960345bdab9c77dfbb3100c734fd62e726 100644 (file)
@@ -39,8 +39,11 @@ INCLUDES
 #include <iomanip>
 
 #include "FGGroundReactions.h"
+#include "FGFCS.h"
 #include "input_output/FGPropertyManager.h"
 
+using namespace std;
+
 namespace JSBSim {
 
 static const char *IdSrc = "$Id$";
index a14245bca5dfc3cc115dc2bcb08ae427b8bd01ef..9bff3f6e898536320d9d08942e6141c748e65d6e 100644 (file)
@@ -40,6 +40,9 @@ INCLUDES
 #include "FGPropagate.h"
 #include "FGState.h"
 #include "FGMassBalance.h"
+#include <iostream>
+
+using namespace std;
 
 namespace JSBSim {
 
index 4715ad05a4f10660ee0d0ed6532473de3830182e..6ba43df4ec73eabe33a0bdcdf2ca8a52c49d6495 100755 (executable)
@@ -42,8 +42,14 @@ INCLUDES
 #include "FGState.h"
 #include "FGFDMExec.h"
 
-#include <fstream>
+#include "input_output/FGfdmSocket.h"
+#include "input_output/FGXMLElement.h"
+
+#include <sstream>
 #include <iomanip>
+#include <cstdlib>
+
+using namespace std;
 
 namespace JSBSim {
 
@@ -89,9 +95,8 @@ bool FGInput::InitModel(void)
 
 bool FGInput::Run(void)
 {
-  string line, token, info_string;
+  string line, token;
   size_t start=0, string_start=0, string_end=0;
-  char buf[100];
   double value=0;
   FGPropertyManager* node=0;
 
@@ -157,8 +162,9 @@ bool FGInput::Run(void)
             socket->Reply("Must be in HOLD to search properties\n");
           }
         } else if (node > 0) {
-          sprintf(buf, "%s = %12.6f\n", argument.c_str(), node->getDoubleValue());
-          socket->Reply(buf);
+          ostringstream buf;
+          buf << argument << " = " << setw(12) << setprecision(6) << node->getDoubleValue() << endl;
+          socket->Reply(buf.str());
         }
 
       } else if (command == "hold") {                  // PAUSE
@@ -180,12 +186,12 @@ bool FGInput::Run(void)
       } else if (command == "info") {                   // INFO
 
         // get info about the sim run and/or aircraft, etc.
-        sprintf(buf, "%8.3f", State->Getsim_time());
-        info_string  = "JSBSim version: " + JSBSim_version + "\n";
-        info_string += "Config File version: " + needed_cfg_version + "\n";
-        info_string += "Aircraft simulated: " + Aircraft->GetAircraftName() + "\n";
-        info_string += "Simulation time: " + string(buf) + "\n";
-        socket->Reply(info_string);
+        ostringstream info;
+        info << "JSBSim version: " << JSBSim_version << endl;
+        info << "Config File version: " << needed_cfg_version << endl;
+        info << "Aircraft simulated: " << Aircraft->GetAircraftName() << endl;
+        info << "Simulation time: " << setw(8) << setprecision(3) << State->Getsim_time() << endl;
+        socket->Reply(info.str());
 
       } else if (command == "help") {                   // HELP
 
index 840b24d663dad4a5fdfbef309d9ed948a9c49376..58aa9ebdbd4070fec76852900f1c93560c463abf 100755 (executable)
@@ -40,11 +40,7 @@ INCLUDES
 
 #include "FGModel.h"
 
-#include <iostream>
-#include <fstream>
-
-#include "input_output/FGfdmSocket.h"
-#include "input_output/FGXMLElement.h"
+#include <string>
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
@@ -58,6 +54,10 @@ FORWARD DECLARATIONS
 
 namespace JSBSim {
 
+class FGFDMExec;
+class Element;
+class FGfdmSocket;
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -78,7 +78,6 @@ public:
   bool InitModel(void);
   bool Run(void);
 
-  void SetType(string);
   inline void Enable(void) { enabled = true; }
   inline void Disable(void) { enabled = false; }
   inline bool Toggle(void) {enabled = !enabled; return enabled;}
@@ -88,7 +87,7 @@ private:
   bool sFirstPass, dFirstPass, enabled;
   unsigned int port;
   FGfdmSocket* socket;
-  string data;
+  std::string data;
   void Debug(int from);
 };
 }
index a470fd5f4727655f68e31adaf27d8bf76deaef32..b0c448b41777baf98a5ff7375f6017505f067c27 100644 (file)
@@ -41,6 +41,16 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGLGear.h"
+#include "FGState.h"
+#include "FGGroundReactions.h"
+#include "FGFCS.h"
+#include "FGAuxiliary.h"
+#include "FGAtmosphere.h"
+#include "FGMassBalance.h"
+#include "math/FGTable.h"
+#include <cstdlib>
+
+using namespace std;
 
 namespace JSBSim {
 
index 14f57510c2a339a95cfd49f7c1c6e9db8e7f5cc9..dfba5bbf0bff2d7d40a47a2bdac852744d042244 100644 (file)
@@ -38,11 +38,8 @@ SENTRY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#include "FGFDMExec.h"
 #include "models/propulsion/FGForce.h"
-#include "input_output/FGXMLElement.h"
 #include "math/FGColumnVector3.h"
-#include "math/FGTable.h"
 #include <string>
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -63,6 +60,8 @@ class FGFCS;
 class FGState;
 class FGMassBalance;
 class FGAuxiliary;
+class FGTable;
+class Element;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
@@ -333,11 +332,11 @@ private:
   bool isRetractable;
   bool GearUp, GearDown;
   bool Servicable;
-  string name;
-  string sSteerType;
-  string sBrakeGroup;
-  string sRetractable;
-  string sContactType;
+  std::string name;
+  std::string sSteerType;
+  std::string sBrakeGroup;
+  std::string sRetractable;
+  std::string sContactType;
 
   BrakeGroup  eBrakeGrp;
   ContactType eContactType;
@@ -377,12 +376,6 @@ private:
   void Debug(int from);
 };
 }
-#include "FGAircraft.h"
-#include "FGPropagate.h"
-#include "FGAuxiliary.h"
-#include "FGFCS.h"
-#include "FGMassBalance.h"
-#include "FGState.h"
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
index a3b0d60fce4974b38faaadae6edbc1979d4527f0..c866fa40a1ea0462beca5d6404c32d9da5839906 100644 (file)
@@ -42,6 +42,10 @@ INCLUDES
 #include "FGPropulsion.h"
 #include "FGBuoyantForces.h"
 #include "input_output/FGPropertyManager.h"
+#include <iostream>
+#include <cstdlib>
+
+using namespace std;
 
 namespace JSBSim {
 
@@ -338,6 +342,24 @@ void FGMassBalance::bind(void)
                        (PMF)&FGMassBalance::GetXYZcg);
 }
 
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+void FGMassBalance::PointMass::bind(FGPropertyManager* PropertyManager, int num) {
+  string tmp = CreateIndexedPropertyName("inertia/pointmass-weight-lbs", num);
+  PropertyManager->Tie( tmp.c_str(), this, &PointMass::GetPointMassWeight,
+                                       &PointMass::SetPointMassWeight);
+
+  tmp = CreateIndexedPropertyName("inertia/pointmass-location-X-inches", num);
+  PropertyManager->Tie( tmp.c_str(), this, eX, &PointMass::GetPointMassLocation,
+                                           &PointMass::SetPointMassLocation);
+  tmp = CreateIndexedPropertyName("inertia/pointmass-location-Y-inches", num);
+  PropertyManager->Tie( tmp.c_str(), this, eY, &PointMass::GetPointMassLocation,
+                                           &PointMass::SetPointMassLocation);
+  tmp = CreateIndexedPropertyName("inertia/pointmass-location-Z-inches", num);
+  PropertyManager->Tie( tmp.c_str(), this, eZ, &PointMass::GetPointMassLocation,
+                                           &PointMass::SetPointMassLocation);
+}
+
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 //    The bitmasked value choices are as follows:
 //    unset: In this case (the default) JSBSim would only print
index 46f99e4351728d30f4d507a5a148f0bb083b9c55..686b27b74de18571702f571dee6ba07d81ff489d 100644 (file)
@@ -189,24 +189,10 @@ private:
     void SetPointMassWeight(double wt) {Weight = wt;}
     double GetPointMassWeight(void) const {return Weight;}
 
-    void bind(FGPropertyManager* PropertyManager, int num) {
-      string tmp = CreateIndexedPropertyName("inertia/pointmass-weight-lbs", num);
-      PropertyManager->Tie( tmp.c_str(), this, &PointMass::GetPointMassWeight,
-                                       &PointMass::SetPointMassWeight);
-
-      tmp = CreateIndexedPropertyName("inertia/pointmass-location-X-inches", num);
-      PropertyManager->Tie( tmp.c_str(), this, eX, &PointMass::GetPointMassLocation,
-                                           &PointMass::SetPointMassLocation);
-      tmp = CreateIndexedPropertyName("inertia/pointmass-location-Y-inches", num);
-      PropertyManager->Tie( tmp.c_str(), this, eY, &PointMass::GetPointMassLocation,
-                                           &PointMass::SetPointMassLocation);
-      tmp = CreateIndexedPropertyName("inertia/pointmass-location-Z-inches", num);
-      PropertyManager->Tie( tmp.c_str(), this, eZ, &PointMass::GetPointMassLocation,
-                                           &PointMass::SetPointMassLocation);
-    }
+    void bind(FGPropertyManager* PropertyManager, int num);
   };
 
-  vector <struct PointMass*> PointMasses;
+  std::vector <struct PointMass*> PointMasses;
 
   void bind(void);
   void Debug(int from);
index bb41c22f8ee62f19e0f119119b958990deef457a..3a16f493a4d47448ea86fe2cc1bc9dbfbf4f6772 100644 (file)
@@ -52,6 +52,9 @@ INCLUDES
 #include "FGAircraft.h"
 #include "FGPropagate.h"
 #include "FGAuxiliary.h"
+#include <iostream>
+
+using namespace std;
 
 namespace JSBSim {
 
index 859db0b418744f1234380cf1215d7b9e63735836..bfba0af48437a511a2cd43fafd3c435e60ee6172 100644 (file)
@@ -39,10 +39,7 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGJSBBase.h"
-#include "input_output/FGPropertyManager.h"
-#include "input_output/FGXMLElement.h"
 
-#include <iostream>
 #include <string>
 #include <vector>
 
@@ -52,8 +49,6 @@ DEFINITIONS
 
 #define ID_MODEL "$Id$"
 
-using namespace std;
-
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -74,6 +69,8 @@ class FGBuoyantForces;
 class FGAircraft;
 class FGPropagate;
 class FGAuxiliary;
+class Element;
+class FGPropertyManager;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
@@ -102,7 +99,7 @@ public:
   virtual bool Load(Element* el);
 
   FGModel* NextModel;
-  string Name;
+  std::string Name;
 
   /** Runs the model; called by the Executive
       @see JSBSim.cpp documentation
@@ -137,7 +134,7 @@ protected:
   FGAuxiliary*       Auxiliary;
   FGPropertyManager* PropertyManager;
 
-  vector <double*> interface_properties;
+  std::vector <double*> interface_properties;
 };
 }
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 87d7cee245a8eecf268f8ab2d21b5ca7d3e5996b..2e509ff6387043d17c44772be50bf2bc421f0ae7 100644 (file)
@@ -53,13 +53,16 @@ INCLUDES
 #include "FGPropagate.h"
 #include "FGAuxiliary.h"
 #include "FGInertial.h"
-#include "FGPropulsion.h"   //access to FGEngine, FGTank
+#include "models/propulsion/FGEngine.h"
+#include "models/propulsion/FGTank.h"
 #include "models/propulsion/FGPiston.h"
-#include <fstream>
+#include <sstream>
 #include <iomanip>
 #include <cstring>
+#include <cstdlib>
 
 #include "input_output/net_fdm.hxx"
+#include "input_output/FGfdmSocket.h"
 
 #if defined(WIN32) && !defined(__CYGWIN__)
 #  include <windows.h>
@@ -70,6 +73,8 @@ INCLUDES
 static const int endianTest = 1;
 #define isLittleEndian (*((char *) &endianTest ) != 0)
 
+using namespace std;
+
 namespace JSBSim {
 
 static const char *IdSrc = "$Id$";
@@ -157,20 +162,17 @@ FGOutput::~FGOutput()
 
 bool FGOutput::InitModel(void)
 {
-  char fname[1000] = "";
-
   if (!FGModel::InitModel()) return false;
 
   if (Filename.size() > 0 && StartNewFile) {
-    size_t idx = BaseFilename.find_last_of(".");
-    size_t len = BaseFilename.length();
-    string extension = "";
-    if (idx != string::npos) {
-      extension = BaseFilename.substr(idx, len-idx);
-      len -= extension.length();
+    ostringstream buf;
+    string::size_type dot = BaseFilename.find_last_of('.');
+    if (dot != string::npos) {
+      buf << BaseFilename.substr(0, dot) << '_' << runID_postfix++ << BaseFilename.substr(dot);
+    } else {
+      buf << BaseFilename << '_' << runID_postfix++;
     }
-    sprintf(fname, "%s_%d%s", BaseFilename.substr(0,len).c_str(), runID_postfix++, extension.c_str());
-    Filename = string(fname);
+    Filename = buf.str();
     datafile.close();
     StartNewFile = false;
     dFirstPass = true;
@@ -205,7 +207,7 @@ bool FGOutput::Run(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-void FGOutput::SetType(string type)
+void FGOutput::SetType(const string& type)
 {
   if (type == "CSV") {
     Type = otCSV;
@@ -227,7 +229,7 @@ void FGOutput::SetType(string type)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-void FGOutput::DelimitedOutput(string fname)
+void FGOutput::DelimitedOutput(const string& fname)
 {
   streambuf* buffer;
   string scratch = "";
@@ -918,7 +920,7 @@ void FGOutput::SocketOutput(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-void FGOutput::SocketStatusOutput(string out_str)
+void FGOutput::SocketStatusOutput(const string& out_str)
 {
   string asciiData;
 
index 1646dadb008e680faccc6285aed4fb4c13f8a1cb..cd1ca6e30881c39587eb101bd983a772e0b547f6 100644 (file)
@@ -41,14 +41,11 @@ INCLUDES
 
 #include "FGModel.h"
 
-#include <iostream>
 #include <fstream>
 
-#include "input_output/FGfdmSocket.h"
 #include "input_output/FGXMLFileRead.h"
 #include "input_output/net_fdm.hxx"
 
-
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -61,6 +58,8 @@ FORWARD DECLARATIONS
 
 namespace JSBSim {
 
+class FGfdmSocket;
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -140,22 +139,22 @@ public:
   bool InitModel(void);
   bool Run(void);
 
-  void DelimitedOutput(string);
+  void DelimitedOutput(const std::string&);
   void SocketOutput(void);
   void FlightGearSocketOutput(void);
-  void SocketStatusOutput(string);
+  void SocketStatusOutput(const std::string&);
   void SocketDataFill(FGNetFDM* net);
 
 
-  void SetType(string);
+  void SetType(const std::string& type);
   void SetStartNewFile(bool tt) {StartNewFile = tt;}
   void SetSubsystems(int tt) {SubSystems = tt;}
   void Enable(void) { enabled = true; }
   void Disable(void) { enabled = false; }
   bool Toggle(void) {enabled = !enabled; return enabled;}
   bool Load(Element* el);
-  void SetOutputFileName(string fname) {Filename = fname;}
-  void SetDirectivesFile(string fname) {DirectivesFile = fname;}
+  void SetOutputFileName(const std::string& fname) {Filename = fname;}
+  void SetDirectivesFile(const std::string& fname) {DirectivesFile = fname;}
   void SetRate(int rt);
   string GetOutputFileName(void) const {return Filename;}
 
@@ -185,11 +184,11 @@ private:
   int SubSystems;
   int runID_postfix;
   bool StartNewFile;
-  string output_file_name, delimeter, BaseFilename, Filename, DirectivesFile;
-  ofstream datafile;
+  std::string output_file_name, delimeter, BaseFilename, Filename, DirectivesFile;
+  std::ofstream datafile;
   FGfdmSocket* socket;
   FGfdmSocket* flightGearSocket;
-  vector <FGPropertyManager*> OutputProperties;
+  std::vector <FGPropertyManager*> OutputProperties;
 
   void Debug(int from);
 };
index 432ec509b81b7ace10a4e6f65a20d02b2f55b5f3..f2a1251fc4465e844a7c5144245620851183eb64 100644 (file)
@@ -54,7 +54,8 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include <cmath>
-#include <iomanip>
+#include <cstdlib>
+#include <iostream>
 
 #include "FGPropagate.h"
 #include "FGFDMExec.h"
@@ -64,6 +65,8 @@ INCLUDES
 #include "FGInertial.h"
 #include "input_output/FGPropertyManager.h"
 
+using namespace std;
+
 namespace JSBSim {
 
 static const char *IdSrc = "$Id$";
index 88fbff084ee37506ed727c0b2fd61cfcef316023..b6e6c14ea5c59340413d948c78f6fba784c6e675 100644 (file)
@@ -45,15 +45,24 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGPropulsion.h"
+#include "FGState.h"
+#include "models/FGFCS.h"
+#include "models/FGMassBalance.h"
+#include "models/propulsion/FGThruster.h"
 #include "models/propulsion/FGRocket.h"
 #include "models/propulsion/FGTurbine.h"
 #include "models/propulsion/FGPiston.h"
 #include "models/propulsion/FGElectric.h"
 #include "models/propulsion/FGTurboProp.h"
+#include "models/propulsion/FGTank.h"
 #include "input_output/FGPropertyManager.h"
 #include "input_output/FGXMLParse.h"
 #include "math/FGColumnVector3.h"
+#include <iostream>
 #include <sstream>
+#include <cstdlib>
+
+using namespace std;
 
 namespace JSBSim {
 
@@ -330,7 +339,7 @@ bool FGPropulsion::Load(Element* el)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGPropulsion::FindEngineFullPathname(string engine_filename)
+string FGPropulsion::FindEngineFullPathname(const string& engine_filename)
 {
   string fullpath, localpath;
   string enginePath = FDMExec->GetEnginePath();
@@ -358,7 +367,7 @@ string FGPropulsion::FindEngineFullPathname(string engine_filename)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-ifstream* FGPropulsion::FindEngineFile(string engine_filename)
+ifstream* FGPropulsion::FindEngineFile(const string& engine_filename)
 {
   string fullpath, localpath;
   string enginePath = FDMExec->GetEnginePath();
@@ -383,7 +392,7 @@ ifstream* FGPropulsion::FindEngineFile(string engine_filename)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGPropulsion::GetPropulsionStrings(string delimeter)
+string FGPropulsion::GetPropulsionStrings(const string& delimiter)
 {
   unsigned int i;
 
@@ -393,13 +402,13 @@ string FGPropulsion::GetPropulsionStrings(string delimeter)
 
   for (i=0; i<Engines.size(); i++) {
     if (firstime)  firstime = false;
-    else           PropulsionStrings += delimeter;
+    else           PropulsionStrings += delimiter;
 
-    PropulsionStrings += Engines[i]->GetEngineLabels(delimeter);
+    PropulsionStrings += Engines[i]->GetEngineLabels(delimiter);
   }
   for (i=0; i<Tanks.size(); i++) {
-    if (Tanks[i]->GetType() == FGTank::ttFUEL) buf << delimeter << "Fuel Tank " << i;
-    else if (Tanks[i]->GetType() == FGTank::ttOXIDIZER) buf << delimeter << "Oxidizer Tank " << i;
+    if (Tanks[i]->GetType() == FGTank::ttFUEL) buf << delimiter << "Fuel Tank " << i;
+    else if (Tanks[i]->GetType() == FGTank::ttOXIDIZER) buf << delimiter << "Oxidizer Tank " << i;
   }
 
   return PropulsionStrings;
@@ -407,7 +416,7 @@ string FGPropulsion::GetPropulsionStrings(string delimeter)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGPropulsion::GetPropulsionValues(string delimeter)
+string FGPropulsion::GetPropulsionValues(const string& delimiter)
 {
   unsigned int i;
 
@@ -417,12 +426,12 @@ string FGPropulsion::GetPropulsionValues(string delimeter)
 
   for (i=0; i<Engines.size(); i++) {
     if (firstime)  firstime = false;
-    else           PropulsionValues += delimeter;
+    else           PropulsionValues += delimiter;
 
-    PropulsionValues += Engines[i]->GetEngineValues(delimeter);
+    PropulsionValues += Engines[i]->GetEngineValues(delimiter);
   }
   for (i=0; i<Tanks.size(); i++) {
-    buf << delimeter;
+    buf << delimiter;
     buf << Tanks[i]->GetContents();
   }
 
index 3ef37afec42e122035a6a6fc58519f6bcac100ec..ce62a60ea0f4d6719fca5bcb4c4e1546e2294ab4 100644 (file)
@@ -39,11 +39,9 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include <vector>
-#include <fstream>
+#include <iosfwd>
 
 #include "FGModel.h"
-#include "models/propulsion/FGEngine.h"
-#include "models/propulsion/FGTank.h"
 #include "math/FGMatrix33.h"
 #include "input_output/FGXMLFileRead.h"
 
@@ -59,6 +57,9 @@ FORWARD DECLARATIONS
 
 namespace JSBSim {
 
+class FGTank;
+class FGEngine;
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -157,8 +158,8 @@ public:
   /** Sets up the engines as running */
   void InitRunning(int n);
 
-  string GetPropulsionStrings(string delimeter);
-  string GetPropulsionValues(string delimeter);
+  std::string GetPropulsionStrings(const std::string& delimiter);
+  std::string GetPropulsionValues(const std::string& delimiter);
 
   inline FGColumnVector3& GetForces(void)  {return vForces; }
   inline double GetForces(int n) const { return vForces(n);}
@@ -176,8 +177,8 @@ public:
   FGColumnVector3& GetTanksMoment(void);
   double GetTanksWeight(void);
 
-  ifstream* FindEngineFile(string filename);
-  string FindEngineFullPathname(string engine_filename);
+  std::ifstream* FindEngineFile(const std::string& filename);
+  std::string FindEngineFullPathname(const std::string& engine_filename);
   inline int GetActiveEngine(void) const {return ActiveEngine;}
   inline bool GetFuelFreeze(void) {return fuel_freeze;}
   double GetTotalFuelQuantity(void) const {return TotalFuelQuantity;}
@@ -190,8 +191,8 @@ public:
   FGMatrix33& CalculateTankInertias(void);
 
 private:
-  vector <FGEngine*>   Engines;
-  vector <FGTank*>     Tanks;
+  std::vector <FGEngine*>   Engines;
+  std::vector <FGTank*>     Tanks;
   unsigned int numSelectedFuelTanks;
   unsigned int numSelectedOxiTanks;
   unsigned int numFuelTanks;
index 590e3f6d3ed3e41a7963274af30fd9937a947af9..0328581017fff44c68b4beba98d997dbd0ca499c 100755 (executable)
@@ -59,11 +59,11 @@ INCLUDES
 
 #include "FGMSIS.h"
 #include "FGState.h"
-#include <math.h>          /* maths functions */
-#include <stdlib.h>        /* for malloc/free */
-#include <stdio.h>         /* for printf      */
+#include <cmath>          /* maths functions */
 #include <iostream>        // for cout, endl
 
+using namespace std;
+
 namespace JSBSim {
 
 static const char *IdSrc = "$Id$";
@@ -322,7 +322,7 @@ double MSIS::dnet (double dd, double dm, double zhm, double xmm, double xm)
   double ylog;
   a  = zhm / (xmm-xm);
   if (!((dm>0) && (dd>0))) {
-    printf("dnet log error %e %e %e\n",dm,dd,xm);
+    cerr << "dnet log error " << dm << ' ' << dd << ' ' << xm << ' ' << endl;
     if ((dd==0) && (dm==0))
       dd=1;
     if (dm==0)
@@ -400,7 +400,7 @@ void MSIS::splint (double *xa, double *ya, double *y2a, int n, double x, double
   }
   h = xa[khi] - xa[klo];
   if (h==0.0)
-    printf("bad XA input to splint");
+    cerr << "bad XA input to splint" << endl;
   a = (xa[khi] - x)/h;
   b = (x - xa[klo])/h;
   yi = a * ya[klo] + b * ya[khi] + ((a*a*a - a) * y2a[klo] + (b*b*b - b) * y2a[khi]) * h * h/6.0;
@@ -422,9 +422,9 @@ void MSIS::spline (double *x, double *y, int n, double yp1, double ypn, double *
   double *u;
   double sig, p, qn, un;
   int i, k;
-  u=(double*)malloc(sizeof(double)*n);
+  u=new double[n];
   if (u==NULL) {
-    printf("Out Of Memory in spline - ERROR");
+    cerr << "Out Of Memory in spline - ERROR" << endl;
     return;
   }
   if (yp1>0.99E30) {
@@ -451,7 +451,7 @@ void MSIS::spline (double *x, double *y, int n, double yp1, double ypn, double *
   for (k=n-2;k>=0;k--)
     y2[k] = y2[k] * y2[k+1] + u[k];
 
-  free(u);
+  delete u;
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -964,7 +964,7 @@ double MSIS::glob7s(double *p, struct nrlmsise_input *input,
   if (p[99]==0)
     p[99]=pset;
   if (p[99]!=pset) {
-    printf("Wrong parameter set for glob7s\n");
+    cerr << "Wrong parameter set for glob7s" << endl;
     return -1;
   }
   for (j=0;j<14;j++)
@@ -1247,7 +1247,7 @@ void MSIS::ghp7(struct nrlmsise_input *input, struct nrlmsise_flags *flags,
     if (sqrt(diff*diff)<test)
       return;
     if (l==ltest) {
-      printf("ERROR: ghp7 not converging for press %e, diff %e",press,diff);
+      cerr << "ERROR: ghp7 not converging for press " << press << ", diff " << diff << endl;
       return;
     }
     xm = output->d[5] / xn / 1.66E-24;
index 3bd73792629b3b1c698b2d0736baaec91ec8a4ec..7bebc7d3400dabf4221a5f1ca56bdeacf2b597a2 100755 (executable)
@@ -43,6 +43,9 @@ INCLUDES
 
 #include "FGMars.h"
 #include "FGState.h"
+#include <iostream>
+
+using namespace std;
 
 namespace JSBSim {
 
index e5c529de5f507b8f8c7c6a99934dbb8075c13e21..1148c81b6fe64fff7e88647b79d222f48a590cc9 100755 (executable)
@@ -38,6 +38,10 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGAccelerometer.h"
+#include <iostream>
+#include <cstdlib>
+
+using namespace std;
 
 namespace JSBSim {
 
index e7ba4205f5953490d323d2ba3ce7e563f647c6e3..ae2aa38b7a0cd5b186c62036e2c7e81d171c2d8b 100755 (executable)
@@ -39,6 +39,8 @@ INCLUDES
 
 #include "FGActuator.h"
 
+using namespace std;
+
 namespace JSBSim {
 
 static const char *IdSrc = "$Id$";
index babd910e2acfe26fe34ce8563d41bc75e9df026b..3d0689d382e0a364a2800cc23b66ccfce9155827 100644 (file)
@@ -38,6 +38,11 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGDeadBand.h"
+#include "input_output/FGXMLElement.h"
+#include "input_output/FGPropertyManager.h"
+#include <iostream>
+
+using namespace std;
 
 namespace JSBSim {
 
index 82523bdc56207a11b6e0bacfda215612142b1a84..9dd4a39a354cb819ae5dabc2126378c4feab9a9d 100644 (file)
@@ -38,7 +38,6 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGFCSComponent.h"
-#include "input_output/FGXMLElement.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
@@ -53,6 +52,8 @@ FORWARD DECLARATIONS
 namespace JSBSim {
 
 class FGFCS;
+class Element;
+class FGPropertyManager;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
index e2e4e1b9520a49ecc4f85fb52b4f6e053761b01c..d1f454555f5e73f931e75d187ba34a93579a2c0b 100644 (file)
@@ -38,6 +38,12 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGFCSComponent.h"
+#include "input_output/FGPropertyManager.h"
+#include "input_output/FGXMLElement.h"
+#include <iostream>
+#include <cstdlib>
+
+using namespace std;
 
 namespace JSBSim {
 
@@ -147,6 +153,8 @@ FGFCSComponent::FGFCSComponent(FGFCS* _fcs, Element* element) : fcs(_fcs)
     if (delayType.length() > 0) {
       if (delayType == "time") {
         delay = (int)(delay / dt);
+      } else if (delayType == "frames") {
+        // no op. the delay type of "frames" is assumed and is the default.
       } else {
         cerr << "Unallowed delay type" << endl;
       }
index f64b204c35b24f756851a2d12a1a08ad7328f708..b1fc2c6c5d7057742bf9ba6640f152d5330fea2d 100644 (file)
@@ -38,8 +38,6 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGJSBBase.h"
-#include "input_output/FGPropertyManager.h"
-#include "input_output/FGXMLElement.h"
 #include <string>
 #include <vector>
 
@@ -49,9 +47,6 @@ DEFINITIONS
 
 #define ID_FCSCOMPONENT "$Id$"
 
-using std::string;
-using std::vector;
-
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -59,6 +54,8 @@ FORWARD DECLARATIONS
 namespace JSBSim {
 
 class FGFCS;
+class FGPropertyManager;
+class Element;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
@@ -102,22 +99,22 @@ public:
   virtual bool Run(void);
   virtual void SetOutput(void);
   double GetOutput (void) const {return Output;}
-  string GetName(void) const {return Name;}
-  string GetType(void) const { return Type; }
+  std::string GetName(void) const {return Name;}
+  std::string GetType(void) const { return Type; }
   virtual double GetOutputPct(void) const { return 0; }
 
 protected:
   FGFCS* fcs;
   FGPropertyManager* PropertyManager;
   FGPropertyManager* treenode;
-  vector <FGPropertyManager*> OutputNodes;
+  std::vector <FGPropertyManager*> OutputNodes;
   FGPropertyManager* ClipMinPropertyNode;
   FGPropertyManager* ClipMaxPropertyNode;
-  vector <FGPropertyManager*> InputNodes;
-  vector <float> InputSigns;
-  vector <double> output_array;
-  string Type;
-  string Name;
+  std::vector <FGPropertyManager*> InputNodes;
+  std::vector <float> InputSigns;
+  std::vector <double> output_array;
+  std::string Type;
+  std::string Name;
   double Input;
   double Output;
   double clipmax, clipmin;
index b8512bb41e268c04bc895d26e4e7f35b6913f083..d8a91572e3879e7492c24fdc1de9bcca6002c73e 100755 (executable)
@@ -38,6 +38,10 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGFCSFunction.h"
+#include <cstdlib>
+#include <iostream>
+
+using namespace std;
 
 namespace JSBSim {
 
index 6122e15d0c9408e4973288555d66efc6ce9ce814..f0ca4906406cf6b2f04ade940e8da0538c5ff0be 100644 (file)
@@ -38,6 +38,13 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGFilter.h"
+#include "input_output/FGXMLElement.h"
+#include "input_output/FGPropertyManager.h"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
 
 namespace JSBSim {
 
@@ -54,9 +61,10 @@ FGFilter::FGFilter(FGFCS* fcs, Element* element) : FGFCSComponent(fcs, element)
   DynamicFilter = false;
 
   C[1] = C[2] = C[3] = C[4] = C[5] = C[6] = 0.0;
-  for (int i=0; i<7; i++) {
+  for (int i=1; i<7; i++) {
     PropertySign[i] = 1.0;
     PropertyNode[i] = 0L;
+    ReadFilterCoefficients(element, i);
   }
 
   if      (Type == "LAG_FILTER")          FilterType = eLag        ;
@@ -66,13 +74,6 @@ FGFilter::FGFilter(FGFCS* fcs, Element* element) : FGFCSComponent(fcs, element)
   else if (Type == "INTEGRATOR")          FilterType = eIntegrator ;
   else                                    FilterType = eUnknown    ;
 
-  ReadFilterCoefficients(element, 1);
-  ReadFilterCoefficients(element, 2);
-  ReadFilterCoefficients(element, 3);
-  ReadFilterCoefficients(element, 4);
-  ReadFilterCoefficients(element, 5);
-  ReadFilterCoefficients(element, 6);
-
   if (element->FindElement("trigger")) {
     Trigger =  PropertyManager->GetNode(element->FindElementValue("trigger"));
   }
@@ -97,13 +98,13 @@ FGFilter::~FGFilter()
 
 void FGFilter::ReadFilterCoefficients(Element* element, int index)
 {
-  char buf[3];
-  sprintf(buf, "c%d", index);
-  string coefficient = string(buf);
-  string property_string="";
-
+  // index is known to be 1-7. 
+  // A stringstream would be overkill, but also trying to avoid sprintf
+  string coefficient = "c0";
+  coefficient[1] += index;
+  
   if ( element->FindElement(coefficient) ) {
-    property_string = element->FindElementValue(coefficient);
+    string property_string = element->FindElementValue(coefficient);
     if (!is_number(property_string)) { // property
       if (property_string[0] == '-') {
        PropertySign[index] = -1.0;
index 5e7f10b74a5606c77d5821d431f430b75ed52d48..7aeafc202c293eea8432d4a2c0bb1dcadb5bf253 100644 (file)
@@ -38,7 +38,6 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGFCSComponent.h"
-#include "input_output/FGXMLElement.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
@@ -52,6 +51,10 @@ FORWARD DECLARATIONS
 
 namespace JSBSim {
 
+class Element;
+class FGPropertyManager;
+class FGFCS;
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
index f72e6c4f44f724b16910b0d0e609f5f7c01b04c5..0ecb8c6459fe0f60dcc6a184f1c66c2767899bce 100644 (file)
@@ -38,6 +38,12 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGGain.h"
+#include "input_output/FGXMLElement.h"
+#include <iostream>
+#include <string>
+#include <cstdlib>
+
+using namespace std;
 
 namespace JSBSim {
 
index 543a3d88332dc8cd6f34af1379c57420d28fe787..525c4e449cbcd0de44882ef5e0d1b21bcb6daf8b 100644 (file)
@@ -38,12 +38,8 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGFCSComponent.h"
-#include <string>
-#include "input_output/FGXMLElement.h"
 #include "math/FGTable.h"
 
-using std::string;
-
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -57,6 +53,7 @@ FORWARD DECLARATIONS
 namespace JSBSim {
 
 class FGFCS;
+class Element;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
index 15af4c5f3517ee54a6d1054cf1dc50c8c165f4b6..2325dec1e25135a9afaf9b87e65f8ea797ed6389 100644 (file)
@@ -38,6 +38,9 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGGradient.h"
+#include <iostream>
+
+using namespace std;
 
 namespace JSBSim {
 
index f48af626c0b3813b3f61ac007919a36b515a9e9b..740c01e3a554bf1166ffad03211370e3d433a26d 100755 (executable)
@@ -38,6 +38,9 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGGyro.h"
+#include <iostream>
+
+using namespace std;
 
 namespace JSBSim {
 
index d25182a13933f312edd79234957c9e018eb7aebd..931c1740caf2612803218b03dfd273edec153c26 100644 (file)
@@ -38,8 +38,11 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGKinemat.h"
-#include <math.h>
-#include <float.h>
+#include "input_output/FGXMLElement.h"
+#include <iostream>
+#include <cstdlib>
+
+using namespace std;
 
 namespace JSBSim {
 
index f836567d1a5cce4f279b5bbca9db586ecac2b605..8dcc73bb876cc9c1478ef4e4fc0ca16dc00e11f1 100644 (file)
@@ -38,12 +38,7 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGFCSComponent.h"
-#include "input_output/FGXMLElement.h"
 #include <vector>
-#include <string>
-
-using std::vector;
-using std::string;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
@@ -134,8 +129,8 @@ public:
   bool Run (void);
 
 private:
-  vector<double> Detents;
-  vector<double> TransitionTimes;
+  std::vector<double> Detents;
+  std::vector<double> TransitionTimes;
   int NumDetents;
   double OutputPct;
   bool  DoScale;
index c4be3c471a58bcdcd35e04ea0bc88633a4db1e63..368d3524e9daf28b114336d7a5012c40f9ce90bc 100755 (executable)
@@ -40,6 +40,10 @@ INCLUDES
 #include "FGMagnetometer.h"
 #include "simgear/magvar/coremag.hxx"
 #include <ctime>
+#include <cstdlib>
+#include <iostream>
+
+using namespace std;
 
 namespace JSBSim {
 
index 7df31c67c466b71ea60a72b79528507f78e195eb..3dda266f208c4ddc37037d13061cbad4a3ae254a 100755 (executable)
@@ -36,6 +36,11 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGPID.h"
+#include "input_output/FGXMLElement.h"
+#include <string>
+#include <iostream>
+
+using namespace std;
 
 namespace JSBSim {
 
index 670c1af2373e39791069dbfc9c8f45a88c800dc2..adad3606c571874af027162d560863bfecc74285 100755 (executable)
@@ -39,8 +39,6 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGFCSComponent.h"
-#include "input_output/FGXMLElement.h"
-#include <string>
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
@@ -48,10 +46,6 @@ DEFINITIONS
 
 #define ID_PID "$Id$"
 
-using std::string;
-
-using std::string;
-
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -59,6 +53,7 @@ FORWARD DECLARATIONS
 namespace JSBSim {
 
 class FGFCS;
+class Element;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
index d2f9243d92a49147fc03524deba9a2391d233af3..1ca89b6ba7eb66a3f9db8c035880e6d5628ef7ee 100755 (executable)
@@ -38,6 +38,11 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGSensor.h"
+#include "input_output/FGXMLElement.h"
+#include <iostream>
+#include <cstdlib>
+
+using namespace std;
 
 namespace JSBSim {
 
index 18699e966958eb99cc540f37c197a03e20acc8cd..136099536e51d8b93cff0c7800d9e49c60cbefad 100755 (executable)
@@ -38,8 +38,7 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGFCSComponent.h"
-#include "input_output/FGXMLElement.h"
-#include <vector>
+#include <string>
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
@@ -53,8 +52,8 @@ FORWARD DECLARATIONS
 
 namespace JSBSim {
 
-using std::vector;
 class FGFCS;
+class Element;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
@@ -155,7 +154,7 @@ protected:
   bool fail_low;
   bool fail_high;
   bool fail_stuck;
-  string quant_property;
+  std::string quant_property;
 
   void ProcessSensorSignal(void);
   void Noise(void);
index cbd43de89e627ddbb155cad07a9e339ccb13d8d8..4f6d52f3eaed93fdbf4003407bb6c269a9dfead1 100755 (executable)
@@ -42,6 +42,8 @@ INCLUDES
 #include "math/FGColumnVector3.h"
 #include "math/FGMatrix33.h"
 
+#include <iostream>
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -77,7 +79,7 @@ public:
   {
     Element* orient_element = element->FindElement("orientation");
     if (orient_element) vOrient = orient_element->FindElementTripletConvertTo("RAD");
-    else {cerr << "No orientation given for this sensor. " << endl;}
+    else { std::cerr << "No orientation given for this sensor. " << std::endl;}
 
     Element* axis_element = element->FindElement("axis");
     if (axis_element) {
@@ -89,7 +91,7 @@ public:
       } else if (sAxis == "Z" || sAxis == "z") {
         axis = 3;
       } else {
-        cerr << "  Incorrect/no axis specified for this sensor; assuming X axis" << endl;
+        std::cerr << "  Incorrect/no axis specified for this sensor; assuming X axis" << std::endl;
         axis = 1;
       }
     }
index c8a1fcadc8d9fc17d1869704f2eae1a95124e409..e77ee72082ea1b503bbc1365a6fe5623c06edf7e 100644 (file)
@@ -38,6 +38,10 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGSummer.h"
+#include "input_output/FGXMLElement.h"
+#include <iostream>
+
+using namespace std;
 
 namespace JSBSim {
 
index 9ffeddb8e243898ef23f6c0691000a560345bef6..e37642855b6f5ed0f35c1e2f78c24a87ba594a89 100644 (file)
@@ -38,9 +38,6 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGFCSComponent.h"
-#include "input_output/FGXMLElement.h"
-#include <vector>
-#include <string>
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
@@ -48,18 +45,14 @@ DEFINITIONS
 
 #define ID_SUMMER "$Id$"
 
-using std::vector;
-using std::string;
-
-using std::vector;
-using std::string;
-
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 namespace JSBSim {
 
+class Element;
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
index 76b9fc1e6da8abde37a1b2a6b6c0219db83d99db..c29c7227752ccfe485453afd30ec96512cf23e6f 100644 (file)
@@ -62,6 +62,10 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGSwitch.h"
+#include <iostream>
+#include <cstdlib>
+
+using namespace std;
 
 namespace JSBSim {
 
index 255fb644d33223d3058777245e73cb57f52f7fdf..1ab17c7b60c0a9529908f553d04d41f042c110f4 100644 (file)
@@ -40,7 +40,14 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGElectric.h"
+#include "FGState.h"
 #include "models/FGPropulsion.h"
+#include "models/propulsion/FGThruster.h"
+
+#include <iostream>
+#include <sstream>
+
+using namespace std;
 
 namespace JSBSim {
 
@@ -92,24 +99,24 @@ double FGElectric::Calculate(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGElectric::GetEngineLabels(string delimeter)
+string FGElectric::GetEngineLabels(const string& delimiter)
 {
   std::ostringstream buf;
 
-  buf << Name << " HP (engine " << EngineNumber << ")" << delimeter
-      << Thruster->GetThrusterLabels(EngineNumber, delimeter);
+  buf << Name << " HP (engine " << EngineNumber << ")" << delimiter
+      << Thruster->GetThrusterLabels(EngineNumber, delimiter);
 
   return buf.str();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGElectric::GetEngineValues(string delimeter)
+string FGElectric::GetEngineValues(const string& delimiter)
 {
   std::ostringstream buf;
 
-  buf << HP << delimeter
-     << Thruster->GetThrusterValues(EngineNumber, delimeter);
+  buf << HP << delimiter
+     << Thruster->GetThrusterValues(EngineNumber, delimiter);
 
   return buf.str();
 }
index 663a153f35d7041134e361f7310b543aee5bec4b..da4a575bb0349f869f137276da85dad762584d9d 100644 (file)
@@ -83,8 +83,8 @@ public:
   double Calculate(void);
   double GetPowerAvailable(void) {return PowerAvailable;}
   double getRPM(void) {return RPM;}
-  string GetEngineLabels(string delimeter);
-  string GetEngineValues(string delimeter);
+  std::string GetEngineLabels(const std::string& delimiter);
+  std::string GetEngineValues(const std::string& delimiter);
 
 private:
 
index ae447b05a0c8f48374e8b2f6da5b06a790596eb5..4c98cd3d1d647045808ac3b21c5a3710174ddff3 100644 (file)
@@ -41,9 +41,16 @@ INCLUDES
 #include "FGTank.h"
 #include "FGPropeller.h"
 #include "FGNozzle.h"
+#include "FGState.h"
+#include "models/FGPropulsion.h"
 #include "input_output/FGXMLParse.h"
 #include "math/FGColumnVector3.h"
+
+#include <iostream>
 #include <fstream>
+#include <cstdlib>
+
+using namespace std;
 
 namespace JSBSim {
 
index 66ad9bf93f8b7dafdbe16384aed3c63a17e4d8e1..4876f571f3e9aa6cdf9675c944079067e6713de9 100644 (file)
@@ -44,9 +44,8 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGJSBBase.h"
-#include "FGThruster.h"
-#include "input_output/FGPropertyManager.h"
 #include "input_output/FGXMLFileRead.h"
+#include "math/FGColumnVector3.h"
 #include <vector>
 #include <string>
 
@@ -56,9 +55,6 @@ DEFINITIONS
 
 #define ID_ENGINE "$Id$"
 
-using std::string;
-using std::vector;
-
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -75,6 +71,7 @@ class FGPropulsion;
 class FGAuxiliary;
 class FGThruster;
 class Element;
+class FGPropertyManager;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
@@ -187,8 +184,8 @@ public:
   bool LoadThruster(Element *el);
   FGThruster* GetThruster(void) {return Thruster;}
 
-  virtual string GetEngineLabels(string delimeter) = 0;
-  virtual string GetEngineValues(string delimeter) = 0;
+  virtual std::string GetEngineLabels(const std::string& delimiter) = 0;
+  virtual std::string GetEngineValues(const std::string& delimiter) = 0;
 
 protected:
   /** Reduces the fuel in the active tanks by the amount required.
@@ -205,7 +202,7 @@ protected:
   virtual double CalcFuelNeed(void);
 
   FGPropertyManager* PropertyManager;
-  string Name;
+  std::string Name;
   const int   EngineNumber;
   EngineType Type;
   double X, Y, Z;
@@ -240,20 +237,10 @@ protected:
   FGAuxiliary*    Auxiliary;
   FGThruster*     Thruster;
 
-  vector <int> SourceTanks;
+  std::vector <int> SourceTanks;
   void Debug(int from);
 };
 }
-#include "FGState.h"
-#include "FGFDMExec.h"
-#include "models/FGAtmosphere.h"
-#include "models/FGFCS.h"
-#include "models/FGAircraft.h"
-#include "models/FGPropagate.h"
-#include "models/FGPropulsion.h"
-#include "models/FGAuxiliary.h"
-#include "models/propulsion/FGThruster.h"
-#include "input_output/FGXMLElement.h"
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 #endif
index 4d907e3f41ae4dc258185428890da89014e557be..ff7532916325914025583df537d86be4388e5979 100644 (file)
@@ -46,6 +46,10 @@ and the cg.
 #include "models/FGPropagate.h"
 #include "models/FGMassBalance.h"
 #include "models/FGAerodynamics.h"
+#include <iostream>
+#include <cstdlib>
+
+using namespace std;
 
 namespace JSBSim {
 
index 45b0065c4588e1806a9a069f6532ed59e7d0e106..fdbd1533fe8cf9f6b020595eb4970b522a6740e0 100644 (file)
@@ -35,10 +35,15 @@ HISTORY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
+#include <iostream>
 #include <sstream>
+#include <cstdlib>
 
 #include "FGNozzle.h"
 #include "models/FGAtmosphere.h"
+#include "input_output/FGXMLElement.h"
+
+using namespace std;
 
 namespace JSBSim {
 
@@ -59,14 +64,14 @@ FGNozzle::FGNozzle(FGFDMExec* FDMExec, Element* nozzle_element, int num)
     cerr << "Fatal Error: Nozzle exit area must be given in nozzle config file." << endl;
     exit(-1);
   }
-
+/*
   if (nozzle_element->FindElement("pe"))
     PE = nozzle_element->FindElementValueAsNumberConvertTo("pe", "PSF");
   else {
     cerr << "Fatal Error: Nozzle exit pressure must be given in nozzle config file." << endl;
     exit(-1);
   }
-
+*/
   Thrust = 0;
   Type = ttNozzle;
   
index 5f1d070bffe2733ee387f886ab75e5fd91c5f795..4b5dc40a559afa2cf25e1ef348b1ef58263e1ce1 100644 (file)
@@ -95,7 +95,7 @@ public:
   string GetThrusterValues(int id, string delimeter);
 
 private:
-  double PE;
+//  double PE;
   double Area;
   void Debug(int from);
 };
index d2a0831ac3a38321484035ad766d43244805a0da..116d20cc037b45caa8c9530ccfb49abc57e1a6e9 100644 (file)
@@ -43,8 +43,13 @@ INCLUDES
 #include <sstream>
 
 #include "FGPiston.h"
+#include "FGState.h"
+#include "models/FGAtmosphere.h"
 #include "models/FGPropulsion.h"
 #include "FGPropeller.h"
+#include <iostream>
+
+using namespace std;
 
 namespace JSBSim {
 
@@ -838,28 +843,28 @@ void FGPiston::doOilPressure(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGPiston::GetEngineLabels(string delimeter)
+string FGPiston::GetEngineLabels(const string& delimiter)
 {
   std::ostringstream buf;
 
-  buf << Name << " Power Available (engine " << EngineNumber << " in HP)" << delimeter
-      << Name << " HP (engine " << EngineNumber << ")" << delimeter
-      << Name << " equivalent ratio (engine " << EngineNumber << ")" << delimeter
-      << Name << " MAP (engine " << EngineNumber << " in inHg)" << delimeter
-      << Thruster->GetThrusterLabels(EngineNumber, delimeter);
+  buf << Name << " Power Available (engine " << EngineNumber << " in HP)" << delimiter
+      << Name << " HP (engine " << EngineNumber << ")" << delimiter
+      << Name << " equivalent ratio (engine " << EngineNumber << ")" << delimiter
+      << Name << " MAP (engine " << EngineNumber << " in inHg)" << delimiter
+      << Thruster->GetThrusterLabels(EngineNumber, delimiter);
 
   return buf.str();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGPiston::GetEngineValues(string delimeter)
+string FGPiston::GetEngineValues(const string& delimiter)
 {
   std::ostringstream buf;
 
-  buf << PowerAvailable << delimeter << HP << delimeter
-      << equivalence_ratio << delimeter << ManifoldPressure_inHg << delimeter
-      << Thruster->GetThrusterValues(EngineNumber, delimeter);
+  buf << PowerAvailable << delimiter << HP << delimiter
+      << equivalence_ratio << delimiter << ManifoldPressure_inHg << delimiter
+      << Thruster->GetThrusterValues(EngineNumber, delimiter);
 
   return buf.str();
 }
index cbcac27631318082b5e4ad25314511a20497171f..2bfb1971a8ec7c3ce129c5c57c10be1f2c042a21 100644 (file)
@@ -195,8 +195,8 @@ public:
   /// Destructor
   ~FGPiston();
 
-  string GetEngineLabels(string delimeter);
-  string GetEngineValues(string delimeter);
+  std::string GetEngineLabels(const std::string& delimiter);
+  std::string GetEngineValues(const std::string& delimiter);
 
   double Calculate(void);
   double GetPowerAvailable(void) {return PowerAvailable;}
index a7e1a59c33bb46a634316462f60acc0e6927f38e..fb1be8ac125de1d236b4014a6dfbf1c9c97c7c97 100644 (file)
@@ -35,12 +35,16 @@ HISTORY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
+#include <iostream>
 #include <sstream>
 
 #include "FGPropeller.h"
 #include "models/FGPropagate.h"
 #include "models/FGAtmosphere.h"
 #include "models/FGAuxiliary.h"
+#include "input_output/FGXMLElement.h"
+
+using namespace std;
 
 namespace JSBSim {
 
index 0debff012ccf76e91bb0ea02652a053d9b2e0400..8f699bfd8f80aed05df9934c59a90569d4c61354 100644 (file)
@@ -38,9 +38,15 @@ HISTORY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
+#include <iostream>
 #include <sstream>
-
 #include "FGRocket.h"
+#include "FGState.h"
+#include "models/FGPropulsion.h"
+#include "FGThruster.h"
+#include "FGTank.h"
+
+using namespace std;
 
 namespace JSBSim {
 
@@ -114,25 +120,23 @@ double FGRocket::Calculate(void)
   PropellantFlowRate = (FuelExpended + OxidizerExpended)/dT;
   Throttle = FCS->GetThrottlePos(EngineNumber);
 
-  // If there is a thrust table, it is a function of propellant remaining. The
+  // If there is a thrust table, it is a function of propellant burned. The
   // engine is started when the throttle is advanced to 1.0. After that, it
-  // burns without regard to throttle setting. The table returns a value between
-  // zero and one, representing the percentage of maximum vacuum thrust being
-  // applied.
+  // burns without regard to throttle setting.
 
   if (ThrustTable != 0L) { // Thrust table given -> Solid fuel used
 
     if ((Throttle == 1 || BurnTime > 0.0 ) && !Starved) {
       BurnTime += State->Getdt();
-      double TotalEngineFuelAvailable=0.0;
+      double TotalEngineFuelBurned=0.0;
       for (int i=0; i<(int)SourceTanks.size(); i++) {
         FGTank* tank = Propulsion->GetTank(i);
         if (SourceTanks[i] == 1) {
-          TotalEngineFuelAvailable += tank->GetContents();
+          TotalEngineFuelBurned += tank->GetCapacity() - tank->GetContents();
         }
       }
 
-      VacThrust = ThrustTable->GetValue(TotalEngineFuelAvailable);
+      VacThrust = ThrustTable->GetValue(TotalEngineFuelBurned);
     } else {
       VacThrust = 0.0;
     }
@@ -252,23 +256,23 @@ double FGRocket::CalcOxidizerNeed(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGRocket::GetEngineLabels(string delimeter)
+string FGRocket::GetEngineLabels(const string& delimiter)
 {
   std::ostringstream buf;
 
-  buf << Name << " Total Impulse (engine " << EngineNumber << " in psf)" << delimeter
-      << Thruster->GetThrusterLabels(EngineNumber, delimeter);
+  buf << Name << " Total Impulse (engine " << EngineNumber << " in psf)" << delimiter
+      << Thruster->GetThrusterLabels(EngineNumber, delimiter);
 
   return buf.str();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGRocket::GetEngineValues(string delimeter)
+string FGRocket::GetEngineValues(const string& delimiter)
 {
   std::ostringstream buf;
 
-  buf << It << delimeter << Thruster->GetThrusterValues(EngineNumber, delimeter);
+  buf << It << delimiter << Thruster->GetThrusterValues(EngineNumber, delimiter);
 
   return buf.str();
 }
index f96d02010e2770dc3ab0c3fc2613bccf2ca9fe76..15235575b9e77aa003c178c3d0da5483950c0b29 100644 (file)
@@ -159,8 +159,8 @@ public:
 
   double GetOxiFlowRate(void) const {return OxidizerFlowRate;}
 
-  string GetEngineLabels(string delimeter);
-  string GetEngineValues(string delimeter);
+  std::string GetEngineLabels(const std::string& delimiter);
+  std::string GetEngineValues(const std::string& delimiter);
 
 private:
   /** Reduces the fuel in the active tanks by the amount required.
index 7c3de71a6219fea8789139630a2c873c9bffedce..6ef33e7c03feb540ce5a8c517126b73c30f82abd 100644 (file)
@@ -36,6 +36,9 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGRotor.h"
+#include <iostream>
+
+using namespace std;
 
 namespace JSBSim {
 
index ffeb562767bb3fd955b9449ba61e6d1caf8310be..dced188c54a9d5fe6a0108cd8c92d7bfad1305e4 100644 (file)
@@ -37,11 +37,14 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGTank.h"
+#include "FGFDMExec.h"
 #include "models/FGAuxiliary.h"
+#include "input_output/FGXMLElement.h"
+#include "input_output/FGPropertyManager.h"
+#include <iostream>
+#include <cstdlib>
 
-using std::cerr;
-using std::endl;
-using std::cout;
+using namespace std;
 
 namespace JSBSim {
 
index 141d01003f4ab7d5bfc97f8fb367689c187be290..7f4f7545768e21eb3e47a548512fffbf858d6f9c 100644 (file)
@@ -44,17 +44,10 @@ SENTRY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#include "FGFDMExec.h"
 #include "FGJSBBase.h"
-#include "input_output/FGXMLElement.h"
 #include "math/FGColumnVector3.h"
 #include <string>
 
-using std::string;
-using std::cerr;
-using std::endl;
-using std::cout;
-
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -67,6 +60,10 @@ FORWARD DECLARATIONS
 
 namespace JSBSim {
 
+class Element;
+class FGPropertyManager;
+class FGFDMExec;
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -281,8 +278,8 @@ private:
   TankType Type;
   GrainType grainType;
   int TankNumber;
-  string type;
-  string strGType;
+  std::string type;
+  std::string strGType;
   FGColumnVector3 vXYZ;
   FGColumnVector3 vXYZ_drain;
   double Capacity;
index 9a5c38340a3fb42513475eba7c35df6ea7299771..32a508ee17c9f55111a805fe138d776d94537d9d 100644 (file)
@@ -35,9 +35,13 @@ HISTORY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
+#include <iostream>
 #include <sstream>
 
 #include "FGThruster.h"
+#include "input_output/FGXMLElement.h"
+
+using namespace std;
 
 namespace JSBSim {
 
index 3c483657205e2d1157d70c35275f409386363c4f..886b678dc5c96d89b09b17b808812ab63c7e0ba0 100644 (file)
@@ -39,8 +39,6 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGForce.h"
-#include "input_output/FGXMLElement.h"
-#include "input_output/FGPropertyManager.h"
 #include "math/FGColumnVector3.h"
 #include <string>
 
@@ -56,6 +54,9 @@ FORWARD DECLARATIONS
 
 namespace JSBSim {
 
+class Element;
+class FGPropertyManager;
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
index f17c05ee789f7f97ed61221aa16bbd224a3bbc8c..b690d72f0cbf5e5b54cec99af18d763f1f1e3ceb 100644 (file)
@@ -39,10 +39,14 @@ HISTORY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#include <vector>
+#include <iostream>
 #include <sstream>
-
 #include "FGTurbine.h"
+#include "FGState.h"
+#include "models/FGPropulsion.h"
+#include "FGThruster.h"
+
+using namespace std;
 
 namespace JSBSim {
 
@@ -489,26 +493,26 @@ bool FGTurbine::Load(FGFDMExec* exec, Element *el)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGTurbine::GetEngineLabels(string delimeter)
+string FGTurbine::GetEngineLabels(const string& delimiter)
 {
   std::ostringstream buf;
 
-  buf << Name << "_N1[" << EngineNumber << "]" << delimeter
-      << Name << "_N2[" << EngineNumber << "]" << delimeter
-      << Thruster->GetThrusterLabels(EngineNumber, delimeter);
+  buf << Name << "_N1[" << EngineNumber << "]" << delimiter
+      << Name << "_N2[" << EngineNumber << "]" << delimiter
+      << Thruster->GetThrusterLabels(EngineNumber, delimiter);
 
   return buf.str();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGTurbine::GetEngineValues(string delimeter)
+string FGTurbine::GetEngineValues(const string& delimiter)
 {
   std::ostringstream buf;
 
-  buf << N1 << delimeter
-      << N2 << delimeter
-      << Thruster->GetThrusterValues(EngineNumber, delimeter);
+  buf << N1 << delimiter
+      << N2 << delimiter
+      << Thruster->GetThrusterValues(EngineNumber, delimiter);
 
   return buf.str();
 }
index fbb8497c90b0e752be710286bf8a6fba0f2ccc0e..9eebc335d9dc7c0be7ec989a622ebe5e26304374 100644 (file)
@@ -40,10 +40,7 @@ SENTRY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#include <vector>
 #include "FGEngine.h"
-#include "input_output/FGXMLElement.h"
-#include "math/FGFunction.h"
 
 #define ID_TURBINE "$Id$"
 
@@ -53,6 +50,9 @@ FORWARD DECLARATIONS
 
 namespace JSBSim {
 
+class Element;
+class FGFunction;
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -209,8 +209,8 @@ public:
   int InitRunning(void);
   void ResetToIC(void);
 
-  string GetEngineLabels(string delimeter);
-  string GetEngineValues(string delimeter);
+  std::string GetEngineLabels(const std::string& delimiter);
+  std::string GetEngineValues(const std::string& delimiter);
 
 private:
 
index dce83141299f64d0a81d451f96368096bea93311..9ebef96df9b4ced5f41fd20cadd556073f2be0b6 100755 (executable)
@@ -41,11 +41,15 @@ HISTORY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#include <vector>
+#include <iostream>
 #include <sstream>
 #include "FGTurboProp.h"
 
 #include "FGPropeller.h"
+#include "FGState.h"
+#include "models/FGAuxiliary.h"
+
+using namespace std;
 
 namespace JSBSim {
 
@@ -245,7 +249,10 @@ double FGTurboProp::Calculate(void)
   }
 
   //printf ("EngHP: %lf / Requi: %lf\n",Eng_HP,Prop_Required_Power);
-  return Thruster->Calculate((Eng_HP * hptoftlbssec)-Thruster->GetPowerRequired());
+  PowerAvailable = (Eng_HP * hptoftlbssec) - Thruster->GetPowerRequired();
+
+  return Thruster->Calculate(PowerAvailable);
+
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -438,7 +445,7 @@ double FGTurboProp::ExpSeek(double *var, double target, double accel_tau, double
 
 void FGTurboProp::SetDefaults(void)
 {
-  Name = "Not defined";
+//  Name = "Not defined";
   N1 = N2 = 0.0;
   Type = etTurboprop;
   MilThrust = 10000.0;
@@ -468,27 +475,28 @@ void FGTurboProp::SetDefaults(void)
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 
-string FGTurboProp::GetEngineLabels(string delimeter)
+string FGTurboProp::GetEngineLabels(const string& delimiter)
 {
   std::ostringstream buf;
 
-  buf << Name << "_N1[" << EngineNumber << "]" << delimeter
-      << Name << "_N2[" << EngineNumber << "]" << delimeter
-      << Name << "__PwrAvailJVK[" << EngineNumber << "]" << delimeter
-      << Thruster->GetThrusterLabels(EngineNumber, delimeter);
+  buf << Name << "_N1[" << EngineNumber << "]" << delimiter
+      << Name << "_N2[" << EngineNumber << "]" << delimiter
+      << Name << "_PwrAvail[" << EngineNumber << "]" << delimiter
+      << Thruster->GetThrusterLabels(EngineNumber, delimiter);
 
   return buf.str();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGTurboProp::GetEngineValues(string delimeter)
+string FGTurboProp::GetEngineValues(const string& delimiter)
 {
   std::ostringstream buf;
 
-  buf << N1 << delimeter
-      << N2 << delimeter
-      << Thruster->GetThrusterValues(EngineNumber,delimeter);
+  buf << PowerAvailable << delimiter
+      << N1 << delimiter
+      << N2 << delimiter
+      << Thruster->GetThrusterValues(EngineNumber,delimiter);
 
   return buf.str();
 }
index d3b137538267acdbe434a1ec9374db2cbefca724..cb10f85b99dcce08f030a75fbb30c8cf00a93fe2 100755 (executable)
@@ -147,8 +147,8 @@ public:
   inline void SetGeneratorPower(bool gp) { GeneratorPower=gp; }
   inline void SetCondition(bool c) { Condition=c; }
   int InitRunning(void);
-  string GetEngineLabels(string delimeter);  // added from Turbine 0.9.6
-  string GetEngineValues(string delimeter);  // added from Turbine 0.9.6
+  std::string GetEngineLabels(const std::string& delimiter);
+  std::string GetEngineValues(const std::string& delimiter);
 
 private:
 
@@ -167,6 +167,7 @@ private:
   double N2_factor;        ///< factor to tie N2 and throttle
   double ThrottleCmd;      ///< FCS-supplied throttle position
   double TAT;              ///< total air temperature (deg C)
+  double PowerAvailable;
   bool Stalled;            ///< true if engine is compressor-stalled
   bool Seized;             ///< true if inner spool is seized
   bool Overtemp;           ///< true if EGT exceeds limits