Salome HOME
Updated copyright comment
[modules/kernel.git] / src / SALOMESDS / SALOMESDS_DataServerManager.hxx
index a9c99962965fc9eec63b6b3585a626a8d55c64f3..f0390735f93db6adf0abd81055ffa78e3c148def 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2019  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -31,8 +31,9 @@
 #include "SALOMESDS_Defines.hxx"
 
 #include <string>
+#include <mutex>
 
-class SALOME_NamingService;
+class SALOME_NamingService_Abstract;
 
 namespace SALOMESDS
 {
@@ -44,6 +45,8 @@ namespace SALOMESDS
     RequestSwitcherDSM(CORBA::ORB_ptr orb, DataServerManager *dsm):RequestSwitcherBase(orb),_dsm(dsm) { }
     SALOME::StringVec *listScopes();
     SALOME::DataScopeServerTransaction_ptr giveADataScopeTransactionCalled(const char *scopeName, CORBA::Boolean& isCreated);
+    void holdRequests()override;
+    void activeRequests()override;
   private:
     DataServerManager *_dsm;
   };
@@ -53,7 +56,8 @@ namespace SALOMESDS
   class SALOMESDS_EXPORT DataServerManager : public virtual POA_SALOME::DataServerManager
   {
   public:
-    DataServerManager(int argc, char *argv[], CORBA::ORB_ptr orb, PortableServer::POA_ptr poa);
+    DataServerManager(const SALOME_CPythonHelper *pyHelper, CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, SALOME_NamingService_Abstract *ns = nullptr);
+    ~DataServerManager();
     SALOME::StringVec *listScopes();
     SALOME::StringVec *listAliveAndKickingScopes();
     SALOME::DataScopeServer_ptr getDefaultScope();
@@ -70,22 +74,33 @@ namespace SALOMESDS
     void cleanScopesInNS();
     void shutdownScopes();
     SALOME::RequestSwitcherDSM_ptr getRequestSwitcher();
+    void holdRequests();
+    void activeRequests();
+
   public:
     CORBA::ORB_var getORB() { return _orb; }
     static std::string CreateAbsNameInNSFromScopeName(const std::string& scopeName);
     static CORBA::Boolean IsAliveAndKicking(SALOME::DataScopeServerBase_ptr scopePtr);
-    static SALOME::DataScopeServerBase_var GetScopePtrGivenName(const std::string& scopeName, const std::vector<std::string>& scopes, SALOME_NamingService& ns);
+    static SALOME::DataScopeServerBase_var GetScopePtrGivenName(const std::string& scopeName, const std::vector<std::string>& scopes, SALOME_NamingService_Abstract *ns);
+    SALOME::StringVec *listScopes_unsafe();
+    SALOME::DataScopeServerTransaction_ptr giveADataScopeTransactionCalled_unsafe(
+                              const char *scopeName, CORBA::Boolean& isCreated);
   public:
     static const char NAME_IN_NS[];
     static const char DFT_SCOPE_NAME_IN_NS[];
   private:
     std::vector<std::string> listOfScopesCpp();
     SALOME::DataScopeServerBase_var getScopePtrGivenName(const std::string& scopeName);
+    CORBA::Boolean isAliveAndKicking_unsafe(const char *scopeName);
+    SALOME::DataScopeServerBase_ptr retriveDataScope_unsafe(const char *scopeName);
   private:
+    //! naming service object is owned
+    SALOME_NamingService_Abstract *_ns = nullptr;
     CORBA::ORB_var _orb;
     //! single thread poa
     PortableServer::POA_var _poa;
     AutoServantPtr<RequestSwitcherDSM> _rs;
+    std::mutex _mutex;
   };
 }