FlightGear next
FGOutput.h
Go to the documentation of this file.
1/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3 Header: FGOutput.h
4 Author: Jon Berndt
5 Date started: 12/2/98
6
7 ------------- Copyright (C) 1999 Jon S. Berndt (jon@jsbsim.org) -------------
8
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU Lesser General Public License as published by the Free
11 Software Foundation; either version 2 of the License, or (at your option) any
12 later version.
13
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
17 details.
18
19 You should have received a copy of the GNU Lesser General Public License along
20 with this program; if not, write to the Free Software Foundation, Inc., 59
21 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23 Further information about the GNU Lesser General Public License can also be
24 found on the world wide web at http://www.gnu.org.
25
26HISTORY
27--------------------------------------------------------------------------------
2812/02/98 JSB Created
2911/09/07 HDW Added FlightGear Socket Interface
3009/10/11 BC Broke Down the Code in Several Classes
31
32%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
33SENTRY
34%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
35
36#ifndef FGOUTPUT_H
37#define FGOUTPUT_H
38
39/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
40INCLUDES
41%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
42
43#include "FGModel.h"
45
46/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47FORWARD DECLARATIONS
48%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
49
50namespace JSBSim {
51
52/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53CLASS DOCUMENTATION
54%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
55
120
121/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
122CLASS DECLARATION
123%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
124
125class FGOutput : public FGModel
126{
127public:
129 ~FGOutput() override;
130
137 bool InitModel(void) override;
146 bool Run(bool Holding) override;
152 void Print(void);
158 void ForceOutput(int idx);
164 void SetStartNewOutput(void);
172 bool SetOutputName(unsigned int idx, const std::string& name);
178 bool SetDirectivesFile(const SGPath& fname);
180 void Enable(void) { enabled = true; }
182 void Disable(void) { enabled = false; }
189 bool Toggle(int idx);
192 void SetRateHz(double rate);
198 bool Load(Element* el, const SGPath& dir = SGPath());
211 bool Load(int subSystems, std::string protocol, std::string type,
212 std::string port, std::string name, double outRate,
213 std::vector<FGPropertyNode_ptr> & outputProperties);
218 std::string GetOutputName(unsigned int idx) const;
219
220 SGPath FindFullPathName(const SGPath& path) const override;
221
222private:
223 std::vector<FGOutputType*> OutputTypes;
224 bool enabled;
225 SGPath includePath;
226
227 void Debug(int from) override;
228};
229}
230//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
231#endif
unsigned int rate
Definition FGModel.h:102
FGModel(FGFDMExec *)
Constructor.
Definition FGModel.cpp:57
~FGOutput() override
Definition FGOutput.cpp:70
bool SetOutputName(unsigned int idx, const std::string &name)
Overwrites the name identifier under which the output will be logged.
Definition FGOutput.cpp:151
bool Run(bool Holding) override
Runs the Output model; called by the Executive.
Definition FGOutput.cpp:94
bool Toggle(int idx)
Toggles the output generation of each ouput instance.
Definition FGOutput.cpp:125
void Print(void)
Makes all the output instances to generate their ouput.
Definition FGOutput.cpp:109
void SetStartNewOutput(void)
Reset the output prior to a restart of the simulation.
Definition FGOutput.cpp:117
FGOutput(FGFDMExec *)
Definition FGOutput.cpp:56
bool InitModel(void) override
Initializes the instance.
Definition FGOutput.cpp:80
void Enable(void)
Enables the output generation for all output instances.
Definition FGOutput.h:180
void SetRateHz(double rate)
Modifies the output rate for all output instances.
Definition FGOutput.cpp:135
std::string GetOutputName(unsigned int idx) const
Get the name identifier to which the output will be directed.
Definition FGOutput.cpp:161
SGPath FindFullPathName(const SGPath &path) const override
Definition FGOutput.cpp:284
void Disable(void)
Disables the output generation for all output instances.
Definition FGOutput.h:182
bool SetDirectivesFile(const SGPath &fname)
Adds a new output instance to the Output Manager.
Definition FGOutput.cpp:172
void ForceOutput(int idx)
Force an output instance to generate its output.
Definition FGOutput.cpp:143
bool Load(Element *el, const SGPath &dir=SGPath())
Load the output directives and adds a new output instance to the Output Manager list.
Definition FGOutput.cpp:238
const char * name