JSBSim Flight Dynamics Model  1.0 (02 March 2017)
An Open Source Flight Dynamics and Control Software Library in C++
FGOutputFile.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 
3  Header: FGOutputFile.h
4  Author: Bertrand Coconnier
5  Date started: 09/10/11
6 
7  ------------- Copyright (C) 2011 Bertrand Coconnier -------------
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 09/10/11 BC Created
29 
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 SENTRY
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33 
34 #ifndef FGOUTPUTFILE_H
35 #define FGOUTPUTFILE_H
36 
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 INCLUDES
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40 
41 #include "FGFDMExec.h"
42 #include "FGOutputType.h"
43 
44 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
45 DEFINITIONS
46 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
47 
48 #define ID_OUTPUTFILE "$Id: FGOutputFile.h,v 1.8 2017/02/25 14:23:18 bcoconni Exp $"
49 
50 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
51 FORWARD DECLARATIONS
52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
53 
54 namespace JSBSim {
55 
56 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 CLASS DOCUMENTATION
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
59 
72 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73 CLASS DECLARATION
74 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
75 
76 class FGOutputFile : public FGOutputType
77 {
78 public:
80  FGOutputFile(FGFDMExec* fdmex);
81 
83  virtual ~FGOutputFile() { CloseFile(); }
84 
88  bool Load(Element* el);
89 
94  bool InitModel(void);
102  void SetStartNewOutput(void);
108  void SetOutputName(const std::string& fname) {
109  Name = (FDMExec->GetRootDir()/fname).utf8Str();
110  runID_postfix = -1;
111  Filename = SGPath();
112  }
116  void Print(void) = 0;
117 
118 protected:
119  SGPath Filename;
120 
122  virtual bool OpenFile(void) = 0;
124  virtual void CloseFile(void) {}
125 
126 private:
127  int runID_postfix;
128 };
129 }
130 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
131 #endif
132 
void SetStartNewOutput(void)
Reset the output prior to a restart of the simulation.
Abstract class that provide functions that are generic to all the outputs that are directed to a file...
Definition: FGOutputFile.h:76
bool InitModel(void)
Initializes the instance.
virtual ~FGOutputFile()
Destructor : closes the file.
Definition: FGOutputFile.h:83
virtual void CloseFile(void)
Closes the file.
Definition: FGOutputFile.h:124
void SetOutputName(const std::string &fname)
Overwrites the name identifier under which the output will be logged.
Definition: FGOutputFile.h:108
bool Load(Element *el)
Init the output directives from an XML file.
const SGPath & GetRootDir(void) const
Retrieves the Root Directory.
Definition: FGFDMExec.h:567
Abstract class to provide functions generic to all the output directives.
Definition: FGOutputType.h:95
FGOutputFile(FGFDMExec *fdmex)
Constructor.
void Print(void)=0
Generate the output.
Encapsulates the JSBSim simulation executive.
Definition: FGFDMExec.h:189
virtual bool OpenFile(void)=0
Opens the file.