JSBSim Flight Dynamics Model 1.3.0 (09 Apr 2026)
An Open Source Flight Dynamics and Control Software Library in C++
Loading...
Searching...
No Matches
FGSwitch.h
1/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3 Header: FGSwitch.h
4 Author: Jon S. Berndt
5 Date started: 12/23/2002
6
7 ------------- Copyright (C) 2002 jon@jsbsim.org -------------
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
26HISTORY
27--------------------------------------------------------------------------------
28
29%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
30SENTRY
31%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
32
33#ifndef FGSWITCH_H
34#define FGSWITCH_H
35
36/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37INCLUDES
38%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
39
40#include "FGFCSComponent.h"
41#include "math/FGParameterValue.h"
42
43/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44FORWARD DECLARATIONS
45%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
46
47namespace JSBSim {
48
49class FGCondition;
50
51/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52CLASS DOCUMENTATION
53%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
54
126/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
127CLASS DECLARATION
128%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
129
131{
132public:
137 FGSwitch(FGFCS* fcs, Element* element);
138
140 ~FGSwitch();
141
144 bool Run(void) override;
145
146private:
147
148 struct Test {
149 std::unique_ptr<FGCondition> condition;
150 bool Default;
151 FGParameter_ptr OutputValue;
152
153 // constructor for the test structure
154 Test(void) : condition(nullptr), Default(false) {}
155
156 void setTestValue(const std::string &value, const std::string &Name,
157 std::shared_ptr<FGPropertyManager> pm, Element* el)
158 {
159 if (!value.empty())
160 OutputValue = new FGParameterValue(value, pm, el);
161 else
162 throw BaseException("No VALUE supplied for switch component: " + Name);
163 }
164
165 std::string GetOutputName(void) const {return OutputValue->GetName();}
166 };
167
168 std::vector <Test*> tests;
169 bool initialized = false;
170
171 void VerifyProperties(void);
172 void Debug(int from) override;
173};
174}
175#endif
Base class for JSBSim Flight Control System Components.
Encapsulates the Flight Control System (FCS) functionality.
Definition FGFCS.h:189
Represents a either a real value or a property value.
Encapsulates a switch for the flight control system.
Definition FGSwitch.h:131
~FGSwitch()
Destructor.
Definition FGSwitch.cpp:130
bool Run(void) override
Executes the switch logic.
Definition FGSwitch.cpp:138
Main namespace for the JSBSim Flight Dynamics Model.
Definition FGFDMExec.cpp:71