JSBSim Flight Dynamics Model  1.1.11 (13 Feb 2022)
An Open Source Flight Dynamics and Control Software Library in C++
FGInputType.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 
3  Header: FGInputType.h
4  Author: Paul Chavent
5  Date started: 01/20/15
6 
7  ------------- Copyright (C) 2015 Paul Chavent -------------
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 01/20/15 PC Created
29 
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 SENTRY
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33 
34 #ifndef FGINPUTTYPE_H
35 #define FGINPUTTYPE_H
36 
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 INCLUDES
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40 
41 #include "models/FGModel.h"
42 
43 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44 FORWARD DECLARATIONS
45 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
46 
47 namespace JSBSim {
48 
49 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50 CLASS DOCUMENTATION
51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
52 
69 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
70 CLASS DECLARATION
71 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
72 
73 class FGInputType : public FGModel
74 {
75 public:
79  FGInputType(FGFDMExec* fdmex);
80 
82  ~FGInputType() override;
83 
87  void SetIdx(unsigned int idx);
88 
92  bool Load(Element* el) override;
93 
95  bool InitModel(void) override;
96 
103  bool Run(bool Holding) override;
104 
109  virtual void Read(bool Holding) = 0;
110 
112  void Enable(void) { enabled = true; }
114  void Disable(void) { enabled = false; }
118  bool Toggle(void) {enabled = !enabled; return enabled;}
119 
125  virtual void SetInputName(const std::string& name) { Name = name; }
126 
129  virtual const std::string& GetInputName(void) const { return Name; }
130 
131 protected:
132  unsigned int InputIdx;
133  bool enabled;
134 
135  void Debug(int from) override;
136 };
137 }
138 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
139 #endif
JSBSim::FGInputType::Run
bool Run(bool Holding) override
Executes the input directives (implement the FGModel interface).
Definition: FGInputType.cpp:98
JSBSim::FGFDMExec
Encapsulates the JSBSim simulation executive.
Definition: FGFDMExec.h:185
JSBSim::FGModel
Base class for all scheduled JSBSim models.
Definition: FGModel.h:68
JSBSim::FGInputType::InitModel
bool InitModel(void) override
Init the input model according to its configitation.
Definition: FGInputType.cpp:88
JSBSim::FGInputType::Toggle
bool Toggle(void)
Toggles the input generation.
Definition: FGInputType.h:118
JSBSim::FGInputType::Disable
void Disable(void)
Disables the input generation.
Definition: FGInputType.h:114
JSBSim::FGInputType::Load
bool Load(Element *el) override
Init the input directives from an XML file (implement the FGModel interface).
Definition: FGInputType.cpp:72
JSBSim::FGInputType::FGInputType
FGInputType(FGFDMExec *fdmex)
Constructor (implement the FGModel interface).
Definition: FGInputType.cpp:50
JSBSim::FGInputType::Enable
void Enable(void)
Enables the input generation.
Definition: FGInputType.h:112
JSBSim::FGInputType
Abstract class to provide functions generic to all the input directives.
Definition: FGInputType.h:73
JSBSim::FGInputType::SetIdx
void SetIdx(unsigned int idx)
Set the idx for this input instance.
Definition: FGInputType.cpp:65
JSBSim::FGInputType::GetInputName
virtual const std::string & GetInputName(void) const
Get the name identifier to which the input will be directed.
Definition: FGInputType.h:129
JSBSim::FGInputType::SetInputName
virtual void SetInputName(const std::string &name)
Overwrites the name identifier under which the input will be read.
Definition: FGInputType.h:125
JSBSim::FGInputType::~FGInputType
~FGInputType() override
Destructor.
Definition: FGInputType.cpp:58
JSBSim::Element
Definition: FGXMLElement.h:143
JSBSim::FGInputType::Read
virtual void Read(bool Holding)=0
Generate the input.