FlightGear next
FGInputType.h
Go to the documentation of this file.
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
26HISTORY
27--------------------------------------------------------------------------------
2801/20/15 PC Created
29
30%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31SENTRY
32%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33
34#ifndef FGINPUTTYPE_H
35#define FGINPUTTYPE_H
36
37/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38INCLUDES
39%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40
41#include "models/FGModel.h"
42
43/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44FORWARD DECLARATIONS
45%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
46
47namespace JSBSim {
48
49/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50CLASS DOCUMENTATION
51%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
52
68
69/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
70CLASS DECLARATION
71%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
72
73class FGInputType : public FGModel
74{
75public:
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
131protected:
132 unsigned int InputIdx;
134
135 void Debug(int from) override;
136};
137}
138//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
139#endif
bool Load(Element *el) override
Init the input directives from an XML file (implement the FGModel interface).
~FGInputType() override
Destructor.
bool Toggle(void)
Toggles the input generation.
void Enable(void)
Enables the input generation.
bool InitModel(void) override
Init the input model according to its configitation.
virtual void SetInputName(const std::string &name)
Overwrites the name identifier under which the input will be read.
unsigned int InputIdx
virtual const std::string & GetInputName(void) const
Get the name identifier to which the input will be directed.
virtual void Read(bool Holding)=0
Generate the input.
void Debug(int from) override
void SetIdx(unsigned int idx)
Set the idx for this input instance.
void Disable(void)
Disables the input generation.
bool Run(bool Holding) override
Executes the input directives (implement the FGModel interface).
FGInputType(FGFDMExec *fdmex)
Constructor (implement the FGModel interface).
FGModel(FGFDMExec *)
Constructor.
Definition FGModel.cpp:57
std::string Name
Definition FGModel.h:103
const char * name