#include "FGFCSComponent.h"
#include "input_output/FGPropertyManager.h"
#include "input_output/FGXMLElement.h"
+#include "math/FGPropertyValue.h"
#include <iostream>
#include <cstdlib>
namespace JSBSim {
-static const char *IdSrc = "$Id: FGFCSComponent.cpp,v 1.27 2009/10/24 22:59:30 jberndt Exp $";
+static const char *IdSrc = "$Id: FGFCSComponent.cpp,v 1.32 2011/06/16 03:39:38 jberndt Exp $";
static const char *IdHdr = ID_FCSCOMPONENT;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGFCSComponent::FGFCSComponent(FGFCS* _fcs, Element* element) : fcs(_fcs)
{
Element *input_element, *clip_el;
- Input = Output = clipmin = clipmax = 0.0;
+ Input = Output = clipmin = clipmax = delay_time = 0.0;
treenode = 0;
delay = index = 0;
ClipMinPropertyNode = ClipMaxPropertyNode = 0;
Name = element->GetAttributeValue("name");
- FGPropertyManager *tmp=0;
-
input_element = element->FindElement("input");
while (input_element) {
input = input_element->GetDataLine();
} else {
InputSigns.push_back( 1.0);
}
- tmp = PropertyManager->GetNode(input);
- if (tmp) {
- InputNodes.push_back( tmp );
+ FGPropertyManager* node = 0L;
+ if (PropertyManager->HasNode(input)) {
+ node = PropertyManager->GetNode(input);
+ InputNodes.push_back(new FGPropertyValue( node ));
} else {
- cerr << fgred << " In component: " << Name << " unknown property "
- << input << " referenced. Aborting" << reset << endl;
- exit(-1);
+ InputNodes.push_back(new FGPropertyValue( input,
+ PropertyManager ));
}
+ InputNames.push_back( input );
+
input_element = element->FindNextElement("input");
}
Element* delay_elem = element->FindElement("delay");
if ( delay_elem ) {
- delay = (unsigned int)delay_elem->GetDataAsNumber();
+ delay_time = delay_elem->GetDataAsNumber();
string delayType = delay_elem->GetAttributeValue("type");
if (delayType.length() > 0) {
if (delayType == "time") {
- delay = (int)(delay / dt);
+ delay = (unsigned int)(delay_time / dt);
} else if (delayType == "frames") {
- // no op. the delay type of "frames" is assumed and is the default.
+ delay = (unsigned int)delay_time;
} else {
cerr << "Unallowed delay type" << endl;
}
} else {
- delay = (int)(delay / dt);
+ delay = (unsigned int)(delay_time / dt);
}
output_array.resize(delay);
for (int i=0; i<delay; i++) output_array[i] = 0.0;
FGFCSComponent::~FGFCSComponent()
{
Debug(1);
+ for (unsigned int i=0; i<InputNodes.size(); i++) {
+ delete InputNodes[i];
+ }
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%