{
for (ObsListIter it (myObservers.begin()); it != myObservers.end(); ++it)
{
- if ( it->first->_is_equivalent(theObs) ) {
- myObservers.erase( it );
- break;
- }
+ if ( it->first->_is_equivalent(theObs) ) {
+ myObservers.erase( it );
+ break;
+ }
}
}
aSession->emitMessageOneWay(str.c_str());
SALOMEDS::lock();
}
-
- std::string anIOR = _impl->GetTransientReference();
- if ( anIOR.empty() ) {
- CORBA::Object_var obj = aNamingService->Resolve("/Study");
- SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow( obj );
- CORBA::String_var IORStudy = _orb->object_to_string(aStudy);
- _impl->SetTransientReference((char*)IORStudy.in());
- }
-
}
//============================================================================
{
SALOMEDS::Locker lock;
if (_closed)
- throw SALOMEDS::Study::StudyInvalidReference();
+ return;
//delete the builder servant
PortableServer::POA_var poa=_builder->_default_POA();
PortableServer::ObjectId_var anObjectId = poa->servant_to_id(_builder);
_impl->setNotifier(0);
delete _notifier;
delete _genObjRegister;
+ _notifier = NULL;
_closed = true;
}
bool SALOMEDS_Study_i::Open(const char* aUrl)
throw(SALOME::SALOME_Exception)
{
+ if (!_closed)
+ Clear();
+ Init();
SALOMEDS::Locker lock;
Unexpect aCatch(SalomeException);
* Purpose : Save a Study to it's persistent reference
*/
//============================================================================
-CORBA::Boolean SALOMEDS_Study_i::Save(CORBA::Boolean theMultiFile)
-{
- SALOMEDS::Locker lock;
- if (_closed)
- throw SALOMEDS::Study::StudyInvalidReference();
- return _impl->Save(_factory, theMultiFile);
-}
-
-CORBA::Boolean SALOMEDS_Study_i::SaveASCII(CORBA::Boolean theMultiFile)
+CORBA::Boolean SALOMEDS_Study_i::Save(CORBA::Boolean theMultiFile, CORBA::Boolean theASCII)
{
SALOMEDS::Locker lock;
if (_closed)
throw SALOMEDS::Study::StudyInvalidReference();
- return _impl->SaveASCII(_factory, theMultiFile);
+ return _impl->Save(_factory, theMultiFile, theASCII);
}
//=============================================================================
* Purpose : Save a study to the persistent reference aUrl
*/
//============================================================================
-CORBA::Boolean SALOMEDS_Study_i::SaveAs(const char* aUrl, CORBA::Boolean theMultiFile)
-{
- SALOMEDS::Locker lock;
- if (_closed)
- throw SALOMEDS::Study::StudyInvalidReference();
- return _impl->SaveAs(std::string(aUrl), _factory, theMultiFile);
-}
-
-CORBA::Boolean SALOMEDS_Study_i::SaveAsASCII(const char* aUrl, CORBA::Boolean theMultiFile)
+CORBA::Boolean SALOMEDS_Study_i::SaveAs(const char* aUrl, CORBA::Boolean theMultiFile, CORBA::Boolean theASCII)
{
SALOMEDS::Locker lock;
if (_closed)
throw SALOMEDS::Study::StudyInvalidReference();
- return _impl->SaveAsASCII(std::string(aUrl), _factory, theMultiFile);
+ return _impl->SaveAs(std::string(aUrl), _factory, theMultiFile, theASCII);
}
//============================================================================
throw SALOMEDS::Study::StudyInvalidReference();
return CORBA::string_dup(_impl->GetPersistentReference().c_str());
}
-//============================================================================
-/*! Function : GetTransientReference
- * Purpose : Get IOR of the Study (registred in OCAF document in doc->Root)
- */
-//============================================================================
-char* SALOMEDS_Study_i::GetTransientReference()
-{
- SALOMEDS::Locker lock;
- if (_closed)
- throw SALOMEDS::Study::StudyInvalidReference();
- return CORBA::string_dup(_impl->GetTransientReference().c_str());
-}
//============================================================================
/*! Function : IsEmpty
return CORBA::string_dup(aPath.c_str());
}
-
-//============================================================================
-/*! Function : SetContext
- * Purpose : Sets the current context
- */
-//============================================================================
-void SALOMEDS_Study_i::SetContext(const char* thePath)
-{
- SALOMEDS::Locker lock;
-
- if (_closed)
- throw SALOMEDS::Study::StudyInvalidReference();
-
- _impl->SetContext(std::string((char*)thePath));
- if (_impl->IsError() && _impl->GetErrorCode() == "InvalidContext")
- throw SALOMEDS::Study::StudyInvalidContext();
-}
-
-//============================================================================
-/*! Function : GetContext
- * Purpose : Gets the current context
- */
-//============================================================================
-char* SALOMEDS_Study_i::GetContext()
-{
- SALOMEDS::Locker lock;
-
- if (_closed)
- throw SALOMEDS::Study::StudyInvalidReference();
-
- if (!_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext();
-
- return CORBA::string_dup(_impl->GetContext().c_str());
-}
-
-//============================================================================
-/*! Function : GetObjectNames
- * Purpose : method to get all object names in the given context (or in the current context, if 'theContext' is empty)
- */
-//============================================================================
-SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetObjectNames(const char* theContext)
-{
- SALOMEDS::Locker lock;
-
- if (_closed)
- throw SALOMEDS::Study::StudyInvalidReference();
-
- SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings;
-
- if (strlen(theContext) == 0 && !_impl->HasCurrentContext())
- throw SALOMEDS::Study::StudyInvalidContext();
-
- std::vector<std::string> aSeq = _impl->GetObjectNames(std::string((char*)theContext));
- if (_impl->GetErrorCode() == "InvalidContext")
- throw SALOMEDS::Study::StudyInvalidContext();
-
- 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 : GetDirectoryNames
- * Purpose : method to get all directory names in the given context (or in the current context, if 'theContext' is empty)
- */
-//============================================================================
-SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetDirectoryNames(const char* theContext)
-{
- SALOMEDS::Locker lock;
-
- if (_closed)
- throw SALOMEDS::Study::StudyInvalidReference();
-
- SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings;
-
- if (strlen(theContext) == 0 && !_impl->HasCurrentContext())
- throw SALOMEDS::Study::StudyInvalidContext();
-
- std::vector<std::string> aSeq = _impl->GetDirectoryNames(std::string((char*)theContext));
- if (_impl->GetErrorCode() == "InvalidContext")
- throw SALOMEDS::Study::StudyInvalidContext();
-
- 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 : GetFileNames
- * Purpose : method to get all file names in the given context (or in the current context, if 'theContext' is empty)
- */
-//============================================================================
-SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetFileNames(const char* theContext)
-{
- SALOMEDS::Locker lock;
-
- if (_closed)
- throw SALOMEDS::Study::StudyInvalidReference();
-
- SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings;
-
- if (strlen(theContext) == 0 && !_impl->HasCurrentContext())
- throw SALOMEDS::Study::StudyInvalidContext();
-
- std::vector<std::string> aSeq = _impl->GetFileNames(std::string((char*)theContext));
- if (_impl->GetErrorCode() == "InvalidContext")
- throw SALOMEDS::Study::StudyInvalidContext();
-
- 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 : GetComponentNames
- * Purpose : method to get all components names
- * SRN: Note, theContext can be any, it doesn't matter
- */
-//============================================================================
-SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetComponentNames(const char* theContext)
-{
- SALOMEDS::Locker lock;
-
- if (_closed)
- throw SALOMEDS::Study::StudyInvalidReference();
-
- SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings;
-
- std::vector<std::string> aSeq = _impl->GetComponentNames(std::string((char*)theContext));
-
- 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 : NewChildIterator
* Purpose : Create a ChildIterator from an SObject
_impl->UpdateIORLabelMap(std::string((char*)anIOR), std::string((char*)anEntry));
}
-SALOMEDS::Study_ptr SALOMEDS_Study_i::GetStudy(const DF_Label& theLabel, CORBA::ORB_ptr orb)
-{
- SALOMEDS::Locker lock;
-
- SALOMEDSImpl_AttributeIOR* Att = NULL;
- if ((Att=(SALOMEDSImpl_AttributeIOR*)theLabel.Root().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))){
- char* IOR = CORBA::string_dup(Att->Value().c_str());
- CORBA::Object_var obj = orb->string_to_object(IOR);
- SALOMEDS::Study_ptr aStudy = SALOMEDS::Study::_narrow(obj) ;
- ASSERT(!CORBA::is_nil(aStudy));
- return SALOMEDS::Study::_duplicate(aStudy);
- } else {
- MESSAGE("GetStudy: Problem to get study");
- }
- return SALOMEDS::Study::_nil();
-}
-
void SALOMEDS_Study_i::IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute)
{
SALOMEDS::Locker lock;