FIND_PACKAGE(SalomeOmniORB REQUIRED)
FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
FIND_PACKAGE(SalomePThread REQUIRED)
+FIND_PACKAGE(SalomeSWIG REQUIRED)
# Find GUI
# ===========
MESSAGE(STATUS "Creation of ${CMAKE_CURRENT_BINARY_DIR}/SalomeApp.xml")
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/SalomeApp.xml.in ${CMAKE_CURRENT_BINARY_DIR}/SalomeApp.xml @ONLY)
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/SalomeApp.xml DESTINATION ${SALOME_ATOMSOLV_INSTALL_RES_DATA})
\ No newline at end of file
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/SalomeApp.xml DESTINATION ${SALOME_ATOMSOLV_INSTALL_RES_DATA})
+SALOME_CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/SalomeApp.xml.in ${CMAKE_CURRENT_BINARY_DIR}/SalomeAppSL.xml INSTALL ${SALOME_ATOMSOLV_INSTALL_RES_DATA})
using namespace std;
-ATOMSOLV::ATOMSOLV(CORBA::ORB_ptr orb,
+ATOMSOLV_Abstract::ATOMSOLV_Abstract(CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
PortableServer::ObjectId * contId,
const char *instanceName,
- const char *interfaceName) :
- Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
+ const char *interfaceName,
+ bool withRegistry) :
+ Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, withRegistry)
{
MESSAGE("activate object");
_thisObj = this ;
myData = new ATOMSOLV_ORB::TMoleculeList();
}
-ATOMSOLV::~ATOMSOLV()
+ATOMSOLV_Abstract::~ATOMSOLV_Abstract()
{
}
-CORBA::Boolean ATOMSOLV::setData( const ATOMSOLV_ORB::TMoleculeList& theData )
+CORBA::Boolean ATOMSOLV_Abstract::setData( const ATOMSOLV_ORB::TMoleculeList& theData )
{
const int n = theData.length();
ATOMSOLV_ORB::TMoleculeList_var data = new ATOMSOLV_ORB::TMoleculeList();
return (bool)n;
}
-CORBA::Boolean ATOMSOLV::getData( ATOMSOLV_ORB::TMoleculeList_out outData )
+CORBA::Boolean ATOMSOLV_Abstract::getData( ATOMSOLV_ORB::TMoleculeList_out outData )
{
ATOMSOLV_ORB::TMoleculeList* data = myData;
- // printf( " -- ATOMSOLV::getData() length = %d\n", data->length() );
+ // printf( " -- ATOMSOLV_Abstract::getData() length = %d\n", data->length() );
const int n = data->length();
outData = new ATOMSOLV_ORB::TMoleculeList();
outData->length( n );
return true;
}
-CORBA::Boolean ATOMSOLV::processData()
+CORBA::Boolean ATOMSOLV_Abstract::processData()
{
ATOMSOLV_ORB::TMoleculeList* data = myData;
for ( int i = 0, n = data->length(); i < n; i++ )
return true;
}
-char* ATOMSOLV::getVersion()
+char* ATOMSOLV_Abstract::getVersion()
{
#if defined(ATOMSOLV_DEVELOPMENT)
return CORBA::string_dup(ATOMSOLV_VERSION_STR"dev");
{
MESSAGE("PortableServer::ObjectId * ATOMSOLVEngine_factory()");
SCRUTE(interfaceName);
- ATOMSOLV * myATOMSOLV
- = new ATOMSOLV(orb, poa, contId, instanceName, interfaceName);
+ ATOMSOLV_Session * myATOMSOLV
+ = new ATOMSOLV_Session(orb, poa, contId, instanceName, interfaceName);
return myATOMSOLV->getId() ;
}
}
#endif
-class ATOMSOLV_EXPORT ATOMSOLV:
+class ATOMSOLV_EXPORT ATOMSOLV_Abstract:
public POA_ATOMSOLV_ORB::ATOMSOLV_Gen,
public Engines_Component_i
{
public:
- ATOMSOLV(CORBA::ORB_ptr orb,
+ ATOMSOLV_Abstract(CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
PortableServer::ObjectId * contId,
const char *instanceName,
- const char *interfaceName);
- virtual ~ATOMSOLV();
+ const char *interfaceName,
+ bool withRegistry = true);
+ virtual ~ATOMSOLV_Abstract();
CORBA::Boolean setData( const ATOMSOLV_ORB::TMoleculeList& theData );
CORBA::Boolean getData( ATOMSOLV_ORB::TMoleculeList_out outData );
ATOMSOLV_ORB::TMoleculeList* myData;
};
+class ATOMSOLV_EXPORT ATOMSOLV_Session : public ATOMSOLV_Abstract
+{
+public:
+ ATOMSOLV_Session( CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId* contId,
+ const char* instanceName,
+ const char* interfaceName):ATOMSOLV_Abstract(orb,poa,contId,instanceName,interfaceName,true) { }
+};
+
+class ATOMSOLV_EXPORT ATOMSOLV_No_Session : public ATOMSOLV_Abstract
+{
+public:
+ ATOMSOLV_No_Session( CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId* contId,
+ const char* instanceName,
+ const char* interfaceName):ATOMSOLV_Abstract(orb,poa,contId,instanceName,interfaceName,false) { }
+};
+
extern "C"
ATOMSOLV_EXPORT
PortableServer::ObjectId * ATOMSOLVEngine_factory(CORBA::ORB_ptr orb,
--- /dev/null
+// Copyright (C) 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 "ATOMSOLV_Component_Generator.hxx"
+
+#include "ATOMSOLV.hxx"
+#include "SALOME_Container_i.hxx"
+#include "SALOME_KernelServices.hxx"
+
+#include <cstring>
+
+static Engines::EngineComponent_var _unique_compo;
+
+Engines::EngineComponent_var RetrieveATOMSOLVInstance()
+{
+ constexpr char COMPO_NAME[]="ATOMSOLV";
+ if (CORBA::is_nil(_unique_compo))
+ {
+ CORBA::ORB_var orb;
+ {
+ int argc(0);
+ orb = CORBA::ORB_init(argc, nullptr);
+ }
+ CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
+ PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
+ PortableServer::POAManager_var pman = poa->the_POAManager();
+ CORBA::PolicyList policies;
+ policies.length(0);
+ auto *cont(KERNEL::getContainerSA());
+ PortableServer::ObjectId *conId(cont->getCORBAId());
+ //
+ pman->activate();
+ //
+ ATOMSOLV_No_Session *servant = new ATOMSOLV_No_Session(orb, poa, conId, "ATOMSOLV_inst_2", COMPO_NAME);
+ PortableServer::ObjectId *zeId = servant->getId();
+ CORBA::Object_var zeRef = poa->id_to_reference(*zeId);
+ KERNEL::RegisterCompo(COMPO_NAME,zeRef);
+ _unique_compo = Engines::EngineComponent::_narrow(zeRef);
+ }
+ return _unique_compo;
+}
--- /dev/null
+// Copyright (C) 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 "ATOMSOLV.hxx"
+
+#include "SALOMEconfig.h"
+
+#include CORBA_SERVER_HEADER(ATOMSOLV)
+
+ATOMSOLV_EXPORT Engines::EngineComponent_var RetrieveATOMSOLVInstance();
SET(_link_LIBRARIES
${ATOMGEN_SalomeIDLATOMGEN}
${KERNEL_SalomeContainer}
+ ${KERNEL_SalomeKernelHelpers}
SalomeIDLATOMSOLV
)
# header files / no moc processing
SET(ATOMSOLV_HEADERS
ATOMSOLV.hxx
+ ATOMSOLV_Component_Generator.hxx
)
# --- sources ---
# sources / static
SET(ATOMSOLV_SOURCES
ATOMSOLV.cxx
+ ATOMSOLV_Component_Generator.cxx
)
# --- rules ---
#include "ATOMSOLVGUI_Displayer.h"
#include "ATOMSOLVGUI_Selection.h"
#include "ATOMSOLVGUI_TransparencyDlg.h"
+#include "ATOMSOLV_Component_Generator.hxx"
#include <ATOMSOLV_version.h>
#include <SalomeApp_Application.h>
#include <SalomeApp_Study.h>
+#include "SALOME_NamingService_Abstract.hxx"
+#include "SALOME_KernelServices.hxx"
+
#include <LightApp_DataOwner.h>
#include <LightApp_SelectionMgr.h>
#include <LightApp_Preferences.h>
if ( !app )
myEngine = ATOMSOLV_ORB::ATOMSOLV_Gen::_nil();
else {
- Engines::EngineComponent_var comp = app->lcc()->FindOrLoad_Component( "FactoryServer", "ATOMSOLV" );
+ SALOME_NamingService_Abstract *ns = SalomeApp_Application::namingService();
+ Engines::EngineComponent_var comp;
+ if(ns->IsTrueNS())
+ {
+ comp = app->lcc()->FindOrLoad_Component( "FactoryServer", "ATOMSOLV" );
+ }
+ else
+ {
+ comp = RetrieveATOMSOLVInstance();
+ CORBA::Object_var comp2 = CORBA::Object::_narrow(comp);
+ KERNEL::RegisterCompo("ATOMSOLV",comp2);
+ }
ATOMSOLV_ORB::ATOMSOLV_Gen_ptr atomGen = ATOMSOLV_ORB::ATOMSOLV_Gen::_narrow(comp);
ASSERT( !CORBA::is_nil( atomGen ) );
myEngine = atomGen;
ATOMSOLV_ORB::ATOMSOLV_Gen_var engine = GetATOMSOLVGen();
SalomeApp_Application* app = getApp();
if ( !CORBA::is_nil( engine ) && app ) {
- Engines::EngineComponent_var comp = app->lcc()->FindOrLoad_Component( "FactoryServerPy","ATOMGEN" );
+ Engines::EngineComponent_var comp = app->lcc()->FindOrLoad_Component( "FactoryServer","ATOMGEN" );
ATOMGEN_ORB::ATOMGEN_Gen_var atomGen = ATOMGEN_ORB::ATOMGEN_Gen::_narrow( comp );
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
if ( !CORBA::is_nil( atomGen ) && appStudy ) {
${OMNIORB_INCLUDE_DIR}
${PROJECT_BINARY_DIR}
${PROJECT_BINARY_DIR}/idl
+ ${CMAKE_CURRENT_SOURCE_DIR}/../ATOMSOLV
)
# additional preprocessor / compiler flags
${GUI_LightApp}
${GUI_SalomeApp}
${ATOMGEN_SalomeIDLATOMGEN}
+ ATOMSOLVEngine
SalomeIDLATOMSOLV
)
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 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
+#
+
+def buildInstance(orb):
+ import AtomsolvHelper
+ atomsolv_ior = AtomsolvHelper.BuildATOMSOLVInstance()
+ import ATOMSOLV_ORB
+ import CORBA
+ orb=CORBA.ORB_init([''])
+ atomsolv = orb.string_to_object(atomsolv_ior)
+ return atomsolv, orb
--- /dev/null
+// Copyright (C) 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 "AtomsolvHelper.h"
+
+#include "SALOME_KernelServices.hxx"
+
+#include "ATOMSOLV_Component_Generator.hxx"
+
+std::string BuildATOMSOLVInstance()
+{
+ Engines::EngineComponent_var zeRef = RetrieveATOMSOLVInstance();
+ CORBA::String_var ior = KERNEL::getORB()->object_to_string(zeRef);
+ return std::string(ior.in());
+}
--- /dev/null
+// Copyright (C) 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 <string>
+
+std::string BuildATOMSOLVInstance();
--- /dev/null
+// Copyright (C) 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 AtomsolvHelper
+
+%include "std_string.i"
+
+%inline
+{
+ std::string BuildATOMSOLVInstance();
+}
--- /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(
+ ${KERNEL_INCLUDE_DIRS}
+ ${PROJECT_BINARY_DIR}/idl
+ ${PROJECT_SOURCE_DIR}/src/ATOMSOLV
+)
+
+SET(_bin_SCRIPTS
+ ATOMSOLV_SalomeSessionless.py
+)
+
+# additional preprocessor / compiler flags
+ADD_DEFINITIONS(${OMNIORB_DEFINITIONS} )
+
+# SWIG wrapping
+SET(AtomsolvHelper_HEADERS AtomsolvHelper.h AtomsolvHelper.i)
+SET(AtomsolvHelper_SOURCES AtomsolvHelper.cxx ${AtomsolvHelper_HEADERS})
+SET_SOURCE_FILES_PROPERTIES(AtomsolvHelper.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(AtomsolvHelper.i PROPERTIES SWIG_FLAGS "-py3")
+SET_SOURCE_FILES_PROPERTIES(AtomsolvHelper_wrap.cpp PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H")
+SET(_swig_SCRIPTS ${CMAKE_CURRENT_BINARY_DIR}/AtomsolvHelper.py )
+IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
+ SWIG_ADD_MODULE(AtomsolvHelper python ${AtomsolvHelper_SOURCES})
+ELSE()
+ SWIG_ADD_LIBRARY(AtomsolvHelper LANGUAGE python SOURCES ${AtomsolvHelper_SOURCES})
+ENDIF()
+SWIG_LINK_LIBRARIES(AtomsolvHelper ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} ATOMSOLVEngine ${KERNEL_SalomeKernelHelpers} ${KERNEL_SalomeDS} )
+SWIG_CHECK_GENERATION(AtomsolvHelper)
+IF(WIN32)
+ SET_TARGET_PROPERTIES(_AtomsolvHelper PROPERTIES DEBUG_OUTPUT_NAME _AtomsolvHelper_d)
+ENDIF(WIN32)
+install(TARGETS _AtomsolvHelper DESTINATION ${SALOME_INSTALL_LIBS})
+install(FILES ${AtomsolvHelper_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
+SALOME_INSTALL_SCRIPTS("${_swig_SCRIPTS}" ${SALOME_INSTALL_BINS} EXTRA_DPYS "${SWIG_MODULE_AtomsolvHelper_REAL_NAME}")
+
+SALOME_INSTALL_SCRIPTS("${_bin_SCRIPTS}" ${SALOME_INSTALL_PYTHON} DEF_PERMS)
# Common packages
##
SET(SUBDIRS_COMMON
- ATOMSOLV ATOMSOLVGUI
+ ATOMSOLV ATOMSOLVGUI ATOMSOLV_SWIG
)
SET(SUBDIRS