- SGPropertyNode *child;
- int ccount = node->nChildren();
- for ( j = 0; j < ccount; ++j ) {
- child = node->getChild(j);
- string cname = child->getName();
- string cval = child->getStringValue();
- // cout << " " << cname << " = " << cval << endl;
- if ( cname == "input" ) {
- FGElectricalComponent *s = find( child->getStringValue() );
- if ( s != NULL ) {
- c->add_input( s );
- if ( s->get_kind() == FG_SUPPLIER ) {
- s->add_output( c );
- } else if ( s->get_kind() == FG_BUS ) {
- s->add_output( c );
- } else {
- SG_LOG( SG_ALL, SG_ALERT,
- "Attempt to connect to something that can't provide an output: "
- << child->getStringValue() );
- return false;
- }
- } else {
- SG_LOG( SG_ALL, SG_ALERT,
- "Can't find named source: "
- << child->getStringValue() );
- return false;
- }
- } else if ( cname == "output" ) {
- FGElectricalComponent *s = find( child->getStringValue() );
- if ( s != NULL ) {
- c->add_output( s );
- if ( s->get_kind() == FG_BUS ) {
- s->add_input( c );
- } else if ( s->get_kind() == FG_OUTPUT ) {
- s->add_input( c );
- } else {
- SG_LOG( SG_ALL, SG_ALERT,
- "Attempt to connect to something that can't provide an input: "
- << child->getStringValue() );
- return false;
- }
- } else {
- SG_LOG( SG_ALL, SG_ALERT,
- "Can't find named source: "
- << child->getStringValue() );
- return false;
- }
- } else if ( cname == "switch" ) {
- // set default value of switch to true
- // cout << "Switch = " << child->getStringValue() << endl;
- fgSetBool( child->getStringValue(), true );
- c->add_switch( fgGetNode( child->getStringValue(), true ) );
- }
- }