From 5b6f0beca30dcaddd1f8e9031cd0a176c7396093 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Mon, 8 Feb 2021 21:26:07 +0100 Subject: [PATCH] Fix detected error into test1.py since agy/arch2 branch integration --- src/HOMARD_I/CMakeLists.txt | 4 +++ src/HOMARD_I/HOMARD_Gen_i.cxx | 27 +++------------ src/HOMARD_I/HOMARD_Gen_i.hxx | 9 ++--- src/HOMARD_I/HOMARD_Gen_i_No_Session.cxx | 26 ++++++++++++++ src/HOMARD_I/HOMARD_Gen_i_No_Session.hxx | 32 ++++++++++++++++++ src/HOMARD_I/HOMARD_Gen_i_Session.cxx | 43 ++++++++++++++++++++++++ src/HOMARD_I/HOMARD_Gen_i_Session.hxx | 32 ++++++++++++++++++ 7 files changed, 145 insertions(+), 28 deletions(-) create mode 100644 src/HOMARD_I/HOMARD_Gen_i_No_Session.cxx create mode 100644 src/HOMARD_I/HOMARD_Gen_i_No_Session.hxx create mode 100644 src/HOMARD_I/HOMARD_Gen_i_Session.cxx create mode 100644 src/HOMARD_I/HOMARD_Gen_i_Session.hxx diff --git a/src/HOMARD_I/CMakeLists.txt b/src/HOMARD_I/CMakeLists.txt index 6afe4741..e7d84a38 100644 --- a/src/HOMARD_I/CMakeLists.txt +++ b/src/HOMARD_I/CMakeLists.txt @@ -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 diff --git a/src/HOMARD_I/HOMARD_Gen_i.cxx b/src/HOMARD_I/HOMARD_Gen_i.cxx index bdca7a62..a42a858c 100644 --- a/src/HOMARD_I/HOMARD_Gen_i.cxx +++ b/src/HOMARD_I/HOMARD_Gen_i.cxx @@ -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_::Instance(); ASSERT(SINGLETON_::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(); - } -} diff --git a/src/HOMARD_I/HOMARD_Gen_i.hxx b/src/HOMARD_I/HOMARD_Gen_i.hxx index 10c07cec..0b6ed288 100644 --- a/src/HOMARD_I/HOMARD_Gen_i.hxx +++ b/src/HOMARD_I/HOMARD_Gen_i.hxx @@ -43,9 +43,7 @@ #include #include -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 index 00000000..bfeb38b1 --- /dev/null +++ b/src/HOMARD_I/HOMARD_Gen_i_No_Session.cxx @@ -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 index 00000000..1752ec40 --- /dev/null +++ b/src/HOMARD_I/HOMARD_Gen_i_No_Session.hxx @@ -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 index 00000000..0b152aff --- /dev/null +++ b/src/HOMARD_I/HOMARD_Gen_i_Session.cxx @@ -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 index 00000000..50a91230 --- /dev/null +++ b/src/HOMARD_I/HOMARD_Gen_i_Session.hxx @@ -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 ); +}; -- 2.30.2