Version: 9.16.0
SALOME_Fake_NamingService.hxx
Go to the documentation of this file.
1// Copyright (C) 2021-2026 CEA, EDF
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
25
26#include <mutex>
27#include <utility>
28#include <string>
29#include <map>
30
32{
33public:
34 SALOME_Fake_NamingService(CORBA::ORB_ptr orb);
36 static void SetLogContainersFile(const std::string& logFileName);
37 static std::string GetLogContainersFile();
38 static void FlushLogContainersFile();
39 bool IsTrueNS() const override { return false; }
40 std::vector< std::string > repr() override;
41 void init_orb(CORBA::ORB_ptr orb=0) override;
42 void Register(CORBA::Object_ptr ObjRef, const char* Path) override;
43 CORBA::Object_ptr Resolve(const char* Path) override;
44 CORBA::Object_ptr ResolveFirst(const char* Path) override;
45 void Destroy_Name(const char* Path) override;
46 void Destroy_Directory(const char* Path) override;
47 void Destroy_FullDirectory(const char* Path) override;
48 bool Change_Directory(const char* Path) override;
49 std::vector<std::string> list_subdirs() override;
50 std::vector<std::string> list_directory() override;
51 std::vector<std::string> list_directory_recurs() override;
53 CORBA::Object_ptr ResolveComponent(const char* hostname, const char* containerName, const char* componentName, const int nbproc=0) override;
54private:
55 static std::string ReprOfContainersIORS_NoThreadSafe();
56 static std::string ReprOfContainersIORS();
57 static std::vector< std::pair< std::string, Engines::Container_var> > ListOfContainersInNS_NoThreadSafe();
58 static void FlushLogContainersFile_NoThreadSafe();
59 static std::vector<std::string> SplitDir(const std::string& fullPath);
60private:
61 static std::mutex _mutex;
62 static std::map<std::string,CORBA::Object_var> _map;
64 static std::string _log_container_file_name;
65private:
66 mutable std::string _current_dir;
67};
#define NAMINGSERVICE_EXPORT
Definition: SALOME_NamingService_defs.hxx:36
Definition: SALOME_Fake_NamingService.hxx:32
std::string _current_dir
Definition: SALOME_Fake_NamingService.hxx:66
bool IsTrueNS() const override
Definition: SALOME_Fake_NamingService.hxx:39
SALOME_Fake_NamingService()=default
static std::map< std::string, CORBA::Object_var > _map
Definition: SALOME_Fake_NamingService.hxx:62
static std::mutex _mutex
Definition: SALOME_Fake_NamingService.hxx:61
static bool _log_container_file_thread_launched
Definition: SALOME_Fake_NamingService.hxx:63
static std::string _log_container_file_name
Definition: SALOME_Fake_NamingService.hxx:64
Definition: SALOME_NamingService_Abstract.hxx:46
virtual void Destroy_Directory(const char *Path)=0
virtual bool Change_Directory(const char *Path)=0
virtual std::vector< std::string > list_directory()=0
virtual std::vector< std::string > list_directory_recurs()=0
virtual std::vector< std::string > list_subdirs()=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 SALOME_NamingService_Container_Abstract * clone()=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 void Destroy_FullDirectory(const char *Path)=0
virtual CORBA::Object_ptr ResolveFirst(const char *Path)=0
containerName
Definition: SALOME_ContainerPy.py:383
orb
Definition: salome.py:122
hostname
Definition: test.py:29