JSBSim Flight Dynamics Model  1.0 (02 March 2017)
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 DEFINITIONS
45 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
46 
47 #define ID_INPUTTYPE "$Id: FGInputType.h,v 1.3 2015/08/23 09:37:16 bcoconni Exp $"
48 
49 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50 FORWARD DECLARATIONS
51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
52 
53 namespace JSBSim {
54 
55 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56 CLASS DOCUMENTATION
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
58 
75 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76 CLASS DECLARATION
77 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
78 
79 class FGInputType : public FGModel
80 {
81 public:
85  FGInputType(FGFDMExec* fdmex);
86 
88  virtual ~FGInputType();
89 
93  void SetIdx(unsigned int idx);
94 
98  virtual bool Load(Element* el);
99 
101  virtual bool InitModel(void);
102 
109  bool Run(bool Holding);
110 
115  virtual void Read(bool Holding) = 0;
116 
118  void Enable(void) { enabled = true; }
120  void Disable(void) { enabled = false; }
124  bool Toggle(void) {enabled = !enabled; return enabled;}
125 
131  virtual void SetInputName(const std::string& name) { Name = name; }
132 
135  virtual const std::string& GetInputName(void) const { return Name; }
136 
137 protected:
138  unsigned int InputIdx;
139  bool enabled;
140 
141  void Debug(int from);
142 };
143 }
144 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
145 #endif
virtual bool Load(Element *el)
Init the input directives from an XML file (implement the FGModel interface).
Definition: FGInputType.cpp:81
void SetIdx(unsigned int idx)
Set the idx for this input instance.
Definition: FGInputType.cpp:74
virtual const std::string & GetInputName(void) const
Get the name identifier to which the input will be directed.
Definition: FGInputType.h:135
bool Toggle(void)
Toggles the input generation.
Definition: FGInputType.h:124
void Disable(void)
Disables the input generation.
Definition: FGInputType.h:120
virtual void SetInputName(const std::string &name)
Overwrites the name identifier under which the input will be read.
Definition: FGInputType.h:131
virtual ~FGInputType()
Destructor.
Definition: FGInputType.cpp:67
void Enable(void)
Enables the input generation.
Definition: FGInputType.h:118
Abstract class to provide functions generic to all the input directives.
Definition: FGInputType.h:79
Base class for all scheduled JSBSim models.
Definition: FGModel.h:74
virtual void Read(bool Holding)=0
Generate the input.
bool Run(bool Holding)
Executes the input directives (implement the FGModel interface).
virtual bool InitModel(void)
Init the input model according to its configitation.
Definition: FGInputType.cpp:97
Encapsulates the JSBSim simulation executive.
Definition: FGFDMExec.h:189
FGInputType(FGFDMExec *fdmex)
Constructor (implement the FGModel interface).
Definition: FGInputType.cpp:58