1 // Copyright (C) 2021 CEA/DEN, EDF R&D, OPEN CASCADE
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "SALOME_NamingService_Abstract.hxx"
22 // ============================================================================
23 /*! \brief provide a default container name if empty.
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",
29 * \sa BuildContainerNameForNS(const char *containerName, const char *hostname)
31 // ============================================================================
33 std::string SALOME_NamingService_Abstract::ContainerName(const char *containerName)
35 std::string ret,containerNameCpp(containerName);
37 if (containerNameCpp.empty())
38 ret = "FactoryServer";
45 // ============================================================================
46 /*! \brief build a string representing a container in Naming Service.
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
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)
57 // ============================================================================
59 std::string SALOME_NamingService_Abstract::BuildContainerNameForNS(const char *containerName, const char *hostname)
61 std::string ret("/Containers/");
64 ret += ContainerName(containerName);