#include "SALOMEDS_StudyPropertiesAttribute.hxx"
#include "SALOMEDS_Tool.hxx"
+#include "SALOMEDS.hxx"
#include "Utils_CorbaException.hxx"
#include "Utils_ExceptHandlers.hxx"
SALOMEDS::SComponent_ptr
SALOMEDS_StudyBuilder_i::NewComponent(const char* DataType)
{
+ SALOMEDS::Locker lock;
+
CheckLocked();
//Always create component under main label.
TDF_Label L = _doc->Main();
void SALOMEDS_StudyBuilder_i::DefineComponentInstance(SALOMEDS::SComponent_ptr theComponent,
CORBA::Object_ptr theObject)
{
+ SALOMEDS::Locker lock;
+
CheckLocked();
if(CORBA::is_nil(theComponent) || CORBA::is_nil(theObject))
void
SALOMEDS_StudyBuilder_i::RemoveComponent(SALOMEDS::SComponent_ptr theComponent)
{
+ SALOMEDS::Locker lock;
+
CheckLocked();
RemoveObject(theComponent);
}
SALOMEDS::SObject_ptr
SALOMEDS_StudyBuilder_i::NewObject(SALOMEDS::SObject_ptr theFatherObject)
{
+ SALOMEDS::Locker lock;
+
CheckLocked();
if(CORBA::is_nil(theFatherObject))
SALOMEDS_StudyBuilder_i::NewObjectToTag(SALOMEDS::SObject_ptr theFatherObject,
CORBA::Long theTag)
{
+ SALOMEDS::Locker lock;
+
CheckLocked();
if(CORBA::is_nil(theFatherObject))
//============================================================================
void SALOMEDS_StudyBuilder_i::RemoveObject(SALOMEDS::SObject_ptr theSObject)
{
+ SALOMEDS::Locker lock;
+
RemoveSObject(theSObject);
}
//============================================================================
void SALOMEDS_StudyBuilder_i::RemoveObjectWithChildren(SALOMEDS::SObject_ptr theSObject)
{
+ SALOMEDS::Locker lock;
+
if(SALOMEDS_SObject_i* aSObject = RemoveSObject(theSObject,false)){
SALOMEDS_ChildIterator_i aChildIter(_study,aSObject->GetLabel(),true);
for(; aChildIter.More(); aChildIter.Next()){
TCollection_AsciiString ch(res);
SALOMEDS::SObject_var aSObject = SALOMEDS_SObject_i::NewRef(theStudy,aCurrentLabel);
-
+
+ // PAL8065: san - Translate_persistentID_to_IOR() should always be called from some CORBA method
+ // protected with a lock
+ SALOMEDS::unlock();
CORBA::String_var anIOR =
theDriver->LocalPersistentIDToIOR(aSObject,ch.ToCString(),theIsMultiFile,theIsASCII);
+ SALOMEDS::lock();
+
SALOMEDS_IORAttribute::Set(aCurrentLabel,const_cast<char*>(anIOR.in()),theStudy);
}
SALOMEDS::Driver_ptr theDriver)
throw(SALOME::SALOME_Exception)
{
+ SALOMEDS::Locker lock;
+
Unexpect aCatch(SBSalomeException);
if(CORBA::is_nil(theSComponent))
// set path without file name from URL
std::string aDir(aHDFPath.ToCString());
- aDir.substr(0,aDir.find('/'));
+ aDir = aDir.substr(0,aDir.rfind('/') + 1);
+ SALOMEDS::unlock();
CORBA::Boolean aResult = (ASCIIfileState[0]=='A')?
theDriver->LoadASCII(theSComponent, aStreamFile.in(), aDir.c_str(), aMultifileState[0]=='M'):
theDriver->Load(theSComponent, aStreamFile.in(), aDir.c_str(), aMultifileState[0]=='M');
+ SALOMEDS::lock();
+
if(!aResult) {
RemoveAttribute( theSComponent, "AttributeIOR" );
if (isASCII) {
SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SALOMEDS::SObject_ptr theObject,
const char* theTypeOfAttribute)
{
+ SALOMEDS::Locker lock;
+
if(SALOMEDS_SObject_i* aSObject = _study->DownCast(theObject))
return aSObject->FindOrCreateAttribute(theTypeOfAttribute);
SALOMEDS::GenericAttribute_out theAttr,
const char* theTypeOfAttribute)
{
+ SALOMEDS::Locker lock;
+
if(SALOMEDS_SObject_i* aSObject = _study->DownCast(theObject))
return aSObject->FindAttribute(theAttr,theTypeOfAttribute);
void SALOMEDS_StudyBuilder_i::RemoveAttribute(SALOMEDS::SObject_ptr theSObject,
const char* aTypeOfAttribute)
{
+ SALOMEDS::Locker lock;
+
CheckLocked();
if(CORBA::is_nil(theSObject))
SALOMEDS_StudyBuilder_i::Addreference(SALOMEDS::SObject_ptr me,
SALOMEDS::SObject_ptr theReferencedObject)
{
+ SALOMEDS::Locker lock;
+
CheckLocked();
if(CORBA::is_nil(me) || CORBA::is_nil(theReferencedObject))
return;
//============================================================================
void SALOMEDS_StudyBuilder_i::RemoveReference(SALOMEDS::SObject_ptr me)
{
+ SALOMEDS::Locker lock;
+
SALOMEDS::SObject_var theReferencedObject;
if(!me->ReferencedObject(theReferencedObject)) return; //No reference is found
//============================================================================
void SALOMEDS_StudyBuilder_i::AddDirectory(const char* thePath)
{
+ SALOMEDS::Locker lock;
+
CheckLocked();
if(thePath == NULL || strlen(thePath) == 0) throw SALOMEDS::Study::StudyInvalidDirectory();
//============================================================================
void SALOMEDS_StudyBuilder_i::SetGUID(SALOMEDS::SObject_ptr anObject, const char* theGUID)
{
+ SALOMEDS::Locker lock;
+
CheckLocked();
if(CORBA::is_nil(anObject))
//============================================================================
bool SALOMEDS_StudyBuilder_i::IsGUID(SALOMEDS::SObject_ptr anObject, const char* theGUID)
{
+ SALOMEDS::Locker lock;
+
if(CORBA::is_nil(anObject))
return false;
//============================================================================
void SALOMEDS_StudyBuilder_i::NewCommand()
{
+ SALOMEDS::Locker lock;
+
// mpv: for SAL2114 - unset "lock changed" flag at the operation start
Handle(SALOMEDS_StudyPropertiesAttribute) anAttr;
if (!_doc->Main().FindAttribute(SALOMEDS_StudyPropertiesAttribute::GetID(), anAttr)) {
//============================================================================
void SALOMEDS_StudyBuilder_i::CommitCommand() throw (SALOMEDS::StudyBuilder::LockProtection)
{
+ SALOMEDS::Locker lock;
+
Unexpect aCatch(SBLockProtection);
Handle(SALOMEDS_StudyPropertiesAttribute) anAttr;
if (!_doc->Main().FindAttribute(SALOMEDS_StudyPropertiesAttribute::GetID(), anAttr)) {
//============================================================================
CORBA::Boolean SALOMEDS_StudyBuilder_i::HasOpenCommand()
{
+ SALOMEDS::Locker lock;
+
return _doc->HasOpenCommand();
}
//============================================================================
void SALOMEDS_StudyBuilder_i::AbortCommand()
{
+ SALOMEDS::Locker lock;
+
_study->UndoPostponed(0);
_doc->AbortCommand();
//============================================================================
void SALOMEDS_StudyBuilder_i::Undo() throw (SALOMEDS::StudyBuilder::LockProtection)
{
+ SALOMEDS::Locker lock;
+
Unexpect aCatch(SBLockProtection);
Handle(SALOMEDS_StudyPropertiesAttribute) anAttr;
if (!_doc->Main().FindAttribute(SALOMEDS_StudyPropertiesAttribute::GetID(), anAttr)) {
*/
//============================================================================
void SALOMEDS_StudyBuilder_i::Redo() throw (SALOMEDS::StudyBuilder::LockProtection)
-{
+{
+ SALOMEDS::Locker lock;
+
Unexpect aCatch(SBLockProtection);
Handle(SALOMEDS_StudyPropertiesAttribute) anAttr;
if (!_doc->Main().FindAttribute(SALOMEDS_StudyPropertiesAttribute::GetID(), anAttr)) {
//============================================================================
CORBA::Boolean SALOMEDS_StudyBuilder_i::GetAvailableUndos()
{
+ SALOMEDS::Locker lock;
+
return _doc->GetAvailableUndos();
}
//============================================================================
CORBA::Boolean SALOMEDS_StudyBuilder_i::GetAvailableRedos()
{
+ SALOMEDS::Locker lock;
+
return _doc->GetAvailableRedos();
}
//============================================================================
CORBA::Long SALOMEDS_StudyBuilder_i::UndoLimit()
{
+ SALOMEDS::Locker lock;
+
return _doc->GetUndoLimit();
}
//============================================================================
void SALOMEDS_StudyBuilder_i::UndoLimit(CORBA::Long n)
{
+ SALOMEDS::Locker lock;
+
CheckLocked();
_doc->SetUndoLimit (n);
}
void SALOMEDS_StudyBuilder_i::SetName(SALOMEDS::SObject_ptr theSO, const char* theValue)
throw(SALOMEDS::StudyBuilder::LockProtection)
{
+ SALOMEDS::Locker lock;
+
Unexpect aCatch(SBLockProtection);
CheckLocked();
void SALOMEDS_StudyBuilder_i::SetComment(SALOMEDS::SObject_ptr theSO, const char* theValue)
throw(SALOMEDS::StudyBuilder::LockProtection)
{
+ SALOMEDS::Locker lock;
+
Unexpect aCatch(SBLockProtection);
CheckLocked();
void SALOMEDS_StudyBuilder_i::SetIOR(SALOMEDS::SObject_ptr theSO, const char* theValue)
throw(SALOMEDS::StudyBuilder::LockProtection)
{
+ SALOMEDS::Locker lock;
+
Unexpect aCatch(SBLockProtection);
CheckLocked();