JSBSim Flight Dynamics Model  1.0 (02 March 2017)
An Open Source Flight Dynamics and Control Software Library in C++
FGOutput.h
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 Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  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 with
20  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21  Place - Suite 330, Boston, MA 02111-1307, USA.
22 
23  Further information about the GNU Lesser General Public License can also be found on
24  the world wide web at http://www.gnu.org.
25 
26 HISTORY
27 --------------------------------------------------------------------------------
28 12/02/98 JSB Created
29 11/09/07 HDW Added FlightGear Socket Interface
30 09/10/11 BC Broke Down the Code in Several Classes
31 
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
33 SENTRY
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
35 
36 #ifndef FGOUTPUT_H
37 #define FGOUTPUT_H
38 
39 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
40 INCLUDES
41 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
42 
43 #include "FGModel.h"
44 #include "input_output/FGOutputType.h"
45 
46 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47 DEFINITIONS
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
49 
50 #define ID_OUTPUT "$Id: FGOutput.h,v 1.34 2017/02/25 14:23:19 bcoconni Exp $"
51 
52 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53 FORWARD DECLARATIONS
54 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
55 
56 namespace JSBSim {
57 
58 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
59 CLASS DOCUMENTATION
60 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
61 
127 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
128 CLASS DECLARATION
129 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
130 
131 class FGOutput : public FGModel
132 {
133 public:
135  ~FGOutput();
136 
143  bool InitModel(void);
152  bool Run(bool Holding);
158  void Print(void);
164  void ForceOutput(int idx);
170  void SetStartNewOutput(void);
178  bool SetOutputName(unsigned int idx, const std::string& name);
184  bool SetDirectivesFile(const SGPath& fname);
186  void Enable(void) { enabled = true; }
188  void Disable(void) { enabled = false; }
195  bool Toggle(int idx);
198  void SetRateHz(double rate);
203  bool Load(Element* el);
216  bool Load(int subSystems, std::string protocol, std::string type,
217  std::string port, std::string name, double outRate,
218  std::vector<FGPropertyNode_ptr> & outputProperties);
223  std::string GetOutputName(unsigned int idx) const;
224 
225 private:
226  std::vector<FGOutputType*> OutputTypes;
227  bool enabled;
228 
229  void Debug(int from);
230 };
231 }
232 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
233 #endif
234 
void Enable(void)
Enables the output generation for all output instances.
Definition: FGOutput.h:186
void ForceOutput(int idx)
Force an output instance to generate its output.
Definition: FGOutput.cpp:156
bool SetDirectivesFile(const SGPath &fname)
Adds a new output instance to the Output Manager.
Definition: FGOutput.cpp:185
bool SetOutputName(unsigned int idx, const std::string &name)
Overwrites the name identifier under which the output will be logged.
Definition: FGOutput.cpp:164
void Disable(void)
Disables the output generation for all output instances.
Definition: FGOutput.h:188
void SetRateHz(double rate)
Modifies the output rate for all output instances.
Definition: FGOutput.cpp:147
bool Toggle(int idx)
Toggles the output generation of each ouput instance.
Definition: FGOutput.cpp:137
Base class for all scheduled JSBSim models.
Definition: FGModel.h:74
bool Run(bool Holding)
Runs the Output model; called by the Executive.
Definition: FGOutput.cpp:103
bool Load(Element *el)
Load the output directives and adds a new output instance to the Output Manager list.
Definition: FGOutput.cpp:249
void SetStartNewOutput(void)
Reset the output prior to a restart of the simulation.
Definition: FGOutput.cpp:128
bool InitModel(void)
Initializes the instance.
Definition: FGOutput.cpp:88
std::string GetOutputName(unsigned int idx) const
Get the name identifier to which the output will be directed.
Definition: FGOutput.cpp:174
Encapsulates the JSBSim simulation executive.
Definition: FGFDMExec.h:189
void Print(void)
Makes all the output instances to generate their ouput.
Definition: FGOutput.cpp:119
Handles simulation output.
Definition: FGOutput.h:131