JSBSim Flight Dynamics Model 1.3.0 (09 Apr 2026)
An Open Source Flight Dynamics and Control Software Library in C++
Loading...
Searching...
No Matches
FGModelLoader Class Reference

Detailed Description

Definition at line 62 of file FGModelLoader.h.

Public Member Functions

 FGModelLoader (const FGModel *_model)
 
Element_ptr Open (Element *el)
 

Constructor & Destructor Documentation

◆ FGModelLoader()

FGModelLoader ( const FGModel _model)
inline

Definition at line 65 of file FGModelLoader.h.

65: model(_model) {}

Member Function Documentation

◆ Open()

Element_ptr Open ( Element el)

Definition at line 54 of file FGModelLoader.cpp.

55{
56 Element_ptr document = el;
57 string fname = el->GetAttributeValue("file");
58
59 if (!fname.empty()) {
60 FGXMLFileRead XMLFileRead;
61 SGPath path(SGPath::fromUtf8(fname.c_str()));
62
63 if (path.isRelative())
64 path = model->FindFullPathName(path);
65
66 if (CachedFiles.find(path.utf8Str()) != CachedFiles.end())
67 document = CachedFiles[path.utf8Str()];
68 else {
69 document = XMLFileRead.LoadXMLDocument(path);
70 if (document == 0L) {
71 FGXMLLogging log(el, LogLevel::ERROR);
72 log << "Could not open file: " << fname << endl;
73 return NULL;
74 }
75 CachedFiles[path.utf8Str()] = document;
76 }
77
78 if (document->GetName() != el->GetName()) {
79 document->SetParent(el);
80 el->AddChildElement(document);
81 }
82 }
83
84 return document;
85}

The documentation for this class was generated from the following files: