Debian Codegraph @

src/FDM/JSBSim/input_output/FGInputType.cpp

raw symbols SCIP
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3 Module: FGInputType.cpp
4 Author: Paul Chavent
5 Date started: 01/20/15
6 Purpose: Manage input of sim parameters to file or stdout
7
8 ------------- Copyright (C) 2015 Paul Chavent -------------
9
10 This program is free software; you can redistribute it and/or modify it under
11 the terms of the GNU Lesser General Public License as published by the Free
12 Software Foundation; either version 2 of the License, or (at your option) any
13 later version.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
18 details.
19
20 You should have received a copy of the GNU Lesser General Public License along
21 with this program; if not, write to the Free Software Foundation, Inc., 59
22 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
24 Further information about the GNU Lesser General Public License can also be
25 found on the world wide web at http://www.gnu.org.
26
27 FUNCTIONAL DESCRIPTION
28 --------------------------------------------------------------------------------
29 This is the place where you create input routines to dump data for perusal
30 later.
31
32 HISTORY
33 --------------------------------------------------------------------------------
34 01/20/15 PC Created
35
36 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37 INCLUDES
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
39
40 #include "FGInputType.h"
41
42 using namespace std;
43
44 namespace JSBSim {
45
46 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47 CLASS IMPLEMENTATION
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
49
50 FGInputType::FGInputType(FGFDMExec* fdmex) :
51 FGModel(fdmex), enabled(true)
52 {
53 Debug(0);
54 }
55
56 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57
58 FGInputType::~FGInputType()
59 {
60 Debug(1);
61 }
62
63 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64
65 void FGInputType::SetIdx(unsigned int idx)
66 {
67 InputIdx = idx;
68 }
69
70 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
71
72 bool FGInputType::Load(Element* element)
73 {
74 // Perform base class Load.
75 if(!FGModel::Upload(element, true))
76 return false;
77
78 // no common attributes yet (see FGOutputType for example
79
80 // FIXME : PostLoad should be called in the most derived class ?
81 PostLoad(element, FDMExec);
82
83 return true;
84 }
85
86 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
87
88 bool FGInputType::InitModel(void)
89 {
90 bool ret = FGModel::InitModel();
91
92 Debug(2);
93 return ret;
94 }
95
96 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
97
98 bool FGInputType::Run(bool Holding)
99 {
100 if (FGModel::Run(Holding)) return true;
101 if (!enabled) return true;
102
103 RunPreFunctions();
104 Read(Holding);
105 RunPostFunctions();
106
107 Debug(4);
108
109 return false;
110 }
111
112 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
113 // The bitmasked value choices are as follows:
114 // unset: In this case (the default) JSBSim would only print
115 // out the normally expected messages, essentially echoing
116 // the config files as they are read. If the environment
117 // variable is not set, debug_lvl is set to 1 internally
118 // 0: This requests JSBSim not to input any messages
119 // whatsoever.
120 // 1: This value explicity requests the normal JSBSim
121 // startup messages
122 // 2: This value asks for a message to be printed out when
123 // a class is instantiated
124 // 4: When this value is set, a message is displayed when a
125 // FGModel object executes its Run() method
126 // 8: When this value is set, various runtime state variables
127 // are printed out periodically
128 // 16: When set various parameters are sanity checked and
129 // a message is printed out when they go out of bounds
130
131 void FGInputType::Debug(int from)
132 {
133 if (debug_lvl <= 0) return;
134
135 if (debug_lvl & 1) { // Standard console startup message input
136 if (from == 0) { // Constructor
137
138 }
139 if (from == 2) {
140 }
141 }
142 if (debug_lvl & 2 ) { // Instantiation/Destruction notification
143 if (from == 0) cout << "Instantiated: FGInputType" << endl;
144 if (from == 1) cout << "Destroyed: FGInputType" << endl;
145 }
146 if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
147 }
148 if (debug_lvl & 8 ) { // Runtime state variables
149 }
150 if (debug_lvl & 16) { // Sanity checking
151 }
152 if (debug_lvl & 64) {
153 if (from == 0) { // Constructor
154 }
155 }
156 }
157 }