X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSALOMEDS%2FSALOMEDS_Client.cxx;h=c3fccc7b0122a25dac0e5b3aff6022ea5188fca0;hb=4d61f5b8863253a259cde301c39b60909a6b18fa;hp=db409bbf53681e4aabd41fa7baccadf0fe6e9467;hpb=22fef16356c8eb8e9dd1542ac49669f373786db3;p=modules%2Fkernel.git diff --git a/src/SALOMEDS/SALOMEDS_Client.cxx b/src/SALOMEDS/SALOMEDS_Client.cxx index db409bbf5..c3fccc7b0 100644 --- a/src/SALOMEDS/SALOMEDS_Client.cxx +++ b/src/SALOMEDS/SALOMEDS_Client.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -29,7 +29,8 @@ #include #include CORBA_SERVER_HEADER(SALOMEDS) #include "SALOMEDS_AttributeName_i.hxx" -#include "SALOME_NamingService.hxx" +#include "SALOME_KernelServices.hxx" +#include "Basics_Utils.hxx" #include "utilities.h" #include "HDFOI.hxx" @@ -38,9 +39,9 @@ * Purpose : */ //============================================================================ -static void DumpComponent(SALOMEDS::Study_ptr Study,SALOMEDS::SObject_ptr SO, int offset) { +static void DumpComponent(SALOMEDS::SObject_ptr SO, int offset) { SALOMEDS::SObject_var RefSO; - SALOMEDS::ChildIterator_var it = Study->NewChildIterator(SO); + SALOMEDS::ChildIterator_var it = KERNEL::getStudyServant()->NewChildIterator(SO); for (; it->More();it->Next()){ SALOMEDS::SObject_var CSO= it->Value(); SALOMEDS::GenericAttribute_var anAttr; @@ -57,7 +58,7 @@ static void DumpComponent(SALOMEDS::Study_ptr Study,SALOMEDS::SObject_ptr SO, in MESSAGE(" "); MESSAGE("*Reference"<GetID()); } - DumpComponent(Study,CSO,offset+2); + DumpComponent(CSO,offset+2); } } @@ -66,17 +67,18 @@ static void DumpComponent(SALOMEDS::Study_ptr Study,SALOMEDS::SObject_ptr SO, in * Purpose : */ //============================================================================ -static void DumpStudy (SALOMEDS::Study_ptr Study) { +static void DumpStudy() { MESSAGE("Explore Study and Write name of each object if it exists"); char* name; - SALOMEDS::SComponentIterator_var itcomp = Study->NewComponentIterator(); + SALOME_UNUSED(name); // unused in release mode + SALOMEDS::SComponentIterator_var itcomp = KERNEL::getStudyServant()->NewComponentIterator(); int offset = 1; for (; itcomp->More(); itcomp->Next()) { SALOMEDS::SComponent_var SC = itcomp->Value(); name = SC->ComponentDataType(); MESSAGE("-> ComponentDataType is "<NewBuilder(); @@ -183,27 +188,19 @@ static void Test(SALOMEDS::Study_ptr myStudy) Name->SetValue("mesh_cylinder_0"); StudyBuild->CommitCommand(); - MESSAGE("Test GetStudy"); - SALOMEDS::Study_var stu = mesh_cylinder->GetStudy(); - MESSAGE ("-> Study Name is "<Name()); - - DumpStudy(myStudy); + DumpStudy(); StudyBuild->Undo(); // Study should have no trace of object mesh_cylinder - DumpStudy(myStudy); + DumpStudy(); // Save as - myStudy->SaveAs("/home/edeville/Study1.hdf", false); + myStudy->SaveAs(Kernel_Utils::decode("/home/edeville/Study1.hdf"), false, false); // Get Persistent Reference of the study test name = myStudy->GetPersistentReference(); MESSAGE("Persitent Reference of the study " << name); - // Get Transient Reference of the study test - name = myStudy->GetTransientReference(); - MESSAGE("Transient Reference of the study " << name); - // FindComponent Test SALOMEDS::SComponent_var compo = myStudy->FindComponent("GEOM"); // Get ComponentDataType test @@ -243,7 +240,7 @@ static void Test(SALOMEDS::Study_ptr myStudy) else { MESSAGE("-> Name is not found"); } - //DumpStudy(myStudy); + //DumpStudy(); } catch(HDFexception) { @@ -267,21 +264,14 @@ int main(int argc, char** argv) CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); PortableServer::POA_var poa = PortableServer::POA::_narrow(obj); - SALOME_NamingService * salomens = new SALOME_NamingService(orb); - - MESSAGE("Find Study "); - CORBA::Object_ptr obj2 = salomens->Resolve("/Study"); - SALOMEDS::Study_var myStudy = SALOMEDS::Study::_narrow(obj2); - // Obtain a POAManager, and tell the POA to start accepting // requests on its objects. PortableServer::POAManager_var pman = poa->the_POAManager(); pman->activate(); // Test basic services - Test(myStudy); + Test(); - delete salomens; orb->run(); orb->destroy(); } @@ -291,7 +281,7 @@ int main(int argc, char** argv) catch(CORBA::Exception&) { MESSAGE( "Caught CORBA::Exception." ) } - catch(omniORB::fatalException& fe) { + catch(omniORB::fatalException& fe) { //!< TODO: unused variable MESSAGE( "Caught omniORB::fatalException:" ) MESSAGE( " file: " << fe.file() ) MESSAGE( " line: " << fe.line() )