Debian Codegraph @

src/FDM/JSBSim/models/FGModel.h

raw symbols SCIP
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3 Header: FGModel.h
4 Author: Jon Berndt
5 Date started: 11/21/98
6
7 ------------- Copyright (C) 1999 Jon S. Berndt ([email protected]) -------------
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
26 HISTORY
27 --------------------------------------------------------------------------------
28 11/22/98 JSB Created
29
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 SENTRY
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33
34 #ifndef FGMODEL_H
35 #define FGMODEL_H
36
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 INCLUDES
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40
41 #include <string>
42
43 #include "math/FGModelFunctions.h"
44 #include "simgear/misc/sg_path.hxx"
45
46 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47 FORWARD DECLARATIONS
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
49
50 namespace JSBSim {
51
52 class FGFDMExec;
53 class Element;
54 class FGPropertyManager;
55
56 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 CLASS DOCUMENTATION
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
59
60 /** Base class for all scheduled JSBSim models
61 @author Jon S. Berndt
62 */
63
64 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65 CLASS DECLARATION
66 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
67
68 class JSBSIM_API FGModel : public FGModelFunctions
69 {
70 public:
71
72 /// Constructor
73 explicit FGModel(FGFDMExec*);
74 /// Destructor
75 ~FGModel() override;
76
77 /** Runs the model; called by the Executive.
78 Can pass in a value indicating if the executive is directing the simulation to Hold.
79 @param Holding if true, the executive has been directed to hold the sim from
80 advancing time. Some models may ignore this flag, such as the Input
81 model, which may need to be active to listen on a socket for the
82 "Resume" command to be given. The Holding flag is not used in the base
83 FGModel class.
84 @see JSBSim.cpp documentation
85 @return false if no error */
86 virtual bool Run(bool Holding);
87
88 bool InitModel(void) override;
89 /// Set the ouput rate for the model in frames
90 void SetRate(unsigned int tt) {rate = tt;}
91 /// Get the output rate for the model in frames
92 unsigned int GetRate(void) {return rate;}
93 FGFDMExec* GetExec(void) {return FDMExec;}
94
95 void SetPropertyManager(FGPropertyManager *fgpm) { PropertyManager=fgpm;}
96 virtual SGPath FindFullPathName(const SGPath& path) const;
97 const std::string& GetName(void) { return Name; }
98 virtual bool Load(Element* el) { return true; }
99
100 protected:
101 unsigned int exe_ctr;
102 unsigned int rate;
103 std::string Name;
104
105 /** Uploads this model in memory.
106 Uploads the model in memory if its contents are contained in a separate
107 file.
108 @param el a pointer to the element
109 @param preLoad true if model functions and local properties must be
110 preloaded.
111 @return true if model is successfully loaded*/
112 bool Upload(Element* el, bool preLoad);
113
114 virtual void Debug(int from);
115
116 FGFDMExec* FDMExec;
117 FGPropertyManager* PropertyManager;
118 };
119 }
120 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
121 #endif