From: Ovidiu Mircescu Date: Thu, 10 Sep 2015 15:46:31 +0000 (+0200) Subject: Set a default value of 1 for nbBranches of foreachloop in the built-in catalog. X-Git-Tag: V7_7_0b1~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=87690b6334df5f9b047825a8feb57293e358b13e;p=modules%2Fyacs.git Set a default value of 1 for nbBranches of foreachloop in the built-in catalog. There was a minor GUI issue where the displayed value of nbBranches was 1, but actually it was not set. --- diff --git a/src/engine/Runtime.cxx b/src/engine/Runtime.cxx index c54ce5925..91775a2c8 100644 --- a/src/engine/Runtime.cxx +++ b/src/engine/Runtime.cxx @@ -86,15 +86,10 @@ Runtime::Runtime() DEBTRACE( "_tc_stringpair refcnt: " << Runtime::_tc_stringpair->getRefCnt() ); DEBTRACE( "_tc_propvec refcnt: " << Runtime::_tc_propvec->getRefCnt() ); _builtinCatalog = new Catalog("builtins"); - _builtinCatalog->_composednodeMap["Bloc"]=createBloc("Bloc"); - _builtinCatalog->_composednodeMap["Switch"]=createSwitch("Switch"); - _builtinCatalog->_composednodeMap["WhileLoop"]=createWhileLoop("WhileLoop"); - _builtinCatalog->_composednodeMap["ForLoop"]=createForLoop("ForLoop"); - _builtinCatalog->_composednodeMap["ForEachLoop_double"]=createForEachLoop("ForEachLoop_double",Runtime::_tc_double); - _builtinCatalog->_composednodeMap["ForEachLoop_string"]=createForEachLoop("ForEachLoop_string",Runtime::_tc_string); - _builtinCatalog->_composednodeMap["ForEachLoop_int"]=createForEachLoop("ForEachLoop_int",Runtime::_tc_int); - _builtinCatalog->_composednodeMap["ForEachLoop_bool"]=createForEachLoop("ForEachLoop_bool",Runtime::_tc_bool); std::map& typeMap=_builtinCatalog->_typeMap; + /* All composed node creations are moved to RuntimeSALOME::initBuiltins. + It is not safe to have all those calls to virtual functions (create*) + in the constructor. */ Runtime::_tc_double->incrRef(); typeMap["double"]=Runtime::_tc_double; Runtime::_tc_int->incrRef(); @@ -255,7 +250,9 @@ ForLoop* Runtime::createForLoop(const std::string& name) ForEachLoop* Runtime::createForEachLoop(const std::string& name,TypeCode *type) { - return new ForEachLoop(name,type); + ForEachLoop* ret = new ForEachLoop(name,type); + ret->edGetNbOfBranchesPort()->edInit(1); + return ret; } OptimizerLoop* Runtime::createOptimizerLoop(const std::string& name,const std::string& algLib,const std::string& factoryName,bool algInitOnFile, diff --git a/src/runtime/RuntimeSALOME.cxx b/src/runtime/RuntimeSALOME.cxx index 1727e6426..0ac34e183 100644 --- a/src/runtime/RuntimeSALOME.cxx +++ b/src/runtime/RuntimeSALOME.cxx @@ -43,6 +43,7 @@ #include "PresetPorts.hxx" #include "InputDataStreamPort.hxx" #include "OutputDataStreamPort.hxx" +#include "Switch.hxx" #include "SalomeProc.hxx" #include "PyStdout.hxx" //Catalog Loaders @@ -181,6 +182,14 @@ void RuntimeSALOME::initBuiltins() std::list ltc; typeMap["pyobj"]= createInterfaceTc("python:obj:1.0","pyobj",ltc); typeMap["seqpyobj"]= createSequenceTc("seqpyobj","seqpyobj",typeMap["pyobj"]); + composednodeMap["Bloc"]=createBloc("Bloc"); + composednodeMap["Switch"]=createSwitch("Switch"); + composednodeMap["WhileLoop"]=createWhileLoop("WhileLoop"); + composednodeMap["ForLoop"]=createForLoop("ForLoop"); + composednodeMap["ForEachLoop_double"]=createForEachLoop("ForEachLoop_double",Runtime::_tc_double); + composednodeMap["ForEachLoop_string"]=createForEachLoop("ForEachLoop_string",Runtime::_tc_string); + composednodeMap["ForEachLoop_int"]=createForEachLoop("ForEachLoop_int",Runtime::_tc_int); + composednodeMap["ForEachLoop_bool"]=createForEachLoop("ForEachLoop_bool",Runtime::_tc_bool); composednodeMap["ForEachLoop_pyobj"]=createForEachLoop("ForEachLoop_pyobj",typeMap["pyobj"]);; ENGINE::TypeCodeStruct *t = createStructTc("","Engines/dataref"); t->addMember("ref",_tc_string);