DESTINATION ${KERNEL_TEST_DIR}
RENAME CTestTestfile.cmake)
+
+IF(SALOME_LIGHT_ONLY)
+ ADD_DEFINITIONS(-DSALOME_LIGHT)
+ENDIF()
+
# Sources
# ========
IF(NOT SALOME_LIGHT_ONLY)
# They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
SET(_${PROJECT_NAME}_exposed_targets
- SALOMEBasics SALOMELocalTrace SalomeHDFPersist OpUtil)
+ SALOMEBasics ArgvKeeper SALOMELocalTrace SalomeHDFPersist OpUtil)
# CORBA specific targets:
IF(NOT SALOME_LIGHT_ONLY)
SET(KERNEL_TEST_LIB "$ENV{KERNEL_ROOT_DIR}/@KERNEL_TEST_LIB@")
# Add all test subdirs
-SUBDIRS( Launcher
+SUBDIRS( ArgvKeeper
+ Launcher
Launcher_SWIG
LifeCycleCORBA_SWIG
NamingService
# SALOME_USE_MPI - ON if KERNEL is built with MPI support
# SALOME_KERNEL_BUILD_DOC - ON if documentation for KERNEL module has been built
# SALOME_KERNEL_BUILD_TESTS - ON if tests for KERNEL module has been built
-# SALOME_LIGHT_ONLY - ON if SALOME is built in Light mode (no CORBA)
+# SALOME_KERNEL_LIGHT_ONLY - ON if SALOME is built in Light mode (no CORBA)
###############################################################
# Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
SET(SALOME_USE_LIBBATCH @SALOME_USE_LIBBATCH@)
SET(SALOME_USE_64BIT_IDS @SALOME_USE_64BIT_IDS@)
+IF(SALOME_KERNEL_LIGHT_ONLY)
+ ADD_DEFINITIONS(-DSALOME_LIGHT)
+ENDIF()
+
# Prerequisites:
IF(SALOME_KERNEL_BUILD_TESTS)
SET_AND_CHECK(CPPUNIT_ROOT_DIR_EXP "@PACKAGE_CPPUNIT_ROOT_DIR@")
IF(SALOME_USE_MPI)
SET_AND_CHECK(MPI_ROOT_DIR_EXP "@PACKAGE_MPI_ROOT_DIR@")
ENDIF()
-IF(NOT SALOME_LIGHT_ONLY)
+IF(NOT SALOME_KERNEL_LIGHT_ONLY)
SET_AND_CHECK(OMNIORB_ROOT_DIR_EXP "@PACKAGE_OMNIORB_ROOT_DIR@")
SET_AND_CHECK(OMNIORBPY_ROOT_DIR_EXP "@PACKAGE_OMNIORBPY_ROOT_DIR@")
ENDIF()
--- /dev/null
+// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "ArgvKeeper.hxx"
+#include <mutex>
+
+namespace
+{
+ std::recursive_mutex mutex; //!< mutex to protect access to static data
+ std::vector<std::string> argv_list; //!< cmd line arguments
+ bool isInitialized = false; //!< \c true if cmd line arguments were initialized
+}
+
+//! \brief Store cmd line arguments
+void SetArgcArgv(int argc, char* argv[])
+{
+ std::vector<std::string> tmp_list;
+ for (int i=0; i < argc; ++i)
+ tmp_list.push_back(std::string(argv[i]));
+ SetArgcArgv(tmp_list);
+}
+
+//! \overload void SetArgcArgv(int argc, char* argv[])
+void SetArgcArgv(const std::vector<std::string>& argv)
+{
+ std::lock_guard<std::recursive_mutex> g(mutex);
+ if (!isInitialized && !argv.empty())
+ {
+ isInitialized = true;
+ for (const std::string& value: argv) {
+ argv_list.push_back(value);
+ }
+ }
+}
+
+//! \brief Get cmd line arguments
+std::vector<std::string> GetArgcArgv()
+{
+ std::lock_guard<std::recursive_mutex> g(mutex);
+ return argv_list;
+}
+
+//! \brief Check if cmd line arguments were initialized
+//!
+//! In debug mode returns \c true if SetArgcArgv() was called or \c false otherwise.
+//! In release mode always returns \c true.
+bool ArgcArgvInitialized()
+{
+#ifdef DEBUG
+ return isInitialized;
+#else
+ return true;
+#endif
+}
--- /dev/null
+// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#pragma once
+#include <string>
+#include <vector>
+
+void SetArgcArgv(int argc, char* argv[]);
+void SetArgcArgv(const std::vector<std::string>& argv);
+std::vector<std::string> GetArgcArgv();
+bool ArgcArgvInitialized();
--- /dev/null
+// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+%module ArgvKeeper
+
+%include "std_string.i"
+%include "std_vector.i"
+
+%{
+#include "ArgvKeeper.hxx"
+%}
+
+%template() std::vector<std::string>;
+
+%inline
+{
+ void SetArgcArgv(const std::vector<std::string>& argv);
+ std::vector<std::string> GetArgcArgv();
+}
--- /dev/null
+# Copyright (C) 2012-2021 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+INCLUDE(${SWIG_USE_FILE})
+
+INCLUDE_DIRECTORIES(
+ ${PYTHON_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+# Library
+ADD_LIBRARY(ArgvKeeper ArgvKeeper.cxx)
+INSTALL(TARGETS ArgvKeeper EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
+INSTALL(FILES ArgvKeeper.hxx DESTINATION ${SALOME_INSTALL_HEADERS})
+
+# Python binding (SWIG)
+SET_SOURCE_FILES_PROPERTIES(ArgvKeeper.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(ArgvKeeper.i PROPERTIES SWIG_FLAGS "-py3")
+SET_SOURCE_FILES_PROPERTIES(ArgvKeeper_wrap.cpp PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H")
+IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
+ SWIG_ADD_MODULE(ArgvKeeper python ArgvKeeper.i ArgvKeeper.hxx)
+ELSE()
+ SWIG_ADD_LIBRARY(ArgvKeeper LANGUAGE python SOURCES ArgvKeeper.i ArgvKeeper.hxx)
+ENDIF()
+IF(${MACHINE} STREQUAL WINDOWS)
+ SET_TARGET_PROPERTIES(_ArgvKeeper PROPERTIES DEBUG_OUTPUT_NAME _ArgvKeeper_d)
+ENDIF(${MACHINE} STREQUAL WINDOWS)
+SWIG_LINK_LIBRARIES(ArgvKeeper ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} ArgvKeeper)
+INSTALL(TARGETS _ArgvKeeper DESTINATION ${SALOME_INSTALL_LIBS})
+SALOME_INSTALL_SCRIPTS(${CMAKE_CURRENT_BINARY_DIR}/ArgvKeeper.py
+ ${SALOME_INSTALL_BINS}
+ EXTRA_DPYS "${SWIG_MODULE_ArgvKeeper_REAL_NAME}")
+
+# Tests
+IF(SALOME_BUILD_TESTS)
+ ADD_SUBDIRECTORY(Test)
+ENDIF(SALOME_BUILD_TESTS)
--- /dev/null
+// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "ArgvKeeperTest.hxx"
+#include "ArgvKeeper.hxx"
+
+#include <string>
+#include <vector>
+
+void ArgvKeeperUnitTests::TEST_argvKeeper()
+{
+ // args not set
+ CPPUNIT_ASSERT_EQUAL(GetArgcArgv().size(), size_t(0));
+
+ // args set
+ std::vector<std::string> params = {"aaa", "bbb", "ccc"};
+ SetArgcArgv(params);
+ CPPUNIT_ASSERT_EQUAL(GetArgcArgv().size(), size_t(3));
+ CPPUNIT_ASSERT_EQUAL(GetArgcArgv()[0], params[0]);
+ CPPUNIT_ASSERT_EQUAL(GetArgcArgv()[1], params[1]);
+ CPPUNIT_ASSERT_EQUAL(GetArgcArgv()[2], params[2]);
+}
--- /dev/null
+// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#pragma once
+
+#include <cppunit/extensions/HelperMacros.h>
+
+class ArgvKeeperUnitTests: public CppUnit::TestFixture
+{
+ CPPUNIT_TEST_SUITE(ArgvKeeperUnitTests);
+ CPPUNIT_TEST(TEST_argvKeeper);
+ CPPUNIT_TEST_SUITE_END();
+
+public:
+ void TEST_argvKeeper();
+};
--- /dev/null
+# Copyright (C) 2012-2021 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+INCLUDE_DIRECTORIES(
+ ${CPPUNIT_INCLUDE_DIRS}
+ ${CMAKE_SOURCE_DIR}/src/ArgvKeeper
+ ${CMAKE_SOURCE_DIR}/src/Basics/Test
+)
+
+SET(LOCAL_TEST_DIR ${KERNEL_TEST_DIR}/ArgvKeeper)
+
+ADD_DEFINITIONS(${CPPUNIT_DEFINITIONS})
+
+ADD_EXECUTABLE(TestArgvKeeper ArgvKeeperTest.cxx TestArgvKeeper.cxx)
+TARGET_LINK_LIBRARIES(TestArgvKeeper ArgvKeeper ${CPPUNIT_LIBRARIES})
+
+INSTALL(TARGETS TestArgvKeeper DESTINATION ${LOCAL_TEST_DIR})
+INSTALL(FILES test_ArgvKeeper.py DESTINATION ${LOCAL_TEST_DIR})
+INSTALL(FILES CTestTestfileInstall.cmake
+ DESTINATION ${LOCAL_TEST_DIR}
+ RENAME CTestTestfile.cmake)
--- /dev/null
+# Copyright (C) 2015-2021 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+IF(NOT WIN32)
+ ADD_TEST(${COMPONENT_NAME}_ArgvKeeperCxx TestArgvKeeper)
+ SET_TESTS_PROPERTIES(${COMPONENT_NAME}_ArgvKeeperCxx PROPERTIES
+ LABELS "${COMPONENT_NAME}"
+ ENVIRONMENT "LD_LIBRARY_PATH=${KERNEL_TEST_LIB}:$ENV{LD_LIBRARY_PATH}"
+ )
+ ADD_TEST(${COMPONENT_NAME}_ArgvKeeperPy ${PYTHON_TEST_DRIVER} ${TIMEOUT} test_ArgvKeeper.py)
+ SET_TESTS_PROPERTIES(${COMPONENT_NAME}_ArgvKeeperPy PROPERTIES
+ LABELS "${COMPONENT_NAME}"
+ ENVIRONMENT "LD_LIBRARY_PATH=${KERNEL_TEST_LIB}:$ENV{LD_LIBRARY_PATH}"
+ )
+ENDIF()
--- /dev/null
+// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "ArgvKeeperTest.hxx"
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ArgvKeeperUnitTests);
+
+#include "BasicMainTest.hxx"
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import unittest
+import ArgvKeeper
+
+from time import sleep
+
+class TestArgvKeeper(unittest.TestCase):
+ def test1(self):
+ self.assertEqual(ArgvKeeper.GetArgcArgv(), ())
+ args = ('aaa', 'bbb', 'ccc')
+ ArgvKeeper.SetArgcArgv(args)
+ self.assertEqual(ArgvKeeper.GetArgcArgv(), args)
+
+if __name__ == '__main__':
+ unittest.main()
#
SET(SUBDIR_BASE
+ ArgvKeeper
AppQuickStart
Basics
SALOMELocalTrace
#endif
#include "omniORB4/poa.h"
#include "omnithread.h"
-#include "Utils_SINGLETON.hxx"
-#include "Utils_ORB_INIT.hxx"
+#include "OpUtil.hxx"
#include "Basics_MpiUtils.hxx"
#include "utilities.h"
#ifndef WIN32
CORBA::ORB_var &getGlobalORB(){
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
- CORBA::ORB_var &orb = init(0,0);
+ CORBA::ORB_var orb = KERNEL::GetRefToORB();
return orb;
}
#endif
#include "SALOME_Comm_i.hxx"
#include "SALOMEMultiComm.hxx"
#include "SenderFactory.hxx"
+ #include "OpUtil.hxx"
%}
%typemap(in) SALOME::SenderDouble_ptr
// Ask omniORB to convert IOR string to SALOME::SenderDouble_ptr
- int argc = 0;
- char *xargv = (char*)"";
- char **argv = &xargv;
- CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
+ CORBA::ORB_var ORB = KERNEL::GetRefToORB();
CORBA::Object_var O = ORB->string_to_object(s);
SALOME::SenderDouble_ptr t = SALOME::SenderDouble::_narrow(O);
$1 = t;
// Ask omniORB to convert IOR string to SALOME::SenderInt_ptr
- int argc = 0;
- char *xargv = (char*)"";
- char **argv = &xargv;
- CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
+ CORBA::ORB_var ORB = KERNEL::GetRefToORB();
CORBA::Object_var O = ORB->string_to_object(s);
SALOME::SenderInt_ptr t = SALOME::SenderInt::_narrow(O);
$1 = t;
pdict, pdict);
PyObject* orb = PyDict_GetItemString(pdict, "o");
// Get the orb Corba C++
- int argc = 0;
- char *xargv = (char*)"";
- char **argv = &xargv;
- CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
+ CORBA::ORB_var ORB = KERNEL::GetRefToORB();
std::string s = ORB->object_to_string($1);
PyObject * tmp = PyString_FromString(s.c_str());
$result = PyObject_CallMethod(orb, (char*)"string_to_object", (char*)"O", tmp);
pdict, pdict);
PyObject* orb = PyDict_GetItemString(pdict, "o");
// Get the orb Corba C++
- int argc = 0;
- char *xargv = (char*)"";
- char **argv = &xargv;
- CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
+ CORBA::ORB_var ORB = KERNEL::GetRefToORB();
std::string s = ORB->object_to_string($1);
PyObject * tmp = PyString_FromString(s.c_str());
$result = PyObject_CallMethod(orb, (char*)"string_to_object", (char*)"O", tmp);
${HDF5_INCLUDE_DIRS}
${PYTHON_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}/salome_adm
+ ${CMAKE_CURRENT_SOURCE_DIR}/../ArgvKeeper
${CMAKE_CURRENT_SOURCE_DIR}/../Basics
${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace
${CMAKE_CURRENT_SOURCE_DIR}/../NamingService
ADD_DEFINITIONS(${HDF5_DEFINITIONS} ${OMNIORB_DEFINITIONS})
SET(COMMON_LIBS
+ ArgvKeeper
Registry
SalomeNotification
SalomeResourcesManager
#include "SALOME_Container_i.hxx"
#include "RegistryConnexion.hxx"
#include "Basics_Utils.hxx"
+#include "OpUtil.hxx"
#include "Utils_SINGLETON.hxx"
-#include "Utils_ORB_INIT.hxx"
#include "SALOME_NamingService.hxx"
#include "Utils_CorbaException.hxx"
SALOME_NamingService_Abstract *Engines_Component_i::getNS()
{
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
- CORBA::ORB_var &orb = init( 0 , 0 ) ;
+ CORBA::ORB_var orb = KERNEL::GetRefToORB();
SALOME_NamingService *naming = SINGLETON_<SALOME_NamingService>::Instance() ;
naming->init_orb( orb ) ;
#include CORBA_SERVER_HEADER(SALOME_Component)
#include CORBA_SERVER_HEADER(SALOME_Exception)
#include <pthread.h> // must be before Python.h !
+#include "OpUtil.hxx"
#include "SALOME_Container_i.hxx"
#include "SALOME_Component_i.hxx"
#include "SALOME_FileRef_i.hxx"
{
if(!_container_singleton_ssl)
{
- int argc(0);
- CORBA::ORB_var orb = CORBA::ORB_init(argc,nullptr);
+ CORBA::ORB_var orb = KERNEL::GetRefToORB();
CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
PortableServer::POAManager_var pman = poa->the_POAManager();
#else
#include <process.h>
#endif
+#include "ArgvKeeper.hxx"
#include "SALOME_Container_Common.hxx"
#include "SALOME_Container_i.hxx"
#include "utilities.h"
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
#include "OpUtil.hxx"
#include "KernelBasis.hxx"
// Initialise the ORB.
//SRN: BugID: IPAL9541, it's necessary to set a size of one message to be at least 100Mb
//CORBA::ORB_var orb = CORBA::ORB_init( argc , argv ) ;
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
- CORBA::ORB_ptr orb = init(argc , argv ) ;
+ SetArgcArgv(argc, argv);
+ CORBA::ORB_ptr orb = KERNEL::GetRefToORB();
// LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
INFOS_COMPILATION;
//
#include "Salome_file_i.hxx"
+#include "ArgvKeeper.hxx"
+#include "OpUtil.hxx"
#include <iostream>
#include <fstream>
#include <sstream>
print_state(state);
// We start CORBA ...
- CORBA::ORB_ptr orb = CORBA::ORB_init(argc , argv);
+ SetArgcArgv(argc, argv);
+ CORBA::ORB_ptr orb = KERNEL::GetRefToORB();
obj = orb->resolve_initial_references("RootPOA");
root_poa = PortableServer::POA::_narrow(obj);
pman = root_poa->the_POAManager();
${PTHREAD_INCLUDE_DIR}
${OMNIORB_INCLUDE_DIR}
${PROJECT_BINARY_DIR}/salome_adm
+ ${PROJECT_SOURCE_DIR}/src/ArgvKeeper
${PROJECT_SOURCE_DIR}/src/Container
${PROJECT_SOURCE_DIR}/src/GenericObj
${PROJECT_SOURCE_DIR}/src/Notification
)
SET(SALOME_ConnectionManagerServer_LIBS
+ ArgvKeeper
SalomeIDLKernel
SalomeNS
SALOMELocalTrace
// Module : KERNEL
//
#include "ConnectionManager_i.hxx"
+#include "ArgvKeeper.hxx"
+#include "OpUtil.hxx"
#include "utilities.h"
#include <iostream>
PortableServer::POA_var root_poa;
PortableServer::POAManager_var pman;
CORBA::Object_var obj;
- CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+ SetArgcArgv(argc, argv);
+ CORBA::ORB_var orb = KERNEL::GetRefToORB();
+
try{
obj = orb->resolve_initial_references("RootPOA");
if(!CORBA::is_nil(obj))
${OMNIORB_INCLUDE_DIR}
${PYTHON_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}/salome_adm
+ ${CMAKE_CURRENT_SOURCE_DIR}/../ArgvKeeper
${CMAKE_CURRENT_SOURCE_DIR}/../NamingService
${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace
${CMAKE_CURRENT_SOURCE_DIR}/../Basics
)
ADD_LIBRARY(SalomeORB ${SalomeORB_SOURCES})
-TARGET_LINK_LIBRARIES(SalomeORB ${OMNIORB_LIBRARIES})
+TARGET_LINK_LIBRARIES(SalomeORB OpUtil ${OMNIORB_LIBRARIES})
INSTALL(TARGETS SalomeORB EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
SET(SalomeKernelHelpers_LIBS
//
#include "SALOME_KernelORB.hxx"
+#include "OpUtil.hxx"
namespace KERNEL {
/**
CORBA::ORB_ptr getORB() {
static CORBA::ORB_ptr orb;
if(CORBA::is_nil(orb)){
- int argc=0;
- orb = CORBA::ORB_init(argc,0);
+ orb = KERNEL::GetRefToORB();
}
return orb;
}
${Boost_INCLUDE_DIRS}
${LIBBATCH_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}/salome_adm
+ ${CMAKE_CURRENT_SOURCE_DIR}/../ArgvKeeper
${CMAKE_CURRENT_SOURCE_DIR}/../Basics
${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace
${CMAKE_CURRENT_SOURCE_DIR}/../NamingService
# This local variable defines the list of dependent libraries common to all target in this package.
SET(COMMON_LIBS
+ ArgvKeeper
Registry
SalomeNotification
SalomeContainer
{
if(!_launcher_singleton_ssl)
{
- int argc(0);
- CORBA::ORB_var orb = CORBA::ORB_init(argc,nullptr);
+ CORBA::ORB_var orb = KERNEL::GetRefToORB();
PortableServer::POA_var root_poa=PortableServer::POA::_the_root_poa();
SALOME_Fake_NamingService *ns=new SALOME_Fake_NamingService(orb);
_launcher_singleton_ssl = new SALOME_Launcher(orb,root_poa,ns);//3rd arg is important to skip NS !
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+#include "ArgvKeeper.hxx"
#include "SALOME_Launcher.hxx"
#include "SALOMESDS_DataServerManager.hxx"
#include "SALOME_ExternalServerLauncher.hxx"
#include "SALOME_CPythonHelper.hxx"
+#include "OpUtil.hxx"
#include "utilities.h"
#include <sstream>
#include <iostream>
#include <stdexcept>
+#include <string>
+#include <vector>
#include <libxml/parser.h>
void AttachDebugger();
CORBA::Object_var obj;
CORBA::ORB_var orb;
{
- int myArgc(argc+2);
- char **myArgv(new char *[myArgc]);
+ std::vector<std::string> args;
for(int i=0;i<argc;i++)
- myArgv[i]=strdup(argv[i]);
- myArgv[argc+0]=strdup("-ORBsupportCurrent");
- myArgv[argc+1]=strdup("0");
- orb = CORBA::ORB_init( myArgc , myArgv ) ;
- for(int i=0;i<myArgc;i++)
- free(myArgv[i]);
- delete [] myArgv;
+ args.push_back(argv[i]);
+ args.push_back("-ORBsupportCurrent");
+ args.push_back("0");
+ SetArgcArgv(args);
+ orb = KERNEL::GetRefToORB();
}
// LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
INFOS_COMPILATION;
${PTHREAD_INCLUDE_DIR}
${PYTHON_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}/salome_adm
+ ${CMAKE_CURRENT_SOURCE_DIR}/../ArgvKeeper
${CMAKE_CURRENT_SOURCE_DIR}/../Basics
${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace
${CMAKE_CURRENT_SOURCE_DIR}/../SALOMETraceCollector
)
SET(COMMON_LIBS
+ ArgvKeeper
SalomeContainer
SalomeResourcesManager
SalomeNS
#endif
#include "Basics_Utils.hxx"
+#include "OpUtil.hxx"
#include "utilities.h"
#include <ServiceUnreachable.hxx>
{
// be sure to have an instance of traceCollector, when used via SWIG
// in a Python module
- int argc = 0;
- char *xargv = (char*)"";
- char **argv = &xargv;
- CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+ CORBA::ORB_var orb = KERNEL::GetRefToORB();
// LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
_NSnew=0;
if (!ns)
}
// 7) Logger
- int argc = 0;
- char *xargv = (char*)"";
- char **argv = &xargv;
- CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+ CORBA::ORB_var orb = KERNEL::GetRefToORB();
CORBA::Object_var objLog = CORBA::Object::_nil();
CosNaming::NamingContext_var inc;
#include "LifeCycleCORBATest.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
#include "SALOME_FileTransferCORBA.hxx"
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
+#include "OpUtil.hxx"
#include "Basics_Utils.hxx"
#include "Basics_DirUtils.hxx"
#include "utilities.h"
// --- Get or initialize the orb
- int _argc = 1;
- char* _argv[] = {(char*)""};
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
- _orb = init(_argc , _argv ) ;
+ _orb = KERNEL::GetRefToORB();
// --- Create a SALOME_NamingService instance
#include <unistd.h>
#endif
#include <SALOMEconfig.h>
+#include "ArgvKeeper.hxx"
#include "SALOME_NamingService.hxx"
#include "SALOME_ResourcesManager.hxx"
#include "SALOME_ContainerManager.hxx"
#include "SALOME_ResourcesManager.hxx"
#include "NamingService_WaitForServerReadiness.hxx"
#include "OpUtil.hxx"
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
#include "Utils_SALOME_Exception.hxx"
#include "Utils_CommException.hxx"
#include "Basics_DirUtils.hxx"
int status;
// Initializing omniORB
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- CORBA::ORB_ptr orb = init( argc , argv ) ;
+ SetArgcArgv( argc, argv ) ;
+ CORBA::ORB_ptr orb = KERNEL::GetRefToORB();
SALOME_NamingService *_NS=new SALOME_NamingService(orb);
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(SALOME_Component)
#include CORBA_CLIENT_HEADER(SALOME_TestComponent)
+#include "ArgvKeeper.hxx"
#include "SALOME_NamingService.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
#include "SALOME_FileTransferCORBA.hxx"
+#include "OpUtil.hxx"
#include "utilities.h"
#include <Basics_Utils.hxx>
try
{
// --- Initialize omniORB
-
- CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+ SetArgcArgv(argc, argv);
+ CORBA::ORB_var orb = KERNEL::GetRefToORB();
// --- Obtain a reference to the root POA
${OMNIORB_INCLUDE_DIR}
${PTHREAD_INCLUDE_DIR}
${PROJECT_BINARY_DIR}/salome_adm
+ ${CMAKE_CURRENT_SOURCE_DIR}/../ArgvKeeper
${CMAKE_CURRENT_SOURCE_DIR}/../Basics
${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace
+ ${CMAKE_CURRENT_SOURCE_DIR}/../Utils
${PROJECT_BINARY_DIR}/idl
)
ADD_DEFINITIONS(${OMNIORB_DEFINITIONS})
)
SET(SALOME_Logger_Server_LIBS
+ ArgvKeeper
SalomeLoggerServer
SalomeIDLKernel
+ OpUtil
${OMNIORB_LIBRARIES}
)
//
#include <iostream>
#include "SALOME_Logger_Server.hxx"
+#include "OpUtil.hxx"
+#include "ArgvKeeper.hxx"
#include <SALOMEconfig.h>
#include <sys/types.h>
#include <stdlib.h>
PortableServer::POA_var poa;
PortableServer::POAManager_var pman;
- CORBA::ORB_var orb = CORBA::ORB_init(argc, argv) ;
+ SetArgcArgv(argc, argv);
+ CORBA::ORB_var orb = KERNEL::GetRefToORB() ;
for (i = 1; i <= NumberOfTries; i++)
{
${PYTHON_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
${PROJECT_BINARY_DIR}/salome_adm
+ ${CMAKE_CURRENT_SOURCE_DIR}/../ArgvKeeper
${CMAKE_CURRENT_SOURCE_DIR}/../Basics
${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace
${CMAKE_CURRENT_SOURCE_DIR}/../NamingService
)
SET(COMMON_LIBS
+ ArgvKeeper
Registry
SalomeNotification
SalomeResourcesManager
#include <mpi.h>
#include <iostream>
+#include "ArgvKeeper.hxx"
#include "MPIContainer_i.hxx"
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
+#include "OpUtil.hxx"
#include "utilities.h"
int main(int argc, char* argv[])
MPI_Comm_rank(MPI_COMM_WORLD,&numproc);
// Initialise the ORB.
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- CORBA::ORB_var &orb = init( argc , argv ) ;
+ SetArgcArgv(argc, argv);
+ CORBA::ORB_ptr orb = KERNEL::GetRefToORB();
// SALOMETraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
BEGIN_OF("[" << numproc << "] " << argv[0])
${LIBXML2_INCLUDE_DIR}
${PYTHON_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}/salome_adm
+ ${CMAKE_CURRENT_SOURCE_DIR}/../ArgvKeeper
${CMAKE_CURRENT_SOURCE_DIR}/../Basics
${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace
${CMAKE_CURRENT_SOURCE_DIR}/../NamingService
# This local variable defines the list of dependent libraries common to all target in this package.
SET(COMMON_LIBS
+ ArgvKeeper
SalomeNS
OpUtil
SALOMELocalTrace
/* $Header$ */
#include <iostream>
+#include "ArgvKeeper.hxx"
+#include "OpUtil.hxx"
#include "SALOME_NamingService.hxx"
#include "SALOME_ModuleCatalog.hh"
#include <string>
try {
// initialize the ORB
-
- orb = CORBA::ORB_init (argc, argv);
+ SetArgcArgv(argc, argv);
+ orb = KERNEL::GetRefToORB();
// Get CORBA reference of the catalog
/* $Header$ */
#include <iostream>
+#include "ArgvKeeper.hxx"
#include "SALOME_NamingService.hxx"
#include "SALOME_ModuleCatalog_impl.hxx"
+#include "OpUtil.hxx"
#include "utilities.h"
#include "Utils_SINGLETON.hxx"
int main(int argc,char **argv)
{
// initialize the ORB
- CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
+ SetArgcArgv(argc, argv);
+ CORBA::ORB_var orb = KERNEL::GetRefToORB();
try
{
CosNaming::NamingContext_var _rootContext, catalogContext;
INFOS( "Module Catalog Server: Naming Service was found" );
if(EnvL==1)
{
- CORBA::ORB_var orb1 = CORBA::ORB_init(argc,argv) ;
+ CORBA::ORB_var orb1 = KERNEL::GetRefToORB() ;
SALOME_NamingService &NS = *SINGLETON_<SALOME_NamingService>::Instance() ;
NS.init_orb( orb1 ) ;
for(int j=1; j<=NumberOfTries; j++)
${OMNIORB_INCLUDE_DIR}
${PTHREAD_INCLUDE_DIR}
${PROJECT_BINARY_DIR}/salome_adm
+ ${CMAKE_CURRENT_SOURCE_DIR}/../ArgvKeeper
${CMAKE_CURRENT_SOURCE_DIR}/../Basics
${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace
${CMAKE_CURRENT_SOURCE_DIR}/../Utils
//
#include "SALOME_NamingService.hxx"
#include "ServiceUnreachable.hxx"
+#include "OpUtil.hxx"
#include "utilities.h"
if(orb)
_orb = CORBA::ORB::_duplicate(orb);
else
- {
- int argc=0;
- _orb = CORBA::ORB_init(argc, 0); // Here we make the assumption that the orb has already been initialized
- }
+ _orb = KERNEL::GetRefToORB(); // Here we make the assumption that the orb has already been initialized
_initialize_root_context();
}
//
#include "NamingServiceTest.hxx"
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
+#include "OpUtil.hxx"
#include "Basics_Utils.hxx"
#include "Basics_DirUtils.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
// --- Get or initialize the orb
- int _argc = 1;
- char* _argv[] = {(char*)""};
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
- _orb = init(_argc , _argv ) ;
+ _orb = KERNEL::GetRefToORB();
// --- Create a SALOME_NamingService instance
//
#include "NOTIFICATION.hxx"
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
+#include "OpUtil.hxx"
CosNA_EventChannel_ptr NOTIFICATION_channel() {
- ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance(); ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
- CORBA::ORB_ptr orb = init(0, 0);
+ CORBA::ORB_ptr orb = KERNEL::GetRefToORB();
CosNA_EventChannel_ptr channel = CosNA_EventChannel::_nil();
CosNaming::NamingContext_var name_context;
${PYTHON_INCLUDE_DIRS}
${PACO_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}/salome_adm
+ ${PROJECT_SOURCE_DIR}/src/ArgvKeeper
${PROJECT_SOURCE_DIR}/src/Container
${PROJECT_SOURCE_DIR}/src/Notification
${PROJECT_SOURCE_DIR}/src/SALOMELocalTrace
# This local variable defines the list of dependent libraries common to all target in this package.
SET(COMMON_LIBS
+ ArgvKeeper
SalomeContainer
SalomeNS
SALOMELocalTrace
// SALOME ParallelContainerNodeDummy : launcher of a PaCO++ object
// File : SALOME_ParallelContainerNodeDummy.cxx
-// Author : André Ribes, EDF
+// Author : Andr� Ribes, EDF
// Module : SALOME PARALLEL
//
#include <iostream>
#include "SALOME_NamingService.hxx"
#include "utilities.h"
+#include "ArgvKeeper.hxx"
#include "Basics_Utils.hxx"
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
#include "SALOMETraceCollector.hxx"
#include "OpUtil.hxx"
}
// Initialise the ORB.
- CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+ SetArgcArgv(argc, argv);
+ CORBA::ORB_var orb = KERNEL::GetRefToORB();
KERNEL_PYTHON::init_python(argc,argv);
std::string containerName("");
// SALOME ParallelContainerNodeMpi : Launch mpi PaCO++ object nodes
// File : SALOME_ParallelContainerNodeMpi.cxx
-// Author : André Ribes, EDF
+// Author : Andr� Ribes, EDF
// Module : SALOME PARALLEL
//
#include <iostream>
#include "SALOME_NamingService.hxx"
#include "utilities.h"
+#include "ArgvKeeper.hxx"
#include "Basics_Utils.hxx"
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
#include "SALOMETraceCollector.hxx"
#include "OpUtil.hxx"
std::cerr << "Level MPI_THREAD_MULTIPLE : " << MPI_THREAD_MULTIPLE << std::endl;
std::cerr << "Level provided : " << provided << std::endl;
// Initialise the ORB.
- CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+ SetArgcArgv(argc, argv);
+ CORBA::ORB_var orb = KERNEL::GetRefToORB();
KERNEL_PYTHON::init_python(argc,argv);
// Code pour choisir le reseau infiniband .....
#endif
SALOME_NamingService * ns = new SALOME_NamingService(CORBA::ORB::_duplicate(orb));
- // On récupère le proxy
+ // On r�cup�re le proxy
std::string proxyNameInNS = ns->BuildContainerNameForNS(containerName.c_str(),
proxy_hostname.c_str());
obj = ns->Resolve(proxyNameInNS.c_str());
// SALOME ParallelContainerProxyDummy : Proxy of a PaCO++ object using Dummy
// File : SALOME_ParallelContainerProxyDummy.cxx
-// Author : André Ribes, EDF
+// Author : Andr� Ribes, EDF
// Module : SALOME PARALLEL
//
#include <iostream>
#include "SALOME_NamingService.hxx"
#include "utilities.h"
+#include "ArgvKeeper.hxx"
#include "Basics_Utils.hxx"
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
#include "SALOMETraceCollector.hxx"
#include "OpUtil.hxx"
signal(SIGSEGV, handler);
#endif
// Initialise the ORB.
- CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+ SetArgcArgv(argc, argv);
+ CORBA::ORB_var orb = KERNEL::GetRefToORB();
KERNEL_PYTHON::init_python(argc,argv);
std::string containerName("");
// SALOME ParallelContainerProxyMpi : Launching the proxy of a MPI PaCO++ object
// File : SALOME_ParallelContainerProxyMpi.cxx
-// Author : André Ribes, EDF
+// Author : Andr� Ribes, EDF
// Module : SALOME PARALLEL
//
#include <iostream>
#include "SALOME_NamingService.hxx"
#include "utilities.h"
+#include "ArgvKeeper.hxx"
#include "Basics_Utils.hxx"
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
#include "SALOMETraceCollector.hxx"
#include "OpUtil.hxx"
// MPI Init
int provided;
MPI_Init_thread(&argc, &argv, MPI_THREAD_SERIALIZED ,&provided);
- CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+ SetArgcArgv(argc, argv);
+ CORBA::ORB_var orb = KERNEL::GetRefToORB();
KERNEL_PYTHON::init_python(argc,argv);
#ifdef _DEBUG_
${PTHREAD_INCLUDE_DIR}
${OMNIORB_INCLUDE_DIR}
${PROJECT_BINARY_DIR}/salome_adm
+ ${CMAKE_CURRENT_SOURCE_DIR}/../ArgvKeeper
${CMAKE_CURRENT_SOURCE_DIR}/../Basics
${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace
${CMAKE_CURRENT_SOURCE_DIR}/../NamingService
INSTALL(TARGETS Registry EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
SET(SALOME_Registry_Server_LIBS
+ ArgvKeeper
SalomeIDLKernel
Registry
SalomeNS
# include <stdio.h>
}
+#include "ArgvKeeper.hxx"
#include "utilities.h"
-#include "Utils_ORB_INIT.hxx"
+#include "OpUtil.hxx"
#include "Utils_SINGLETON.hxx"
#include "Utils_SALOME_Exception.hxx"
#include "Utils_CommException.hxx"
int main( int argc , char **argv )
{
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- CORBA::ORB_var &orb = init( argc , argv ) ;
+ SetArgcArgv( argc, argv );
+ CORBA::ORB_var orb = KERNEL::GetRefToORB();
// LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
BEGIN_OF( argv[0] )
INFOS_COMPILATION
${PYTHON_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}/salome_adm
${CMAKE_CURRENT_SOURCE_DIR}/../HDFPersist
+ ${CMAKE_CURRENT_SOURCE_DIR}/../ArgvKeeper
${CMAKE_CURRENT_SOURCE_DIR}/../Basics
${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace
${CMAKE_CURRENT_SOURCE_DIR}/../KernelHelpers
ENDIF(WIN32)
SET(COMMON_LIBS
+ ArgvKeeper
TOOLSDS
SalomeNS
OpUtil
#include CORBA_SERVER_HEADER(SALOMEDS)
#include "SALOMEDS_AttributeName_i.hxx"
#include "SALOME_KernelServices.hxx"
+#include "ArgvKeeper.hxx"
#include "Basics_Utils.hxx"
+#include "OpUtil.hxx"
#include "utilities.h"
#include "HDFOI.hxx"
{
try {
// Initialise the ORB.
-#if OMNIORB_VERSION >= 4
- CORBA::ORB_var orb = CORBA::ORB_init( argc, argv, "omniORB4" ) ;
-#else
- CORBA::ORB_var orb = CORBA::ORB_init( argc, argv, "omniORB3" );
-#endif
+ SetArgcArgv(argc, argv);
+ CORBA::ORB_var orb = KERNEL::GetRefToORB() ;
// Obtain a reference to the root POA.
CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
#include "SALOMEDSImpl_GenericAttribute.hxx"
#include "SALOMEDSImpl_Study.hxx"
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
+#include "OpUtil.hxx"
#include "Basics_Utils.hxx"
void SALOMEDS_SObject::init_orb()
{
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
- _orb = init(0 , 0 ) ;
+ _orb = KERNEL::GetRefToORB();
}
void SALOMEDS_SObject::SetAttrString(const std::string& name, const std::string& value)
// Module : SALOME
// $Header$
//
+#include "ArgvKeeper.hxx"
+#include "OpUtil.hxx"
#include "utilities.h"
#include "Utils_SINGLETON.hxx"
try
{
// Initialise the ORB.
-#if OMNIORB_VERSION >= 4
- CORBA::ORB_var orb = CORBA::ORB_init( argc, argv, "omniORB4" ) ;
-#else
- CORBA::ORB_var orb = CORBA::ORB_init( argc, argv, "omniORB3" );
-#endif
+ SetArgcArgv(argc, argv);
+ CORBA::ORB_var orb = KERNEL::GetRefToORB() ;
SALOME_NamingService* NS = 0;
// Obtain a reference to the root POA.
long TIMESleep = 500000000;
MESSAGE( "SalomeDS Server: Naming Service was found" );
if(EnvL==1)
{
- CORBA::ORB_var orb1 = CORBA::ORB_init(argc,argv) ;
+ CORBA::ORB_var orb1 = KERNEL::GetRefToORB() ;
NS = SINGLETON_<SALOME_NamingService>::Instance() ;
NS->init_orb( orb1 ) ;
for(int j=1; j<=NumberOfTries; j++)
#include "SALOMEDS_Driver_i.hxx"
#include "SALOMEDS_Study_i.hxx"
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
+#include "OpUtil.hxx"
#include "Basics_Utils.hxx"
void SALOMEDS_Study::InitORB()
{
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
- ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
- _orb = init(0 , 0 ) ;
+ _orb = KERNEL::GetRefToORB();
}
void SALOMEDS_Study::Init()
#include "DF_Attribute.hxx"
#include "Utils_CorbaException.hxx"
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
+#include "OpUtil.hxx"
pthread_mutex_t SALOMEDS_StudyBuilder::_remoteBuilderMutex;
void SALOMEDS_StudyBuilder::init_orb()
{
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
- ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
- _orb = init(0 , 0 );
+ _orb = KERNEL::GetRefToORB();
}
${Boost_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR}
${PROJECT_BINARY_DIR}/salome_adm
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../ArgvKeeper
${CMAKE_CURRENT_SOURCE_DIR}/../../Basics
${CMAKE_CURRENT_SOURCE_DIR}/../../Basics/Test
${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMELocalTrace
# This local variable defines the list of dependent libraries common to all target in this package.
SET(COMMON_LIBS
${CPPUNIT_LIBRARIES}
+ ArgvKeeper
SALOMEBasics
SalomeResourcesManager
SalomeContainer
#include "SALOMEDSTest.hxx"
#include "utilities.h"
-#include "Utils_SINGLETON.hxx"
-#include "Utils_ORB_INIT.hxx"
+#include "OpUtil.hxx"
#include "SALOME_NamingService.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
void SALOMEDSTest::setUp()
{
- int argc = 1;
- char* argv[] = {(char*)""};
-
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
- _orb = init(argc , argv ) ;
+ _orb = KERNEL::GetRefToORB();
SALOME_NamingService NS(_orb);
CORBA::Object_var obj = NS.Resolve( "/Study" );
_study = SALOMEDS::Study::_narrow( obj );
void SALOMEDSTest_Embedded::setUp()
{
- int argc = 1;
- char* argv[] = {(char*)""};
-
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
- _orb = init(argc , argv ) ;
+ _orb = KERNEL::GetRefToORB();
SALOME_NamingService NS(_orb);
CORBA::Object_var obj = NS.Resolve( "/Study_embedded" );
_study = SALOMEDS::Study::_narrow( obj );
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOMEDS)
#include "utilities.h"
-#include "Utils_SINGLETON.hxx"
-#include "Utils_ORB_INIT.hxx"
+#include "ArgvKeeper.hxx"
+#include "OpUtil.hxx"
#include "Basics_Utils.hxx"
#include "SALOME_NamingService.hxx"
#include "NamingService_WaitForServerReadiness.hxx"
int main(int argc, char* argv[])
{
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- CORBA::ORB_var orb = init(argc , argv ) ;
+ SetArgcArgv(argc, argv);
+ CORBA::ORB_var orb = KERNEL::GetRefToORB();
std::string host; // = Kernel_Utils::GetHostname();
char* wait_Superv = getenv("SALOMEDS_UNITTESTS_WAIT_SUPERVISOR");
if(wait_Superv) host = Kernel_Utils::GetHostname();
${PYTHON_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}/idl
${PROJECT_BINARY_DIR}/salome_adm
+ ${CMAKE_CURRENT_SOURCE_DIR}/../ArgvKeeper
${CMAKE_CURRENT_SOURCE_DIR}/../Utils
${CMAKE_CURRENT_SOURCE_DIR}/../NamingService
${CMAKE_CURRENT_SOURCE_DIR}/../Launcher
ADD_DEFINITIONS(${OMNIORB_DEFINITIONS} ${PYTHON_DEFINITIONS})
-SET(COMMON_LIBS SalomeNS SalomeContainer SalomeIDLKernel ${OMNIORB_LIBRARIES} ${PYTHON_LIBRARIES})
+SET(COMMON_LIBS ArgvKeeper SalomeNS SalomeContainer SalomeIDLKernel ${OMNIORB_LIBRARIES} ${PYTHON_LIBRARIES})
SET(SalomeSDS_SOURCES
SALOMESDS_Exception.cxx
#include "SALOMESDS_Exception.hxx"
#include "SALOME_CPythonHelper.hxx"
#include "SALOME_NamingService_Abstract.hxx"
+#include "ArgvKeeper.hxx"
+#include "OpUtil.hxx"
#include <string>
#include <sstream>
#include <functional>
+#include <vector>
CORBA::ORB_var GetCustomORB()
{
CORBA::ORB_var orb;
{
- int argc(3);
- char **argv=new char *[3];
- char *p0(strdup("DTC")),*p1(strdup("-ORBsupportCurrent")),*p2(strdup("0"));
- argv[0]=p0;
- argv[1]=p1;// by disabling supportCurrent it make the POAManager::hold_requests work !
- argv[2]=p2;
- orb=CORBA::ORB_init(argc,argv);
- free(p0); free(p1); free(p2);
- delete [] argv;
+ // by disabling supportCurrent it make the POAManager::hold_requests work !
+ std::vector<std::string> args = {"DTC", "-ORBsupportCurrent", "0"};
+ SetArgcArgv(args);
+ orb=KERNEL::GetRefToORB();
}
return orb;
}
${OMNIORB_INCLUDE_DIR}
${PTHREAD_INCLUDE_DIR}
${PROJECT_BINARY_DIR}/salome_adm
+ ${CMAKE_CURRENT_SOURCE_DIR}/../ArgvKeeper
${CMAKE_CURRENT_SOURCE_DIR}/../Basics
+ ${CMAKE_CURRENT_SOURCE_DIR}/../Utils
${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace
${PROJECT_BINARY_DIR}/idl
)
ADD_DEFINITIONS(${OMNIORB_DEFINITIONS} ${PTHREAD_DEFINITIONS})
ADD_LIBRARY(with_loggerTraceCollector SALOMETraceCollector.cxx TraceCollector_WaitForServerReadiness.cxx)
-TARGET_LINK_LIBRARIES(with_loggerTraceCollector SALOMELocalTrace SalomeIDLKernel ${OMNIORB_LIBRARIES} ${PTHREAD_LIBRARIES})
+TARGET_LINK_LIBRARIES(with_loggerTraceCollector ArgvKeeper SALOMELocalTrace OpUtil SalomeIDLKernel ${OMNIORB_LIBRARIES} ${PTHREAD_LIBRARIES})
INSTALL(TARGETS with_loggerTraceCollector EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx")
#include <cstdlib>
#include <omniORB4/CORBA.h>
+#include "OpUtil.hxx"
+#include "Utils_SALOME_Exception.hxx"
#include "SALOMETraceCollector.hxx"
#include "TraceCollector_WaitForServerReadiness.hxx"
#include <SALOMEconfig.h>
if (_singleton == 0) // another thread may have got
{ // the lock after the first test
BaseTraceCollector* myInstance = new SALOMETraceCollector();
- int argc=0;
- char *_argv=0;
- char ** argv = &_argv;
- _orb = CORBA::ORB_init (argc, argv);
+ _orb = KERNEL::GetRefToORB();
sem_init(&_sem,0,0); // to wait until run thread is initialized
pthread_t traceThread;
${PTHREAD_INCLUDE_DIR}
${OMNIORB_INCLUDE_DIR}
${PROJECT_BINARY_DIR}/salome_adm
+ ${CMAKE_CURRENT_SOURCE_DIR}/../ArgvKeeper
${CMAKE_CURRENT_SOURCE_DIR}/../Basics
${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace
${CMAKE_CURRENT_SOURCE_DIR}/../NamingService
)
SET(COMMON_LIBS
+ ArgvKeeper
SalomeContainer
Registry
SalomeNotification
#include CORBA_CLIENT_HEADER(SALOME_TestComponent)
#include "SALOME_NamingService.hxx"
+#include "ArgvKeeper.hxx"
#include "NamingService_WaitForServerReadiness.hxx"
#include "Basics_Utils.hxx"
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
+#include "OpUtil.hxx"
#include "Utils_SALOME_Exception.hxx"
#include "Utils_CommException.hxx"
int main (int argc, char * argv[])
{
// Initializing omniORB
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- CORBA::ORB_ptr orb = init( argc , argv ) ;
+ SetArgcArgv( argc, argv );
+ CORBA::ORB_ptr orb = KERNEL::GetRefToORB();
// LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
try
${MPI_CXX_INCLUDE_PATH}
${OMNIORB_INCLUDE_DIR}
${PROJECT_BINARY_DIR}/salome_adm
+ ${CMAKE_CURRENT_SOURCE_DIR}/../ArgvKeeper
${CMAKE_CURRENT_SOURCE_DIR}/../Basics
${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace
${CMAKE_CURRENT_SOURCE_DIR}/../NamingService
ADD_DEFINITIONS(${OMNIORB_DEFINITIONS} ${MPI_DEFINITIONS})
SET(COMMON_LIBS
+ ArgvKeeper
Registry
SalomeNotification
SalomeResourcesManager
#include CORBA_CLIENT_HEADER(SALOME_MPIContainer)
#include CORBA_CLIENT_HEADER(SALOME_TestMPIComponent)
+#include "ArgvKeeper.hxx"
#include "Basics_Utils.hxx"
-# include "Utils_ORB_INIT.hxx"
-# include "Utils_SINGLETON.hxx"
#include "SALOME_NamingService.hxx"
#include "OpUtil.hxx"
{
// Initializing omniORB
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- CORBA::ORB_var &orb = init( argc , argv ) ;
- // SALOMETraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
+ SetArgcArgv(argc, argv);
+ CORBA::ORB_ptr orb = KERNEL::GetRefToORB();
+ // SALOMETraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
BEGIN_OF(argv[0])
try{
${PTHREAD_INCLUDE_DIR}
${PROJECT_BINARY_DIR}/salome_adm
${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/../ArgvKeeper
${CMAKE_CURRENT_SOURCE_DIR}/../Basics
${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace
${PROJECT_BINARY_DIR}/idl
)
ADD_DEFINITIONS(${OMNIORB_DEFINITIONS} ${PTHREAD_DEFINITIONS})
SET(COMMON_LIBS
+ ArgvKeeper
SALOMELocalTrace
SalomeIDLKernel
${OMNIORB_LIBRARIES}
Utils_DESTRUCTEUR_GENERIQUE.cxx
Utils_ExceptHandlers.cxx
Utils_Mutex.cxx
+ OpUtil.cxx
)
FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx" )
${PTHREAD_INCLUDE_DIR}
${PROJECT_BINARY_DIR}/salome_adm
${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/../ArgvKeeper
${CMAKE_CURRENT_SOURCE_DIR}/../Basics
${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace
)
SET(COMMON_LIBS
+ ArgvKeeper
SALOMELocalTrace
${PTHREAD_LIBRARIES}
)
SET(OpUtil_SOURCES
Utils_SALOME_Exception.cxx
duplicate.cxx
+ OpUtil.cxx
)
- SET(COMMON_HEADERS_HXX Utils_SALOME_Exception.hxx)
+ SET(COMMON_HEADERS_HXX Utils_SALOME_Exception.hxx OpUtil.hxx)
ENDIF()
// File : OpUtil.cxx
// Module : SALOME
//
-#include "utilities.h"
#include "OpUtil.hxx"
-#include <errno.h>
-#include <string.h>
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include <winsock2.h>
-#endif
+#if !defined(SALOME_LIGHT)
-//int gethostname(char *name, size_t len);
+#include "Utils_SINGLETON.hxx"
+#include "Utils_ORB_INIT.hxx"
-std::string GetHostname()
+UTILS_EXPORT CORBA::ORB_var KERNEL::GetRefToORB()
{
- int ls = 100, r = 1;
- char *s;
-
- while (ls < 10000 && r) {
- ls *= 2;
- s = new char[ls];
- r = gethostname(s, ls-1);
- switch (r)
- {
- case 0:
- break;
- default:
-#ifdef EINVAL
- case EINVAL:
-#endif
-#ifdef ENAMETOOLONG
- case ENAMETOOLONG:
-#endif
- delete [] s;
- continue;
- }
- }
-
- if (r != 0) {
- s = new char[50];
- strcpy(s, "localhost");
- }
-
- // remove all after '.'
- char *aDot = (strchr(s,'.'));
- if (aDot) aDot[0] = '\0';
-
- std::string p = s;
- delete [] s;
- return p;
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
+ CORBA::ORB_var &orb = init();
+ return orb;
}
+#endif
UTILS_EXPORT const char *duplicate(const char * const);
+#if !defined(SALOME_LIGHT)
+
+#include <omniORB4/CORBA.h>
+
+namespace KERNEL
+{
+ UTILS_EXPORT CORBA::ORB_var GetRefToORB();
+}
+
+#endif
+
#endif
// $Header$
//
# include "Utils_ORB_INIT.hxx"
+# include "Utils_SALOME_Exception.hxx"
# include "utilities.h"
+# include "ArgvKeeper.hxx"
# include "SALOMEconfig.h"
+# include <string>
+# include <vector>
+
ORB_INIT::ORB_INIT( void ): _orb( CORBA::ORB::_nil() )
{
}
}
}
-CORBA::ORB_var &ORB_INIT::operator() ( int argc , char **argv )
+CORBA::ORB_var &ORB_INIT::operator() ()
{
try {
if ( CORBA::is_nil( _orb ) )
{
try
{
-#if OMNIORB_VERSION >= 4
+ if (!ArgcArgvInitialized())
+ {
+ MESSAGE("WARNING: ORB_INIT(): argc and argv are not initialized");
+ }
+ std::vector<std::string> args = GetArgcArgv();
+ int argc = args.size();
+ char** argv = new char*[argc];
+ for (int i = 0; i < argc; ++i)
+ argv[i] = strdup(args.at(i).c_str());
_orb = CORBA::ORB_init( argc, argv, "omniORB4" ) ;
-#else
- _orb = CORBA::ORB_init( argc, argv, "omniORB3" ) ;
-#endif
+ for (int i = 0; i < argc; ++i)
+ delete[] argv[i];
+ delete[] argv;
}
catch( const CORBA::Exception & )
{
ORB_INIT( void );
virtual ~ORB_INIT();
void explicit_destroy();
- CORBA::ORB_var & operator() ( int argc , char **argv );
+ CORBA::ORB_var & operator() ();
inline CORBA::ORB_var &orb( void );
} ;