]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Before SALOME_NamingService concept creation agy/archi5_0
authorAnthony Geay <anthony.geay@edf.fr>
Thu, 18 Feb 2021 13:06:31 +0000 (14:06 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Thu, 18 Feb 2021 13:06:31 +0000 (14:06 +0100)
src/Session/SALOME_Session_Server.cxx
src/Session/Session_ServerThread.cxx
src/Session/Session_ServerThread.hxx

index 8c516411a21f10b061653a0f92031c676ab5ffd1..67fa2103bf59c2a4406432788326a99516e05b7c 100644 (file)
@@ -463,7 +463,8 @@ int AbstractGUIApp::main(int argc, char **argv)
   QApplication::setOrganizationName("salome");
   QApplication::setApplicationName("salome");
   QApplication::setApplicationVersion(salomeVersion());
-
+  int vvvv(90);
+  std::cin >> vvvv;
   // Install Qt debug messages handler
   MsgHandler msgHandler;
   qInstallMessageHandler(QtxMsgHandler);
index 4e7e65f548dfe0e43717eb3b3fbe65aaaff9df75..d9f28bd011d38792a1a5d5db7711a33df5ff4277 100644 (file)
@@ -83,9 +83,9 @@ Session_ServerThread::Session_ServerThread(int argc,
   _orb = CORBA::ORB::_duplicate(orb);
   _root_poa = PortableServer::POA::_duplicate(poa);
   _servType =-1;
-  _NS = new SALOME_NamingService(_orb); // one instance per server to limit
-                                        // multi thread coherence problems
-  _container = 0;                       // embedded container
+  _NS.reset( new SALOME_NamingService(_orb) ); // one instance per server to limit
+                                               // multi thread coherence problems
+  _container = nullptr;                        // embedded container
 }
 
 /*! 
@@ -93,8 +93,6 @@ Session_ServerThread::Session_ServerThread(int argc,
 */
 Session_ServerThread::~Session_ServerThread()
 {
-  //MESSAGE("~Session_ServerThread "<< _argv[0]);
-  delete _NS;
   for (int i = 0; i <_argc ; i++ )
     free( _argv[i] );
   delete[] _argv;
@@ -118,42 +116,42 @@ void Session_ServerThread::Init()
       switch (_servType) {
       case 0:  // Container
         {
-          NamingService_WaitForServerReadiness(_NS,"/Registry");
-          NamingService_WaitForServerReadiness(_NS,"/ContainerManager");
+          NamingService_WaitForServerReadiness(_NS.get(),"/Registry");
+          NamingService_WaitForServerReadiness(_NS.get(),"/ContainerManager");
           ActivateContainer(_argc, _argv);
           break;
         }
       case 1:  // ModuleCatalog
         {
-          NamingService_WaitForServerReadiness(_NS,"/Registry");
+          NamingService_WaitForServerReadiness(_NS.get(),"/Registry");
           ActivateModuleCatalog(_argc, _argv);
           break;
         }
       case 2:  // Registry
         {
-          NamingService_WaitForServerReadiness(_NS,"");
+          NamingService_WaitForServerReadiness(_NS.get(),"");
           ActivateRegistry(_argc, _argv);
           break;
         }
       case 3:  // SALOMEDS
         {
-          NamingService_WaitForServerReadiness(_NS,"/Kernel/ModulCatalog");
+          NamingService_WaitForServerReadiness(_NS.get(),"/Kernel/ModulCatalog");
           ActivateSALOMEDS(_argc, _argv);
           break;
         }
       case 4:  // Session
         {
-          NamingService_WaitForServerReadiness(_NS,"/Study");
+          NamingService_WaitForServerReadiness(_NS.get(),"/Study");
           std::string containerName = "/Containers/";
           containerName = containerName + Kernel_Utils::GetHostname();
           containerName = containerName + "/FactoryServer";
-          NamingService_WaitForServerReadiness(_NS,containerName);
+          NamingService_WaitForServerReadiness(_NS.get(),containerName);
           ActivateSession(_argc, _argv);
           break;
         }
       case 5: // Container Manager
         {
-          NamingService_WaitForServerReadiness(_NS,"");
+          NamingService_WaitForServerReadiness(_NS.get(),"");
           ActivateContainerManager(_argc, _argv);
           break;
         }
@@ -234,8 +232,7 @@ void Session_ServerThread::ActivateSALOMEDS(int /*argc*/, char** /*argv*/)
   }
 }
 
-void Session_ServerThread::ActivateRegistry(int argc,
-                                            char ** argv)
+void Session_ServerThread::ActivateRegistry(int argc, char ** argv)
 {
   MESSAGE("Registry thread started");
   SCRUTE(argc); 
index 1ea0db34aae4322ce0f6d54b0c5df08d3f787b61..03296bf826a8c795c0e984b8011795dca65184ee 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <omniORB4/CORBA.h> 
 #include <string>
+#include <memory>
 
 void WaitForServerReadiness(std::string serverName);
 
@@ -65,7 +66,7 @@ protected:
   int                     _servType;
   CORBA::ORB_var          _orb;
   PortableServer::POA_var _root_poa;
-  SALOME_NamingService *  _NS;
+  std::unique_ptr<SALOME_NamingService> _NS;
   Engines_Container_i*    _container;
 };
 
@@ -85,7 +86,7 @@ public:
   virtual ~Session_SessionThread();  
 
 protected:
-  virtual void ActivateSession       ( int argc, char ** argv );
+  void ActivateSession       ( int argc, char ** argv ) override;
 private:
   QMutex*                 _GUIMutex;
   QWaitCondition*         _GUILauncher;