]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
bos #26457 Factorization of ORB initialization
authorViktor UZLOV <vuzlov@debian10-01.nnov.opencascade.com>
Wed, 13 Oct 2021 07:01:10 +0000 (10:01 +0300)
committervsr <vsr@opencascade.com>
Mon, 29 Nov 2021 09:56:42 +0000 (12:56 +0300)
src/SalomeApp/CMakeLists.txt
src/SalomeApp/SalomeApp_Application.cxx
src/SalomeApp/SalomeApp_Engine_i.cxx
src/Session/CMakeLists.txt
src/Session/SALOME_Session_Server.cxx
src/Session/Session_NS_wrapper.cxx
src/Session/Session_ServerCheck.cxx
src/Session/Session_ServerThread.cxx

index d43b4339d0927a6f77edba73d22c82d4948216ec..041e59c78ad1253dda181ee16cbde6017c019229 100644 (file)
@@ -76,7 +76,7 @@ SET(_link_LIBRARIES
   ${OpenCASCADE_FoundationClasses_LIBRARIES}
   ${QT_LIBRARIES}
   ${PYTHON_LIBRARIES}
-  ${KERNEL_OpUtil} ${KERNEL_SALOMELocalTrace} ${KERNEL_SalomeDSClient} ${KERNEL_TOOLSDS}
+  ${KERNEL_ArgvKeeper} ${KERNEL_OpUtil} ${KERNEL_SALOMELocalTrace} ${KERNEL_SalomeDSClient} ${KERNEL_TOOLSDS}
   CASCatch suit std CAM ObjBrowser SalomePrs Event
   LogWindow LightApp SalomePrs ToolsGUI
 )
index 19d0973798de5032c548c046710abc6d8b5294d8..aedddec2ac591f5b3fa5e83ec9a12029d6bc0fdb 100644 (file)
@@ -80,8 +80,6 @@
 //#include <OB_ListItem.h>
 
 
-#include <Utils_ORB_INIT.hxx>
-#include <Utils_SINGLETON.hxx>
 #include <SALOME_LifeCycleCORBA.hxx>
 
 #include <QApplication>
@@ -97,7 +95,9 @@
 #include <QtDebug>
 
 #include <SALOMEDSClient_ClientFactory.hxx>
+#include <ArgvKeeper.hxx>
 #include <Basics_Utils.hxx>
+#include <OpUtil.hxx>
 
 #include <SALOME_ListIO.hxx>
 #include <SALOME_Prs.h>
@@ -1347,8 +1347,8 @@ CORBA::ORB_var SalomeApp_Application::orb()
 
   if ( CORBA::is_nil( _orb ) ) {
     Qtx::CmdLineArgs args;
-    ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance();
-    _orb = init( args.argc(), args.argv() );
+    SetArgcArgv( args.argc(), args.argv() );
+    _orb = KERNEL::GetRefToORB();
   }
 
   return _orb;
index a7490d7b853f147d061581e25380aaa42dc1fe67..760822ae967cc1def1481704f71e770610442edb 100644 (file)
@@ -33,8 +33,8 @@
 
 #include <SALOME_NamingService.hxx>
 #include <SALOMEDS_Tool.hxx>
-#include <Utils_ORB_INIT.hxx>
-#include <Utils_SINGLETON.hxx>
+#include <ArgvKeeper.hxx>
+#include <OpUtil.hxx>
 #include <Utils_SALOME_Exception.hxx>
 #include <utilities.h>
 
@@ -343,8 +343,8 @@ CORBA::ORB_var SalomeApp_Engine_i::orb()
 
   if ( CORBA::is_nil( _orb ) ) {
     Qtx::CmdLineArgs args;
-    ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance();
-    _orb = init( args.argc(), args.argv() );
+    SetArgcArgv( args.argc(), args.argv() );
+    _orb = KERNEL::GetRefToORB();
   }
 
   return _orb;
