step[i] = 0 ;
}
VXSize = 0 ;
+ GraphsNumber = 0 ;
+
+ aLinkValue = CORBA::Any();
}
GraphBase::XmlHandler::XmlHandler() {}
GraphBase::XmlHandler::~XmlHandler() {}
-QString GraphBase::XmlHandler::errorProtocol()
-{
- return errorProt;
+QString GraphBase::XmlHandler::errorProtocol() {
+ return errorProt;
}
-bool GraphBase::XmlHandler::startDocument()
-{
- // at the beginning of parsing: do some initialization
- errorProt = "";
- return TRUE;
+bool GraphBase::XmlHandler::startDocument() {
+ MESSAGE( "====================startDocument " ) ;
+// at the beginning of parsing: do some initialization
+ errorProt = "";
+ return TRUE;
+}
+
+bool GraphBase::XmlHandler::endDocument() {
+ MESSAGE( "====================endDocument " ) ;
+ return TRUE;
}
bool GraphBase::XmlHandler::startElement( const QString&, const QString&,
MESSAGE( "====================startElement " << depth << " " << qName)
#endif
- if ( qName == "dataflow" && depth == 0 ) {
+
+ if ( ( qName == "dataflow" || qName == "supergraph" ) && depth == 0 ) {
// Dataflow detected
+ aListOfDataFlows.resize( GraphsNumber + 1 ) ;
+ int i ;
+ for ( i = 0 ; i < maxlevel ; i++ ) {
+ fieldname[i] = NULLSTRING ;
+ fieldvalue[i] = NULLSTRING ;
+ step[i] = 0 ;
+ }
+ VXSize = 0 ;
dataflowxml = TRUE;
}
if ( dataflowxml ) {
-// fieldname[depth++] = (const char * ) qName ;
- fieldname[depth++] = qName.latin1() ;
+ if ( qName == "supergraph" ) {
+ fieldname[depth] = qName.latin1() ;
+ }
+ else {
+ fieldname[depth++] = qName.latin1() ;
+ }
}
if ( depth == maxlevel+1 )
return false ;
const QString&,
const QString& qName) {
+ if ( qName == "supergraph" ) {
+#if TRACE
+ MESSAGE( " ====================endElement supergraph" ) ;
+#endif
+ return TRUE ;
+ }
+
+// ERRORs :
+// * On a eu endElement(dataflow)
+// * Ou bien on a eu uniquement startElement(dataflow) et qName != fieldname et fieldvalue != NULLSTRING
if ( !dataflowxml ||
( qName != QString( fieldname[depth].c_str() ) &&
fieldvalue[depth] != NULLSTRING ) ) {
- MESSAGE( "endElement ERROR " << dataflowxml << " qName " << qName
- << " fieldname" << fieldname[depth] << " fieldvalue "
+ MESSAGE( "endElement ERROR dataflowxml " << dataflowxml << " qName " << qName
+ << " fieldname[" << depth << "] "<< fieldname[depth] << " fieldvalue "
<< fieldvalue[depth] )
return returnfalse( this , "top" , qName ) ;
}
- if ( fieldvalue[depth] == NULLSTRING )
+ if ( fieldvalue[depth] == NULLSTRING ) {
depth -= 1 ;
+ }
#if TRACE
- MESSAGE( " ==========endElement step[" << depth << "]="
+ MESSAGE( " ====================endElement step[" << depth << "]="
<< step[depth] << " qName " << qName << " fieldvalue '"
<< fieldvalue[depth] << "'")
#endif
switch ( depth ) {
case 0 : {
if ( step[depth] == 0 && qName == "dataflow" ) {
+ GraphsNumber += 1 ;
dataflowxml = false ;
}
else
switch ( step[depth] ) {
case 0 :
if ( qName == "info-list" ) {
-// aDataFlow.Info = aNode ;
+// aListOfDataFlows[ GraphsNumber ].Info = aNode ;
step[depth]++ ;
}
else
if ( qName == "node" ) {
// Node ok
if ( step[1] == 0 ) {
- aDataFlow.Info = aNode ;
+ aListOfDataFlows[ GraphsNumber ].Info = aNode ;
}
else if ( step[1] == 1 ) {
- int sizenode = aDataFlow.Nodes.size() ;
- aDataFlow.Nodes.resize( sizenode+1 ) ;
- aDataFlow.Nodes[ sizenode ] = aNode ;
+ int sizenode = aListOfDataFlows[ GraphsNumber ].Nodes.size() ;
+ aListOfDataFlows[ GraphsNumber ].Nodes.resize( sizenode+1 ) ;
+ aListOfDataFlows[ GraphsNumber ].Nodes[ sizenode ] = aNode ;
}
step[3] = 0 ;
aNode.theService.ServiceinParameter.length( 0 ) ;
aNode.theService.ServiceoutParameter.length( 0 ) ;
- aNode.theListOfParameters.resize( 0 ) ;
+ aNode.theListOfInDataStreams.resize( 0 ) ;
+ aNode.theListOfOutDataStreams.resize( 0 ) ;
aNode.theListOfFuncName.resize( 0 ) ;
aNode.theListOfPythonFunctions.resize( 0 ) ;
break ;
}
case 1 :
if ( qName == "link" ) {
- int sizelink = aDataFlow.Links.size() ;
- aDataFlow.Links.resize( sizelink+1 ) ;
- aDataFlow.Links[ sizelink ] = aLink ;
+ int sizelink = aListOfDataFlows[ GraphsNumber ].Links.size() ;
+ aListOfDataFlows[ GraphsNumber ].Links.resize( sizelink+1 ) ;
+ aListOfDataFlows[ GraphsNumber ].Links[ sizelink ] = aLink ;
if ( VXSize ) {
- aDataFlow.Links[ sizelink ].aListOfCoords.resize( VXSize ) ;
+ aListOfDataFlows[ GraphsNumber ].Links[ sizelink ].aListOfCoords.resize( VXSize ) ;
int ic ;
for ( ic = 0 ; ic < VXSize ; ic++ ) {
- aDataFlow.Links[ sizelink ].aListOfCoords[ ic ].theX = VX[ic] ;
- aDataFlow.Links[ sizelink ].aListOfCoords[ ic ].theY = VY[ic] ;
+ aListOfDataFlows[ GraphsNumber ].Links[ sizelink ].aListOfCoords[ ic ].theX = VX[ic] ;
+ aListOfDataFlows[ GraphsNumber ].Links[ sizelink ].aListOfCoords[ ic ].theY = VY[ic] ;
}
}
VXSize = 0 ;
if ( qName == "data" ) {
// Data ok
if ( constructor ) {
- int sizedata = aDataFlow.Datas.size() ;
- aDataFlow.Datas.resize( sizedata+1 ) ;
- aDataFlow.Datas[ sizedata ] = aLink ;
+ int sizedata = aListOfDataFlows[ GraphsNumber ].Datas.size() ;
+ aListOfDataFlows[ GraphsNumber ].Datas.resize( sizedata+1 ) ;
+
+ if ( aLink.aLinkValue.type()->kind() == CORBA::tk_double ) // mkr : PAL12235
+ aLink.aLinkValue = *aLinkDoubleValue ;
+
+ aListOfDataFlows[ GraphsNumber ].Datas[ sizedata ] = aLink ;
+
if ( VXSize ) {
- aDataFlow.Datas[ sizedata ].aListOfCoords.resize( VXSize ) ;
+ aListOfDataFlows[ GraphsNumber ].Datas[ sizedata ].aListOfCoords.resize( VXSize ) ;
int ic ;
for ( ic = 0 ; ic < VXSize ; ic++ ) {
- aDataFlow.Datas[ sizedata ].aListOfCoords[ ic ].theX = VX[ic] ;
- aDataFlow.Datas[ sizedata ].aListOfCoords[ ic ].theY = VY[ic] ;
+ aListOfDataFlows[ GraphsNumber ].Datas[ sizedata ].aListOfCoords[ ic ].theX = VX[ic] ;
+ aListOfDataFlows[ GraphsNumber ].Datas[ sizedata ].aListOfCoords[ ic ].theY = VY[ic] ;
}
}
}
// kind ok
sscanf( fieldvalue[depth].c_str() ,"%d" , (int * ) &aNode.theKind ) ;
fieldvalue[depth] = NULLSTRING ;
+ if ( aNode.theKind != SUPERV::DataStreamGraph ) {
+ step[depth]++ ;
+ step[4] = 0 ;
+ }
+ break ;
+ }
+ else if ( qName == "streamgraph-timeout" ) {
+ if ( fieldvalue[depth] == NULLSTRING )
+ return returnfalse( this , "depth3-3" , qName ) ;
+ sscanf( fieldvalue[depth].c_str() ,"%d" , (int * ) &aNode.theTimeout ) ;
+ fieldvalue[depth] = NULLSTRING ;
+// step[depth]++ ;
+// step[4] = 0 ;
+ break ;
+ }
+ else if ( qName == "streamgraph-datastreamtrace" ) {
+ if ( fieldvalue[depth] == NULLSTRING )
+ return returnfalse( this , "depth3-3" , qName ) ;
+ sscanf( fieldvalue[depth].c_str() ,"%d" , (int * ) &aNode.theDataStreamTrace ) ;
+ fieldvalue[depth] = NULLSTRING ;
+// step[depth]++ ;
+// step[4] = 0 ;
+ break ;
+ }
+ else if ( qName == "streamgraph-deltatime" ) {
+ if ( fieldvalue[depth] == NULLSTRING )
+ return returnfalse( this , "depth3-3" , qName ) ;
+ sscanf( fieldvalue[depth].c_str() ,"%lf" , (double * ) &aNode.theDeltaTime ) ;
+ fieldvalue[depth] = NULLSTRING ;
step[depth]++ ;
step[4] = 0 ;
+ break ;
}
- else
- return returnfalse( this , "depth3-3" , qName ) ;
- break ;
+ else {
+ step[depth]++ ;
+ step[4] = 0 ;
+ }
+// return returnfalse( this , "depth3-3" , qName ) ;
+// break ;
case 4 :
if ( qName == "coupled-node" ) {
if ( fieldvalue[depth] == NULLSTRING )
return returnfalse( this , "depth3-5" , qName ) ;
break ;
case 6 :
- if ( qName == "Parameter-list" ) {
+ if ( qName == "DataStream-list" || qName == "Parameter-list" ) {
if ( fieldvalue[depth] != NULLSTRING )
return returnfalse( this , "depth3-6" , qName ) ;
fieldvalue[depth] = NULLSTRING ;
aLink.aLinkValue = CORBA::Any() ;
switch ( Kind ) {
case CORBA::tk_string: {
- aLink.aLinkValue <<= (char *) NULL ;
+//Mandrake 10.1/Salome 3 aLink.aLinkValue <<= (char *) NULL ;
+ aLink.aLinkValue <<= (char *) "" ;
char * t;
aLink.aLinkValue >>= t;
#if TRACE
break;
}
case CORBA::tk_double: {
- aLink.aLinkValue <<= (double ) 0. ;
- double d;
+ //aLink.aLinkValue <<= (double ) 0. ;
+ double d = 0.;
+ aLink.aLinkValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
aLink.aLinkValue >>= d;
#if TRACE
MESSAGE( d << " (double)" );
if ( fieldvalue[depth] == NULLSTRING )
return returnfalse( this , "depth4-4" , qName ) ;
if ( !strcmp( fieldvalue[depth].c_str() , "?" ) ) {
-// aLink.aLinkValue.Value = fieldvalue[depth].c_str() ;
- aLink.aLinkValue = CORBA::Any() ; // ???
+ aLink.aLinkValue <<= "" ;
}
else {
switch ( aLink.aLinkValue.type()->kind() ) {
case CORBA::tk_double: {
double d;
sscanf( fieldvalue[depth].c_str() , "%lf" , &d ) ;
- aLink.aLinkValue <<= d;
+ //aLink.aLinkValue <<= d;
+ aLink.aLinkValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+ aLinkValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+ aLinkDoubleValue = new CORBA::Any( aLinkValue );
#if TRACE
- MESSAGE( d << " (double)" );
+ MESSAGE( d << " (double)" );
#endif
break;
}
if ( qName == "inParameter" ) {
if ( fieldvalue[depth] != NULLSTRING )
return returnfalse( this , "depth4-6" , qName ) ;
- int size = aNode.theListOfParameters.size() ;
- aNode.theListOfParameters.resize( size+1 ) ;
- aNode.theListOfParameters[size].theInParameter = aParameter ;
- step[depth]++ ;
+ int size = aNode.theListOfInDataStreams.size() ;
+ aNode.theListOfInDataStreams.resize( size+1 ) ;
+ aNode.theListOfInDataStreams[ size ] = anInDataStreamParameter ;
+ break ;
// One more aParameter input
}
else
- return returnfalse( this , "depth4-6" , qName ) ;
- break ;
+ step[depth]++ ;
+// return returnfalse( this , "depth4-6" , qName ) ;
+// break ;
case 7 :
if ( qName == "outParameter" ) {
if ( fieldvalue[depth] != NULLSTRING )
return returnfalse( this , "depth4-7" , qName ) ;
- int size = aNode.theListOfParameters.size() ;
- aNode.theListOfParameters[size-1].theOutParameter = aParameter ;
+ int size = aNode.theListOfOutDataStreams.size() ;
+ aNode.theListOfOutDataStreams.resize( size+1 ) ;
+ aNode.theListOfOutDataStreams[ size ] = anOutDataStreamParameter ;
// One more aParameter output
step[4] = 6 ;
step[5] = 4 ;
if ( qName == "inParameter-type" ) {
if ( fieldvalue[depth] == NULLSTRING )
return returnfalse( this , "depth5-4" , qName ) ;
- if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
- aParameter.Parametertype = fieldvalue[depth].c_str() ;
- }
- else {
- aParameter.Parametertype = "" ;
- }
+ sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theDataStreamParameter.Parametertype ) ;
fieldvalue[depth] = NULLSTRING ;
step[depth]++ ;
+#if TRACE
+ //cout << "InDataStreamParameter.inParameter-type " << anInDataStreamParameter.theDataStreamParameter.Parametertype << " step[" << depth << "]" << step[depth] << endl ;
+#endif
+ break ;
}
else
- return returnfalse( this , "depth5-4" , qName ) ;
- break ;
+ step[depth] = 6 ;
+// return returnfalse( this , "depth5-4" , qName ) ;
+// break ;
case 5 :
if ( qName == "inParameter-name" ) {
if ( fieldvalue[depth] == NULLSTRING )
return returnfalse( this , "depth5-5" , qName ) ;
if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
- aParameter.Parametername = fieldvalue[depth].c_str() ;
+ anInDataStreamParameter.theDataStreamParameter.Parametername = fieldvalue[depth].c_str() ;
}
else {
- aParameter.Parametername = "" ;
+ anInDataStreamParameter.theDataStreamParameter.Parametername = "" ;
}
fieldvalue[depth] = NULLSTRING ;
- step[depth]++ ;
+#if TRACE
+ //cout << "InDataStreamParameter.inParameter-name " << anInDataStreamParameter.theDataStreamParameter.Parametername << " step[" << depth << "]" << step[depth] << endl ;
+#endif
+// step[depth]++ ;
+// step[depth] = 4 ;
+ break ;
}
- else
- return returnfalse( this , "depth5-5" , qName ) ;
- break ;
+ else if ( qName == "inParameter-dependency" ) {
+ if ( fieldvalue[depth] == NULLSTRING )
+ return returnfalse( this , "depth5-5" , qName ) ;
+ sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theDataStreamParameter.Parameterdependency ) ;
+ fieldvalue[depth] = NULLSTRING ;
+#if TRACE
+ //cout << "InDataStreamParameter.inParameter-dependency " << anInDataStreamParameter.theDataStreamParameter.Parameterdependency << " step[" << depth << "]"
+ // << step[depth] << endl ;
+#endif
+// step[depth]++ ;
+// step[depth] = 4 ;
+ break ;
+ }
+ else if ( qName == "inParameter-schema" ) {
+ if ( fieldvalue[depth] == NULLSTRING )
+ return returnfalse( this , "depth5-5" , qName ) ;
+ sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theKindOfSchema ) ;
+ fieldvalue[depth] = NULLSTRING ;
+#if TRACE
+ //cout << "InDataStreamParameter.inParameter-schema " << anInDataStreamParameter.theKindOfSchema << " step[" << depth << "]"
+ // << step[depth] << endl ;
+#endif
+// step[depth]++ ;
+// step[depth] = 4 ;
+ break ;
+ }
+ else if ( qName == "inParameter-interpolation" ) {
+ if ( fieldvalue[depth] == NULLSTRING )
+ return returnfalse( this , "depth5-5" , qName ) ;
+ sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theKindOfInterpolation ) ;
+ fieldvalue[depth] = NULLSTRING ;
+#if TRACE
+ //cout << "InDataStreamParameter.inParameter-interpolation " << anInDataStreamParameter.theKindOfInterpolation << " step[" << depth << "]"
+ // << step[depth] << endl ;
+#endif
+// step[depth]++ ;
+// step[depth] = 4 ;
+ break ;
+ }
+ else if ( qName == "inParameter-extrapolation" ) {
+ if ( fieldvalue[depth] == NULLSTRING )
+ return returnfalse( this , "depth5-5" , qName ) ;
+ sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theKindOfExtrapolation ) ;
+ fieldvalue[depth] = NULLSTRING ;
+// step[depth]++ ;
+ step[depth] = 4 ;
+#if TRACE
+ //cout << "InDataStreamParameter.inParameter-extrapolation " << anInDataStreamParameter.theKindOfExtrapolation << " step[" << depth << "]"
+ // << step[depth] << endl ;
+#endif
+ break ;
+ }
+// else
+// return returnfalse( this , "depth5-5" , qName ) ;
+// break ;
case 6 :
if ( qName == "outParameter-type" ) {
if ( fieldvalue[depth] == NULLSTRING )
return returnfalse( this , "depth5-6" , qName ) ;
- if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
- aParameter.Parametertype = fieldvalue[depth].c_str() ;
- }
- else {
- aParameter.Parametertype = "" ;
- }
+ sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anOutDataStreamParameter.theDataStreamParameter.Parametertype ) ;
fieldvalue[depth] = NULLSTRING ;
- step[depth]++ ;
+// step[depth]++ ;
+ step[depth] = 7 ;
+#if TRACE
+ //cout << "OutDataStreamParameter.outParameter-type " << anOutDataStreamParameter.theDataStreamParameter.Parametertype << " step[" << depth << "]"
+ // << step[depth] << endl ;
+#endif
}
else
return returnfalse( this , "depth5-6" , qName ) ;
if ( fieldvalue[depth] == NULLSTRING )
return returnfalse( this , "depth5-7" , qName ) ;
if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
- aParameter.Parametername = fieldvalue[depth].c_str() ;
+ anOutDataStreamParameter.theDataStreamParameter.Parametername = fieldvalue[depth].c_str() ;
}
else {
- aParameter.Parametername = "" ;
+ anOutDataStreamParameter.theDataStreamParameter.Parametername = "" ;
}
fieldvalue[depth] = NULLSTRING ;
- step[depth]++ ;
+#if TRACE
+ //cout << "OutDataStreamParameter.outParameter-name " << anOutDataStreamParameter.theDataStreamParameter.Parametername << " step[" << depth << "]"
+ // << step[depth] << endl ;
+#endif
+// step[depth]++ ;
+// step[depth] = 6 ;
+ }
+ else if ( qName == "outParameter-dependency" ) {
+ if ( fieldvalue[depth] == NULLSTRING )
+ return returnfalse( this , "depth5-7" , qName ) ;
+ sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anOutDataStreamParameter.theDataStreamParameter.Parameterdependency ) ;
+ fieldvalue[depth] = NULLSTRING ;
+#if TRACE
+ //cout << "OutDataStreamParameter.outParameter-dependency " << anOutDataStreamParameter.theDataStreamParameter.Parameterdependency << " step[" << depth << "]"
+ // << step[depth] << endl ;
+#endif
+// step[depth]++ ;
+// step[depth] = 6 ;
+ }
+ else if ( qName == "outParameter-values" ) {
+ if ( fieldvalue[depth] == NULLSTRING )
+ return returnfalse( this , "depth5-7" , qName ) ;
+ sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anOutDataStreamParameter.theNumberOfValues ) ;
+ fieldvalue[depth] = NULLSTRING ;
+// step[depth]++ ;
+ step[depth] = 6 ;
+#if TRACE
+ //cout << "OutDataStreamParameter.outParameter-values " << anOutDataStreamParameter.theNumberOfValues << " step[" << depth << "]"
+ // << step[depth] << endl ;
+#endif
}
else
return returnfalse( this , "depth5-7" , qName ) ;
}
}
+#if TRACE
+ //cout << "return from endElement " << qName << " step[" << depth << "]" << step[depth] << endl ;
+#endif
return TRUE;
}
depth -= 1 ;
#if TRACE
MESSAGE( "characters step[" << depth << "]=" << step[depth]
- << " ch " << ch << " fieldvalue_must_be_NULL " << fieldvalue[depth] )
+ << " ch " << ch << " fieldvalue_must_be_NULL : '" << fieldvalue[depth] << "'" ) ;
#endif
if ( depth < 0 || fieldvalue[depth] != NULLSTRING )
return returnfalse( this , "characters " , ch ) ;
QString GraphBase::XmlHandler::errorString() {
- cout << "the document is not in the quote file format" << endl ;
+ //cout << "the document is not in the quote file format" << endl ;
return "the document is not in the quote file format";
}
.arg( exception.message() )
.arg( exception.lineNumber() )
.arg( exception.columnNumber() );
- cout << "GraphBase::XmlHandler::fatalError " << errorProt.latin1() << endl ;
+ //cout << "GraphBase::XmlHandler::fatalError " << errorProt.latin1() << endl ;
return QXmlDefaultHandler::fatalError( exception );
}