/*!
- Marks this Study as being locked. The lock status can be checked by method IsStudyLocked
- \param theLockerID identifies a locker of the study can be for ex. IOR of the engine that locked the study.
+ Marks this Study as being locked by the given locker. The lock status can be checked by method IsStudyLocked
+ \param theLockerID identifies a locker of the study can be for ex. IOR of the engine that locks the study.
*/
- void SetStudyLock(in string theLockerIDe);
+ void SetStudyLock(in string theLockerID);
/*!
Returns True if the Study was marked locked.
boolean IsStudyLocked();
/*!
- Marks this Study as being unlocked. The lock status can be checked by method IsStudyLocked
+ Marks this Study as being unlocked by the given locker. The lock status can be checked by method IsStudyLocked
+ \param theLockerID identifies a locker of the study can be for ex. IOR of the engine that unlocks the study.
*/
- void UnLockStudy();
+ void UnLockStudy(in string theLockerID);
/*!
- Returns the ID of the Study's locker.
+ Returns the list iof IDs of the Study's lockers.
*/
- string GetLockerID();
+ ListOfStrings GetLockerID();
};
return isLocked;
}
-void SALOMEDS_Study::UnLockStudy()
+void SALOMEDS_Study::UnLockStudy(const string& theLockerID)
{
- if(_isLocal) _local_impl->UnLockStudy();
- else _corba_impl->UnLockStudy();
+ if(_isLocal) _local_impl->UnLockStudy((char*)theLockerID.c_str());
+ else _corba_impl->UnLockStudy((char*)theLockerID.c_str());
}
-string SALOMEDS_Study::GetLockerID()
+vector<string> SALOMEDS_Study::GetLockerID()
{
- std::string aLockerID;
+ std::vector<std::string> aVector;
+ int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
- aLockerID = _local_impl->GetLockerID();
+
+ Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetLockerID();
+ aLength = aSeq->Length();
+ for (i = 1; i <= aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
}
- else aLockerID = _corba_impl->GetLockerID();
- return aLockerID;
+ else {
+ SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetLockerID();
+ aLength = aSeq->length();
+ for (i = 0; i < aLength; i++) aVector.push_back((char*)aSeq[i].in());
+ }
+ return aVector;
}
std::string SALOMEDS_Study::ConvertObjectToIOR(CORBA::Object_ptr theObject)
const std::string& theModuleName, int theSavePoint);
virtual void SetStudyLock(const std::string& theLockerID);
virtual bool IsStudyLocked();
- virtual void UnLockStudy();
- virtual std::string GetLockerID();
+ virtual void UnLockStudy(const std::string& theLockerID);
+ virtual std::vector<std::string> GetLockerID();
std::string ConvertObjectToIOR(CORBA::Object_ptr theObject);
CORBA::Object_ptr ConvertIORToObject(const std::string& theIOR);
* Purpose :
*/
//============================================================================
-void SALOMEDS_Study_i::UnLockStudy()
+void SALOMEDS_Study_i::UnLockStudy(const char* theLockerID)
{
SALOMEDS::Locker lock;
- _impl->UnLockStudy();
+ _impl->UnLockStudy(theLockerID);
}
//============================================================================
* Purpose :
*/
//============================================================================
-char* SALOMEDS_Study_i::GetLockerID()
+SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetLockerID()
{
SALOMEDS::Locker lock;
- return CORBA::string_dup(_impl->GetLockerID());
+
+ SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings;
+
+ Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetLockerID();
+
+ int aLength = aSeq->Length();
+ aResult->length(aLength);
+ for(int anIndex = 1; anIndex <= aLength; anIndex++) {
+ aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString());
+ }
+ return aResult._retn();
}
//============================================================================
virtual bool IsStudyLocked();
- virtual void UnLockStudy();
+ virtual void UnLockStudy(const char* theLockerID);
- virtual char* GetLockerID();
+ virtual SALOMEDS::ListOfStrings* GetLockerID();
virtual char* GetDefaultScript(const char* theModuleName, const char* theShift);
const std::string& theModuleName, int theSavePoint) = 0;
virtual void SetStudyLock(const std::string& theLockerID) = 0;
virtual bool IsStudyLocked() = 0;
- virtual void UnLockStudy() = 0;
- virtual std::string GetLockerID() = 0;
+ virtual void UnLockStudy(const std::string& theLockerID) = 0;
+ virtual std::vector<std::string> GetLockerID() = 0;
};
//Put on the root label a StudyHandle attribute to store the address of this object
//It will be used to retrieve the study object by TDF_Label that belongs to the study
SALOMEDSImpl_StudyHandle::Set(_doc->Main().Root(), this);
- _locker = "";
+ _lockers = new TColStd_HSequenceOfAsciiString();
}
//============================================================================
void SALOMEDSImpl_Study::SetStudyLock(const char* theLockerID)
{
- _locker = TCollection_AsciiString((char*)theLockerID);
+ _lockers->Append(TCollection_AsciiString((char*)theLockerID));
}
//============================================================================
//============================================================================
bool SALOMEDSImpl_Study::IsStudyLocked()
{
- return !(_locker=="");
+ return (_lockers->Length() > 0);
}
//============================================================================
* Purpose :
*/
//============================================================================
-void SALOMEDSImpl_Study::UnLockStudy()
+void SALOMEDSImpl_Study::UnLockStudy(const char* theLockerID)
{
- _locker = "";
+ int length = _lockers->Length(), pos = -1;
+ TCollection_AsciiString id((char*)theLockerID);
+ for(int i = 1; i<=length; i++) {
+ if(id == _lockers->Value(i)) {
+ pos = i;
+ break;
+ }
+ }
+ if(pos > 0) _lockers->Remove(pos);
}
//============================================================================
* Purpose :
*/
//============================================================================
-char* SALOMEDSImpl_Study::GetLockerID()
+Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetLockerID()
{
- return _locker.ToCString();
+ return _lockers;
}
TDF_Label _current;
bool _autoFill;
TCollection_AsciiString _errorCode;
- TCollection_AsciiString _locker;
- Handle(SALOMEDSImpl_Callback) _cb;
- Handle(SALOMEDSImpl_StudyBuilder) _builder;
- Handle(SALOMEDSImpl_UseCaseBuilder) _useCaseBuilder;
+ Handle(TColStd_HSequenceOfAsciiString) _lockers;
+ Handle(SALOMEDSImpl_Callback) _cb;
+ Handle(SALOMEDSImpl_StudyBuilder) _builder;
+ Handle(SALOMEDSImpl_UseCaseBuilder) _useCaseBuilder;
DataMapOfAsciiStringTransient _mapOfSO;
DataMapOfAsciiStringTransient _mapOfSCO;
Standard_EXPORT bool IsStudyLocked();
//Unlocks the study
- Standard_EXPORT void UnLockStudy();
+ Standard_EXPORT void UnLockStudy(const char* theLockerID);
//Returns an ID of the study locker
- Standard_EXPORT char* GetLockerID();
+ Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) GetLockerID();
public:
DEFINE_STANDARD_RTTI( SALOMEDSImpl_Study )
aStudy->SetStudyLock("SRN");
cout << "Is study locked = " << aStudy->IsStudyLocked() << endl;
cout << "Get study locker : " << aStudy->GetLockerID() << endl;
- aStudy->UnLockStudy();
+ aStudy->UnLockStudy("SRN");
cout << "Is study locked = " << aStudy->IsStudyLocked() << endl;
Handle(SALOMEDSImpl_StudyBuilder) aBuilder = aStudy->NewBuilder();