59 if (type_string ==
"inclusive") Type = eInclusive;
60 else if (type_string ==
"exclusive") Type = eExclusive;
62 throw(
"Not a known Distributor type, "+type_string);
66 while (case_element) {
67 Case* current_case =
new Case;
71 while (prop_val_element) {
73 string property_string = prop_val_element->
GetDataLine();
74 current_case->AddPropValPair(
new PropValPair(property_string, value_string,
PropertyManager));
77 Cases.push_back(current_case);
88 for (
auto Case: Cases)
delete Case;
96 bool completed =
false;
97 for (
auto Case: Cases) {
98 if (Case->HasTest()) {
99 if (Case->GetTestResult() && !((Type == eExclusive) && completed)) {
100 Case->SetPropValPairs();
104 Case->SetPropValPairs();
130void FGDistributor::Debug(
int from)
137 for (
auto Case: Cases) {
138 std::cout <<
" Case: " << ctr << endl;
139 if (Case->HasTest()) {
140 Case->GetTest()->PrintCondition(
" ");
142 std::cout <<
" Set these properties by default: " << std::endl;
144 std::cout << std::endl;
145 for (
auto propVal = Case->IterPropValPairs(); propVal != Case->EndPropValPairs(); ++propVal) {
146 std::cout <<
" Set property " << (*propVal)->GetPropName();
147 if ((*propVal)->GetLateBoundProp()) std::cout <<
" (late bound)";
148 std::cout <<
" to " << (*propVal)->GetValString();
149 if ((*propVal)->GetLateBoundValue()) std::cout <<
" (late bound)";
150 std::cout << std::endl;
157 if (from == 0) cout <<
"Instantiated: FGDistributor" << endl;
158 if (from == 1) cout <<
"Destroyed: FGDistributor" << endl;
std::string GetDataLine(unsigned int i=0)
Gets a line of data belonging to an element.
std::string GetAttributeValue(const std::string &key)
Retrieves an attribute.
Element * FindElement(const std::string &el="")
Searches for a specified element.
Element * FindNextElement(const std::string &el="")
Searches for the next element as specified.
Encapsulates a condition, which is used in parts of JSBSim including switches.
~FGDistributor()
Destructor.
bool Run(void) override
Executes the distributor logic.
FGDistributor(FGFCS *fcs, Element *element)
Constructor.
FGFCSComponent(FGFCS *fcs, Element *el)
Constructor.
FGPropertyManager * PropertyManager
virtual void bind(Element *el)