Salome HOME
Fix detected error into test1.py since agy/arch2 branch integration
authorAnthony Geay <anthony.geay@edf.fr>
Mon, 8 Feb 2021 20:26:07 +0000 (21:26 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Mon, 8 Feb 2021 20:26:07 +0000 (21:26 +0100)
src/HOMARD_I/CMakeLists.txt
src/HOMARD_I/HOMARD_Gen_i.cxx
src/HOMARD_I/HOMARD_Gen_i.hxx
src/HOMARD_I/HOMARD_Gen_i_No_Session.cxx [new file with mode: 0644]
src/HOMARD_I/HOMARD_Gen_i_No_Session.hxx [new file with mode: 0644]
src/HOMARD_I/HOMARD_Gen_i_Session.cxx [new file with mode: 0644]
src/HOMARD_I/HOMARD_Gen_i_Session.hxx [new file with mode: 0644]

index 6afe4741d56b4df323075b1416f8af0d38a714b0..e7d84a388940c9ce016de823fa9b4633718f14bc 100644 (file)
@@ -64,6 +64,8 @@ SET(HOMARDEngine_HEADERS
   HOMARD_Iteration_i.hxx
   HOMARD_Zone_i.hxx
   HOMARD_Gen_i.hxx
+  HOMARD_Gen_i_Session.hxx
+  HOMARD_Gen_i_No_Session.hxx
   HOMARD_Boundary_i.hxx
   HOMARD_YACS_i.hxx
   HomardMedCommun.h
@@ -78,6 +80,8 @@ SET(HOMARDEngine_SOURCES
   HOMARD_Hypothesis_i.cxx
   HOMARD_Iteration_i.cxx
   HOMARD_Gen_i.cxx
+  HOMARD_Gen_i_Session.cxx
+  HOMARD_Gen_i_No_Session.cxx
   HOMARD_Zone_i.cxx
   HOMARD_Boundary_i.cxx
   HOMARD_YACS_i.cxx
index bdca7a6259fa13aee52ebabf566c995a3a5bada9..a42a858c60a4f2e5fd5a1a5c7ea0e08e019614e3 100644 (file)
@@ -99,13 +99,11 @@ Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
   _thisObj = this;
   _id = _poa->activate_object(_thisObj);
 
-  myHomard = new ::HOMARD_Gen();
+  myHomard = new ::HOMARD_Gen;
   _NS = SINGLETON_<SALOME_NamingService>::Instance();
   ASSERT(SINGLETON_<SALOME_NamingService>::IsAlreadyExisting());
   _NS->init_orb(_orb);
 
-  myStudy = SALOMEDS::Study::_duplicate( SMESH_Gen_i::GetSMESHGen()->getStudyServant() );
-
   _tag_gene = 0 ;
   _tag_boun = 0 ;
   _tag_hypo = 0 ;
@@ -4580,7 +4578,7 @@ SALOMEDS::TMPFile* HOMARD_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
   // HOMARD data file name
   std::string aFileName = "";
   if (isMultiFile)
-    aFileName = SALOMEDS_Tool::GetNameFromPath(Kernel_Utils::encode(SMESH_Gen_i::GetSMESHGen()->getStudyServant()->URL()));
+    aFileName = SALOMEDS_Tool::GetNameFromPath(Kernel_Utils::encode(myStudy->URL()));
   aFileName += "_HOMARD.dat";
 
   // initialize sequence of file names
@@ -4704,7 +4702,7 @@ CORBA::Boolean HOMARD_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
   // HOMARD data file name
   std::string aFileName = "";
   if (isMultiFile)
-    aFileName = SALOMEDS_Tool::GetNameFromPath(Kernel_Utils::encode(SMESH_Gen_i::GetSMESHGen()->getStudyServant()->URL()));
+    aFileName = SALOMEDS_Tool::GetNameFromPath(Kernel_Utils::encode(myStudy->URL()));
   aFileName = tmpDir + aFileName + "_HOMARD.dat";
 
   StudyContext& context = myStudyContext;
@@ -4966,7 +4964,7 @@ Engines::TMPFile* HOMARD_Gen_i::DumpPython(CORBA::Boolean isPublished,
    MESSAGE ("Entree dans DumpPython");
    isValidScript=1;
 
-   SALOMEDS::SObject_var aSO = SMESH_Gen_i::GetSMESHGen()->getStudyServant()->FindComponent("HOMARD");
+   SALOMEDS::SObject_var aSO = myStudy->FindComponent("HOMARD");
    if(CORBA::is_nil(aSO))
       return new Engines::TMPFile(0);
 
@@ -5135,7 +5133,7 @@ Engines::TMPFile* HOMARD_Gen_i::DumpPython(CORBA::Boolean isPublished,
 void HOMARD_Gen_i::IsValidStudy( )
 {
 //   MESSAGE( "IsValidStudy" );
-  if (CORBA::is_nil(SMESH_Gen_i::GetSMESHGen()->getStudyServant()))
+  if (CORBA::is_nil(myStudy))
   {
     SALOME::ExceptionStruct es;
     es.type = SALOME::BAD_PARAM;
@@ -5415,18 +5413,3 @@ CORBA::Long HOMARD_Gen_i::GetYACSConvergenceType()
   return _YACSTypeTest ;
 }
 
-//=============================================================================
-extern "C"
-{
-  HOMARDENGINE_EXPORT
-  PortableServer::ObjectId* HOMARDEngine_factory(CORBA::ORB_ptr orb,
-                                                 PortableServer::POA_ptr poa,
-                                                 PortableServer::ObjectId* contId,
-                                                 const char* instanceName,
-                                                 const char* interfaceName)
-  {
-    MESSAGE("PortableServer::ObjectId* HOMARDEngine_factory()");
-    HOMARD_Gen_i* myHOMARD_Gen = new HOMARD_Gen_i(orb, poa, contId, instanceName, interfaceName);
-    return myHOMARD_Gen->getId();
-  }
-}
index 10c07cec4bec881c606a8106629c23b94b8603bb..0b6ed28899291c24e09ce61e476d121cbdf33106 100644 (file)
@@ -43,9 +43,7 @@
 #include <string>
 #include <map>
 
-class HOMARDENGINE_EXPORT HOMARD_Gen_i:
-  public virtual Engines_Component_i,
-  public virtual POA_HOMARD::HOMARD_Gen
+class HOMARDENGINE_EXPORT HOMARD_Gen_i : public Engines_Component_i, public POA_HOMARD::HOMARD_Gen
 {
 public:
   HOMARD_Gen_i( CORBA::ORB_ptr orb,
@@ -321,7 +319,6 @@ private:
   };
 
   ::HOMARD_Gen*                 myHomard;
-  SALOMEDS::Study_var           myStudy;
   StudyContext                  myStudyContext;
   SALOME_NamingService*         _NS;
 
@@ -340,8 +337,8 @@ private:
   int _YACSMaxNode ;
   int _YACSMaxElem ;
   int _YACSTypeTest ;
- ;
-
+protected:
+  SALOMEDS::Study_var           myStudy;
 };
 
 #endif
diff --git a/src/HOMARD_I/HOMARD_Gen_i_No_Session.cxx b/src/HOMARD_I/HOMARD_Gen_i_No_Session.cxx
new file mode 100644 (file)
index 0000000..bfeb38b
--- /dev/null
@@ -0,0 +1,26 @@
+// Copyright (C) 2021  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "HOMARD_Gen_i_No_Session.hxx"
+#include "SALOMEDS_Study_i.hxx"
+
+HOMARD_Gen_i_No_Session::HOMARD_Gen_i_No_Session( CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId* contId, const char* instanceName, const char* interfaceName ):HOMARD_Gen_i(orb,poa,contId,instanceName,interfaceName)
+{
+    myStudy = KERNEL::getStudyServantSA();
+}
diff --git a/src/HOMARD_I/HOMARD_Gen_i_No_Session.hxx b/src/HOMARD_I/HOMARD_Gen_i_No_Session.hxx
new file mode 100644 (file)
index 0000000..1752ec4
--- /dev/null
@@ -0,0 +1,32 @@
+// Copyright (C) 2021  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#pragma once
+
+#include "HOMARD_Gen_i.hxx"
+
+class HOMARDENGINE_EXPORT HOMARD_Gen_i_No_Session : public HOMARD_Gen_i
+{
+public:
+  HOMARD_Gen_i_No_Session( CORBA::ORB_ptr orb,
+                        PortableServer::POA_ptr poa,
+                        PortableServer::ObjectId* contId,
+                        const char* instanceName,
+                        const char* interfaceName );
+};
diff --git a/src/HOMARD_I/HOMARD_Gen_i_Session.cxx b/src/HOMARD_I/HOMARD_Gen_i_Session.cxx
new file mode 100644 (file)
index 0000000..0b152af
--- /dev/null
@@ -0,0 +1,43 @@
+// Copyright (C) 2021  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "HOMARD_Gen_i_Session.hxx"
+#include "SALOMEDS_Study_i.hxx"
+#include "SALOME_KernelServices.hxx"
+
+HOMARD_Gen_i_Session::HOMARD_Gen_i_Session( CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId* contId, const char* instanceName, const char* interfaceName ):HOMARD_Gen_i(orb,poa,contId,instanceName,interfaceName)
+{
+    myStudy = SALOMEDS::Study::_duplicate(KERNEL::getStudyServant());
+}
+
+//=============================================================================
+extern "C"
+{
+  HOMARDENGINE_EXPORT
+  PortableServer::ObjectId* HOMARDEngine_factory(CORBA::ORB_ptr orb,
+                                                 PortableServer::POA_ptr poa,
+                                                 PortableServer::ObjectId* contId,
+                                                 const char* instanceName,
+                                                 const char* interfaceName)
+  {
+    MESSAGE("PortableServer::ObjectId* HOMARDEngine_factory()");
+    HOMARD_Gen_i_Session* myHOMARD_Gen = new HOMARD_Gen_i_Session(orb, poa, contId, instanceName, interfaceName);
+    return myHOMARD_Gen->getId();
+  }
+}
diff --git a/src/HOMARD_I/HOMARD_Gen_i_Session.hxx b/src/HOMARD_I/HOMARD_Gen_i_Session.hxx
new file mode 100644 (file)
index 0000000..50a9123
--- /dev/null
@@ -0,0 +1,32 @@
+// Copyright (C) 2021  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#pragma once
+
+#include "HOMARD_Gen_i.hxx"
+
+class HOMARDENGINE_EXPORT HOMARD_Gen_i_Session : public HOMARD_Gen_i
+{
+public:
+  HOMARD_Gen_i_Session( CORBA::ORB_ptr orb,
+                        PortableServer::POA_ptr poa,
+                        PortableServer::ObjectId* contId,
+                        const char* instanceName,
+                        const char* interfaceName );
+};