Version: 6.5.0
SALOME_NamingService.hxx
1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, 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.
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: /home/server/cvs/KERNEL/KERNEL_SRC/src/NamingService/SALOME_NamingService.hxx,v 1.11.2.4.10.2.12.1 2012-04-12 14:05:18 vsr Exp $
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 "utilities.h"
39 #include "Utils_Mutex.hxx"
40 #include "ServiceUnreachable.hxx"
41 
42 #include "SALOME_NamingService_defs.hxx"
43 
44 #ifdef WNT
45 #pragma warning(disable:4290) // Warning Exception ...
46 #endif
47 
48 class NAMINGSERVICE_EXPORT SALOME_NamingService
49 {
50 public:
52  SALOME_NamingService(CORBA::ORB_ptr orb);
53 
54  virtual ~SALOME_NamingService();
55 
56  void init_orb(CORBA::ORB_ptr orb=0);
57  void Register(CORBA::Object_ptr ObjRef,
58  const char* Path)
59  throw(ServiceUnreachable);
60  CORBA::Object_ptr Resolve(const char* Path)
61  throw( ServiceUnreachable);
62  CORBA::Object_ptr ResolveFirst(const char* Path)
63  throw( ServiceUnreachable);
64  CORBA::Object_ptr ResolveComponent(const char* hostname,
65  const char* containerName,
66  const char* componentName,
67  const int nbproc=0)
68  throw(ServiceUnreachable);
69  std::string ContainerName(const char *ContainerName);
70  std::string ContainerName(const Engines::ContainerParameters& params);
71  std::string BuildContainerNameForNS(const char *ContainerName,
72  const char *hostname);
73  std::string
74  BuildContainerNameForNS(const Engines::ContainerParameters& params,
75  const char *hostname);
76 
77  // Will Be deleted on SALOME 6
78  std::string ContainerName(const Engines::MachineParameters& params);
79  std::string
80  BuildContainerNameForNS(const Engines::MachineParameters& params,
81  const char *hostname);
82  int Find(const char* name)
83  throw(ServiceUnreachable);
84  bool Create_Directory(const char* Path)
85  throw(ServiceUnreachable);
86  bool Change_Directory(const char* Path)
87  throw(ServiceUnreachable);
88  char* Current_Directory()
89  throw(ServiceUnreachable);
90  void list()
91  throw(ServiceUnreachable);
92  std::vector<std::string> list_directory()
93  throw(ServiceUnreachable);
94  std::vector<std::string> list_subdirs()
95  throw(ServiceUnreachable);
96  std::vector<std::string> list_directory_recurs()
97  throw(ServiceUnreachable);
98  void Destroy_Name(const char* Path)
99  throw(ServiceUnreachable);
100  virtual void Destroy_Directory(const char* Path)
101  throw(ServiceUnreachable);
102  virtual void Destroy_FullDirectory(const char* Path)
103  throw(ServiceUnreachable);
104  char* getIORaddr();
105  CORBA::ORB_ptr orb();
106 
107 protected:
108  Utils_Mutex _myMutex;
109  CORBA::ORB_var _orb;
110  CosNaming::NamingContext_var _root_context, _current_context;
111 
112  void _initialize_root_context();
113  int _createContextNameDir(std::string path,
114  CosNaming::Name& context_name,
115  std::vector<std::string>& splitPath,
116  bool onlyDir);
117  void _Find(const char* name, CORBA::Long& occurence_number);
118  void _current_directory(std::vector<std::string>& splitPath,
119  int& lengthResult,
120  CosNaming::NamingContext_var contextToFind,
121  bool& notFound);
122  void _list_directory_recurs(std::vector<std::string>& myList,
123  std::string relativeSubDir,
124  std::string absCurDirectory);
125 
126 };
127 
128 #endif // SALOME_NAMINGSERVICE_H
129 
A class to manage the SALOME naming service.
Definition: SALOME_NamingService.hxx:48
Type to describe required properties of a container.
Definition: SALOME_ContainerManager.idl:301
Type to describe required properties of a container.
Definition: SALOME_ContainerManager.idl:86
exception class for NamingService : ServiceUnreachable
Definition: ServiceUnreachable.hxx:37
Definition: Utils_Mutex.hxx:36
Copyright © 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS