]> SALOME platform Git repositories - modules/kernel.git/blob - src/NamingService/SALOME_Fake_NamingService.hxx
Salome HOME
f60e1480e66cb95df04bb6252080da4ea9e4d494
[modules/kernel.git] / src / NamingService / SALOME_Fake_NamingService.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 "omniORB4/CORBA.h"
23
24 #include "SALOME_NamingService_Abstract.hxx"
25
26 #include <mutex>
27 #include <string>
28 #include <map>
29
30 class NAMINGSERVICE_EXPORT SALOME_Fake_NamingService : public SALOME_NamingService_Abstract
31 {
32 public:
33     SALOME_Fake_NamingService(CORBA::ORB_ptr orb);
34     SALOME_Fake_NamingService() = default;
35     void init_orb(CORBA::ORB_ptr orb=0) override;
36     void Register(CORBA::Object_ptr ObjRef, const char* Path) override;
37     CORBA::Object_ptr Resolve(const char* Path) override;
38     CORBA::Object_ptr ResolveFirst(const char* Path) override;
39     void Destroy_Name(const char* Path) override;
40     void Destroy_Directory(const char* Path) override;
41     void Destroy_FullDirectory(const char* Path) override;
42     bool Change_Directory(const char* Path) override;
43     std::vector<std::string> list_subdirs() override;
44     std::vector<std::string> list_directory() override;
45     SALOME_NamingService_Abstract *clone() override;
46     CORBA::Object_ptr ResolveComponent(const char* hostname, const char* containerName, const char* componentName, const int nbproc=0) override;
47 private:
48     static std::mutex _mutex;
49     static std::map<std::string,CORBA::Object_var> _map;
50 };