// Read parameters
TParameters* parameters = new_filter->GetParameters( );
- parameters->Clear( );
-
- TiXmlElement* param = filter->FirstChildElement( "parameter" );
- while( param != NULL )
- {
- const char* param_name = param->Attribute( "name" );
- const char* param_type = param->Attribute( "type" );
- if( param_name != NULL && param_type != NULL )
- {
- std::string param_type_str( param_type );
- const char* value = param->Attribute( "value" );
- if( value != NULL )
- {
- if( param_type_str == "String" )
- parameters->ConfigureAsString( param_name );
- else if( param_type_str == "Bool" )
- parameters->ConfigureAsBool( param_name );
- else if( param_type_str == "Int" )
- parameters->ConfigureAsInt( param_name );
- else if( param_type_str == "Uint" )
- parameters->ConfigureAsUint( param_name );
- else if( param_type_str == "Real" )
- parameters->ConfigureAsReal( param_name );
- else if( param_type_str == "Index" )
- parameters->ConfigureAsIndex( param_name );
- else if( param_type_str == "Point" )
- parameters->ConfigureAsPoint( param_name );
- else if( param_type_str == "Vector" )
- parameters->ConfigureAsVector( param_name );
- else if( param_type_str == "StringList" )
- parameters->ConfigureAsStringList( param_name );
- else if( param_type_str == "BoolList" )
- parameters->ConfigureAsBoolList( param_name );
- else if( param_type_str == "IntList" )
- parameters->ConfigureAsIntList( param_name );
- else if( param_type_str == "UintList" )
- parameters->ConfigureAsUintList( param_name );
- else if( param_type_str == "RealList" )
- parameters->ConfigureAsRealList( param_name );
- else if( param_type_str == "IndexList" )
- parameters->ConfigureAsIndexList( param_name );
- else if( param_type_str == "PointList" )
- parameters->ConfigureAsPointList( param_name );
- else if( param_type_str == "VectorList" )
- parameters->ConfigureAsVectorList( param_name );
- else if( param_type_str == "Choices" )
- parameters->ConfigureAsChoices( param_name );
- parameters->SetString( param_name, value, false );
-
- } // fi
-
- } // fi
- param = param->NextSiblingElement( "parameter" );
-
- } // elihw
+ parameters->FromXML( filter );
}
else
err
} // elihw
+ // Read exposed inputs
+ TiXmlElement* port = root->FirstChildElement( "exposed_input_port" );
+ while( port != NULL )
+ {
+ this->ExposeInputPort(
+ port->Attribute( "port_name" ),
+ port->Attribute( "filter" ),
+ port->Attribute( "filter_port_name" )
+ );
+ port = connection->NextSiblingElement( "exposed_input_port" );
+
+ } // elihw
+
+ // Read exposed outputs
+#error ACA VOY
+ port = root->FirstChildElement( "exposed_output_port" );
+ while( port != NULL )
+ {
+ this->ExposeOutputPort(
+ port->Attribute( "port_name" ),
+ port->Attribute( "filter" ),
+ port->Attribute( "filter_port_name" )
+ );
+ port = connection->NextSiblingElement( "exposed_output_port" );
+
+ } // elihw
+
// Finish and return
delete doc;
return( err.str( ) );
e->SetAttribute( "ViewY", filter->GetViewY( ) );
const TParameters* params = filter->GetParameters( );
- std::vector< std::string > names;
- params->GetNames( names );
- for( auto nIt = names.begin( ); nIt != names.end( ); ++nIt )
- {
- TiXmlElement* p = new TiXmlElement( "parameter" );
- p->SetAttribute( "name", nIt->c_str( ) );
- if( params->HasString( *nIt ) )
- p->SetAttribute( "type", "String" );
- else if( params->HasBool( *nIt ) )
- p->SetAttribute( "type", "Bool" );
- else if( params->HasInt( *nIt ) )
- p->SetAttribute( "type", "Int" );
- else if( params->HasUint( *nIt ) )
- p->SetAttribute( "type", "Uint" );
- else if( params->HasReal( *nIt ) )
- p->SetAttribute( "type", "Real" );
- else if( params->HasIndex( *nIt ) )
- p->SetAttribute( "type", "Index" );
- else if( params->HasPoint( *nIt ) )
- p->SetAttribute( "type", "Point" );
- else if( params->HasVector( *nIt ) )
- p->SetAttribute( "type", "Vector" );
- else if( params->HasStringList( *nIt ) )
- p->SetAttribute( "type", "StringList" );
- else if( params->HasBoolList( *nIt ) )
- p->SetAttribute( "type", "BoolList" );
- else if( params->HasIntList( *nIt ) )
- p->SetAttribute( "type", "IntList" );
- else if( params->HasUintList( *nIt ) )
- p->SetAttribute( "type", "UintList" );
- else if( params->HasRealList( *nIt ) )
- p->SetAttribute( "type", "RealList" );
- else if( params->HasIndexList( *nIt ) )
- p->SetAttribute( "type", "IndexList" );
- else if( params->HasPointList( *nIt ) )
- p->SetAttribute( "type", "PointList" );
- else if( params->HasVectorList( *nIt ) )
- p->SetAttribute( "type", "VectorList" );
- else if( params->HasChoices( *nIt ) )
- p->SetAttribute( "type", "Choices" );
- p->SetAttribute(
- "value", params->GetString( *nIt, false ).c_str( )
- );
- e->LinkEndChild( p );
+ params->ToXML( e );
- } // rof
root->LinkEndChild( e );
}
else if( data != NULL )
} // rof
+ // Save exposed ports
+ auto eipIt = this->m_ExposedInputPorts.begin( );
+ for( ; eipIt != this->m_ExposedInputPorts.end( ); ++eipIt )
+ {
+ TiXmlElement* port = new TiXmlElement( "exposed_input_port" );
+ port->SetAttribute( "port_name", eipIt->first.c_str( ) );
+ port->SetAttribute( "filter", eipIt->second.first.c_str( ) );
+ port->SetAttribute( "filter_port_name", eipIt->second.second.c_str( ) );
+ root->LinkEndChild( port );
+
+ } // rof
+
+ auto eopIt = this->m_ExposedOutputPorts.begin( );
+ for( ; eopIt != this->m_ExposedOutputPorts.end( ); ++eopIt )
+ {
+ TiXmlElement* port = new TiXmlElement( "exposed_output_port" );
+ port->SetAttribute( "port_name", eopIt->first.c_str( ) );
+ port->SetAttribute( "filter", eopIt->second.first.c_str( ) );
+ port->SetAttribute( "filter_port_name", eopIt->second.second.c_str( ) );
+ root->LinkEndChild( port );
+
+ } // rof
+
// Physical write and return
doc->LinkEndChild( root );
doc->SaveFile( fname.c_str( ) );