*/
UseCaseBuilder GetUseCaseBuilder() raises(StudyInvalidReference);
-/*! \brief Clear a study object
+/*! \brief Clear the previous and initialize new empty study object
*/
void Clear() raises(StudyInvalidReference);
-/*! \brief Initialization a study object
-*/
- void Init() raises(StudyInvalidReference);
-
/*! \brief Open a study by url
Reads and activates the structure of the study %Objects.
\param aSComponent The according %SComponent
*/
- void Close (in SComponent aSComponent);
- //void Close ( in string aIORSComponent);
+ void Close ();
/*! Gets the type of the data
def salome_close():
global salome_initial, myStudy, myStudyName
- try:
+ #try:
# study can be clear either from GUI or directly with salome.myStudy.Clear()
- myStudy.Clear()
- except:
- pass
+ # myStudy.Clear()
+ #except:
+ # pass
salome_initial=True
salome_iapp_close()
salome_study_close()
if isinstance(theStudyPath, bytes):
theStudyPath = str(theStudyPath, 'UTF8')
openStudy(theStudyPath)
- else:
- myStudy.Init()
myStudyName = myStudy._get_Name()
return isOk;
}
-void SALOMEDS_Driver_i::Close(const SALOMEDSImpl_SComponent& theComponent)
+void SALOMEDS_Driver_i::Close()
{
- SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb);
-
SALOMEDS::unlock();
if ( !CORBA::is_nil(_driver) )
- _driver->Close(sco.in());
- sco->UnRegister();
+ _driver->Close();
SALOMEDS::lock();
}
const std::string& theURL,
bool isMultiFile);
- virtual void Close(const SALOMEDSImpl_SComponent& theComponent);
+ virtual void Close();
virtual std::string ComponentDataType();
_orb = init(0 , 0 ) ;
}
-void SALOMEDS_Study::Init()
-{
- if(CORBA::is_nil(_corba_impl))
- return;
-
- _corba_impl->Init();
-}
-
void SALOMEDS_Study::Clear()
{
if(CORBA::is_nil(_corba_impl))
~SALOMEDS_Study();
virtual void Clear();
- virtual void Init();
virtual bool Open(const std::string& theStudyUrl);
_factory = new SALOMEDS_DriverFactory_i(_orb);
_closed = true;
- Init();
+ Clear();
}
//============================================================================
//============================================================================
SALOMEDS_Study_i::~SALOMEDS_Study_i()
{
- Clear();
+ Clear_internal();
delete _factory;
delete _impl;
}
* Purpose : Initialize study components
*/
//============================================================================
-void SALOMEDS_Study_i::Init()
+void SALOMEDS_Study_i::Clear()
{
+ Clear_internal();
if (!_closed)
//throw SALOMEDS::Study::StudyInvalidReference();
return;
* Purpose : Clear study components
*/
//============================================================================
-void SALOMEDS_Study_i::Clear()
+void SALOMEDS_Study_i::Clear_internal()
{
if (_closed)
return;
SALOMEDS::Locker lock;
-
- //delete the builder servant
- PortableServer::POA_var poa=_default_POA();
- PortableServer::ObjectId_var anObjectId = poa->servant_to_id(_builder);
- poa->deactivate_object(anObjectId.in());
- _builder->_remove_ref();
+ if (_builder) {
+ //delete the builder servant
+ PortableServer::POA_var poa=_default_POA();
+ PortableServer::ObjectId_var anObjectId = poa->servant_to_id(_builder);
+ poa->deactivate_object(anObjectId.in());
+ _builder->_remove_ref();
+ }
RemovePostponed(-1);
- if (_impl->GetDocument()) {
- SALOMEDS::SComponentIterator_var itcomponent = NewComponentIterator();
- for (; itcomponent->More(); itcomponent->Next()) {
- SALOMEDS::SComponent_var sco = itcomponent->Value();
- CORBA::String_var compodatatype=sco->ComponentDataType();
- MESSAGE ( "Look for an engine for data type :"<< compodatatype);
- // if there is an associated Engine call its method for closing
- CORBA::String_var IOREngine;
- if (sco->ComponentIOR(IOREngine)) {
- // we have found the associated engine to write the data
- 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&) {
- }
+ SALOME_NamingService *aNamingService = KERNEL::getNamingService();
+ if( aNamingService->Change_Directory("/Containers") ) {
+
+ std::vector<std::string> dirContent = aNamingService->list_directory_recurs();
+ for( std::vector<std::string>::iterator iter = dirContent.begin(); iter!=dirContent.end(); iter++ ) {
+ CORBA::Object_var obj = aNamingService->Resolve( ( *iter ).c_str() );
+ SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_narrow(obj) ;
+ if ( !CORBA::is_nil( anEngine ) ) {
+ SALOMEDS::unlock();
+ anEngine->Close();
+ SALOMEDS::lock();
}
- sco->UnRegister();
}
-
- //Does not need any more this iterator
- itcomponent->UnRegister();
}
-
+
// Notify GUI that study is cleared
SALOMEDS::sendMessageToGUI( "studyCleared" );
throw(SALOME::SALOME_Exception)
{
if (!_closed)
- Clear();
- Init();
+ Clear();
SALOMEDS::Locker lock;
Unexpect aCatch(SalomeException);
{
SALOMEDS::Locker lock;
- if (_closed)
- throw SALOMEDS::Study::StudyInvalidReference();
-
SALOMEDS_UseCaseBuilder_i* UCBuilder = new SALOMEDS_UseCaseBuilder_i(_impl->GetUseCaseBuilder(), _orb);
SALOMEDS::UseCaseBuilder_var uc = UCBuilder->_this();
return uc._retn();
{
SALOMEDS::Locker lock;
- if (_closed)
- throw SALOMEDS::Study::StudyInvalidReference();
+ // if (_closed)
+ // throw SALOMEDS::Study::StudyInvalidReference();
std::vector<std::string> anIORs = _impl->GetIORs();
int i, aSize = (int)anIORs.size();
virtual PortableServer::POA_ptr _default_POA();
- virtual void Init();
virtual void Clear();
//! method to Open a Study
virtual void attach(SALOMEDS::Observer_ptr theObs, CORBA::Boolean modify);
virtual void detach(SALOMEDS::Observer_ptr theObs);
+
+ private:
+ void Clear_internal(); //Internal method
};
#endif
//Try to set empty string
_attr->SetValue("");
CPPUNIT_ASSERT(_attr->Value() == "");
-
- study->Clear();
}
_attr->SetDrawable(false);
CPPUNIT_ASSERT(!_attr->IsDrawable());
-
- study->Clear();
}
_attr->SetExpandable(true);
CPPUNIT_ASSERT(_attr->IsExpandable());
-
- study->Clear();
}
//Try to set empty string
_attr->SetValue("");
CPPUNIT_ASSERT(_attr->Value() == "");
-
- study->Clear();
}
//Try to set empty string
_attr->SetValue("");
CPPUNIT_ASSERT(_attr->Value() == "");
-
- study->Clear();
}
CPPUNIT_ASSERT(_attr->Get(2));
CPPUNIT_ASSERT(!_attr->Get(4));
-
- study->Clear();
}
CPPUNIT_ASSERT(!_attr->GetVisibility(0));
_attr->SetVisibility(-1, true);
CPPUNIT_ASSERT(_attr->GetVisibility(-1));
-
- study->Clear();
}
_attr->SetValue(ior);
CPPUNIT_ASSERT(ior == _attr->Value());
-
- study->Clear();
}
//Check method Value
CPPUNIT_ASSERT(_attr->Value() == value);
-
- study->Clear();
}
//Check method Value
CPPUNIT_ASSERT(_attr->Value() == value);
-
- study->Clear();
}
//Try to set empty string
_attr->SetValue("");
CPPUNIT_ASSERT(_attr->Value() == "");
-
- study->Clear();
}
_attr->SetOpened(false);
CPPUNIT_ASSERT(!_attr->IsOpened());
-
- study->Clear();
}
CPPUNIT_ASSERT(_attr->IsSet("StrArray", PT_STRARRAY) && _attr->GetStrArray("StrArray")[0] == "hello");
CPPUNIT_ASSERT(_attr->IsSet("StrArray", PT_STRARRAY) && _attr->GetStrArray("StrArray")[1] == "world");
*/
-
- study->Clear();
}
//Try to set empty string
_attr->SetValue("");
CPPUNIT_ASSERT(_attr->Value() == "");
-
- study->Clear();
}
//Check empty PixMap assigning and retrieval
_attr->SetPixMap("");
CPPUNIT_ASSERT(_attr->GetPixMap() == "");
-
- study->Clear();
}
//Check setting and retrieval of empty object
_attr->SetObject("", true);
CPPUNIT_ASSERT(_attr->GetObject() == "" && _attr->IsScript());
-
- study->Clear();
}
//Check method Value
CPPUNIT_ASSERT(_attr->Value() == value);
-
- study->Clear();
}
_attr->SetSelectable(true);
CPPUNIT_ASSERT(_attr->IsSelectable());
-
- study->Clear();
}
isRaised = true;
}
CPPUNIT_ASSERT(isRaised);
-
- study->Clear();
}
isRaised = true;
}
CPPUNIT_ASSERT(isRaised);
-
- study->Clear();
}
_attr->GetModificationsList(vs, vi[0], vi[1], vi[2], vi[3], vi[4], true);
CPPUNIT_ASSERT(vs[0] == "srn" && vi[0][0] == 1 && vi[1][0] == 2 && vi[2][0] == 3 && vi[3][0] == 4 && vi[4][0] == 5);
-
- study->Clear();
}
data2 = _attr->GetColumn(3);
CPPUNIT_ASSERT(data2.size() == 3 && data2[0] == 11 && data2[1] == -22 && data2[2] == -33);
-
- study->Clear();
}
data2 = _attr->GetColumn(3);
CPPUNIT_ASSERT(data2.size() == 3 && data2[0] == 11.11 && data2[1] == -22.22 && data2[2] == -33.33);
-
- study->Clear();
}
data2 = _attr->GetColumn(3);
CPPUNIT_ASSERT(data2.size() == 3 && data2[0] == "11" && data2[1] == "-22" && data2[2] == "-33");
-
- study->Clear();
}
CPPUNIT_ASSERT(v.size() == 1);
CPPUNIT_ASSERT(v[0]->GetID() == "0:1:3");
-
- study->Clear();
}
CPPUNIT_ASSERT(color.G == color2.G);
CPPUNIT_ASSERT(color.B == color2.B);
-
- study->Clear();
}
CPPUNIT_ASSERT(color.G == color2.G);
CPPUNIT_ASSERT(color.B == color2.B);
-
- study->Clear();
}
std::string value = "0e1c36e6-1111-4d90-ab3b-18a14310e648";
_PTR(AttributeTreeNode) _attr_guid = studyBuilder->FindOrCreateAttribute(so, "AttributeTreeNodeGUID"+value);
CPPUNIT_ASSERT(_attr_guid && _attr_guid->GetTreeID() == value);
-
- study->Clear();
}
#undef SALOMEDS_ALL_TESTS
_PTR(AttributeUserID) _attr2 = studyBuilder->FindOrCreateAttribute(so, "AttributeUserID"+value);
CPPUNIT_ASSERT(_attr2 && _attr2->Value() == value);
- study->Clear();
}
//Check that there are two SObject under so
CPPUNIT_ASSERT(count == 2);
-
- study->Clear();
}
//Check method ComponentDataType
CPPUNIT_ASSERT(sco->ComponentDataType() == "Test");
-
- study->Clear();
}
CPPUNIT_ASSERT(i<2);
CPPUNIT_ASSERT(ci->Value()->ComponentDataType() == v[i]);
}
-
- study->Clear();
}
//Check method GetObject
CORBA::Object_var obj = dynamic_cast<SALOMEDS_SObject*>(so.get())->GetObject();
CPPUNIT_ASSERT(!CORBA::is_nil(obj));
-
- study->Clear();
}
CPPUNIT_ASSERT(!ior.empty());
system("rm -f srn_SALOMEDS_UnitTests.hdf");
-
- study3->Clear();
}
it->Next();
CPPUNIT_ASSERT(it->More());
CPPUNIT_ASSERT(it->Value()->GetID() == so1->GetID());
-
- study->Clear();
}
#undef SALOMEDS_ALL_TESTS
public:
virtual ~SALOMEDSClient_Study() {}
- virtual void Init() = 0;
virtual void Clear() = 0;
virtual bool Open(const std::string& theStudyUrl) = 0;
const std::string& theURL,
bool isMultiFile) = 0;
- virtual void Close(const SALOMEDSImpl_SComponent& theComponent) = 0;
+ virtual void Close() = 0;
virtual std::string ComponentDataType() = 0;