]> git.mxchange.org Git - flightgear.git/commitdiff
Roy Vegard Ovesen:
authormfranz <mfranz>
Wed, 6 Dec 2006 22:11:43 +0000 (22:11 +0000)
committermfranz <mfranz>
Wed, 6 Dec 2006 22:11:43 +0000 (22:11 +0000)
- finish cleanup/optimization of instrumentation system (started by mfranz)
- improve configuration of special properties by
  addressing them directly

36 files changed:
src/Instrumentation/airspeed_indicator.cxx
src/Instrumentation/airspeed_indicator.hxx
src/Instrumentation/altimeter.cxx
src/Instrumentation/altimeter.hxx
src/Instrumentation/attitude_indicator.cxx
src/Instrumentation/attitude_indicator.hxx
src/Instrumentation/dme.cxx
src/Instrumentation/dme.hxx
src/Instrumentation/encoder.cxx
src/Instrumentation/encoder.hxx
src/Instrumentation/gps.cxx
src/Instrumentation/gps.hxx
src/Instrumentation/heading_indicator.cxx
src/Instrumentation/heading_indicator.hxx
src/Instrumentation/mag_compass.cxx
src/Instrumentation/mag_compass.hxx
src/Instrumentation/mrg.cxx
src/Instrumentation/mrg.hxx
src/Instrumentation/navradio.cxx
src/Instrumentation/navradio.hxx
src/Instrumentation/slip_skid_ball.cxx
src/Instrumentation/slip_skid_ball.hxx
src/Instrumentation/transponder.cxx
src/Instrumentation/transponder.hxx
src/Instrumentation/turn_indicator.cxx
src/Instrumentation/turn_indicator.hxx
src/Instrumentation/vertical_speed_indicator.cxx
src/Instrumentation/vertical_speed_indicator.hxx
src/Instrumentation/wxradar.cxx
src/Instrumentation/wxradar.hxx
src/Systems/pitot.cxx
src/Systems/pitot.hxx
src/Systems/static.cxx
src/Systems/static.hxx
src/Systems/vacuum.cxx
src/Systems/vacuum.hxx

index 5d5c6c39e801b02479e32e11cdfa933cf0eb54b7..0196ddbaef9bd20b3d420f1c0f78ae0f868b9af0 100644 (file)
 
 AirspeedIndicator::AirspeedIndicator ( SGPropertyNode *node )
     :
-    name(node->getStringValue("name", "airspeed-indicator")),
-    num(node->getIntValue("number", 0)),
-    pitot_port(node->getStringValue("pitot-port", "/systems/pitot")),
-    static_port(node->getStringValue("static-port", "/systems/static"))
+    _name(node->getStringValue("name", "airspeed-indicator")),
+    _num(node->getIntValue("number", 0)),
+    _total_pressure(node->getStringValue("total-pressure", "/systems/pitot/total-pressure-inhg")),
+    _static_pressure(node->getStringValue("static-pressure", "/systems/static/pressure-inhg"))
 {
 }
 
@@ -32,14 +32,12 @@ void
 AirspeedIndicator::init ()
 {
     string branch;
-    branch = "/instrumentation/" + name;
-    pitot_port += "/total-pressure-inhg";
-    static_port += "/pressure-inhg";
+    branch = "/instrumentation/" + _name;
 
-    SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+    SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
     _serviceable_node = node->getChild("serviceable", 0, true);
-    _total_pressure_node = fgGetNode(pitot_port.c_str(), true);
-    _static_pressure_node = fgGetNode(static_port.c_str(), true);
+    _total_pressure_node = fgGetNode(_total_pressure.c_str(), true);
+    _static_pressure_node = fgGetNode(_static_pressure.c_str(), true);
     _density_node = fgGetNode("/environment/density-slugft3", true);
     _speed_node = node->getChild("indicated-speed-kt", 0, true);
 }
index 5bab3aa7a7db0136f47361020c4b24b682d29941..e4827081d1706aace56016c2ac097463039fb7ff 100644 (file)
@@ -35,7 +35,6 @@ class AirspeedIndicator : public SGSubsystem
 public:
 
     AirspeedIndicator ( SGPropertyNode *node );
-    AirspeedIndicator ( int i);
     virtual ~AirspeedIndicator ();
 
     virtual void init ();
@@ -43,10 +42,10 @@ public:
 
 private:
 
-    string name;
-    unsigned int num;
-    string pitot_port;
-    string static_port;
+    string _name;
+    unsigned int _num;
+    string _total_pressure;
+    string _static_pressure;
     SGPropertyNode_ptr _serviceable_node;
     SGPropertyNode_ptr _total_pressure_node;
     SGPropertyNode_ptr _static_pressure_node;