index 480715f57f023a9cbea4d02a1dcaa32543f34164..fe934c25a477d8971dba643e82c2554354a91f15 100644 (file)
@@ -57,6 +57,7 @@ SET(_link_LIBRARIES
   ${QT_LIBRARIES}
   ${OpenCASCADE_FoundationClasses_LIBRARIES}
   ${OMNIORB_LIBRARIES}
+  ${KERNEL_ArgvKeeper}
   ${KERNEL_SalomeNS}
   ${KERNEL_SalomeLifeCycleCORBA}
   ${KERNEL_OpUtil}
index e95d71ee5f53a21d79ed3d3651a6c7651dd72682..253fd8f22be6ff85aface0fc778793104aa2e88b 100644 (file)
@@ -20,6 +20,7 @@
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
+#include <ArgvKeeper.hxx>
 #include <Container_init_python.hxx> // this include must be the first one as it includes Python.h
 #include <Basics_Utils.hxx>
 #include <ConnectionManager_i.hxx>
@@ -579,15 +580,14 @@ int AbstractGUIAppMain(int argc, char **argv)
   try
   {
     // ...create ORB, get RootPOA object, NamingService, etc.
-    ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
-    ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
     int orbArgc = 1;
     if (std::string(argv[1]).find("-ORBInitRef") != std::string::npos)
     {
       orbArgc = 3;
       remoteLauncher = true;
     }
-    orb = init(orbArgc, argv);
+    SetArgcArgv(orbArgc, argv);
+    orb = KERNEL::GetRefToORB();
 
     CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
     poa = PortableServer::POA::_narrow(obj);
index 2619179e44bb8f9d1c9cf62429e703a6e30dcc02..a90359c4b01a4a7d36fb7800cfa656766ad98c30 100644 (file)
@@ -19,6 +19,8 @@
 
 #include "Session_NS_wrapper.hxx"
 
+#include "ArgvKeeper.hxx"
+#include "OpUtil.hxx"
 #include "SALOME_Fake_NamingService.hxx"
 #include "SALOME_Container_i.hxx"
 #include "SALOME_Launcher.hxx"
@@ -199,13 +201,12 @@ void OldStyleNS::activateSALOMEDS(CORBA::ORB_var orb, PortableServer::POA_var po
   }
 }
 
-#include "Utils_ORB_INIT.hxx"
 #include "Utils_SINGLETON.hxx"
 
 CORBA::Object_var OldStyleNS::forServerChecker(const char *NSName, int argc, char **argv)
 {
-  ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance();
-  CORBA::ORB_var orb = init( argc, argv );
+  SetArgcArgv( argc, argv );
+  CORBA::ORB_var orb = KERNEL::GetRefToORB();
   SALOME_NamingService &NS = *SINGLETON_<SALOME_NamingService>::Instance();
   ASSERT( SINGLETON_<SALOME_NamingService>::IsAlreadyExisting() );
   NS.init_orb( orb );
@@ -216,8 +217,8 @@ CORBA::Object_var OldStyleNS::forServerChecker(const char *NSName, int argc, cha
 CosNaming::NamingContext_var OldStyleNS::checkTrueNamingServiceIfExpected(int argc, char **argv, bool& forceOK)
 {
   forceOK = false;//tell checker : do as before
-  ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance();
-  CORBA::ORB_var orb = init( argc, argv );
+  SetArgcArgv( argc, argv );
+  CORBA::ORB_var orb = KERNEL::GetRefToORB();
   CORBA::Object_var obj = orb->resolve_initial_references( "NameService" );
   CosNaming::NamingContext_var _root_context = CosNaming::NamingContext::_narrow( obj );
   return _root_context;
index 882e37470cbac4d35984ddd2b9eebb8926de5cc7..db8299ea3343ffcacbfdcad2369b374ffcad1377 100644 (file)
@@ -32,7 +32,6 @@
 #include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
 #include CORBA_CLIENT_HEADER(SALOME_Component)
 
-#include "Utils_ORB_INIT.hxx"
 #include "Utils_SINGLETON.hxx"
 #include "SALOME_NamingService.hxx"
 #include "Basics_Utils.hxx"
index d508588d7cf1de1a99b3d5367843c72e7b087d21..66cf53f8bd1f177df816f92960bb52bcde7748a8 100644 (file)
@@ -35,9 +35,7 @@
 
 #include "Session_Session_i.hxx"
 
-#include <Utils_ORB_INIT.hxx>
-#include <Utils_SINGLETON.hxx>
-#include <Utils_SALOME_Exception.hxx>
+#include <Utils_CommException.hxx>
 #include <Basics_Utils.hxx>
 #include <NamingService_WaitForServerReadiness.hxx>
 #include <utilities.h>