Salome HOME
Avoid dynamic_cast<SALOME_NamingService *> to detect SSL mode or not
[modules/yacs.git] / src / NamingService / SALOME_NamingService_Abstract.hxx
1 // Copyright (C) 2021  CEA/DEN, EDF R&D, 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_defs.hxx"
23
24 #include <SALOMEconfig.h>
25 #include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
26 #include CORBA_CLIENT_HEADER(SALOME_Component)
27
28 #include <vector>
29 #include <string>
30
31 class NAMINGSERVICE_EXPORT SALOME_NamingService_Container_Abstract
32 {
33 public:
34   virtual void init_orb(CORBA::ORB_ptr orb=0) = 0;
35   virtual SALOME_NamingService_Container_Abstract *clone() = 0;
36   virtual void Register(CORBA::Object_ptr ObjRef, const char* Path) = 0;
37   virtual void Destroy_FullDirectory(const char* Path) = 0;
38   virtual void Destroy_Name(const char* Path) = 0;
39   virtual CORBA::Object_ptr Resolve(const char* Path) = 0;
40   virtual CORBA::Object_ptr ResolveFirst(const char* Path) = 0;
41   virtual bool IsTrueNS() const = 0;
42   static constexpr char SEP = '/';
43 };
44
45 class NAMINGSERVICE_EXPORT SALOME_NamingService_Abstract : public SALOME_NamingService_Container_Abstract
46 {
47 public:
48   SALOME_NamingService_Abstract *cloneCoVar();
49   virtual std::vector< std::string > repr() = 0;
50   virtual void Destroy_Directory(const char* Path) = 0;
51   virtual bool Change_Directory(const char* Path) = 0;
52   virtual std::vector<std::string> list_subdirs() = 0;
53   virtual std::vector<std::string> list_directory() = 0;
54   virtual std::vector<std::string> list_directory_recurs() = 0;
55   virtual CORBA::Object_ptr ResolveComponent(const char* hostname, const char* containerName, const char* componentName, const int nbproc=0) = 0;
56   virtual ~SALOME_NamingService_Abstract() { }
57   static std::string ContainerName(const Engines::ContainerParameters& params);
58   static std::string ContainerName(const char *ContainerName);
59   static std::string BuildContainerNameForNS(const char *ContainerName, const char *hostname);
60   static std::string BuildContainerNameForNS(const Engines::ContainerParameters& params, const char *hostname);
61 };