4 #include <simgear/xml/easyxml.hxx>
5 #include <simgear/props/props.hxx>
7 #include "Airplane.hpp"
14 // This class forms the "glue" to the FlightGear codebase. It handles
15 // parsing of XML airplane files, interfacing to the properties
16 // system, and providing data for the use of the FGInterface object.
17 class FGFDM : public XMLVisitor {
22 void iterate(float dt);
23 void getExternalInput(float dt=1e6);
25 Airplane* getAirplane();
27 // XML parsing callback from XMLVisitor
28 virtual void startElement(const char* name, const XMLAttributes &atts);
31 struct AxisRec { char* name; int handle; };
32 struct EngRec { char* prefix; Thruster* eng; };
33 struct WeightRec { char* prop; float size; int handle; };
34 struct PropOut { SGPropertyNode* prop; int handle, type; bool left;
37 void setOutputProperties();
39 Rotor* parseRotor(XMLAttributes* a, const char* name);
40 Wing* parseWing(XMLAttributes* a, const char* name);
41 int parseAxis(const char* name);
42 int parseOutput(const char* name);
43 void parseWeight(XMLAttributes* a);
44 void parseTurbineEngine(XMLAttributes* a);
45 void parsePistonEngine(XMLAttributes* a);
46 void parsePropeller(XMLAttributes* a);
47 bool eq(const char* a, const char* b);
48 bool caseeq(const char* a, const char* b);
49 char* dup(const char* s);
50 int attri(XMLAttributes* atts, char* attr);
51 int attri(XMLAttributes* atts, char* attr, int def);
52 float attrf(XMLAttributes* atts, char* attr);
53 float attrf(XMLAttributes* atts, char* attr, float def);
54 bool attrb(XMLAttributes* atts, char* attr);
56 // The core Airplane object we manage.
59 // Aerodynamic turbulence model
62 // The list of "axes" that we expect to find as input. These are
63 // typically property names.
69 // Engine types. Contains an EngRec structure.
72 // Output properties for the ControlMap
75 // Parsing temporaries