+//============================================================================
+/*! Function : GetCommonParameters
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS::AttributeParameter_ptr SALOMEDS_Study_i::GetCommonParameters(const char* theID, CORBA::Long theSavePoint)
+{
+ SALOMEDS::Locker lock;
+
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ SALOMEDSImpl_AttributeParameter* anAttr = _impl->GetCommonParameters(theID, theSavePoint);
+ SALOMEDS_AttributeParameter_i* SP = new SALOMEDS_AttributeParameter_i(anAttr, _orb);
+ SALOMEDS::AttributeParameter_var aParam = SP->_this();
+
+ return aParam._retn();
+}
+
+//============================================================================
+/*! Function : GetCommonModuleParameters
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS::AttributeParameter_ptr SALOMEDS_Study_i::GetModuleParameters(const char* theID,
+ const char* theModuleName,
+ CORBA::Long theSavePoint)
+{
+ SALOMEDS::Locker lock;
+
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ SALOMEDSImpl_AttributeParameter* anAttr = _impl->GetModuleParameters(theID, theModuleName, theSavePoint);
+ SALOMEDS_AttributeParameter_i* SP = new SALOMEDS_AttributeParameter_i(anAttr, _orb);
+ SALOMEDS::AttributeParameter_var aParam = SP->_this();
+
+ return aParam._retn();
+}
+
+//============================================================================
+/*! Function : SetStudyLock
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_Study_i::SetStudyLock(const char* theLockerID)
+{
+ SALOMEDS::Locker lock;
+
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ _impl->SetStudyLock(theLockerID);
+}
+
+//============================================================================
+/*! Function : IsStudyLocked
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDS_Study_i::IsStudyLocked()
+{
+ SALOMEDS::Locker lock;
+
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ return _impl->IsStudyLocked();
+}
+
+//============================================================================
+/*! Function : UnLockStudy
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_Study_i::UnLockStudy(const char* theLockerID)
+{
+ SALOMEDS::Locker lock;
+
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ _impl->UnLockStudy(theLockerID);
+}
+
+//============================================================================
+/*! Function : GetLockerID
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetLockerID()
+{
+ SALOMEDS::Locker lock;
+
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ 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)
+{
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+
+ _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)
+{
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ _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)
+{
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ _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)
+{
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ _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)
+{
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ _impl->SetStringVariableAsDouble(std::string(theVarName),
+ theValue,
+ SALOMEDSImpl_GenericVariable::STRING_VAR);
+}
+
+//============================================================================
+/*! Function : GetReal
+ * Purpose :
+ */
+//============================================================================
+CORBA::Double SALOMEDS_Study_i::GetReal(const char* theVarName)
+{
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ return _impl->GetVariableValue(std::string(theVarName));
+}
+
+//============================================================================
+/*! Function : GetInteger
+ * Purpose :
+ */
+//============================================================================
+CORBA::Long SALOMEDS_Study_i::GetInteger(const char* theVarName)
+{
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ return (long)_impl->GetVariableValue(std::string(theVarName));
+}
+
+//============================================================================
+/*! Function : GetBoolean
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_Study_i::GetBoolean(const char* theVarName)
+{
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ return (bool)_impl->GetVariableValue(std::string(theVarName));
+}
+
+//============================================================================
+/*! Function : GetString
+ * Purpose :
+ */
+//============================================================================
+char* SALOMEDS_Study_i::GetString(const char* theVarName)
+{
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ return CORBA::string_dup(_impl->GetStringVariableValue(std::string(theVarName)).c_str());
+}
+
+//============================================================================
+/*! Function : IsReal
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_Study_i::IsReal(const char* theVarName)
+{
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ return _impl->IsTypeOf(std::string(theVarName),
+ SALOMEDSImpl_GenericVariable::REAL_VAR);
+}
+
+//============================================================================
+/*! Function : IsInteger
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_Study_i::IsInteger(const char* theVarName)
+{
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ return _impl->IsTypeOf(std::string(theVarName),
+ SALOMEDSImpl_GenericVariable::INTEGER_VAR);
+}
+
+//============================================================================
+/*! Function : IsBoolean
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_Study_i::IsBoolean(const char* theVarName)
+{
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ return _impl->IsTypeOf(std::string(theVarName),
+ SALOMEDSImpl_GenericVariable::BOOLEAN_VAR);
+}
+
+//============================================================================
+/*! Function : IsString
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_Study_i::IsString(const char* theVarName)
+{
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ return _impl->IsTypeOf(std::string(theVarName),
+ SALOMEDSImpl_GenericVariable::STRING_VAR);
+}
+
+//============================================================================
+/*! Function : IsVariable
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_Study_i::IsVariable(const char* theVarName)
+{
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ return _impl->IsVariable(std::string(theVarName));
+}
+
+//============================================================================
+/*! Function : GetVariableNames
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetVariableNames()
+{
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings;
+
+ std::vector<std::string> aVarNames = _impl->GetVariableNames();
+
+ 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)
+{
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ bool 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)
+{
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ bool 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)
+{
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ return _impl->IsVariableUsed(std::string(theVarName));
+}
+
+
+//============================================================================
+/*! Function : ParseVariables
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS::ListOfListOfStrings* SALOMEDS_Study_i::ParseVariables(const char* theVarName)
+{
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ SALOMEDS::ListOfListOfStrings_var aResult = new SALOMEDS::ListOfListOfStrings;
+
+ std::vector< std::vector<std::string> > aSections = _impl->ParseVariables(std::string(theVarName));
+
+ 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;
+
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ 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)
+{
+ if (_closed)
+ throw SALOMEDS::Study::StudyInvalidReference();
+
+ _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);
+ }
+ }
+}
+
+//============================================================================
+/*! Function : attach
+ * Purpose : This function attach an observer to the study
+ */
+//============================================================================
+void SALOMEDS_Study_i::attach(SALOMEDS::Observer_ptr theObs, CORBA::Boolean modify)
+{
+ if (_notifier)
+ static_cast<SALOMEDS::Notifier*>(_notifier)->attach(theObs, modify);
+}
+
+
+//============================================================================
+/*! Function : detach
+ * Purpose : This function detaches an observer from the study
+ */
+//============================================================================
+void SALOMEDS_Study_i::detach(SALOMEDS::Observer_ptr theObs)
+{
+ if (_notifier)
+ static_cast<SALOMEDS::Notifier*>(_notifier)->detach(theObs);
+}
+