Salome HOME
updated copyright message
[modules/gui.git] / src / Session / Session_NS_wrapper.hxx
1 // Copyright (C) 2021-2023  CEA, EDF, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #pragma once
21
22 #include "SALOME_NamingService.hxx"
23 #include "SALOME_Session.hxx"
24
25 #include "omniORB4/CORBA.h"
26
27 class QMutex;
28 class QWaitCondition;
29
30 class Abstract_Engines_Container_i;
31
32 class SESSION_EXPORT OldStyleNS
33 {
34 public:
35   using RealNS = SALOME_NamingService;
36 public:
37   OldStyleNS(CORBA::ORB_ptr orb):_NS(orb) {}
38   void Register(CORBA::Object_ptr ObjRef, const char* Path) { _NS.Register(ObjRef,Path); }
39   CORBA::Object_ptr Resolve(const char* Path) { return _NS.Resolve(Path); }
40   RealNS *getNS() { return &_NS; }
41   Abstract_Engines_Container_i *activateContainer(CORBA::ORB_var orb, PortableServer::POA_var poa, int argc, char** argv);
42   static void defineDefaultSALOMEKERNELNamingService() { /* nothing to do by default true NamingService server is considered */ }
43   static void activateContainerManager(CORBA::ORB_var orb);
44   static void activateSession(CORBA::ORB_var orb, PortableServer::POA_var poa, QMutex *GUIMutex, QWaitCondition *GUILauncher, int argc, char ** argv);
45   static void activateSALOMEDS(CORBA::ORB_var orb, PortableServer::POA_var poa);
46   static CORBA::Object_var forServerChecker(const char *NSName, int argc, char **argv);
47   static CosNaming::NamingContext_var checkTrueNamingServiceIfExpected(int argc, char **argv, bool& forceOK);
48   static const char LibName[];
49 private:
50   RealNS _NS;
51 };
52
53 #include "SALOME_Fake_NamingService.hxx"
54
55 class SESSION_EXPORT NewStyleNS
56 {
57 public:
58   using RealNS = SALOME_Fake_NamingService;
59 public:
60   NewStyleNS(CORBA::ORB_ptr orb):_NS(orb) {}
61   void Register(CORBA::Object_ptr ObjRef, const char* Path) { _NS.Register(ObjRef,Path); }
62   CORBA::Object_ptr Resolve(const char* Path) { return _NS.Resolve(Path); }
63   RealNS *getNS() { return &_NS; }
64   Abstract_Engines_Container_i *activateContainer(CORBA::ORB_var orb, PortableServer::POA_var poa, int argc, char** argv);
65   static void defineDefaultSALOMEKERNELNamingService();
66   static void activateContainerManager(CORBA::ORB_var orb);
67   static void activateSession(CORBA::ORB_var orb, PortableServer::POA_var poa, QMutex *GUIMutex, QWaitCondition *GUILauncher, int argc, char ** argv);
68   static void activateSALOMEDS(CORBA::ORB_var orb, PortableServer::POA_var poa);
69   static CORBA::Object_var forServerChecker(const char *NSName, int argc, char **argv);
70   static CosNaming::NamingContext_var checkTrueNamingServiceIfExpected(int argc, char **argv, bool& forceOK);
71   static const char LibName[];
72 private:
73   RealNS _NS;
74 };