MCPcopy Create free account
hub / github.com/JSBSim-Team/jsbsim / Load

Method Load

src/models/FGOutput.cpp:194–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
193
194bool FGOutput::Load(int subSystems, std::string protocol, std::string type,
195 std::string port, std::string name, double outRate,
196 std::vector<SGPropertyNode_ptr> & outputProperties)
197{
198 size_t idx = OutputTypes.size();
199 FGOutputType* Output = 0;
200
201 if (debug_lvl > 0) {
202 FGLogging log(LogLevel::DEBUG);
203 log << "\n Output data set: " << idx << "\n";
204 }
205
206 type = to_upper(type);
207
208 if (type == "CSV") {
209 FGOutputTextFile* OutputTextFile = new FGOutputTextFile(FDMExec);
210 OutputTextFile->SetDelimiter(",");
211 Output = OutputTextFile;
212 } else if (type == "TABULAR") {
213 FGOutputTextFile* OutputTextFile = new FGOutputTextFile(FDMExec);
214 OutputTextFile->SetDelimiter("\t");
215 Output = OutputTextFile;
216 } else if (type == "SOCKET") {
217 Output = new FGOutputSocket(FDMExec);
218 name += ":" + port + "/" + protocol;
219 } else if (type == "FLIGHTGEAR") {
220 Output = new FGOutputFG(FDMExec);
221 name += ":" + port + "/" + protocol;
222 } else if (type == "TERMINAL") {
223 // Not done yet
224 } else if (type != string("NONE")) {
225 FGLogging log(LogLevel::ERROR);
226 log << "Unknown type of output specified in config file\n";
227 }
228
229 if (!Output) return false;
230
231 Output->SetIdx(idx);
232 Output->SetOutputName(name);
233 Output->SetRateHz(outRate);
234 Output->SetSubSystems(subSystems);
235 Output->SetOutputProperties(outputProperties);
236
237 OutputTypes.push_back(Output);
238
239 Debug(2);
240 return true;
241}
242
243//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
244

Callers

nothing calls this directly

Calls 10

sizeMethod · 0.80
SetDelimiterMethod · 0.80
SetSubSystemsMethod · 0.80
SetOutputPropertiesMethod · 0.80
GetAttributeValueMethod · 0.80
PreLoadMethod · 0.80
PostLoadMethod · 0.80
SetIdxMethod · 0.45
SetOutputNameMethod · 0.45
SetRateHzMethod · 0.45

Tested by

no test coverage detected