]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGPropulsion.cpp
First commit of properties code. JSBSim now has a basic property tree all
[flightgear.git] / src / FDM / JSBSim / FGPropulsion.cpp
index 2b8767dd0a19f23e3717820d8d547411e37948eb..df614a6ee5d0d3d8e04b838c4227bf6c0d24cdb1 100644 (file)
@@ -53,6 +53,8 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGPropulsion.h"
+#include "FGPropertyManager.h"
+
 
 static const char *IdSrc = "$Id$";
 static const char *IdHdr = ID_PROPULSION;
@@ -67,7 +69,7 @@ FGPropulsion::FGPropulsion(FGFDMExec* exec) : FGModel(exec)
   numSelectedFuelTanks = numSelectedOxiTanks = 0;
   numTanks = numEngines = numThrusters = 0;
   numOxiTanks = numFuelTanks = 0;
-
+  bind();
   Debug(0);
 }
 
@@ -77,6 +79,7 @@ FGPropulsion::~FGPropulsion()
 {
   for (unsigned int i=0; i<Engines.size(); i++) delete Engines[i];
   Engines.clear();
+  unbind();
   Debug(1);
 }
 
@@ -580,5 +583,49 @@ void FGPropulsion::Debug(int from)
   }
   if (debug_lvl & 16) { // Sanity checking
   }
+  if (debug_lvl & 64) {
+    if (from == 0) { // Constructor
+      cout << IdSrc << endl;
+      cout << IdHdr << endl;
+    }
+  }
+}
+
+void FGPropulsion::bind(void){
+  /* PropertyManager->Tie("propulsion/num-engines", this,
+                       &FGPropulsion::GetNumEngines);
+  PropertyManager->Tie("propulsion/num-tanks", this,
+                       &FGPropulsion::GetNumTanks); */
+  PropertyManager->Tie("propulsion/num-sel-fuel-tanks", this,
+                       &FGPropulsion::GetnumSelectedFuelTanks);
+  PropertyManager->Tie("propulsion/num-sel-ox-tanks", this,
+                       &FGPropulsion::GetnumSelectedOxiTanks);
+  PropertyManager->Tie("propulsion/fbx-prop-lbs", this,1,
+                       &FGPropulsion::GetForces);
+  PropertyManager->Tie("propulsion/fby-prop-lbs", this,2,
+                       &FGPropulsion::GetForces);
+  PropertyManager->Tie("propulsion/fbz-prop-lbs", this,3,
+                       &FGPropulsion::GetForces);
+  PropertyManager->Tie("propulsion/l-prop-lbsft", this,1,
+                       &FGPropulsion::GetMoments);
+  PropertyManager->Tie("propulsion/m-prop-lbsft", this,2,
+                       &FGPropulsion::GetMoments);
+  PropertyManager->Tie("propulsion/n-prop-lbsft", this,3,
+                       &FGPropulsion::GetMoments);
+  //PropertyManager->Tie("propulsion/tanks-weight-lbs", this,
+  //                     &FGPropulsion::GetTanksWeight);
 }
 
+void FGPropulsion::unbind(void){
+  /* PropertyManager->Untie("propulsion/num-engines");
+  PropertyManager->Untie("propulsion/num-tanks"); */
+  PropertyManager->Untie("propulsion/num-sel-fuel-tanks");
+  PropertyManager->Untie("propulsion/num-sel-ox-tanks");
+  PropertyManager->Untie("propulsion/fbx-prop-lbs");
+  PropertyManager->Untie("propulsion/fby-prop-lbs");
+  PropertyManager->Untie("propulsion/fbz-prop-lbs");
+  PropertyManager->Untie("propulsion/l-prop-lbsft");
+  PropertyManager->Untie("propulsion/m-prop-lbsft");
+  PropertyManager->Untie("propulsion/n-prop-lbsft");
+  //PropertyManager->Untie("propulsion/tanks-weight-lbs");
+}