index ceea78ddc450107b06121bca97ce6f8010f7082f..ebd2f6d0de6fee2f28ac253f49db61322253c58e 100644 (file)
@@ -46,40 +46,14 @@ static double altitude_data[][2] = {
 
 
 Altimeter::Altimeter ( SGPropertyNode *node )
-    : name("altimeter"),
-      num(0),
-      static_port("/systems/static"),
+    : _name(node->getStringValue("name", "altimeter")),
+      _num(node->getIntValue("number", 0)),
+      _static_pressure(node->getStringValue("static-pressure", "/systems/static/pressure-inhg")),
       _altitude_table(new SGInterpTable)
 {
     int i;
     for (i = 0; altitude_data[i][0] != -1; i++)
         _altitude_table->addEntry(altitude_data[i][0], altitude_data[i][1]);
-
-    for ( i = 0; i < node->nChildren(); ++i ) {
-        SGPropertyNode *child = node->getChild(i);
-        string cname = child->getName();
-        string cval = child->getStringValue();
-        if ( cname == "name" ) {
-            name = cval;
-        } else if ( cname == "number" ) {
-            num = child->getIntValue();
-        } else if ( cname == "static-port" ) {
-            static_port = cval;
-        } else {
-            SG_LOG( SG_INSTR, SG_WARN, "Error in altimeter config logic" );
-            if ( name.length() ) {
-                SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
-            }
-        }
-    }
-}
-
-Altimeter::Altimeter ()
-    : _altitude_table(new SGInterpTable)
-{
-
-    for (int i = 0; altitude_data[i][0] != -1; i++)
-        _altitude_table->addEntry(altitude_data[i][0], altitude_data[i][1]);
 }
 
 Altimeter::~Altimeter ()
@@ -91,14 +65,13 @@ void
 Altimeter::init ()
 {
     string branch;
-    branch = "/instrumentation/" + name;
-    static_port += "/pressure-inhg";
+    branch = "/instrumentation/" + _name;
 
-    SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+    SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
 
     _serviceable_node = node->getChild("serviceable", 0, true);
     _setting_node = node->getChild("setting-inhg", 0, true);
-    _pressure_node = fgGetNode(static_port.c_str(), true);
+    _pressure_node = fgGetNode(_static_pressure.c_str(), true);
     _altitude_node = node->getChild("indicated-altitude-ft", 0, true);
 }
 
index f75c207bdb2bc74d874209e2106d79f78f2851af..1e4aa12022153d8023e271e5afdfed34b34e2eee 100644 (file)
@@ -23,13 +23,13 @@ class SGInterpTable;
  *
  * Input properties:
  *
- * /instrumentation/"name"/serviceable
- * /instrumentation/"name"/setting-inhg
- * "static_port"/pressure-inhg
+ * /instrumentation/<name>/serviceable
+ * /instrumentation/<name>/setting-inhg
+ * <static_pressure>
  *
  * Output properties:
  *
- * /instrumentation/"name"/indicated-altitude-ft
+ * /instrumentation/<name>/indicated-altitude-ft
  */
 class Altimeter : public SGSubsystem
 {
@@ -37,7 +37,6 @@ class Altimeter : public SGSubsystem
 public:
 
     Altimeter (SGPropertyNode *node);
-    Altimeter ();
     virtual ~Altimeter ();
 
     virtual void init ();
@@ -45,9 +44,9 @@ public:
 
 private:
 
-    string name;
-    int num;
-    string static_port;
+    string _name;
+    int _num;
+    string _static_pressure;
 
     SGPropertyNode_ptr _serviceable_node;
     SGPropertyNode_ptr _setting_node;
index 1555c2c74eeddc49dda9b2656043e8c89544b711..4753afd0ad66b8c217a16a4caf3723e46dbb1adb 100644 (file)
 
 AttitudeIndicator::AttitudeIndicator ( SGPropertyNode *node )
     :
-    name("attitude-indicator"),
-    num(0),
-    vacuum_system("/systems/vacuum")
-{
-    int i;
-    for ( i = 0; i < node->nChildren(); ++i ) {
-        SGPropertyNode *child = node->getChild(i);
-        string cname = child->getName();
-        string cval = child->getStringValue();
-        if ( cname == "name" ) {
-            name = cval;
-        } else if ( cname == "number" ) {
-            num = (int) child->getDoubleValue();
-        } else if ( cname == "vacuum-system" ) {
-            vacuum_system = cval;
-        } else {
-            SG_LOG( SG_INSTR, SG_WARN, "Error in attitude-indicator config logic" );
-            if ( name.length() ) {
-                SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
-            }
-        }
-    }
-}
-
-AttitudeIndicator::AttitudeIndicator ()
+    _name(node->getStringValue("name", "attitude-indicator")),
+    _num(node->getIntValue("number", 0)),
+    _suction(node->getStringValue("suction", "/systems/vacuum/suction-inhg"))
 {
 }
 
@@ -57,14 +35,13 @@ void
 AttitudeIndicator::init ()
 {
     string branch;
-    branch = "/instrumentation/" + name;
-    vacuum_system += "/suction-inhg";
+    branch = "/instrumentation/" + _name;
 
-    SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+    SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
     
     _pitch_in_node = fgGetNode("/orientation/pitch-deg", true);
     _roll_in_node = fgGetNode("/orientation/roll-deg", true);
-    _suction_node = fgGetNode(vacuum_system.c_str(), true);
+    _suction_node = fgGetNode(_suction.c_str(), true);
     SGPropertyNode *cnode = node->getChild("config", 0, true);
     _tumble_flag_node = cnode->getChild("tumble-flag", 0, true);
     _caged_node = node->getChild("caged-flag", 0, true);
@@ -80,8 +57,8 @@ AttitudeIndicator::bind ()
 {
     std::ostringstream temp;
     string branch;
-    temp << num;
-    branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+    temp << _num;
+    branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
 
     fgTie((branch + "/serviceable").c_str(),
           &_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
@@ -94,8 +71,8 @@ AttitudeIndicator::unbind ()
 {
     std::ostringstream temp;
     string branch;
-    temp << num;
-    branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+    temp << _num;
+    branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
 
     fgUntie((branch + "/serviceable").c_str());
     fgUntie((branch + "/spin").c_str());
index 1895760ad471a8c0b2fa7f887ddc63fa22e418d7..2e8bdf128c6bb68cbd38cd03bf7ed33cf3e998f6 100644 (file)
@@ -42,7 +42,6 @@ class AttitudeIndicator : public SGSubsystem
 public:
 
     AttitudeIndicator ( SGPropertyNode *node );
-    AttitudeIndicator ();
     virtual ~AttitudeIndicator ();
 
     virtual void init ();
@@ -52,9 +51,9 @@ public:
 
 private:
 
-    string name;
-    int num;
-    string vacuum_system;
+    string _name;
+    int _num;
+    string _suction;
 
     Gyro _gyro;
 
index 485412a122ebcf32290cbb5d07904a707986584f..f12b4f80e6938ea39670c2cc0b61d5123a35ce95 100644 (file)
@@ -48,35 +48,8 @@ DME::DME ( SGPropertyNode *node )
       _transmitter_elevation_ft(0),
       _transmitter_range_nm(0),
       _transmitter_bias(0.0),
-      name("dme"),
-      num(0)
-{
-    int i;
-    for ( i = 0; i < node->nChildren(); ++i ) {
-        SGPropertyNode *child = node->getChild(i);
-        string cname = child->getName();
-        string cval = child->getStringValue();
-        if ( cname == "name" ) {
-            name = cval;
-        } else if ( cname == "number" ) {
-            num = child->getIntValue();
-        } else {
-            SG_LOG( SG_INSTR, SG_WARN, "Error in dme config logic" );
-            if ( name.length() ) {
-                SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
-            }
-        }
-    }
-}
-
-DME::DME ()
-    : _last_distance_nm(0),
-      _last_frequency_mhz(-1),
-      _time_before_search_sec(0),
-      _transmitter_valid(false),
-      _transmitter_elevation_ft(0),
-      _transmitter_range_nm(0),
-      _transmitter_bias(0.0)
+      _name(node->getStringValue("name", "dme")),
+      _num(node->getIntValue("number", 0))
 {
 }
 
@@ -88,9 +61,9 @@ void
 DME::init ()
 {
     string branch;
-    branch = "/instrumentation/" + name;
+    branch = "/instrumentation/" + _name;
 
-    SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+    SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
 
     _longitude_node = fgGetNode("/position/longitude-deg", true);
     _latitude_node = fgGetNode("/position/latitude-deg", true);
@@ -113,7 +86,7 @@ DME::update (double delta_time_sec)
     const char * source = _source_node->getStringValue();
     if (source[0] == '\0') {
         string branch;
-        branch = "/instrumentation/" + name + "/frequencies/selected-mhz";
+        branch = "/instrumentation/" + _name + "/frequencies/selected-mhz";
         _source_node->setStringValue(branch.c_str());
         source = _source_node->getStringValue();
     }
index 1d3e2e1ccf47680f5cda6e0811c4123c9b807973..03ecca231a12152ee5bfe7b0ed3cda174bc3263c 100644 (file)
@@ -42,7 +42,6 @@ class DME : public SGSubsystem
 public:
 
     DME ( SGPropertyNode *node );
-    DME ();
     virtual ~DME ();
 
     virtual void init ();
@@ -76,8 +75,8 @@ private:
     double _transmitter_range_nm;
     double _transmitter_bias;
 
-    string name;
-    int num;
+    string _name;
+    int _num;
 
 };
 
index 5fd5504e7d859c4d9118a35041dfbf963cea3520..fa603f72f963718f0c31ff94bdca4570fb6546f3 100644 (file)
@@ -60,35 +60,17 @@ int round (double value, int nearest=1)
     return ((int) (value/nearest + 0.5)) * nearest;
 }
 
+
 Encoder::Encoder(SGPropertyNode *node)
     :
-    name("encoder"),
-    num(0),
-    staticPort("/systems/static"),
+    _name(node->getStringValue("name", "encoder")),
+    _num(node->getIntValue("number", 0)),
+    _static_pressure(node->getStringValue("static-pressure", "/systems/static/pressure-inhg")),
     altitudeTable(new SGInterpTable)
 {
     int i;
     for ( i = 0; altitude_data[i][0] != -1; i++ )
         altitudeTable->addEntry(altitude_data[i][0], altitude_data[i][1]);
-
-    for ( i = 0; i < node->nChildren(); ++i ) {
-        SGPropertyNode *child = node->getChild(i);
-        string cname = child->getName();
-        string cval = child->getStringValue();
-        if ( cname == "name" ) {
-            name = cval;
-        } else if ( cname == "number" ) {
-            num = child->getIntValue();
-        } else if ( cname == "static-port" ) {
-            staticPort = cval;
-        } else {
-            SG_LOG( SG_INSTR, SG_WARN, 
-                    "Error in encoder config logic" );
-            if ( name.length() ) {
-                SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
-            }
-        }
-    }
 }
 
 
@@ -101,12 +83,11 @@ Encoder::~Encoder()
 void Encoder::init()
 {
     string branch;
-    branch = "/instrumentation/" + name;
-    staticPort += "/pressure-inhg";
+    branch = "/instrumentation/" + _name;
 
-    SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+    SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
     // Inputs
-    staticPressureNode = fgGetNode(staticPort.c_str(), true);
+    staticPressureNode = fgGetNode(_static_pressure.c_str(), true);
     busPowerNode = fgGetNode("/systems/electrical/outputs/encoder", true);
     serviceableNode = node->getChild("serviceable", 0, true);
     // Outputs
index 39a0489f1441cde9124d800d8a5b1b1a16218563..755ebcdeac08200e95de813f03c6b8be73ff67fc 100644 (file)
@@ -51,9 +51,9 @@ private:
     SGPropertyNode_ptr modeCAltitudeNode;
 
     // Internal
-    string name;
-    int num;
-    string staticPort;
+    string _name;
+    int _num;
+    string _static_pressure;
 
     SGInterpTable* altitudeTable;
 };
index 26c0073520b657f788658c701605e5c31284242d..ae0f3c8101829858f934199dc42ddcf53143482f 100644 (file)
@@ -41,41 +41,9 @@ GPS::GPS ( SGPropertyNode *node)
       _wp1_altitude_m(0),
       _alt_dist_ratio(0),
       _distance_m(0),
-      _course_deg(0)
-{
-    int i;
-    for ( i = 0; i < node->nChildren(); ++i ) {
-        SGPropertyNode *child = node->getChild(i);
-        string cname = child->getName();
-        string cval = child->getStringValue();
-        if ( cname == "name" ) {
-            name = cval;
-        } else if ( cname == "number" ) {
-            num = child->getIntValue();
-        } else {
-            SG_LOG( SG_INSTR, SG_WARN, "Error in gps config logic" );
-            if ( name.length() ) {
-                SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
-            }
-        }
-    }
-}
-
-GPS::GPS ()
-    : _last_valid(false),
-      _last_longitude_deg(0),
-      _last_latitude_deg(0),
-      _last_altitude_m(0),
-      _last_speed_kts(0),
-      _wp0_latitude_deg(0),
-      _wp0_longitude_deg(0),
-      _wp0_altitude_m(0),
-      _wp1_latitude_deg(0),
-      _wp1_longitude_deg(0),
-      _wp1_altitude_m(0),
-      _alt_dist_ratio(0),
-      _distance_m(0),
-      _course_deg(0)
+      _course_deg(0),
+      _name(node->getStringValue("name", "gps")),
+      _num(node->getIntValue("number", 0))
 {
 }
 
@@ -90,9 +58,9 @@ GPS::init ()
     route->clear();
 
     string branch;
-    branch = "/instrumentation/" + name;
+    branch = "/instrumentation/" + _name;
 
-    SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+    SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
 
     _longitude_node = fgGetNode("/position/longitude-deg", true);
     _latitude_node = fgGetNode("/position/latitude-deg", true);
index fb068ac7bcf1e69afc87d861f2d585208cb5c70a..27948ecb47e7ffc259724ce28eff798243573f4c 100644 (file)
@@ -166,14 +166,14 @@ private:
     double _distance_m;
     double _course_deg;
 
-    double bias_length;
-    double bias_angle;
-    double azimuth_error;
-    double range_error;
-    double elapsed_time;
-
-    string name;
-    int num;
+    double _bias_length;
+    double _bias_angle;
+    double _azimuth_error;
+    double _range_error;
+    double _elapsed_time;
+
+    string _name;
+    int _num;
 
 };
 
index 4ab01a60f43115ca8cc5326266d86e567d0ce1bb..a7e96e5502763152a03dc19bc0154dd2bfa3bad4 100644 (file)
 
 HeadingIndicator::HeadingIndicator ( SGPropertyNode *node )
     :
-    name("heading-indicator"),
-    num(0),
-    vacuum_system("/systems/vacuum")
-{
-    int i;
-    for ( i = 0; i < node->nChildren(); ++i ) {
-        SGPropertyNode *child = node->getChild(i);
-        string cname = child->getName();
-        string cval = child->getStringValue();
-        if ( cname == "name" ) {
-            name = cval;
-        } else if ( cname == "number" ) {
-            num = child->getIntValue();
-        } else if ( cname == "vacuum-system" ) {
-            vacuum_system = cval;
-        } else {
-            SG_LOG( SG_INSTR, SG_WARN, "Error in heading-indicator config logic" );
-            if ( name.length() ) {
-                SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
-            }
-        }
-    }
-}
-
-HeadingIndicator::HeadingIndicator ()
+    _name(node->getStringValue("name", "heading-indicator")),
+    _num(node->getIntValue("number", 0)),
+    _suction(node->getStringValue("suction", "/systems/vacuum/suction-inhg"))
 {
 }
 
@@ -51,13 +29,12 @@ void
 HeadingIndicator::init ()
 {
     string branch;
-    branch = "/instrumentation/" + name;
-    vacuum_system += "/suction-inhg";
+    branch = "/instrumentation/" + _name;
 
-    SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+    SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
     _offset_node = node->getChild("offset-deg", 0, true);
     _heading_in_node = fgGetNode("/orientation/heading-deg", true);
-    _suction_node = fgGetNode(vacuum_system.c_str(), true);
+    _suction_node = fgGetNode(_suction.c_str(), true);
     _heading_out_node = node->getChild("indicated-heading-deg", 0, true);
     _last_heading_deg = (_heading_in_node->getDoubleValue() +
                          _offset_node->getDoubleValue());
@@ -68,8 +45,8 @@ HeadingIndicator::bind ()
 {
     std::ostringstream temp;
     string branch;
-    temp << num;
-    branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+    temp << _num;
+    branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
 
     fgTie((branch + "/serviceable").c_str(),
           &_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
@@ -82,8 +59,8 @@ HeadingIndicator::unbind ()
 {
     std::ostringstream temp;
     string branch;
-    temp << num;
-    branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+    temp << _num;
+    branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
 
     fgUntie((branch + "/serviceable").c_str());
     fgUntie((branch + "/spin").c_str());
index 4ba772d22a93ddb11ba110e54046329f00f7aa26..8316384073f0e45480cec59ff68953e7984d9073 100644 (file)
@@ -51,9 +51,9 @@ private:
     Gyro _gyro;
     double _last_heading_deg;
 
-    string name;
-    int num;
-    string vacuum_system;
+    string _name;
+    int _num;
+    string _suction;
 
     SGPropertyNode_ptr _offset_node;
     SGPropertyNode_ptr _heading_in_node;
index e67d35074b1d248f9e2b45e73b00535204928f5d..223c777087e79fe36b46ebdf17d06775c512779d 100644 (file)
 MagCompass::MagCompass ( SGPropertyNode *node )
     : _error_deg(0.0),
       _rate_degps(0.0),
-      name("magnetic-compass"),
-      num(0)
-{
-    int i;
-    for ( i = 0; i < node->nChildren(); ++i ) {
-        SGPropertyNode *child = node->getChild(i);
-        string cname = child->getName();
-        string cval = child->getStringValue();
-        if ( cname == "name" ) {
-            name = cval;
-        } else if ( cname == "number" ) {
-            num = child->getIntValue();
-        } else {
-            SG_LOG( SG_INSTR, SG_WARN, "Error in magnetic-compass config logic" );
-            if ( name.length() ) {
-                SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
-            }
-        }
-    }
-}
-
-MagCompass::MagCompass ()
-    : _error_deg(0.0),
-      _rate_degps(0.0)
+      _name(node->getStringValue("name", "magnetic-compass")),
+      _num(node->getIntValue("number", 0))
 {
 }
 
@@ -56,26 +34,18 @@ void
 MagCompass::init ()
 {
     string branch;
-    branch = "/instrumentation/" + name;
+    branch = "/instrumentation/" + _name;
 
-    SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+    SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
     _serviceable_node = node->getChild("serviceable", 0, true);
-    _roll_node =
-        fgGetNode("/orientation/roll-deg", true);
-    _pitch_node =
-        fgGetNode("/orientation/pitch-deg", true);
-    _heading_node =
-        fgGetNode("/orientation/heading-magnetic-deg", true);
-    _beta_node =
-        fgGetNode("/orientation/side-slip-deg", true);
-    _dip_node =
-        fgGetNode("/environment/magnetic-dip-deg", true);
-    _x_accel_node =
-        fgGetNode("/accelerations/pilot/x-accel-fps_sec", true);
-    _y_accel_node =
-        fgGetNode("/accelerations/pilot/y-accel-fps_sec", true);
-    _z_accel_node =
-        fgGetNode("/accelerations/pilot/z-accel-fps_sec", true);
+    _roll_node = fgGetNode("/orientation/roll-deg", true);
+    _pitch_node = fgGetNode("/orientation/pitch-deg", true);
+    _heading_node = fgGetNode("/orientation/heading-magnetic-deg", true);
+    _beta_node = fgGetNode("/orientation/side-slip-deg", true);
+    _dip_node = fgGetNode("/environment/magnetic-dip-deg", true);
+    _x_accel_node = fgGetNode("/accelerations/pilot/x-accel-fps_sec", true);
+    _y_accel_node = fgGetNode("/accelerations/pilot/y-accel-fps_sec", true);
+    _z_accel_node = fgGetNode("/accelerations/pilot/z-accel-fps_sec", true);
     _out_node = node->getChild("indicated-heading-deg", 0, true);
 }
 
index ea5ac60ec73bde37fcb822a2d757ff73ec09a1ef..919f26bc93269ab36402e0cc1e65bd27f73f8ffb 100644 (file)
@@ -51,8 +51,8 @@ private:
     double _error_deg;
     double _rate_degps;
 
-    string name;
-    int num;
+    string _name;
+    int _num;
 
     SGPropertyNode_ptr _serviceable_node;
     SGPropertyNode_ptr _roll_node;
index 8300791726d74fb54a82667ffc4da3459811c6fd..d890ee266b6a28ffd6097f2779a80560978d0e22 100644 (file)
 
 
 MasterReferenceGyro::MasterReferenceGyro ( SGPropertyNode *node ) :
-       name("master-reference-gyro"),
-       num(0)
-{
-       int i;
-       for ( i = 0; i < node->nChildren(); ++i ) {
-               SGPropertyNode *child = node->getChild(i);
-               string cname = child->getName();
-               string cval = child->getStringValue();
-               if ( cname == "name" ) {
-                       name = cval;
-               } else if ( cname == "number" ) {
-                       num = (int) child->getDoubleValue();
-               } else {
-                       SG_LOG( SG_INSTR, SG_WARN, "Error in mrg config logic" );
-                       if ( name.length() ) {
-                               SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
-                       }
-               }
-       }
-}
-
-MasterReferenceGyro::MasterReferenceGyro ()
+       _name(node->getStringValue("name", "master-reference-gyro")),
+       _num(node->getIntValue("number", 0))
 {
 }
 
@@ -63,7 +43,7 @@ MasterReferenceGyro::init ()
        _indicated_pitch_rate = 0;
        
        string branch;
-       branch = "/instrumentation/" + name;
+       branch = "/instrumentation/" + _name;
 
        _pitch_in_node = fgGetNode("/orientation/pitch-deg", true);
        _roll_in_node = fgGetNode("/orientation/roll-deg", true);
@@ -74,7 +54,7 @@ MasterReferenceGyro::init ()
        _g_in_node =   fgGetNode("/accelerations/pilot-g-damped", true);
        _electrical_node = fgGetNode("/systems/electrical/outputs/MRG", true);
        
-       SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+       SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
        _off_node = node->getChild("off-flag", 0, true);
        _pitch_out_node = node->getChild("indicated-pitch-deg", 0, true);
        _roll_out_node = node->getChild("indicated-roll-deg", 0, true);
@@ -95,8 +75,8 @@ MasterReferenceGyro::bind ()
 {
        std::ostringstream temp;
        string branch;
-       temp << num;
-       branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+       temp << _num;
+       branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
 
        fgTie((branch + "/serviceable").c_str(),
                &_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
@@ -109,8 +89,8 @@ MasterReferenceGyro::unbind ()
 {
        std::ostringstream temp;
        string branch;
-       temp << num;
-       branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+       temp << _num;
+       branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
 
        fgUntie((branch + "/serviceable").c_str());
        fgUntie((branch + "/spin").c_str());
index b10f653ce61ff13c63157240e9bfa3d4622d9cfb..a12df8aaf9820aad7ba8b2544dbb67470abc5230 100644 (file)
@@ -25,7 +25,6 @@
  * /instrumentation/"name"/tumble-norm
  * /orientation/pitch-deg
  * /orientation/roll-deg
- * "vacuum-system"/suction-inhg
  *
  * Output properties:
  *
@@ -50,8 +49,8 @@ public:
 
 private:
 
-    string name;
-    int num;
+    string _name;
+    int _num;
 
     double _last_roll;
     double _last_pitch;
index 4bec5789ba67cd069e0d6f45071b6ad1a726f1bd..1eae58fe1ffb9e5b1537ec57392b029d00ead7b4 100644 (file)
@@ -100,8 +100,8 @@ FGNavRadio::FGNavRadio(SGPropertyNode *node) :
     last_x(0.0),
     last_loc_dist(0.0),
     last_xtrack_error(0.0),
-    name("nav"),
-    num(0),
+    _name(node->getStringValue("name", "nav")),
+    _num(node->getIntValue("number", 0)),
     _time_before_search_sec(-1.0)
 {
     SGPath path( globals->get_fg_root() );
@@ -115,25 +115,6 @@ FGNavRadio::FGNavRadio(SGPropertyNode *node) :
     term_tbl = new SGInterpTable( term.str() );
     low_tbl = new SGInterpTable( low.str() );
     high_tbl = new SGInterpTable( high.str() );
-
-    int i;
-    for ( i = 0; i < node->nChildren(); ++i ) {
-        SGPropertyNode *child = node->getChild(i);
-        string cname = child->getName();
-        string cval = child->getStringValue();
-        if ( cname == "name" ) {
-            name = cval;
-        } else if ( cname == "number" ) {
-            num = child->getIntValue();
-        } else {
-            SG_LOG( SG_INSTR, SG_WARN, 
-                    "Error in nav radio config logic" );
-            if ( name.length() ) {
-                SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
-            }
-        }
-    }
-
 }
 
 
@@ -152,12 +133,12 @@ FGNavRadio::init ()
     morse.init();
 
     string branch;
-    branch = "/instrumentation/" + name;
+    branch = "/instrumentation/" + _name;
 
-    SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+    SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
 
     bus_power_node = 
-       fgGetNode(("/systems/electrical/outputs/" + name).c_str(), true);
+       fgGetNode(("/systems/electrical/outputs/" + _name).c_str(), true);
 
     // inputs
     is_valid_node = node->getChild("data-is-valid", 0, true);
@@ -222,9 +203,9 @@ FGNavRadio::init ()
     gps_from_flag_node = fgGetNode("/instrumentation/gps/from-flag", true);
     
     std::ostringstream temp;
-    temp << name << "nav-ident" << num;
+    temp << _name << "nav-ident" << _num;
     nav_fx_name = temp.str();
-    temp << name << "dme-ident" << num;
+    temp << _name << "dme-ident" << _num;
     dme_fx_name = temp.str();
 }
 
@@ -233,8 +214,8 @@ FGNavRadio::bind ()
 {
     std::ostringstream temp;
     string branch;
-    temp << num;
-    branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+    temp << _num;
+    branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
 }
 
 
@@ -243,8 +224,8 @@ FGNavRadio::unbind ()
 {
     std::ostringstream temp;
     string branch;
-    temp << num;
-    branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+    temp << _num;
+    branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
 }
 
 
index 4dde4ae2075ccd12826d3b586167f3b56c7e0d80..34c1350b003210119074026dad9b43242f4b1c67 100644 (file)
@@ -142,8 +142,8 @@ class FGNavRadio : public SGSubsystem
     double last_loc_dist;
     double last_xtrack_error;
 
-    string name;
-    int num;
+    string _name;
+    int _num;
 
     // internal periodic station search timer
     double _time_before_search_sec;
index 9f4193ee5b2ad1b5263bbdcfd6acbae496b2d473..4925e1fa94ca7b363c96295af9871ea410c1c41d 100644 (file)
 
 SlipSkidBall::SlipSkidBall ( SGPropertyNode *node)
     :
-    name("slip-skid-ball"),
-    num(0)
-{
-    int i;
-    for ( i = 0; i < node->nChildren(); ++i ) {
-        SGPropertyNode *child = node->getChild(i);
-        string cname = child->getName();
-        string cval = child->getStringValue();
-        if ( cname == "name" ) {
-            name = cval;
-        } else if ( cname == "number" ) {
-            num = child->getIntValue();
-        } else {
-            SG_LOG( SG_INSTR, SG_WARN, "Error in slip-skid-ball config logic" );
-            if ( name.length() ) {
-                SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
-            }
-        }
-    }
-}
-
-SlipSkidBall::SlipSkidBall ()
+    _name(node->getStringValue("name", "slip-skid-ball")),
+    _num(node->getIntValue("number", 0))
 {
 }
 
@@ -43,9 +23,9 @@ void
 SlipSkidBall::init ()
 {
     string branch;
-    branch = "/instrumentation/" + name;
+    branch = "/instrumentation/" + _name;
 
-    SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+    SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
     _serviceable_node = node->getChild("serviceable", 0, true);
     _y_accel_node = fgGetNode("/accelerations/pilot/y-accel-fps_sec", true);
     _z_accel_node = fgGetNode("/accelerations/pilot/z-accel-fps_sec", true);
index 7266cdfce4c2b3033d10adf454bb81fb9eed29f9..3a95b115a6c0b679a071380cd51233744d217f71 100644 (file)
@@ -14,8 +14,6 @@
 #include <simgear/props/props.hxx>
 #include <simgear/structure/subsystem_mgr.hxx>
 
-#include "gyro.hxx"
-
 
 /**
  * Model a slip-skid ball.
@@ -36,7 +34,6 @@ class SlipSkidBall : public SGSubsystem
 public:
 
     SlipSkidBall ( SGPropertyNode *node );
-    SlipSkidBall ();
     virtual ~SlipSkidBall ();
 
     virtual void init ();
@@ -44,11 +41,10 @@ public:
 
 private:
 
-    Gyro _gyro;
     double _last_pos;
 
-    string name;
-    int num;
+    string _name;
+    int _num;
 
     SGPropertyNode_ptr _serviceable_node;
     SGPropertyNode_ptr _y_accel_node;
index 192593b3be178f3d9e8719dbe918e09a4430b860..9fa5f13a34cc76d180357f6a407816225dc10839 100644 (file)
 
 Transponder::Transponder(SGPropertyNode *node)
     :
-    name("transponder"),
-    num(0),
-    encoder("/instrumentation/encoder")
+    _name(node->getStringValue("name", "transponder")),
+    _num(node->getIntValue("number", 0)),
+    _mode_c_altitude(node->getStringValue("mode-c-altitude", 
+                                         "/instrumentation/encoder/mode-c-alt-ft"))
 {
-    int i;
-    for ( i = 0; i < node->nChildren(); ++i ) {
-        SGPropertyNode *child = node->getChild(i);
-        string cname = child->getName();
-        string cval = child->getStringValue();
-        if ( cname == "name" ) {
-            name = cval;
-        } else if ( cname == "number" ) {
-            num = child->getIntValue();
-        } else if ( cname == "encoder" ) {
-            encoder = cval;
-        } else {
-            SG_LOG( SG_INSTR, SG_WARN, 
-                    "Error in transponder config logic" );
-            if ( name.length() ) {
-                SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
-            }
-        }
-    }
 }
 
 
@@ -60,12 +42,11 @@ Transponder::~Transponder()
 void Transponder::init()
 {
     string branch;
-    branch = "/instrumentation/" + name;
-    encoder += "/mode-c-alt-ft";
+    branch = "/instrumentation/" + _name;
 
-    SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+    SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
     // Inputs
-    pressureAltitudeNode = fgGetNode(encoder.c_str(), true);
+    pressureAltitudeNode = fgGetNode(_mode_c_altitude.c_str(), true);
     busPowerNode = fgGetNode("/systems/electrical/outputs/transponder", true);
     serviceableNode = node->getChild("serviceable", 0, true);
     // Outputs
index 765edb4315b52ace449d6f8a8d860bfc4dae9a2d..f0a58efd22b08e4722e11deabed63699184818a8 100644 (file)
@@ -50,9 +50,9 @@ private:
     SGPropertyNode_ptr flightLevelNode;
 
     // Internal
-    string name;
-    int num;
-    string encoder;
+    string _name;
+    int _num;
+    string _mode_c_altitude;
 };
 
 #endif // TRANSPONDER_HXX
index 124186c1fec5537385a8d1559ead506238749f20..c8d295fee8a312e783431904053f65ba2699fa89 100644 (file)
 
 TurnIndicator::TurnIndicator ( SGPropertyNode *node) :
     _last_rate(0),
-    name("turn-indicator"),
-    num(0)
-{
-    int i;
-    for ( i = 0; i < node->nChildren(); ++i ) {
-        SGPropertyNode *child = node->getChild(i);
-        string cname = child->getName();
-        string cval = child->getStringValue();
-        if ( cname == "name" ) {
-            name = cval;
-        } else if ( cname == "number" ) {
-            num = child->getIntValue();
-        } else {
-            SG_LOG( SG_INSTR, SG_WARN, "Error in turn-indicator config logic" );
-            if ( name.length() ) {
-                SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
-            }
-        }
-    }
-}
-
-TurnIndicator::TurnIndicator () :
-    _last_rate(0)
+    _name(node->getStringValue("name", "turn-indicator")),
+    _num(node->getIntValue("number", 0))
 {
 }
 
@@ -54,9 +33,9 @@ void
 TurnIndicator::init ()
 {
     string branch;
-    branch = "/instrumentation/" + name;
+    branch = "/instrumentation/" + _name;
 
-    SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+    SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
     _roll_rate_node = fgGetNode("/orientation/roll-rate-degps", true);
     _yaw_rate_node = fgGetNode("/orientation/yaw-rate-degps", true);
     _electric_current_node = 
@@ -69,8 +48,8 @@ TurnIndicator::bind ()
 {
     std::ostringstream temp;
     string branch;
-    temp << num;
-    branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+    temp << _num;
+    branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
 
     fgTie((branch + "/serviceable").c_str(),
           &_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
@@ -83,8 +62,8 @@ TurnIndicator::unbind ()
 {
     std::ostringstream temp;
     string branch;
-    temp << num;
-    branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+    temp << _num;
+    branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
 
     fgUntie((branch + "/serviceable").c_str());
     fgUntie((branch + "/serviceable").c_str());
index d1b2a291708bc3b5b4656838fd064fe72a9b5d32..b96873081b49ae6ebc2375ebe99c6fba89860972 100644 (file)
@@ -41,7 +41,6 @@ class TurnIndicator : public SGSubsystem
 public:
 
     TurnIndicator ( SGPropertyNode *node );
-    TurnIndicator ();
     virtual ~TurnIndicator ();
 
     virtual void init ();
@@ -54,8 +53,8 @@ private:
     Gyro _gyro;
     double _last_rate;
 
-    string name;
-    int num;
+    string _name;
+    int _num;
 
     SGPropertyNode_ptr _roll_rate_node;
     SGPropertyNode_ptr _yaw_rate_node;
index 2188637e077ae76ab4c4eb81b3894038f2665c1a..8a4318a9e6d0be435c45775947e40dfd02d048a2 100644 (file)
 
 VerticalSpeedIndicator::VerticalSpeedIndicator ( SGPropertyNode *node )
     : _internal_pressure_inhg(29.92),
-      name("vertical-speed-indicator"),
-      num(0),
-      static_port("/systems/static")
-{
-    int i;
-    for ( i = 0; i < node->nChildren(); ++i ) {
-        SGPropertyNode *child = node->getChild(i);
-        string cname = child->getName();
-        string cval = child->getStringValue();
-        if ( cname == "name" ) {
-            name = cval;
-        } else if ( cname == "number" ) {
-            num = child->getIntValue();
-        } else if ( cname == "static-port" ) {
-            static_port = cval;
-        } else {
-            SG_LOG( SG_INSTR, SG_WARN, "Error in vertical-speed-indicator config logic" );
-            if ( name.length() ) {
-                SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
-            }
-        }
-    }
-}
-
-VerticalSpeedIndicator::VerticalSpeedIndicator ()
-    : _internal_pressure_inhg(29.92)
+      _name(node->getStringValue("name", "vertical-speed-indicator")),
+      _num(node->getIntValue("number", 0)),
+      _static_pressure(node->getStringValue("static-pressure", "/Systems/static/pressure-inhg"))
 {
 }
 
@@ -49,12 +26,11 @@ void
 VerticalSpeedIndicator::init ()
 {
     string branch;
-    branch = "/instrumentation/" + name;
-    static_port += "/pressure-inhg";
+    branch = "/instrumentation/" + _name;
 
-    SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+    SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
     _serviceable_node = node->getChild("serviceable", 0, true);
-    _pressure_node = fgGetNode(static_port.c_str(), true);
+    _pressure_node = fgGetNode(_static_pressure.c_str(), true);
     _speed_node = node->getChild("indicated-speed-fpm", 0, true);
 
                                 // Initialize at ambient pressure
index 0c2a5a3a92209ba889a413a60443f50667191893..2b6a930d432a9c2dd285ac04f191e34bcd548024 100644 (file)
@@ -33,7 +33,6 @@ class VerticalSpeedIndicator : public SGSubsystem
 public:
 
     VerticalSpeedIndicator ( SGPropertyNode *node );
-    VerticalSpeedIndicator ();
     virtual ~VerticalSpeedIndicator ();
 
     virtual void init ();
@@ -43,9 +42,9 @@ private:
 
     double _internal_pressure_inhg;
 
-    string name;
-    int num;
-    string static_port;
+    string _name;
+    int _num;
+    string _static_pressure;
 
     SGPropertyNode_ptr _serviceable_node;
     SGPropertyNode_ptr _pressure_node;
index 1a879ed5f019b3aa93f1bf46021326f8c5920112..7319a5b418a4c6c29e26d9d0941a1be10b02f699 100644 (file)
 static const char *odgauge_name = "Aircraft/Instruments/Textures/od_wxradar.rgb";
 
 wxRadarBg::wxRadarBg ( SGPropertyNode *node) :
-    name("wxRadar"),
-    num(0),
+    _name(node->getStringValue("name", "wxRadar")),
+    _num(node->getIntValue("number", 0)),
     resultTexture( 0 ),
     wxEcho( 0 ),
     last_switchKnob( "off" ),
     sim_init_done ( false ),
     odg( 0 )
-{
-    int i;
-    for ( i = 0; i < node->nChildren(); ++i ) {
-        SGPropertyNode *child = node->getChild(i);
-        string cname = child->getName();
-        string cval = child->getStringValue();
-        if ( cname == "name" ) {
-            name = cval;
-        } else if ( cname == "number" ) {
-            num = child->getIntValue();
-        } else {
-            SG_LOG( SG_INSTR, SG_WARN, "Error in wxRadar config logic" );
-            if ( name.length() ) {
-                SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
-            }
-        }
-    }
-}
-
-wxRadarBg::wxRadarBg ()
 {
 }
 
@@ -79,9 +59,9 @@ void
 wxRadarBg::init ()
 {
     string branch;
-    branch = "/instrumentation/" + name;
+    branch = "/instrumentation/" + _name;
 
-    _Instrument = fgGetNode(branch.c_str(), num, true );
+    _Instrument = fgGetNode(branch.c_str(), _num, true );
     _serviceable_node = _Instrument->getChild("serviceable", 0, true);
     resultTexture = FGTextureManager::createTexture( odgauge_name );
     SGPath tpath(globals->get_fg_root());
index acaa6680b1f501870fb54e73180af008775eeab7..575519015934a632d2d5cb28c193f26083bf8bb3 100644 (file)
@@ -46,8 +46,8 @@ public:
 
 private:
 
-    string name;
-    int num;
+    string _name;
+    int _num;
 
     SGPropertyNode_ptr _serviceable_node;
     SGPropertyNode_ptr _Instrument;
index 136533f1b3f1371f26b998c63a29a532929f5b92..535caa09db89e5af9d2e40e0e9ccb7af8659f27f 100644 (file)
 
 PitotSystem::PitotSystem ( SGPropertyNode *node )
     :
-    num(0),
-    name("pitot")
+    _name(node->getStringValue("name", "pitot")),
+    _num(node->getIntValue("number", 0))
 {
-    int i;
-    for ( i = 0; i < node->nChildren(); ++i ) {
-        SGPropertyNode *child = node->getChild(i);
-        string cname = child->getName();
-        string cval = child->getStringValue();
-        if ( cname == "name" ) {
-            name = cval;
-        } else if ( cname == "number" ) {
-            num = child->getIntValue();
-        } else {
-            SG_LOG( SG_SYSTEMS, SG_WARN, "Error in systems config logic" );
-            if ( name.length() ) {
-                SG_LOG( SG_SYSTEMS, SG_WARN, "Section = " << name );
-            }
-        }
-    }
-}
-
-PitotSystem::PitotSystem ( int i )
-{
-    num = i;
-    name = "pitot";
 }
 
 PitotSystem::~PitotSystem ()
@@ -48,9 +26,9 @@ void
 PitotSystem::init ()
 {
     string branch;
-    branch = "/systems/" + name;
+    branch = "/systems/" + _name;
 
-    SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+    SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
     _serviceable_node = node->getChild("serviceable", 0, true);
     _pressure_node = fgGetNode("/environment/pressure-inhg", true);
     _density_node = fgGetNode("/environment/density-slugft3", true);
index b0c39b31cd42cbb4e17ba5773fef5be8fc131a88..3cf64b09036b1ee7f8d46ba1195ee7cda2505b45 100644 (file)
@@ -43,7 +43,6 @@ class PitotSystem : public SGSubsystem
 public:
 
     PitotSystem ( SGPropertyNode *node );
-    PitotSystem ( int i );
     virtual ~PitotSystem ();
 
     virtual void init ();
@@ -53,8 +52,8 @@ public:
 
 private:
 
-    int num;
-    string name;
+    string _name;
+    int _num;
     SGPropertyNode_ptr _serviceable_node;
     SGPropertyNode_ptr _pressure_node;
     SGPropertyNode_ptr _density_node;
index f6cfa47b4be31831e46fd551bdc171a02baff1fe..b3c916d8092af73904a9b809a56fccd201195ae0 100644 (file)
 
 StaticSystem::StaticSystem ( SGPropertyNode *node )
     :
-    name("static"),
-    num(0)
+    _name(node->getStringValue("name", "static")),
+    _num(node->getIntValue("number", 0))
 {
-    int i;
-    for ( i = 0; i < node->nChildren(); ++i ) {
-        SGPropertyNode *child = node->getChild(i);
-        string cname = child->getName();
-        string cval = child->getStringValue();
-        if ( cname == "name" ) {
-            name = cval;
-        } else if ( cname == "number" ) {
-            num = child->getIntValue();
-        } else {
-            SG_LOG( SG_SYSTEMS, SG_WARN, "Error in systems config logic" );
-            if ( name.length() ) {
-                SG_LOG( SG_SYSTEMS, SG_WARN, "Section = " << name );
-            }
-        }
-    }
-}
-
-StaticSystem::StaticSystem ( int i )
-{
-    name = "static";
-    num = i;
 }
 
 StaticSystem::~StaticSystem ()
@@ -45,9 +23,9 @@ void
 StaticSystem::init ()
 {
     string branch;
-    branch = "/systems/" + name;
+    branch = "/systems/" + _name;
 
-    SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+    SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
     _serviceable_node = node->getChild("serviceable", 0, true);
     _pressure_in_node = fgGetNode("/environment/pressure-inhg", true);
     _pressure_out_node = node->getChild("pressure-inhg", 0, true);
index fcacd925b6e05c07bdd2c120c17cd7798caadf1e..f777863bd69227c37998aa924bef2ec82a8dfe98 100644 (file)
@@ -46,8 +46,8 @@ public:
 
 private:
 
-    string name;
-    int num;
+    string _name;
+    int _num;
     SGPropertyNode_ptr _serviceable_node;
     SGPropertyNode_ptr _pressure_in_node;
     SGPropertyNode_ptr _pressure_out_node;
index 36bbf5962322cd9fcf70405e61d93fb9be4921a5..cab464404fdd8dc89cea069683d978dc3472b802 100644 (file)
 
 VacuumSystem::VacuumSystem ( SGPropertyNode *node )
     :
-    name("vacuum"),
-    num(0),
-    scale(1.0)
-
+    _name(node->getStringValue("name", "vacuum")),
+    _num(node->getIntValue("number", 0)),
+    _scale(node->getDoubleValue("scale", 1.0))
 {
-    rpms.clear();
+    _rpms.clear();
     int i;
     for ( i = 0; i < node->nChildren(); ++i ) {
         SGPropertyNode *child = node->getChild(i);
         string cname = child->getName();
         string cval = child->getStringValue();
-        if ( cname == "name" ) {
-            name = cval;
-        } else if ( cname == "number" ) {
-            num = child->getIntValue();
-        } else if ( cname == "rpm" ) {
-            rpms.push_back(cval);
-        } else if ( cname == "scale" ) {
-            scale = child->getDoubleValue();
+        if ( cname == "rpm" ) {
+            _rpms.push_back(cval);
         } else {
             SG_LOG( SG_SYSTEMS, SG_WARN, "Error in vacuum config logic" );
-            if ( name.length() ) {
-                SG_LOG( SG_SYSTEMS, SG_WARN, "Section = " << name );
+            if ( _name.length() ) {
+                SG_LOG( SG_SYSTEMS, SG_WARN, "Section = " << _name );
             }
         }
     }
 }
 
-VacuumSystem::VacuumSystem( int i )
-{
-    name = "vacuum";
-    num = i;
-    rpms.clear();
-    scale = 1.0;
-}
-
 VacuumSystem::~VacuumSystem ()
 {
 }
@@ -58,12 +43,12 @@ VacuumSystem::init()
 {
     unsigned int i;
     string branch;
-    branch = "/systems/" + name;
+    branch = "/systems/" + _name;
 
-    SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+    SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
     _serviceable_node = node->getChild("serviceable", 0, true);
-    for ( i = 0; i < rpms.size(); i++ ) {
-      SGPropertyNode_ptr _rpm_node = fgGetNode(rpms[i].c_str(), true);
+    for ( i = 0; i < _rpms.size(); i++ ) {
+      SGPropertyNode_ptr _rpm_node = fgGetNode(_rpms[i].c_str(), true);
       _rpm_nodes.push_back( _rpm_node );
     }
     _pressure_node = fgGetNode("/environment/pressure-inhg", true);
@@ -94,7 +79,7 @@ VacuumSystem::update (double dt)
        // select the source with the max rpm
         double rpm = 0.0;
        for ( i = 0; i < _rpm_nodes.size(); i++ ) {
-         double tmp = _rpm_nodes[i]->getDoubleValue() * scale;
+         double tmp = _rpm_nodes[i]->getDoubleValue() * _scale;
          if ( tmp > rpm ) {
            rpm = tmp;
          }
index d03cb758cd6186e7235dec7a2694a8af9bb5e8c7..fd69135963801ccba8c4f69035e78a5abb780c83 100644 (file)
@@ -49,10 +49,10 @@ public:
 
 private:
 
-    string name;
-    int num;
-    string_list rpms;
-    double scale;
+    string _name;
+    int _num;
+    string_list _rpms;
+    double _scale;
     SGPropertyNode_ptr _serviceable_node;
     vector<SGPropertyNode_ptr> _rpm_nodes;
     SGPropertyNode_ptr _pressure_node;