58 typedef int (
FGOutput::*iOPV)(void)
const;
72 for (
auto output: OutputTypes)
86 for (
auto output: OutputTypes)
87 ret &= output->InitModel();
96 if (
FDMExec->GetTrimStatus())
return true;
98 if (Holding)
return false;
99 if (!enabled)
return true;
101 for (
auto output: OutputTypes)
111 for (
auto output: OutputTypes)
119 for (
auto output: OutputTypes)
120 output->SetStartNewOutput();
127 if (idx >= (
int)0 && idx < (
int)OutputTypes.size())
128 return OutputTypes[idx]->Toggle();
137 for (
auto output: OutputTypes)
138 output->SetRateHz(
rate);
145 if (idx >= (
int)0 && idx < (
int)OutputTypes.size())
146 OutputTypes[idx]->Print();
153 if (idx >= OutputTypes.size())
return false;
155 OutputTypes[idx]->SetOutputName(
name);
165 if (idx < OutputTypes.size())
166 name = OutputTypes[idx]->GetOutputName();
178 s <<
"Could not read directive file: " << fname;
182 bool result =
Load(document);
184 cerr << endl <<
"Aircraft output element has problems in file " << fname << endl;
192 std::string port, std::string
name,
double outRate,
193 std::vector<FGPropertyNode_ptr> & outputProperties)
195 size_t idx = OutputTypes.size();
198 if (
debug_lvl > 0) cout << endl <<
" Output data set: " << idx << endl;
205 Output = OutputTextFile;
206 }
else if (type ==
"TABULAR") {
209 Output = OutputTextFile;
210 }
else if (type ==
"SOCKET") {
212 name +=
":" + port +
"/" + protocol;
213 }
else if (type ==
"FLIGHTGEAR") {
215 name +=
":" + port +
"/" + protocol;
216 }
else if (type ==
"TERMINAL") {
218 }
else if (type !=
string(
"NONE")) {
219 cerr <<
"Unknown type of output specified in config file" << endl;
222 if (!Output)
return false;
230 OutputTypes.push_back(Output);
247 size_t idx = OutputTypes.size();
251 if (
debug_lvl > 0) cout << endl <<
" Output data set: " << idx <<
" " << endl;
257 }
else if (type ==
"TABULAR") {
259 }
else if (type ==
"SOCKET") {
261 }
else if (type ==
"FLIGHTGEAR") {
263 }
else if (type ==
"TERMINAL") {
265 }
else if (type !=
string(
"NONE")) {
266 cerr <<
"Unknown type of output specified in config file" << endl;
269 if (!Output)
return false;
273 Output->
Load(document);
276 OutputTypes.push_back(Output);
287 if (!includePath.isNull()) {
314void FGOutput::Debug(
int from)
326 if (from == 0) cout <<
"Instantiated: FGOutput" << endl;
327 if (from == 1) cout <<
"Destroyed: FGOutput" << endl;
std::string GetAttributeValue(const std::string &key)
Retrieves an attribute.
void PostLoad(Element *el, FGFDMExec *fdmex, std::string prefix="")
void PreLoad(Element *el, FGFDMExec *fdmex, std::string prefix="")
FGPropertyManager * PropertyManager
bool InitModel(void) override
FGModel(FGFDMExec *)
Constructor.
virtual SGPath FindFullPathName(const SGPath &path) const
bool Upload(Element *el, bool preLoad)
Uploads this model in memory.
virtual bool Run(bool Holding)
Runs the model; called by the Executive.
Implements the output to a FlightGear socket.
Implements the output to a socket.
Implements the output to a human readable text file.
void SetDelimiter(const std::string &delim)
Set the delimiter.
Abstract class to provide functions generic to all the output directives.
virtual void SetOutputName(const std::string &name)
Overwrites the name identifier under which the output will be logged.
void SetSubSystems(int subSystems)
Set the activated subsystems for this output instance.
void SetOutputProperties(std::vector< FGPropertyNode_ptr > &outputProperties)
Set the list of properties that should be output for this output instance.
void SetIdx(unsigned int idx)
Set the idx for this output instance.
void SetRateHz(double rtHz)
Set the output rate for this output instances.
bool Load(Element *el) override
Init the output directives from an XML file (implement the FGModel interface).
bool SetOutputName(unsigned int idx, const std::string &name)
Overwrites the name identifier under which the output will be logged.
bool Run(bool Holding) override
Runs the Output model; called by the Executive.
bool Toggle(int idx)
Toggles the output generation of each ouput instance.
void Print(void)
Makes all the output instances to generate their ouput.
void SetStartNewOutput(void)
Reset the output prior to a restart of the simulation.
bool InitModel(void) override
Initializes the instance.
void SetRateHz(double rate)
Modifies the output rate for all output instances.
std::string GetOutputName(unsigned int idx) const
Get the name identifier to which the output will be directed.
SGPath FindFullPathName(const SGPath &path) const override
bool SetDirectivesFile(const SGPath &fname)
Adds a new output instance to the Output Manager.
void ForceOutput(int idx)
Force an output instance to generate its output.
bool Load(Element *el, const SGPath &dir=SGPath())
Load the output directives and adds a new output instance to the Output Manager list.
Element * LoadXMLDocument(const SGPath &XML_filename, bool verbose=true)
This class is solely for the purpose of determining what type of file is given on the command line.
SGPath CheckPathName(const SGPath &path, const SGPath &filename)
std::string & to_upper(std::string &str)