JSBSim Flight Dynamics Model
1.0 (02 March 2017)
An Open Source Flight Dynamics and Control Software Library in C++
|
Public Member Functions | |
Element (const std::string &nm) | |
Constructor. More... | |
~Element (void) | |
Destructor. | |
void | AddAttribute (const std::string &name, const std::string &value) |
Stores an attribute belonging to this element. More... | |
void | AddChildElement (Element *el) |
Adds a child element to the list of children stored for this element. More... | |
void | AddData (std::string d) |
Stores data belonging to this element. More... | |
double | DisperseValue (Element *e, double val, const std::string &supplied_units="", const std::string &target_units="") |
Element * | FindElement (const std::string &el="") |
Searches for a specified element. More... | |
FGColumnVector3 | FindElementTripletConvertTo (const std::string &target_units) |
Composes a 3-element column vector for the supplied location or orientation. More... | |
std::string | FindElementValue (const std::string &el="") |
Searches for the named element and returns the string data belonging to it. More... | |
double | FindElementValueAsNumber (const std::string &el="") |
Searches for the named element and returns the data belonging to it as a number. More... | |
double | FindElementValueAsNumberConvertFromTo (const std::string &el, const std::string &supplied_units, const std::string &target_units) |
Searches for the named element and converts and returns the data belonging to it. More... | |
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. More... | |
Element * | FindNextElement (const std::string &el="") |
Searches for the next element as specified. More... | |
std::string | GetAttributeValue (const std::string &key) |
Retrieves an attribute. More... | |
double | GetAttributeValueAsNumber (const std::string &key) |
Retrieves an attribute value as a double precision real number. More... | |
double | GetDataAsNumber (void) |
Converts the element data to a number. More... | |
std::string | GetDataLine (unsigned int i=0) |
Gets a line of data belonging to an element. More... | |
Element * | GetElement (unsigned int el=0) |
Returns a pointer to the element requested by index. More... | |
const std::string & | GetFileName (void) const |
Returns the name of the file in which the element has been read. More... | |
int | GetLineNumber (void) const |
Returns the line number at which the element has been defined. More... | |
const std::string & | GetName (void) const |
Retrieves the element name. More... | |
Element * | GetNextElement (void) |
Returns a pointer to the next element in the list. More... | |
unsigned int | GetNumDataLines (void) |
Returns the number of lines of data stored. | |
unsigned int | GetNumElements (void) |
Returns the number of child elements for this element. | |
unsigned int | GetNumElements (const std::string &element_name) |
Returns the number of named child elements for this element. | |
Element * | GetParent (void) |
Returns a pointer to the parent of an element. More... | |
bool | HasAttribute (const std::string &key) |
Determines if an element has the supplied attribute. More... | |
void | MergeAttributes (Element *el) |
Merges the attributes of the current element with another element. More... | |
void | Print (unsigned int level=0) |
Prints the element. More... | |
std::string | ReadFrom (void) const |
Return a string that contains a description of the location where the current XML element was read from. More... | |
bool | SetAttributeValue (const std::string &key, const std::string &value) |
Modifies an attribute. More... | |
void | SetFileName (const std::string &name) |
Set the name of the file in which the element has been read. More... | |
void | SetLineNumber (int line) |
Set the line number at which the element has been read. More... | |
void | SetParent (Element *p) |
This function sets the value of the parent class attribute to the supplied Element pointer. More... | |
Definition at line 150 of file FGXMLElement.h.
Element | ( | const std::string & | nm | ) |
Constructor.
nm | the name of this element (if given) |
Definition at line 58 of file FGXMLElement.cpp.
void AddAttribute | ( | const std::string & | name, |
const std::string & | value | ||
) |
Stores an attribute belonging to this element.
name | The string name of the attribute. |
value | The string value of the attribute. |
Definition at line 666 of file FGXMLElement.cpp.
|
inline |
Adds a child element to the list of children stored for this element.
el | Child element to add. |
Definition at line 341 of file FGXMLElement.h.
void AddData | ( | std::string | d | ) |
Stores data belonging to this element.
d | the data to store. |
Definition at line 673 of file FGXMLElement.cpp.
Element * FindElement | ( | const std::string & | el = "" | ) |
Searches for a specified element.
Finds the first element that matches the supplied string, or simply the first element if no search string is supplied. This function call resets the internal element counter to the first element.
el | the search string (empty string by default). |
Definition at line 372 of file FGXMLElement.cpp.
FGColumnVector3 FindElementTripletConvertTo | ( | 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 filled-out 3-element column vector containing the X, Y, Z or ROLL, PITCH, YAW elements found in the supplied element. If one of the mentioned components is not found, that component is set to zero and a warning message is printed. All three elements should be supplied.
target_units | the string representing the native units used by JSBSim to which the value returned will be converted. |
Definition at line 540 of file FGXMLElement.cpp.
string FindElementValue | ( | 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 as a string. If no element is found, the empty string is returned. If no argument is supplied, the data string for the first element is returned.
el | the name of the element being searched for (the empty string by default) |
Definition at line 428 of file FGXMLElement.cpp.
double FindElementValueAsNumber | ( | 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 as a double. If no element is found, HUGE_VAL is returned. If no argument is supplied, the data for the first element is returned.
el | the name of the element being searched for (the empty string by default) |
Definition at line 412 of file FGXMLElement.cpp.
double FindElementValueAsNumberConvertFromTo | ( | const std::string & | el, |
const std::string & | supplied_units, | ||
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 as a double. If no element is found, HUGE_VAL is returned. If no argument is supplied, the data for the first element is returned. Additionally, this function converts the value from the units specified in the supplied_units parameter to the units specified in the target_units parameter. JSBSim itself, as specified by the target_units parameter. The currently allowable unit conversions are seen in the source file FGXMLElement.cpp. Also, see above in the main documentation for this class.
el | the name of the element being searched for (the empty string by default) |
supplied_units | the string representing the units of the value as supplied by the config file. |
target_units | the string representing the native units used by JSBSim to which the value returned will be converted. |
Definition at line 503 of file FGXMLElement.cpp.
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 as a double. If no element is found, HUGE_VAL is returned. If no argument is supplied, the data for the first element is returned. Additionally, this function converts the value from the units specified in the config file (via the UNITS="" attribute in the element definition) to the native units used by JSBSim itself, as specified by the target_units parameter. The currently allowable unit conversions are seen in the source file FGXMLElement.cpp. Also, see above in the main documentation for this class.
el | the name of the element being searched for (the empty string by default) |
target_units | the string representing the native units used by JSBSim to which the value returned will be converted. |
Definition at line 440 of file FGXMLElement.cpp.
Element * FindNextElement | ( | const std::string & | el = "" | ) |
Searches for the next element as specified.
This function would be called after FindElement() is first called (in order to reset the internal counter). If no argument is supplied (or the empty string) a pointer to the very next element is returned. Otherwise, the next occurence of the named element is returned. If the end of the list is reached, 0 is returned.
el | the name of the next element to find. |
Definition at line 390 of file FGXMLElement.cpp.
string GetAttributeValue | ( | const std::string & | key | ) |
Retrieves an attribute.
key | specifies the attribute key to retrieve the value of. |
Definition at line 252 of file FGXMLElement.cpp.
double GetAttributeValueAsNumber | ( | const std::string & | key | ) |
Retrieves an attribute value as a double precision real number.
key | specifies the attribute key to retrieve the value of. |
Definition at line 271 of file FGXMLElement.cpp.
double GetDataAsNumber | ( | void | ) |
Converts the element data to a number.
This function attempts to convert the first (and presumably only) line of data "owned" by the element into a real number. If there is not exactly one line of data owned by the element, then HUGE_VAL is returned.
Definition at line 331 of file FGXMLElement.cpp.
string GetDataLine | ( | unsigned int | i = 0 | ) |
Gets a line of data belonging to an element.
i | the index of the data line to return (0 by default). |
Definition at line 323 of file FGXMLElement.cpp.
Element * GetElement | ( | unsigned int | el = 0 | ) |
Returns a pointer to the element requested by index.
This function also resets an internal counter to the index, so that subsequent calls to GetNextElement() will return the following elements sequentially, until the last element is reached. At that point, GetNextElement() will return NULL.
el | the index of the requested element (0 by default) |
Definition at line 296 of file FGXMLElement.cpp.
|
inline |
Returns the name of the file in which the element has been read.
Definition at line 241 of file FGXMLElement.h.
|
inline |
Returns the line number at which the element has been defined.
Definition at line 236 of file FGXMLElement.h.
|
inline |
Retrieves the element name.
Definition at line 186 of file FGXMLElement.h.
Element * GetNextElement | ( | void | ) |
Returns a pointer to the next element in the list.
The function GetElement() must be called first to be sure that this function will return the correct element. The call to GetElement() resets the internal counter to zero. Subsequent calls to GetNextElement() return a pointer to subsequent elements in the list. When the final element is reached, 0 is returned.
Definition at line 310 of file FGXMLElement.cpp.
|
inline |
Returns a pointer to the parent of an element.
Definition at line 231 of file FGXMLElement.h.
|
inline |
Determines if an element has the supplied attribute.
key | specifies the attribute key to retrieve the value of. |
Definition at line 162 of file FGXMLElement.h.
void MergeAttributes | ( | Element * | el | ) |
Merges the attributes of the current element with another element.
The attributes from the current element override the element that is passed as a parameter. In other words if the two elements have an attribute with the same name, the attribute from the current element is kept and the corresponding attribute of the other element is ignored.
el | element with which the current element will merge its attributes. |
Definition at line 697 of file FGXMLElement.cpp.
void Print | ( | unsigned int | level = 0 | ) |
Prints the element.
Prints this element and calls the Print routine for child elements.
d | The tab level. A level corresponds to a single space. |
Definition at line 642 of file FGXMLElement.cpp.
string ReadFrom | ( | void | ) | const |
Return a string that contains a description of the location where the current XML element was read from.
Definition at line 684 of file FGXMLElement.cpp.
bool SetAttributeValue | ( | const std::string & | key, |
const std::string & | value | ||
) |
Modifies an attribute.
key | specifies the attribute key to modify the value of. |
value | new key value (as a string). |
Definition at line 260 of file FGXMLElement.cpp.
|
inline |
Set the name of the file in which the element has been read.
name | file name |
Definition at line 365 of file FGXMLElement.h.
|
inline |
Set the line number at which the element has been read.
line | line number. |
Definition at line 360 of file FGXMLElement.h.
|
inline |
This function sets the value of the parent class attribute to the supplied Element pointer.
p | pointer to the parent Element. |
Definition at line 337 of file FGXMLElement.h.