]> SALOME platform Git repositories - modules/kernel.git/blob - src/NamingService/SALOME_NamingService_Abstract.cxx
Salome HOME
Kernel evolution for salome gui without neither NS nor other servers.
[modules/kernel.git] / src / NamingService / SALOME_NamingService_Abstract.cxx
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 #include "SALOME_NamingService_Abstract.hxx"
21
22 // ============================================================================
23 /*! \brief provide a default container name if empty.
24  *
25  *  the given container name is returned unchanged, unless it is empty.
26  * \param  containerName
27  * \return container name, where empty input is replaced by "FactoryServer",
28  *         without the path.
29  * \sa BuildContainerNameForNS(const char *containerName, const char *hostname)
30  */
31 // ============================================================================
32
33 std::string SALOME_NamingService_Abstract::ContainerName(const char *containerName)
34 {
35   std::string ret,containerNameCpp(containerName);
36
37   if (containerNameCpp.empty())
38     ret = "FactoryServer";
39   else
40     ret = containerName;
41
42   return ret;
43 }
44
45 // ============================================================================
46 /*! \brief build a string representing a container in Naming Service.
47  *
48  *  Build a string representing the absolute pathname of a container in
49  *  SALOME_NamingService. This form gives a suffixed containerName in case of
50  *  multi processor machine.
51  * \param containerName name of the container in which the component is
52                         instantiated.
53  * \param hostname name of the host of the container, without domain names.
54  * \return the path under the form /Containers/hostname/containerName
55  * \sa ContainerName(const Engines::MachineParameters& params)
56  */
57 // ============================================================================
58
59 std::string SALOME_NamingService_Abstract::BuildContainerNameForNS(const char *containerName, const char *hostname)
60 {
61   std::string ret("/Containers/");
62   ret += hostname;
63   ret += "/";
64   ret += ContainerName(containerName);
65
66   return ret;
67 }