Version: 9.15.0
SALOME_NamingService.hxx
Go to the documentation of this file.
1 // Copyright (C) 2007-2025 CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 // SALOME NamingService : wrapping NamingService services
24 // File : SALOME_NamingService.hxx
25 // Author : Estelle Deville
26 // Module : SALOME
27 // $Header$
28 //
29 #ifndef SALOME_NAMINGSERVICE_H
30 #define SALOME_NAMINGSERVICE_H
31 
32 #include <SALOMEconfig.h>
33 #include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
34 #include CORBA_CLIENT_HEADER(SALOME_Component)
35 
36 #include <vector>
37 #include <string>
38 #include "Utils_Mutex.hxx"
39 #include "ServiceUnreachable.hxx"
40 
42 
43 #ifdef WIN32
44 //#pragma warning(disable:4290) // Warning Exception ...
45 #endif
46 
48 {
49 public:
51  SALOME_NamingService(CORBA::ORB_ptr orb);
52 
53  virtual ~SALOME_NamingService();
54  bool IsTrueNS() const override { return true; }
55  std::vector< std::string > repr() override;
56  void init_orb(CORBA::ORB_ptr orb=0) override;
57  void Register(CORBA::Object_ptr ObjRef, const char* Path) override;
58  CORBA::Object_ptr Resolve(const char* Path) override;
59  CORBA::Object_ptr ResolveFirst(const char* Path) ;
60  CORBA::Object_ptr ResolveComponent(const char* hostname,
61  const char* containerName,
62  const char* componentName,
63  const int nbproc=0) override;
64 
65  int Find(const char* name) ;
66  bool Create_Directory(const char* Path) ;
67  bool Change_Directory(const char* Path) override;
68  char* Current_Directory() ;
69  void list() ;
70  std::vector<std::string> list_directory() override;
71  std::vector<std::string> list_subdirs() override;
72  std::vector<std::string> list_directory_recurs() override ;
73  void Destroy_Name(const char* Path) override;
74  void Destroy_Directory(const char* Path) override;
75  void Destroy_FullDirectory(const char* Path) override;
76  char *getIORaddr();
77  CORBA::ORB_ptr orb();
79 
80 protected:
82  CORBA::ORB_var _orb;
83  CosNaming::NamingContext_var _root_context, _current_context;
84 
85  void _initialize_root_context();
86  int _createContextNameDir(std::string path,
87  CosNaming::Name& context_name,
88  std::vector<std::string>& splitPath,
89  bool onlyDir);
90  void _Find(const char* name, CORBA::Long& occurence_number);
91  void _current_directory(std::vector<std::string>& splitPath,
92  int& lengthResult,
93  CosNaming::NamingContext_var contextToFind,
94  bool& notFound);
95  void _list_directory_recurs(std::vector<std::string>& myList,
96  std::string relativeSubDir,
97  std::string absCurDirectory);
98 
99 };
100 
101 #endif // SALOME_NAMINGSERVICE_H
102 
#define NAMINGSERVICE_EXPORT
Definition: SALOME_NamingService_defs.hxx:36
Definition: SALOME_NamingService_Abstract.hxx:46
virtual void Destroy_Directory(const char *Path)=0
virtual std::vector< std::string > list_directory_recurs()=0
virtual bool Change_Directory(const char *Path)=0
virtual std::vector< std::string > list_subdirs()=0
virtual std::vector< std::string > list_directory()=0
virtual std::vector< std::string > repr()=0
virtual CORBA::Object_ptr ResolveComponent(const char *hostname, const char *containerName, const char *componentName, const int nbproc=0)=0
virtual CORBA::Object_ptr Resolve(const char *Path)=0
virtual void Destroy_Name(const char *Path)=0
virtual void Register(CORBA::Object_ptr ObjRef, const char *Path)=0
virtual void init_orb(CORBA::ORB_ptr orb=0)=0
virtual SALOME_NamingService_Container_Abstract * clone()=0
virtual void Destroy_FullDirectory(const char *Path)=0
virtual CORBA::Object_ptr ResolveFirst(const char *Path)=0
A class to manage the SALOME naming service.
Definition: SALOME_NamingService.hxx:48
CORBA::ORB_var _orb
Definition: SALOME_NamingService.hxx:82
CosNaming::NamingContext_var _current_context
Definition: SALOME_NamingService.hxx:83
bool IsTrueNS() const override
Definition: SALOME_NamingService.hxx:54
Utils_Mutex _myMutex
Definition: SALOME_NamingService.hxx:81
Definition: Utils_Mutex.hxx:37
path
Definition: ORBConfigFile.py:112
containerName
Definition: SALOME_ContainerPy.py:383
list context_name
Definition: TestLifeCycleCORBA.py:55
string name
Definition: pythfilter.py:56
orb
Definition: salome.py:122
hostname
Definition: test.py:29