]> SALOME platform Git repositories - modules/kernel.git/blob - src/NamingService/SALOME_NamingService.hxx
Salome HOME
Initialisation de la base KERNEL avec la version operationnelle de KERNEL_SRC issue...
[modules/kernel.git] / src / NamingService / SALOME_NamingService.hxx
1 // File: SALOME_NamingService.hxx
2 // Created: Tue June 12 2001
3 // Author: Estelle Deville
4 // Project: SALOME
5 // Copyright : CEA/DEN/DMSS/LGLS
6 // $Header$
7
8 #ifndef SALOME_NAMINGSERVICE_H
9 #define SALOME_NAMINGSERVICE_H
10
11 #include "utilities.h"
12 #include <omniORB3/CORBA.h>
13 #include <vector>
14 #include <string>
15
16 //class ServiceUnreachable;
17 #include "ServiceUnreachable.hxx"
18
19 class SALOME_NamingService
20 {
21 public:
22   //! default constructor
23   SALOME_NamingService();
24
25   //! standard constructor
26   SALOME_NamingService(CORBA::ORB_ptr orb);
27
28   //! standard destructor
29   virtual ~SALOME_NamingService();
30
31   //! initialize ORB reference after default constructor
32   void init_orb(CORBA::ORB_ptr orb);
33  
34   //! method to create an association in the NamingService between an object reference and a path
35   void Register(CORBA::Object_ptr ObjRef, const char* Path) 
36     throw(ServiceUnreachable);
37
38   //! method to get the ObjRef of a symbolic name
39   CORBA::Object_ptr Resolve(const char* Path)
40     throw( ServiceUnreachable); 
41
42   //! method to research a name from the naming service's current directory 
43   int Find(const char* name)
44     throw(ServiceUnreachable);
45   
46   //! method to create a directory from the current directory
47   bool Create_Directory(const char* Path)
48     throw(ServiceUnreachable);
49   
50   //! method to change the current directory to the directory Path indicated in "in" Parameter
51   bool Change_Directory(const char* Path)
52     throw(ServiceUnreachable);
53  
54   //!method to get the current directory
55   char* Current_Directory()
56     throw(ServiceUnreachable);
57
58   //!method to print all the contexts contained from the current directory
59   void list()
60     throw(ServiceUnreachable);
61
62   //!method to get all the contexts contained in the current direcotry
63   // Get only objects, isn't iterative
64   vector<string> list_directory()
65     throw(ServiceUnreachable);
66  
67   //! method to destroy an association Path-Object Reference
68   void Destroy_Name(const char* Path)
69     throw(ServiceUnreachable);
70  
71   //! method to destroy a directory if it is empty
72   virtual void Destroy_Directory(const char* Path)
73     throw(ServiceUnreachable);
74
75 protected:
76   CORBA::ORB_ptr _orb;
77   CosNaming::NamingContext_var _root_context, _current_context;
78
79   //! method called by constructor to initialize _root_context
80   void _initialize_root_context();
81   
82   //! method to decompose a Path : /Kernel/Services/Sessions
83   char* _resolve_Path(char* Path);
84
85   //! method to decompose a Path : /Kernel/Services/Sessions
86   void _result_resolve_Path(const char* Path, int& j,
87                             char ** resultat_resolve_Path);
88
89   //! internal method called by Find to research a name from the naming service's current directory 
90   void _Find(const char* name, CORBA::Long& occurence_number);
91
92   //! internal method to create a context name from a Path
93   void _create_context_name_dir(char** resultat_resolve_Path,
94                                 int length_copy,
95                                 CosNaming::Name& _context_name);
96
97   //! internal method to create a parse the naming service tree 
98   void _current_directory(char** result_path,
99                           int& length_result,
100                           CosNaming::NamingContext_var context_to_found,
101                           CORBA::Boolean& _continue);
102 };
103
104 #endif // SALOME_NAMINGSERVICE_H