]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
code improvement
authormpa <mpa@opencascade.com>
Thu, 2 Feb 2017 07:43:51 +0000 (10:43 +0300)
committermpa <mpa@opencascade.com>
Thu, 2 Feb 2017 07:43:51 +0000 (10:43 +0300)
src/KERNEL_PY/kernel/services.py
src/KERNEL_PY/kernel/studyedit.py
src/KernelHelpers/KernelHelpersUseCases.cxx
src/KernelHelpers/SALOME_KernelServices.cxx
src/KernelHelpers/SALOME_KernelServices.hxx
src/KernelHelpers/SALOME_StudyEditor.cxx
src/KernelHelpers/Test/KernelHelpersUnitTests.cxx
src/SALOMEDS/SALOMEDS_Client.cxx
src/SALOMEDS/SALOMEDS_Driver_i.cxx
src/SALOMEDS/SALOMEDS_IParameters.cxx
src/SALOMEDSImpl/SALOMEDSImpl_IParameters.cxx

index e7f3f33b262daaf9d37b0a7c54838b8c933e797a..b1b3db9c1e21276e9bf9943b3b9a8e1bb499e546 100644 (file)
@@ -123,13 +123,6 @@ def getComponentList():
         raise RuntimeError, "Can't accesss module catalog"
     return catalog.GetComponentList()
 
-## Get a study
-#  \ingroup service
-def getStudy():
-    """Get a study"""
-    return salome.myStudy
-
-
 import SALOMEDS
 ## Get a study to create SALOME study. 
 #  \warning you should use instead the variable salome.myStudy. 
index be1941020320b2c0114356319779346bdb374a82..98aad628287c203f0d0cff3b1b22bfd0c9d582bb 100644 (file)
@@ -42,9 +42,6 @@ _DEFAULT_CONTAINER = "FactoryServer"
 # The codec to use for strings that are displayed in Salome study tree is Latin-1
 ENCODING_FOR_SALOME_STUDY = "iso-8859-1"
 
-def getStudy():
-    return salome.myStudy
-
 ## Return a \b StudyEditor instance to edit the study. 
 #  \ingroup studyedit
 def getStudyEditor():
index f408555f2c6416e924f864ffef45524892447f66..02341d11e59042599cf434fe0fabaea5fe41b237 100644 (file)
@@ -61,7 +61,7 @@ bool TEST_getLifeCycleCORBA() {
 }
 
 bool TEST_getStudy() {
-  SALOMEDS::Study_ptr myTestStudy = KERNEL::getStudy();
+  SALOMEDS::Study_ptr myTestStudy = KERNEL::getStudyServant();
   if ( CORBA::is_nil(myTestStudy) ) {
     return false;
   }
index 4b3a07d70c34acb7798cdf6586639bc7965ea0ec..71f9456602d0cfa5e80b761f1f9f6c12d295a389 100644 (file)
@@ -64,7 +64,7 @@ namespace KERNEL {
    * This returns a static reference to the SALOME study. The
    * study can be used to get informations about it.
    */
-  SALOMEDS::Study_ptr getStudy() {
+  SALOMEDS::Study_ptr getStudyServant() {
     static SALOMEDS::Study_ptr aStudy;
     if(CORBA::is_nil(aStudy)){
       SALOME_NamingService *aNamingService = getNamingService();
index 9496986b10327694c69746d89631d204db97ce2c..4353d44f1a25d3184cc0544166f19e9d69596ab0 100644 (file)
@@ -41,7 +41,7 @@ namespace KERNEL {
   KERNELHELPERS_EXPORT SALOME_NamingService *        getNamingService();
   KERNELHELPERS_EXPORT SALOME_LifeCycleCORBA *       getLifeCycleCORBA();
   KERNELHELPERS_EXPORT SALOME::Session_ptr           getSalomeSession();
-  KERNELHELPERS_EXPORT SALOMEDS::Study_ptr           getStudy();
+  KERNELHELPERS_EXPORT SALOMEDS::Study_ptr           getStudyServant();
   KERNELHELPERS_EXPORT Engines::SalomeLauncher_ptr   getSalomeLauncher();
   KERNELHELPERS_EXPORT Engines::ResourcesManager_ptr getResourcesManager();
 
index 39199d4a998a2ff0f36f1561e11ed223e310ccaa..908afb7682f6cca6a56cacdc19d68db0acbe981a 100644 (file)
@@ -23,7 +23,7 @@
 
 /** Canonic constructor. The object can't be used without a setStudy() */
 SALOME_StudyEditor::SALOME_StudyEditor() {
-  _sbuilder = KERNEL::getStudy()->NewBuilder();
+  _sbuilder = KERNEL::getStudyServant()->NewBuilder();
 }
 
 SALOMEDS::SObject_ptr SALOME_StudyEditor::newObject(SALOMEDS::SObject_ptr parent) {
@@ -31,7 +31,7 @@ SALOMEDS::SObject_ptr SALOME_StudyEditor::newObject(SALOMEDS::SObject_ptr parent
 }
 
 SALOMEDS::SObject_ptr SALOME_StudyEditor::findObject(const char * entry) {
-  SALOMEDS::SObject_var sobject = KERNEL::getStudy()->FindObjectID(entry);
+  SALOMEDS::SObject_var sobject = KERNEL::getStudyServant()->FindObjectID(entry);
   return sobject._retn();
 }
 
@@ -58,7 +58,7 @@ bool SALOME_StudyEditor::bindEngine(SALOMEDS::SComponent_var studyRoot,
 }
 
 SALOMEDS::SComponent_ptr SALOME_StudyEditor::findRoot(const char * moduleName) {
-  return KERNEL::getStudy()->FindComponent(moduleName);
+  return KERNEL::getStudyServant()->FindComponent(moduleName);
 }
 
 void SALOME_StudyEditor::setName(SALOMEDS::SObject_var sobject, const char * value) {
index d34ef0332c57727eae2c2d46debd02f0e2fe216f..7aa3bc43601c82fd62002d188d0be441e46a9bda 100644 (file)
@@ -78,7 +78,7 @@ void KernelHelpersUnitTests::TEST_getLifeCycleCORBA() {
 }
 
 void KernelHelpersUnitTests::TEST_getStudy() {
-  SALOMEDS::Study_ptr myTestStudy = KERNEL::getStudy();
+  SALOMEDS::Study_ptr myTestStudy = KERNEL::getStudyServant();
   CPPUNIT_ASSERT(!CORBA::is_nil(myTestStudy));
 
   // One can use the study to store some general properties
index 29f9ba1a2d804fd130ae08e31f066da3e37dd258..12662b5f1890af59745057ad31cfa99044d718b6 100644 (file)
@@ -40,7 +40,7 @@
 //============================================================================
 static void DumpComponent(SALOMEDS::SObject_ptr SO, int offset) {
   SALOMEDS::SObject_var RefSO;
-  SALOMEDS::ChildIterator_var it = KERNEL::getStudy()->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;
@@ -70,7 +70,7 @@ static void DumpStudy() {
   MESSAGE("Explore Study and Write name of each object if it exists");
   
   char* name;
-  SALOMEDS::SComponentIterator_var itcomp = KERNEL::getStudy()->NewComponentIterator();
+  SALOMEDS::SComponentIterator_var itcomp = KERNEL::getStudyServant()->NewComponentIterator();
   int offset = 1;
   for (; itcomp->More(); itcomp->Next()) {
     SALOMEDS::SComponent_var SC = itcomp->Value();
@@ -90,7 +90,7 @@ static void Test()
   try {
   char* name;
 
-  SALOMEDS::Study_var myStudy = KERNEL::getStudy();
+  SALOMEDS::Study_var myStudy = KERNEL::getStudyServant();
 
   MESSAGE("Create Builder ");
   SALOMEDS::StudyBuilder_var StudyBuild = myStudy->NewBuilder();
index 04469f922adc464f1a2dc28451e461a33feb87c2..eecaaff4fb7a84c15ffcf63a43268dc468536998 100644 (file)
@@ -322,10 +322,6 @@ SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::DumpPython(bool isPublished,
                                                     bool& isValidScript,
                                                     long& theStreamLength)
 {
-  SALOME_NamingService* namingService = KERNEL::getNamingService();
-  CORBA::Object_var obj = namingService->Resolve("/Study");
-  SALOMEDS::Study_var st = SALOMEDS::Study::_narrow(obj);
-
   SALOMEDS::unlock();
 
   Engines::TMPFile_var aStream;
index 8439c8b0d31c71dec506c44045bacfdf895dd246..a7104f459907ff663501f7711336e16f4bcb8317 100644 (file)
@@ -264,7 +264,7 @@ std::string SALOMEDS_IParameters::decodeEntry(const std::string& entry)
   std::string compName(entry, 0, pos), compID, tail(entry, pos+1, entry.length()-1);
   
   if(_compNames.find(compName) == _compNames.end()) {
-    _PTR(SObject) so = ClientFactory::Study(KERNEL::getStudy())->FindComponent(compName);
+    _PTR(SObject) so = ClientFactory::Study(KERNEL::getStudyServant())->FindComponent(compName);
     if(!so) return entry;
     compID = so->GetID();
     _compNames[compName] = compID;
@@ -283,7 +283,7 @@ void SALOMEDS_IParameters::setDumpPython(const std::string& theID)
   if(theID == "") anID = getDefaultVisualComponent();
   else anID = theID;
 
-  _PTR(AttributeParameter) ap = ClientFactory::Study(KERNEL::getStudy())->GetCommonParameters(anID, 0);
+  _PTR(AttributeParameter) ap = ClientFactory::Study(KERNEL::getStudyServant())->GetCommonParameters(anID, 0);
   ap->SetBool(_AP_DUMP_PYTHON_, !isDumpPython(theID));
 }
 
@@ -293,7 +293,7 @@ bool SALOMEDS_IParameters::isDumpPython(const std::string& theID)
   if(theID == "") anID = getDefaultVisualComponent();
   else anID = theID;
 
-  _PTR(AttributeParameter) ap = ClientFactory::Study(KERNEL::getStudy())->GetCommonParameters(anID, 0);
+  _PTR(AttributeParameter) ap = ClientFactory::Study(KERNEL::getStudyServant())->GetCommonParameters(anID, 0);
   if(!ap) return false;
   if(!ap->IsSet(_AP_DUMP_PYTHON_, PT_BOOLEAN)) return false;
   return (bool)ap->GetBool(_AP_DUMP_PYTHON_);
index 749c112bbc320f2fa44879d0771bf6630ec6a6cb..ba8d24376076dfb9deb3faaef32e37451608c158 100644 (file)
@@ -341,7 +341,7 @@ std::string SALOMEDSImpl_IParameters::getDefaultScript(SALOMEDSImpl_Study* study
 
 
   dump += shift +"import iparameters\n";
-  dump += shift + "ipar = iparameters.IParameters(theStudy.GetModuleParameters(\""+anID+"\", \""+moduleName+"\", 1))\n\n";
+  dump += shift + "ipar = iparameters.IParameters(salome.myStudy.GetModuleParameters(\""+anID+"\", \""+moduleName+"\", 1))\n\n";
   
   std::vector<std::string> v = ip.getProperties();
   if(v.size() > 0) {