+ MESSAGE ( "We have found an engine for data type :"<< compodatatype);
+ //_narrow can throw a corba exception
+ try
+ {
+ CORBA::Object_var obj = _orb->string_to_object(IOREngine);
+ if (!CORBA::is_nil(obj))
+ {
+ SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_narrow(obj) ;
+ if (!anEngine->_is_nil())
+ {
+ SALOMEDS::unlock();
+ anEngine->Close(sco);
+ SALOMEDS::lock();
+ }
+ }
+ }
+ catch (CORBA::Exception&)
+ {/*pass*/ }
+ }
+ sco->UnRegister();
+ }
+
+ //Does not need any more this iterator
+ itcomponent->UnRegister();
+
+
+ _impl->Close();
+}
+
+//============================================================================
+/*! Function : AddPostponed
+ * Purpose :
+ */
+ //============================================================================
+void SALOMEDS_Study_i::AddPostponed(const char* theIOR)
+{
+ SALOMEDS::Locker lock;
+ //Not implemented
+}
+
+void SALOMEDS_Study_i::AddCreatedPostponed(const char* theIOR)
+{
+ SALOMEDS::Locker lock;
+ //Not implemented
+}
+
+//============================================================================
+/*! Function : RemovePostponed
+ * Purpose :
+ */
+//============================================================================
+#ifndef WIN32
+void SALOMEDS_Study_i::RemovePostponed(const CORBA::Long /*theUndoLimit*/)
+#else
+void SALOMEDS_Study_i::RemovePostponed(CORBA::Long /*theUndoLimit*/)
+#endif
+{
+ SALOMEDS::Locker lock;
+
+ std::vector<std::string> anIORs = _impl->GetIORs();
+ int i, aSize = (int)anIORs.size();
+
+ for(i = 0; i < aSize; i++) {
+ try {
+ CORBA::Object_var obj = _orb->string_to_object(anIORs[i].c_str());
+ SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj);
+ //rnv: To avoid double deletion of the Salome Generic Objects:
+ //rnv: 1. First decrement of the reference count in the SALOMEDSImpl_AttributeIOR::~SALOMEDSImpl_AttributeIOR();
+ //rnv: 2. Second decrement of the reference count in the next string : aGeneric->UnRegister();
+ //if (!CORBA::is_nil(aGeneric)) aGeneric->UnRegister();
+ } catch (...) {}
+ }
+
+ //Not implemented
+}
+
+//============================================================================
+/*! Function : UndoPostponed
+ * Purpose :
+ */
+//============================================================================
+#ifndef WIN32
+void SALOMEDS_Study_i::UndoPostponed(const CORBA::Long theWay)
+#else
+void SALOMEDS_Study_i::UndoPostponed(CORBA::Long theWay)
+#endif
+{
+ SALOMEDS::Locker lock;
+ //Not implemented
+}
+
+
+//============================================================================
+/*! Function : DumpStudy
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_Study_i::DumpStudy(const char* thePath,
+ const char* theBaseName,
+ CORBA::Boolean isPublished,
+ CORBA::Boolean isMultiFile)
+{
+ SALOMEDS::Locker lock;
+
+ std::string aPath((char*)thePath), aBaseName((char*)theBaseName);
+ SALOMEDS_DriverFactory_i* factory = new SALOMEDS_DriverFactory_i(_orb);
+ CORBA::Boolean ret = _impl->DumpStudy(aPath, aBaseName, isPublished, isMultiFile, factory);
+ delete factory;
+ return ret;
+}
+
+//============================================================================
+/*! Function : GetCommonParameters
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS::AttributeParameter_ptr SALOMEDS_Study_i::GetCommonParameters(const char* theID, CORBA::Long theSavePoint)
+{
+ SALOMEDS::Locker lock;
+
+ SALOMEDSImpl_AttributeParameter* anAttr = _impl->GetCommonParameters(theID, theSavePoint);
+ SALOMEDS_AttributeParameter_i* SP = new SALOMEDS_AttributeParameter_i(anAttr, _orb);
+ return SP->AttributeParameter::_this();
+}
+
+//============================================================================
+/*! Function : GetCommonModuleParameters
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS::AttributeParameter_ptr SALOMEDS_Study_i::GetModuleParameters(const char* theID,
+ const char* theModuleName,
+ CORBA::Long theSavePoint)
+{
+ SALOMEDS::Locker lock;
+
+ SALOMEDSImpl_AttributeParameter* anAttr = _impl->GetModuleParameters(theID, theModuleName, theSavePoint);
+ SALOMEDS_AttributeParameter_i* SP = new SALOMEDS_AttributeParameter_i(anAttr, _orb);
+ return SP->AttributeParameter::_this();
+}
+
+//============================================================================
+/*! Function : SetStudyLock
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_Study_i::SetStudyLock(const char* theLockerID)
+{
+ SALOMEDS::Locker lock;
+ _impl->SetStudyLock(theLockerID);
+}
+
+//============================================================================
+/*! Function : IsStudyLocked
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDS_Study_i::IsStudyLocked()
+{
+ SALOMEDS::Locker lock;
+ return _impl->IsStudyLocked();
+}
+
+//============================================================================
+/*! Function : UnLockStudy
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_Study_i::UnLockStudy(const char* theLockerID)
+{
+ SALOMEDS::Locker lock;
+ _impl->UnLockStudy(theLockerID);
+}
+
+//============================================================================
+/*! Function : GetLockerID
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetLockerID()
+{
+ SALOMEDS::Locker lock;
+
+ SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings;
+
+ std::vector<std::string> aSeq = _impl->GetLockerID();
+
+ int aLength = aSeq.size();
+ aResult->length(aLength);
+ for(int anIndex = 0; anIndex < aLength; anIndex++) {
+ aResult[anIndex] = CORBA::string_dup(aSeq[anIndex].c_str());
+ }
+ return aResult._retn();
+}
+//============================================================================
+/*! Function : SetReal
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_Study_i::SetReal(const char* theVarName, CORBA::Double theValue)
+{
+ _impl->SetVariable(std::string(theVarName),
+ theValue,
+ SALOMEDSImpl_GenericVariable::REAL_VAR);
+ if(_notifier)
+ _notifier->modifyNB_Notification(theVarName);
+}
+
+//============================================================================
+/*! Function : SetInteger
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_Study_i::SetInteger(const char* theVarName, CORBA::Long theValue)
+{
+ _impl->SetVariable(std::string(theVarName),
+ theValue,
+ SALOMEDSImpl_GenericVariable::INTEGER_VAR);
+ if(_notifier)
+ _notifier->modifyNB_Notification(theVarName);
+}
+
+//============================================================================
+/*! Function : SetBoolean
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_Study_i::SetBoolean(const char* theVarName, CORBA::Boolean theValue)
+{
+ _impl->SetVariable(std::string(theVarName),
+ theValue,
+ SALOMEDSImpl_GenericVariable::BOOLEAN_VAR);
+ if(_notifier)
+ _notifier->modifyNB_Notification(theVarName);
+}
+
+//============================================================================
+/*! Function : SetString
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_Study_i::SetString(const char* theVarName, const char* theValue)
+{
+ _impl->SetStringVariable(std::string(theVarName),
+ theValue,
+ SALOMEDSImpl_GenericVariable::STRING_VAR);
+ if(_notifier)
+ _notifier->modifyNB_Notification(theVarName);
+}
+
+//============================================================================
+/*! Function : SetStringAsDouble
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_Study_i::SetStringAsDouble(const char* theVarName, CORBA::Double theValue)
+{
+ _impl->SetStringVariableAsDouble(std::string(theVarName),
+ theValue,
+ SALOMEDSImpl_GenericVariable::STRING_VAR);
+}
+
+//============================================================================
+/*! Function : GetReal
+ * Purpose :
+ */
+//============================================================================
+CORBA::Double SALOMEDS_Study_i::GetReal(const char* theVarName)
+{
+ return _impl->GetVariableValue(std::string(theVarName));
+}
+
+//============================================================================
+/*! Function : GetInteger
+ * Purpose :
+ */
+//============================================================================
+CORBA::Long SALOMEDS_Study_i::GetInteger(const char* theVarName)
+{
+ return (int)_impl->GetVariableValue(std::string(theVarName));
+}
+
+//============================================================================
+/*! Function : GetBoolean
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_Study_i::GetBoolean(const char* theVarName)
+{
+ return (bool)_impl->GetVariableValue(std::string(theVarName));
+}
+
+//============================================================================
+/*! Function : GetString
+ * Purpose :
+ */
+//============================================================================
+char* SALOMEDS_Study_i::GetString(const char* theVarName)
+{
+ return CORBA::string_dup(_impl->GetStringVariableValue(std::string(theVarName)).c_str());
+}
+
+//============================================================================
+/*! Function : IsReal
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_Study_i::IsReal(const char* theVarName)
+{
+ return _impl->IsTypeOf(std::string(theVarName),
+ SALOMEDSImpl_GenericVariable::REAL_VAR);
+}
+
+//============================================================================
+/*! Function : IsInteger
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_Study_i::IsInteger(const char* theVarName)
+{
+ return _impl->IsTypeOf(std::string(theVarName),
+ SALOMEDSImpl_GenericVariable::INTEGER_VAR);
+}
+
+//============================================================================
+/*! Function : IsBoolean
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_Study_i::IsBoolean(const char* theVarName)
+{
+ return _impl->IsTypeOf(std::string(theVarName),
+ SALOMEDSImpl_GenericVariable::BOOLEAN_VAR);
+}
+
+//============================================================================
+/*! Function : IsString
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_Study_i::IsString(const char* theVarName)
+{
+ return _impl->IsTypeOf(std::string(theVarName),
+ SALOMEDSImpl_GenericVariable::STRING_VAR);
+}
+
+//============================================================================
+/*! Function : IsVariable
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_Study_i::IsVariable(const char* theVarName)
+{
+ return _impl->IsVariable(std::string(theVarName));
+}
+
+//============================================================================
+/*! Function : GetVariableNames
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetVariableNames()
+{
+ std::vector<std::string> aVarNames = _impl->GetVariableNames();
+ SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings;
+
+ int aLen = aVarNames.size();
+ aResult->length(aLen);
+
+ for (int anInd = 0; anInd < aLen; anInd++)
+ aResult[anInd] = CORBA::string_dup(aVarNames[anInd].c_str());
+
+ return aResult._retn();
+}
+
+//============================================================================
+/*! Function : RemoveVariable
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_Study_i::RemoveVariable(const char* theVarName)
+{
+ CORBA::Boolean res = _impl->RemoveVariable(std::string(theVarName));
+ if(res && _notifier)
+ _notifier->modifyNB_Notification(theVarName);
+ return res;
+}
+
+//============================================================================
+/*! Function : RenameVariable
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_Study_i::RenameVariable(const char* theVarName, const char* theNewVarName)
+{
+ CORBA::Boolean res = _impl->RenameVariable(std::string(theVarName), std::string(theNewVarName));
+ if(res && _notifier)
+ _notifier->modifyNB_Notification(theVarName);
+ return res;
+}
+
+//============================================================================
+/*! Function : IsVariableUsed
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_Study_i::IsVariableUsed(const char* theVarName)
+{
+ return _impl->IsVariableUsed(std::string(theVarName));
+}
+
+
+//============================================================================
+/*! Function : ParseVariables
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS::ListOfListOfStrings* SALOMEDS_Study_i::ParseVariables(const char* theVarName)
+{
+ std::vector< std::vector<std::string> > aSections = _impl->ParseVariables(std::string(theVarName));
+
+ SALOMEDS::ListOfListOfStrings_var aResult = new SALOMEDS::ListOfListOfStrings;
+
+ int aSectionsLen = aSections.size();
+ aResult->length(aSectionsLen);
+
+ for (int aSectionInd = 0; aSectionInd < aSectionsLen; aSectionInd++) {
+ std::vector<std::string> aVarNames = aSections[aSectionInd];
+
+ SALOMEDS::ListOfStrings_var aList = new SALOMEDS::ListOfStrings;
+
+ int aLen = aVarNames.size();
+ aList->length(aLen);
+
+ for (int anInd = 0; anInd < aLen; anInd++)
+ aList[anInd] = CORBA::string_dup(aVarNames[anInd].c_str());
+
+ aResult[aSectionInd] = aList;
+ }
+
+ return aResult._retn();
+}
+
+//============================================================================
+/*! Function : GetDefaultScript
+ * Purpose :
+ */
+//============================================================================
+char* SALOMEDS_Study_i::GetDefaultScript(const char* theModuleName, const char* theShift)
+{
+ SALOMEDS::Locker lock;
+
+ std::string script = SALOMEDSImpl_IParameters::getDefaultScript(_impl, theModuleName, theShift);
+ return CORBA::string_dup(script.c_str());
+}
+
+//============================================================================
+/*! Function : EnableUseCaseAutoFilling
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_Study_i::EnableUseCaseAutoFilling(CORBA::Boolean isEnabled)
+{
+ _impl->EnableUseCaseAutoFilling(isEnabled);
+ SALOMEDSImpl_StudyBuilder* builder = _builder->GetImpl();
+ if(builder) {
+ if(isEnabled) {
+ builder->SetOnAddSObject(_impl->GetCallback());
+ builder->SetOnRemoveSObject(_impl->GetCallback());
+ }
+ else {
+ builder->SetOnAddSObject(NULL);
+ builder->SetOnRemoveSObject(NULL);