65 #include "math/FGCondition.h"
84 current_test =
new Test;
86 current_test->setTestValue(value, Name, PropertyManager);
87 current_test->Default =
true;
88 if (delay > 0 && is_number(value)) {
89 for (
unsigned int i=0; i<delay-1; i++) {
90 output_array[i] = atof(value.c_str());
93 tests.push_back(current_test);
97 while (test_element) {
98 current_test =
new Test;
99 current_test->condition =
new FGCondition(test_element, PropertyManager);
101 current_test->setTestValue(value, Name, PropertyManager);
102 tests.push_back(current_test);
113 for (
auto test: tests) {
114 delete test->condition;
126 double default_output=0.0;
135 for (
auto test: tests) {
137 default_output = test->OutputValue->GetValue();
139 pass = test->condition->Evaluate();
143 Output = test->OutputValue->GetValue();
148 if (!pass) Output = default_output;
150 if (delay != 0) Delay();
159 void FGSwitch::VerifyProperties(
void)
161 for (
auto test: tests) {
162 if (!test->Default) {
163 test->condition->Evaluate();
165 test->OutputValue->GetValue();
188 void FGSwitch::Debug(
int from)
190 if (debug_lvl <= 0)
return;
195 for (
auto test: tests) {
197 cout <<
" Switch default value is: " << test->GetOutputName();
199 cout <<
" Switch takes test " << i <<
" value (" << test->GetOutputName() <<
")" << endl;
201 test->condition->PrintCondition(
" ");
206 for (
auto node: OutputNodes)
207 cout <<
" OUTPUT: " << node->getNameString() << endl;
210 if (debug_lvl & 2 ) {
211 if (from == 0) cout <<
"Instantiated: FGSwitch" << endl;
212 if (from == 1) cout <<
"Destroyed: FGSwitch" << endl;
214 if (debug_lvl & 4 ) {
216 if (debug_lvl & 8 ) {
218 if (debug_lvl & 16) {
220 if (debug_lvl & 64) {