IDLDIR = idl
endif
+ACLOCAL_AMFLAGS = -I salome_adm/unix/config_files
+
SUBDIRS = $(IDLDIR) salome_adm src doc bin resources
DIST_SUBDIRS= idl salome_adm src doc bin resources
docs:usr_docs
dev_docs:
- (cd doc && $(MAKE) $(AM_MAKEFLAGS) dev_docs)
\ No newline at end of file
+ (cd doc && $(MAKE) $(AM_MAKEFLAGS) dev_docs)
# ---
+class ConnectionManagerServer(Server):
+ def __init__(self,args):
+ self.args=args
+ self.initArgs()
+ self.CMD=['SALOME_ConnectionManagerServer']
+
+# ---
+
class RegistryServer(Server):
def __init__(self,args):
self.args=args
myCmServer.setpath(modules_list,modules_root_dir)
myCmServer.run()
+ #
+ # Launch ConnectionManagerServer
+ #
+
+ myConnectionServer = ConnectionManagerServer(args)
+ myConnectionServer.run()
+
from Utils_Identity import getShortHostName
#
#AC_PREREQ(2.59)
#AC_INIT(src)
-AC_INIT([Salome2 Project], [3.2.2], [gboulant@CS], [salome])
+AC_INIT([Salome2 Project], [3.2.2], [paul.rascle@edf.fr], [salome])
# AC_CONFIG_AUX_DIR defines an alternative directory where to find the auxiliary
# scripts such as config.guess, install-sh, ...
AC_CONFIG_AUX_DIR(salome_adm/unix/config_files)
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
-AM_INIT_AUTOMAKE
+AM_INIT_AUTOMAKE([tar-pax])
#AC_CONFIG_HEADER([config.h])
PACKAGE=salome
echo
echo ============================================================
-echo testing optionnal products
+echo testing parallel products
echo ============================================================
echo
CHECK_MPI
+echo
+echo ---------------------------------------------
+echo checking if PaCO++ is requested by user
+echo ---------------------------------------------
+echo
+
+CHECK_PACO
+
+echo
+echo ------------------------------------------------------------
+echo checking if parallel kernel extensions are requested by user
+echo ------------------------------------------------------------
+echo
+
+AC_MSG_CHECKING(whether to enable parallel kernel extension)
+AC_ARG_ENABLE(parallel_extension,
+ AC_HELP_STRING([--enable-parallel_extension], [parallel kernel extension = [no/yes] (default is no)]),
+ parallel_extension_ok=$enableval,
+ parallel_extension_ok=no)
+if test "x$parallel_extension_ok" = "xyes"
+then
+ if test "x$PaCO_ok" = "xno"
+ then
+ parallel_extension_ok=no
+ fi
+fi
+
+if test "x$parallel_extension_ok" = "xyes"
+then
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([no])
+fi
+
+AM_CONDITIONAL([WITH_PACO_PARALLEL], [test "x$parallel_extension_ok" = "xyes"])
+
+echo
+echo ============================================================
+echo testing optionnal products
+echo ============================================================
+echo
+
echo
echo ---------------------------------------------
echo Testing Batch
fi
echo
-if test x$MPIREQUESTED = xyes; then
- requested_products="mpi_ok"
- echo --- products requested by user
- summary $requested_products
- check_fatal_error $requested_products
- echo
-fi
+parallel_products="mpi_ok PaCO_ok parallel_extension_ok"
+echo --- Kernel parallel extensions:
+summary $parallel_products
+echo
optional_products="cppunit_ok openpbs_ok lsf_ok"
echo --- Optional products:
./src/Communication/Makefile \
./src/Communication_SWIG/Makefile \
./src/Container/Makefile \
+ ./src/ParallelContainer/Makefile \
+ ./src/DSC/Makefile \
+ ./src/DSC/DSC_Basic/Makefile \
+ ./src/DSC/DSC_User/Makefile \
+ ./src/DSC/DSC_User/Basic/Makefile \
+ ./src/DSC/DSC_User/Datastream/Makefile \
+ ./src/DSC/DSC_User/Datastream/Palm/Makefile \
+ ./src/DSC/DSC_User/Datastream/Calcium/Makefile \
+ ./src/DSC/ParallelDSC/Makefile \
./src/GenericObj/Makefile \
./src/HDFPersist/Makefile \
./src/KERNEL_PY/Makefile \
@top_srcdir@/src/LifeCycleCORBA \
@top_srcdir@/src/NamingService \
@top_srcdir@/src/Notification \
- @top_srcdir@/src/Utils
+ @top_srcdir@/src/Utils \
+ @top_srcdir@/src/DSC
FILE_PATTERNS = *.idl *.hxx *.cxx python_extension_must_be_here
RECURSIVE = YES
EXCLUDE =
-@set UPDATED 14 June 2006
+@set UPDATED 2 June 2006
@set UPDATED-MONTH June 2006
-@set EDITION 3.2.4
-@set VERSION 3.2.4
+@set EDITION 3.2.2
+@set VERSION 3.2.2
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+// File : SALOME_Ports.idl
+// Author : Eric Fayolle, EDF
+
+#ifndef _CALCIUM_PORTS_IDL_
+#define _CALCIUM_PORTS_IDL_
+
+#include "SALOME_Ports.idl"
+
+module Ports {
+
+ module Calcium_Ports {
+
+ const long UNLIMITED_STORAGE_LEVEL = -70;
+ enum DependencyType { UNDEFINED_DEPENDENCY, TIME_DEPENDENCY, ITERATION_DEPENDENCY };
+ enum DateCalSchem { TI_SCHEM, TF_SCHEM , ALPHA_SCHEM};
+ enum InterpolationSchem { L0_SCHEM, L1_SCHEM };
+ enum ExtrapolationSchem { UNDEFINED_EXTRA_SCHEM, E0_SCHEM, E1_SCHEM};
+
+ // enum DisconnectDirective {UNDEFINED_DIRECTIVE,CONTINUE,STOP};
+ typedef boolean DisconnectDirective;
+ const DisconnectDirective stop = FALSE;
+ const DisconnectDirective cont = TRUE;
+
+ interface Calcium_Port : Ports::Data_Port, Ports::PortProperties {
+ void disconnect(in DisconnectDirective mode);
+ };
+
+ typedef sequence<long> seq_long;
+ typedef sequence<float> seq_float;
+ typedef sequence<double> seq_double;
+ typedef sequence<string> seq_string;
+ typedef sequence<boolean> seq_boolean;
+ typedef seq_float seq_complex;
+
+ interface Calcium_Integer_Port : Calcium_Port {
+ void put (in seq_long data, in double time, in long tag);
+ };
+
+ interface Calcium_Real_Port : Calcium_Port {
+ void put (in seq_float data, in double time, in long tag);
+ };
+
+ interface Calcium_Double_Port : Calcium_Port {
+ void put (in seq_double data, in double time, in long tag);
+ };
+
+ interface Calcium_String_Port : Calcium_Port {
+ void put (in seq_string data, in double time, in long tag);
+ };
+
+ interface Calcium_Logical_Port : Calcium_Port {
+ void put (in seq_boolean data, in double time, in long tag);
+ };
+
+ interface Calcium_Complex_Port : Calcium_Port {
+ void put (in seq_complex data, in double time, in long tag);
+ };
+
+ };
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+// File : DSC_Engines.idl
+// Author : Andre RIBES, EDF
+// $Header:
+
+#ifndef _DSC_ENGINES_IDL_
+#define _DSC_ENGINES_IDL_
+
+#include "SALOME_Component.idl"
+#include "SALOME_Ports.idl"
+
+/*! \file
+ This is a package that contains IDL interfaces that permits to add
+ a dynamic port model to the SALOME object model.
+ */
+module Engines {
+
+ /*! \brief Interface of a DSC component.
+
+ This interface defines the operations needed to add a component model with dynamic port
+ declaration to the SALOME object model. A component is a black box that interacts with
+ other components only by his ports. A port represents a connection point for the component.
+ In this model, a port is a CORBA interface, so a CORBA object.
+
+ There is two ways for a component to interact with a port type :
+ - It implements the port : it means "the component provides an implementation of the
+ interface of the port". We design this kind of port as "provides ports". It provides an
+ interface to other components.
+ - It needs to use an object that provides the port interface. We say that the component uses this
+ port type. It is represented by a "uses" port. A uses port can be connected with a provides port
+ of the same interface type. When the connection is done, a component can use the "uses port" to use the
+ interface provided by the "provides port".
+
+ The interface DSC implements the component interface that containes the operations that are needed
+ to manage declarations into a component and connections between ports.
+
+ These operations are logicaly divided in two parts :
+ - First part permits to add an get ports of a component.
+ - Second part permits to connect/disconnect ports.
+ */
+ interface DSC : Engines::Component {
+
+/*--------------------------------------------------------------------------------------------*/
+/*-------------------------------------- Types Part ------------------------------------------*/
+
+ /*!
+ This sequence is a uses port. It's a sequence since a uses port can be
+ connected with x provides port. Sometimes this kind of uses port is called multiple port.
+ At this programming level, the user has to deal with the sequence. In the DSC_user
+ layer, the user only deals with one pointer.
+ */
+ typedef sequence<Ports::Port> uses_port;
+
+ /*!
+ This enumeration is used when the connection of a port (uses or provides)
+ is changed. This information is for the component's user code.
+ */
+ enum Message {AddingConnection,
+ RemovingConnection,
+ ApplicationError};
+
+ /*!
+ This exception is raised when a port's name is gived before
+ it is added to the component.
+ */
+ exception PortNotDefined {};
+
+ /*!
+ This exception is raised if you try to add a port with the same
+ name than a previous defined port.
+ */
+ exception PortAlreadyDefined {};
+
+ /*!
+ This exception is raised when you try to use a port that is not connected.
+ */
+ exception PortNotConnected {};
+
+ /*!
+ This exception is raised if the type of the provides port is bad.
+ This exception contains a string that gives what type is expected
+ and the type that the operation received.
+ */
+ exception BadPortType {
+ string expected;
+ string received;
+ };
+
+ /*!
+ Port's reference is Nil !
+ */
+ exception NilPort {};
+
+ /*!
+ Port's reference is not the right reference.
+ */
+ exception BadPortReference {};
+
+ /*!
+ Object porperty is not good for the port
+ */
+ exception BadProperty {};
+
+
+/*--------------------------------------------------------------------------------------------*/
+/*-------------------------------------- Operation Part --------------------------------------*/
+
+ /*!
+ This operation adds a provides port to the component.
+
+ \param ref port's Corba reference.
+ \param provides_port_name port's name.
+ \param port_prop port's property object.
+
+ \exception PortAlreadyDefined
+ \exception NilPort
+ \exception BadProperty
+
+ \note Notice that the name of the port is unique on a component. So if there is
+ a uses port that has the same name, the PortAlreadyDefined exception will be throw.
+ Also notice that each port as an object property that is associated with.
+ */
+ void add_provides_port(in Ports::Port ref,
+ in string provides_port_name,
+ in Ports::PortProperties port_prop) raises(PortAlreadyDefined,
+ NilPort,
+ BadProperty);
+
+ /*!
+ This operation adds a uses port to the component.
+
+ \param repository_id port's Corba repository id.
+ Eg : IDL:toto.tata/MODULE/INTERFACE_NAME:1.0
+ \param uses_port_name port's name.
+ \param port_prop port's property object.
+
+ \exception PortAlreadyDefined
+ \exception BadProperty
+
+ \note Notice that the name of the port is unique on the component. So if there is
+ a provides port that has the same name, the PortAlreadyDefined exception will be throw.
+ Also notice that each port as an object property that is associated with.
+ */
+ void add_uses_port(in string repository_id,
+ in string uses_port_name,
+ in Ports::PortProperties port_prop) raises(PortAlreadyDefined,
+ BadProperty);
+
+ /*!
+ This operation is used to get a provides port of the component.
+ It can be used by the framework or the component himself.
+
+ If it's the framework that wants the port, the reference has to be gived
+ even if the port is not connected (boolean connection_error to false).
+ Contrary, if it's the component that wants the port, the port is given
+ in most of cases only if it is connected (boolean connection_error to true).
+ Notice that you can choose the behaviour that you want.
+
+ \param provides_port_name port's name.
+ \param connection_error true if you want to wait that the port is connected with
+ an another port.
+ \return port's Corba reference.
+
+ \exception PortNotDefined
+ \exception PortNotConnected
+ \exception BadPortType
+
+ */
+ Ports::Port get_provides_port(in string provides_port_name,
+ in boolean connection_error) raises(PortNotDefined,
+ PortNotConnected,
+ BadPortType);
+
+ /*!
+ This operation is used to get a uses port of the component.
+ It can be used by the framework or the component himself.
+ Actually, only the user layer of the component will use this operation.
+ A uses port could be obtained if and only if the uses port is connected. The sequence
+ contains all the connections since a uses port can have multiple connections.
+
+ There is a system of callbacks to prevent the user code that there is a new
+ (or a deletion) of a connection (see DSC_Callbacks class).
+
+ \param uses_port_name port's name.
+ \return uses port's sequence.
+
+ \exception PortNotDefined
+ \exception PortNotConnected
+ \exception BadPortType
+
+ \see DSC_Callbacks
+ */
+ uses_port get_uses_port(in string uses_port_name) raises(PortNotDefined,
+ PortNotConnected,
+ BadPortType);
+
+
+ /*!
+ This operation connects a provides port with a uses port.
+
+ \param provides_port_name provides port's name.
+
+ \exception PortNotDefined
+
+ \note Notice that the provides doesn't uses port names or component reference.
+ */
+ void connect_provides_port(in string provides_port_name) raises(PortNotDefined);
+
+ /*!
+ This operation connects a uses port with a provides port.
+
+ \param uses_port_name uses port's name.
+ \param provides_port_ref provides port's Corba reference.
+
+ \exception PortNotDefined
+ \exception BadPortType
+ \exception NilPort
+ */
+ void connect_uses_port(in string uses_port_name,
+ in Ports::Port provides_port_ref) raises(PortNotDefined,
+ BadPortType,
+ NilPort);
+ /*!
+ This operation tests if a port is connected. You can test
+ a uses port or a provides port.
+
+ \param port_name port's name.
+ \return true if the uses port is connected.
+
+ \exception PortNotDefined
+ */
+ boolean is_connected(in string port_name) raises(PortNotDefined);
+
+ /*!
+ This operation disconnects a uses port to a provides port.
+
+ \param provides_port_name provides port's name.
+ \param message state associated with the disconnection.
+
+ \exception PortNotDefined
+ \exception PortNotConnected
+ */
+ void disconnect_provides_port(in string provides_port_name,
+ in Engines::DSC::Message message) raises(PortNotDefined,
+ PortNotConnected);
+
+ /*!
+ This operation disconnects a provides port to a uses port.
+
+ \param uses_port_name uses port's name.
+ \param provides_port_ref CORBA reference of the provides port.
+ \param message state associated with the disconnection.
+
+ \exception PortNotDefined
+ \exception PortNotConnected
+ \exception BadPortReference
+ */
+ void disconnect_uses_port(in string uses_port_name,
+ in Ports::Port provides_port_ref,
+ in Engines::DSC::Message message) raises(PortNotDefined,
+ PortNotConnected,
+ BadPortReference);
+ /*!
+ This operation permits to get port's property object.
+
+ \param port_name port's name.
+ \return properties object's CORBA reference.
+
+ \exception PortNotDefined
+ */
+ Ports::PortProperties get_port_properties(in string port_name) raises(PortNotDefined);
+
+ };
+
+ /*! \brief Interface of the ConnectionManager.
+ It is a helper object for connection operations.
+ The ConnectionManager is used like other services of SALOME (e.g ContainerManager).
+ */
+ interface ConnectionManager {
+
+ /*!
+ The Id gived to the disconnect method is bad.
+ */
+ exception BadId {};
+
+ /*!
+ A connection Id. It's unique.
+ */
+ typedef short connectionId;
+
+ /*!
+ This operation connects a uses port with a provides port.
+
+ \param uses_component The component that have the uses port.
+ \param uses_port_name uses port's name.
+ \param provides_component The component that have the provides port.
+ \param provides_port_name provides port's name.
+
+ \exception Engines::DSC::PortNotDefined
+ \exception Engines::DSC::BadPortType
+ \exception Engines::DSC::NilPort
+
+ \return the id of the connection that the ConnectionManager will use
+ to release this connection when the framework (or a user script, ...)
+ will call ConnectionManager::disconnect.
+ */
+ connectionId connect(in Engines::DSC uses_component,
+ in string uses_port_name,
+ in Engines::DSC provides_component,
+ in string provides_port_name) raises(Engines::DSC::PortNotDefined,
+ Engines::DSC::BadPortType,
+ Engines::DSC::NilPort);
+
+ /*!
+ This operation releases a connection that has been previously created by
+ the ConnectionManager.
+
+ \param id The id of the connection previously gived by the connect operation
+ of the ConnectionManager.
+ \param message state associated with the disconnection.
+
+ \exception Engines::ConnectionManager::BadId
+ */
+ void disconnect(in connectionId id,
+ in Engines::DSC::Message message) raises(Engines::ConnectionManager::BadId);
+
+ };
+
+/*--------------------------------------------------------------------------------------------*/
+
+ /*! \brief Interface of the Superv_Component.
+ This interface is a DSC component that contains services for the SALOME module SUPERV.
+ This interface contains methods that are only in local (so they are described
+ and explained in the implementation class Superv_Component_i). These methods give access
+ to data-oriented ports provided by default by SALOME's kernel.
+ */
+ interface Superv_Component : Engines::DSC {
+
+ /*!
+ The SUPERV module call this method before starting the service. Thus the service
+ can add is dynamics ports before it is started.
+
+ \param service_name service's name.
+ \return true if the service is correctly initialised.
+ */
+ boolean init_service(in string service_name);
+ };
+
+/*--------------------------------------------------------------------------------------------*/
+
+ /*! \brief Interface of a Parallel_DSC component.
+ This interface defines the operations needed to add a paco++ port
+ into a parallel DSC component.
+ */
+ interface Parallel_DSC : Engines::DSC {
+
+ /*!
+ This operation gives the proxy node of a paco++ port to all the nodes.
+ Only a node of the parallel component is going to add a proxy object
+ with an internal method.
+
+ \param ref provides proxy port's reference.
+ \param provides_port_name provides port's name.
+
+ \see Engines_ParallelDSC_i::add_parallel_provides_proxy_port
+ */
+ void set_paco_proxy(in Object ref,
+ in string provides_port_name);
+
+ /*!
+ The SUPERV module call this method before starting the service. Thus the service
+ can add is dynamics ports before is started.
+
+ \param service_name service's name.
+ \return true if the service is correctly initialised.
+ */
+ boolean init_service(in string service_name);
+
+ };
+};
+
+#endif
--- /dev/null
+<?xml version="1.0"?>
+<GridCCM_Interface_description
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+ xsi:noNamespaceSchemaLocation='$PACOPATH/IDL2Tool/interface.xsd'
+>
+
+<Module>
+ <Name>Engines</Name>
+ <Interface>
+ <Name>DSC</Name>
+ <Method>
+ <Name>connect_provides_port</Name>
+ <Type>distributed</Type>
+ </Method>
+ <Method>
+ <Name>connect_uses_port</Name>
+ <Type>distributed</Type>
+ </Method>
+ </Interface>
+ <Interface>
+ <Name>Parallel_DSC</Name>
+ <Method>
+ <Name>set_paco_proxy</Name>
+ <Type>distributed</Type>
+ </Method>
+ <Method>
+ <Name>init_service</Name>
+ <Type>distributed</Type>
+ </Method>
+ </Interface>
+</Module>
+</GridCCM_Interface_description>
include $(top_srcdir)/salome_adm/unix/make_common_starter.am
+# To avoid problems with parallel compilation.
+MAKEFLAGS = -j1
+
BASEIDL_FILES = \
SALOME_Exception.idl \
SALOME_Comm.idl \
SALOME_GenericObj.idl \
SALOME_Session.idl \
SALOME_TestModuleCatalog.idl \
- nstest.idl
+ nstest.idl \
+ DSC_Engines.idl \
+ SALOME_Ports.idl \
+ Calcium_Ports.idl \
+ Palm_Ports.idl
MPIIDL_FILES = \
SALOME_MPIObject.idl \
endif
# all the idl files are needed for make dist
-EXTRA_DIST= $(BASEIDL_FILES) $(MPIIDL_FILES)
+EXTRA_DIST= $(BASEIDL_FILES) $(MPIIDL_FILES) \
+ SALOME_Component.xml DSC_Engines.xml SALOME_Ports.xml
# This variable defines the files to be installed
salomeidl_DATA = $(IDL_FILES)
SALOME_GenericObjSK.cc \
SALOME_SessionSK.cc \
SALOME_TestModuleCatalogSK.cc \
- nstestSK.cc
+ nstestSK.cc \
+ DSC_EnginesSK.cc \
+ SALOME_PortsSK.cc \
+ Calcium_PortsSK.cc \
+ Palm_PortsSK.cc
+
+DYNIDL_SOURCES=\
+ Calcium_PortsDynSK.cc
MPIIDL_SOURCES = \
SALOME_MPIObjectSK.cc \
IDL_SOURCES += $(MPIIDL_SOURCES)
endif
+
+STATIDL_SOURCES=$(BASEIDL_SOURCES)
+if MPI_IS_OK
+ STATIDL_SOURCES += $(MPIIDL_SOURCES)
+endif
+
+IDL_SOURCES += $(DYNIDL_SOURCES)
+
# also install all generated headers to use result library from another modules
-salomeinclude_DATA= $(IDL_SOURCES:%SK.cc=%.hh)
+salomeinclude_DATA= $(STATIDL_SOURCES:%SK.cc=%.hh)
+
+if WITH_PACO_PARALLEL
+PAR = SALOME_ComponentPaCO.h SALOME_ComponentPaCO.cc \
+ SALOME_PortsPaCO.h SALOME_PortsPaCO.cc \
+ DSC_EnginesPaCO.h DSC_EnginesPaCO.cc
+
+PAR_LIB = libSalomeParallelIDLKernel.la
+
+IDL_PACO = SALOME_ComponentPaCO.idl SALOME_PortsPaCO.idl DSC_EnginesPaCO.idl
+
+GEN_PACO = SALOME_ComponentPaCO_Engines_Container_server.cc \
+ SALOME_ComponentPaCO_Engines_Container_client.cc \
+ SALOME_ComponentPaCO_Engines_Component_server.cc \
+ SALOME_ComponentPaCO_Engines_Component_client.cc \
+ SALOME_PortsPaCO_Ports_Port_server.cc \
+ SALOME_PortsPaCO_Ports_Port_client.cc \
+ DSC_EnginesPaCO_Engines_DSC_server.cc \
+ DSC_EnginesPaCO_Engines_DSC_client.cc \
+ DSC_EnginesPaCO_Engines_Parallel_DSC_server.cc \
+ DSC_EnginesPaCO_Engines_Parallel_DSC_client.cc
+
+INCLUDES_PACO = SALOME_ComponentPaCO_Engines_Container_server.h \
+ SALOME_ComponentPaCO_Engines_Container_client.h \
+ SALOME_ComponentPaCO_Engines_Component_server.h \
+ SALOME_ComponentPaCO_Engines_Component_client.h \
+ SALOME_ComponentPaCO.h \
+ SALOME_Component.h \
+ SALOME_PortsPaCO_Ports_Port_server.h \
+ SALOME_PortsPaCO_Ports_Port_client.h \
+ SALOME_PortsPaCO.h \
+ SALOME_Ports.h \
+ DSC_EnginesPaCO_Engines_DSC_server.h \
+ DSC_EnginesPaCO_Engines_DSC_client.h \
+ DSC_EnginesPaCO_Engines_Parallel_DSC_server.h \
+ DSC_EnginesPaCO_Engines_Parallel_DSC_client.h \
+ DSC_EnginesPaCO.h \
+ DSC_Engines.h
+
+XML = SALOME_Component.xml DSC_Engines.xml SALOME_Ports.xml
+endif
+
+idldir = $(prefix)/idl/salome
+nodist_idl_DATA = ${XML} ${IDL_PACO}
+nodist_salomeinclude_HEADERS = ${INCLUDES_PACO}
+
+BUILT_SOURCES = $(IDL_SOURCES) $(PAR)
-BUILT_SOURCES = $(IDL_SOURCES)
+SALOME_ComponentPaCO.h SALOME_ComponentPaCO.cc : SALOME_Component.idl SALOME_Component.xml
+SALOME_PortsPaCO.h SALOME_PortsPaCO.cc : SALOME_Ports.idl SALOME_Ports.xml
+DSC_EnginesPaCO.h DSC_EnginesPaCO.cc : DSC_Engines.idl DSC_Engines.xml
-lib_LTLIBRARIES = libSalomeIDLKernel.la
-nodist_libSalomeIDLKernel_la_SOURCES = $(BUILT_SOURCES)
-libSalomeIDLKernel_la_CPPFLAGS =\
- -I$(top_builddir)/salome_adm/unix \
- -I$(top_builddir)/idl \
- @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
+lib_LTLIBRARIES = libSalomeIDLKernel.la $(PAR_LIB)
+
+nodist_libSalomeIDLKernel_la_SOURCES = $(IDL_SOURCES)
+libSalomeIDLKernel_la_CPPFLAGS =-I$(top_builddir)/salome_adm/unix \
+ -I$(top_builddir)/idl \
+ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
libSalomeIDLKernel_la_LDFLAGS = -no-undefined -version-info=0:0:0
libSalomeIDLKernel_la_LIBADD = @CORBA_LIBS@
+nodist_libSalomeParallelIDLKernel_la_SOURCES = $(PAR) $(GEN_PACO)
+libSalomeParallelIDLKernel_la_CPPFLAGS =-I$(top_builddir)/idl \
+ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ \
+ @PACO_INCLUDES@
+libSalomeParallelIDLKernel_la_LDFLAGS = -no-undefined -version-info=0:0:0
+libSalomeParallelIDLKernel_la_LIBADD = libSalomeIDLKernel.la @PACO_LIBS@
+
# These variables defines the building process of CORBA files
OMNIORB_IDL = @OMNIORB_IDL@
OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@
OMNIORB_IDLPYFLAGS = @OMNIORB_IDLPYFLAGS@ -I$(top_builddir)/salome/idl
-IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -I$(top_builddir)/salome/idl
+IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -Wba -I$(top_builddir)/salome/idl
IDLPYFLAGS = @IDLPYFLAGS@
# potential problem on parallel make on the following - multiple outputs
.idl.hh:
$(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $<
+%PaCO.h %PaCO.cc : %.idl %.xml
+ @PACO_IDL@ -I $(srcdir):@PACOPATH@/idl $^ omniORB4 0
install-exec-local: $(IDL_FILES:%=$(top_srcdir)/idl/%)
$(INSTALL) -d $(pkgpythondir)
-include .depidl
+CLEANFILES = *PaCO* *.h
+
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+// File : SALOME_Ports.idl
+// Author : André RIBES, EDF
+
+#ifndef _PALM_PORTS_IDL_
+#define _PALM_PORTS_IDL_
+
+#include "SALOME_Ports.idl"
+
+/*! \file
+ This file contains IDL palm ports declations.
+*/
+
+module Ports {
+
+ module Palm_Ports {
+
+ /*! \brief Interface of a short for palm.
+ */
+ interface Palm_Data_Short_Port : Ports::Data_Port {
+
+ /*!
+ This operation permits to transmit a short.
+
+ \param data the short transmitted.
+ \param time time associated to the short.
+ \param tag tag associated to the short.
+ */
+ void put (in short data, in long time, in long tag);
+ };
+
+ /*!
+ It is a sequence of short for palm ports.
+ */
+ typedef sequence<short> seq_short;
+
+ /*! \brief Interface of a sequence of short port.
+ */
+ interface Palm_Data_Seq_Short_Port : Ports::Data_Port {
+ /*!
+ This operation permits to transmit a sequence of short.
+
+ \param data the sequence transmitted.
+ \param time time associated to the data.
+ \param tag tag associated to the data.
+ */
+ void put (in seq_short data, in long time, in long tag);
+ };
+
+ };
+};
+
+#endif
// $Header$
/*! \mainpage
- \image html Application-About.png
+ \image html Application-About1.jpg
*/
/*!
>0 otherwise (== study id)
\return a loaded component
*/
- Component create_component_instance(in string componentName,
- in long studyId);
+ Engines::Component create_component_instance(in string componentName,
+ in long studyId);
/*!
Finds a servant instance of a component
--- /dev/null
+<?xml version="1.0"?>
+<GridCCM_Interface_description
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+ xsi:noNamespaceSchemaLocation='$PACOPATH/IDL2Tool/interface.xsd'
+>
+
+<Module>
+ <Name>Engines</Name>
+ <Interface>
+ <Name>Container</Name>
+ <Method>
+ <Name>ping</Name>
+ <Type>distributed</Type>
+ </Method>
+ <Method>
+ <Name>create_component_instance</Name>
+ <Type>distributed</Type>
+ </Method>
+ <Method>
+ <Name>load_component_Library</Name>
+ <Type>distributed</Type>
+ </Method>
+ </Interface>
+ <Interface>
+ <Name>Component</Name>
+ <Method>
+ <Name>ping</Name>
+ <Type>distributed</Type>
+ </Method>
+ </Interface>
+</Module>
+</GridCCM_Interface_description>
long nb_proc_per_node;
long nb_node;
boolean isMPI;
+
+ // PaCO specific informations
+ string parallelLib;
+ long nb_component_nodes;
};
/*!
Container FindOrStartContainer( in MachineParameters params,
in MachineList possibleComputers);
+ /*!
+ This operation launches a PaCO++ container.
+
+ \param Description of the container resquested.
+ \param List of computers ressources.
+
+ \return Container's CORBA reference.
+ */
+ Container FindOrStartParallelContainer( in MachineParameters params,
+ in MachineList possibleComputers);
+
string FindBest(in MachineList possibleComputers);
MachineList GetFittingResources( in MachineParameters params,
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+// File : SALOME_Ports.idl
+// Author : Andre RIBES, EDF
+// $Header:
+
+#ifndef _SALOME_PORTS_IDL_
+#define _SALOME_PORTS_IDL_
+
+/*! \file
+ This file contains the IDL declarations of the kind of ports provided by the
+ SALOME component model.
+ */
+
+module Ports {
+
+ /*! \brief Interface of a DSC Port.
+ This interface defines a Port.
+ A port is a CORBA interface.
+ */
+ interface Port {};
+
+ /*! \brief Interface of a Control_Port.
+ This interface defines a Control Port. When a component uses a control port,
+ it says that the service associated to the provides port can be started.
+
+ \note Currently Control_Port can not employed since it is not recognized
+ by the supervisor. But this type can be used to classified the port.
+ */
+ interface Control_Port : Ports::Port {};
+
+ /*! \brief Interface a Data_Port.
+ This interface defines a Data Port.
+ A Data Port is a port that transmit data between two components.
+
+ Each Data Port has a Put operation for the emitter and a Get operation
+ for the receiver.
+
+ \note Data_Port is currently empty but it permits to identified
+ the behaviour of a port.
+ */
+ interface Data_Port : Ports::Port {};
+
+ /*! \brief Data_And_Control_Port.
+ This interface defines a combination of a Control_Port and a Data_Port.
+
+ \note Like Control_Port, Data_And_Control_Port can not employed since it is
+ not recognized by the supervisor. But this type can be used to classified the port.
+ */
+ interface Data_And_Control_Port : Ports::Port {};
+
+ /*!
+ This exception indicates that the property doesn't not exist.
+ */
+ exception NotDefined {};
+
+ /*!
+ This exception indicates that the given value to the property is not
+ of a good type.
+ */
+ exception BadType {};
+
+ /*!
+ This exception indicates that the given value to the property is not
+ authorized.
+ */
+ exception BadValue {};
+
+ /*! \brief Interface of a PortProperties.
+ This interface permits to set and get properties
+ associated to a port. Each uses or provides port have a
+ PortProperties object. But this object could be empty.
+ */
+ interface PortProperties {
+
+ /*!
+ This operation permits to set a value of a property.
+
+ \param name property's name.
+ \param value value of the property.
+
+ \exception Ports::BadType
+ \exception Ports::NotDefined
+ */
+ void set_property(in string name, in any value) raises (Ports::BadType,
+ Ports::BadValue,
+ Ports::NotDefined);
+
+ /*!
+ This operation permits to get property's value.
+
+ \param name property's name.
+ \return value of the property.
+
+ \exception Ports::NotDefined
+ */
+ any get_property(in string name) raises (Ports::NotDefined);
+ };
+
+ /*! \brief Interface of a basic datastream short port
+ This interface defines a Data_Port that transmit a CORBA::Short.
+ This interface can be seen as an example of an integration of
+ a port in the DSC_User programming model.
+ */
+ interface Data_Short_Port : Ports::Data_Port {
+ void put(in short data);
+ };
+};
+
+#endif
--- /dev/null
+<?xml version="1.0"?>
+<GridCCM_Interface_description
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+ xsi:noNamespaceSchemaLocation='$PACOPATH/IDL2Tool/interface.xsd'
+>
+
+<Module>
+ <Name>Ports</Name>
+ <Interface>
+ <Name>Port</Name>
+ </Interface>
+ <Interface>
+ <Name>Control_Port</Name>
+ </Interface>
+</Module>
+</GridCCM_Interface_description>
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
SUBDIRS = unix
+AUTOMAKE_OPTIONS=filename-length-max=255
# rules for install and build (see make_common_starter.am)
salomeadmux_DATA = SALOMEconfig.h.in
+salomeinclude_DATA = SALOMEconfig.h
BUILT_SOURCES=SALOMEconfig.h SALOMEconfig.h.in
mostlyclean-local:
--- /dev/null
+dnl Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl
+dnl File : check_paco++.m4
+dnl Author : André RIBES (EDF)
+dnl Module : KERNEL
+
+AC_DEFUN([CHECK_PACO],[
+PaCO_ok=yes
+
+AC_ARG_WITH(paco,
+ [AC_HELP_STRING([--with-paco=DIR],[root directory path of PaCO++ installation])],
+ WITHPACO="yes",WITHPACO="no")
+
+if test "x$WITHPACO" = "xyes";
+then
+ PACOPATH=$withval
+ PACO_INCLUDES="-I${PACOPATH}/include"
+ PACO_LIBS="-L${PACOPATH}/lib -lPaCO"
+ dnl a basic test to be sure that PaCO++
+ dnl is correctly installed.
+ AC_CHECK_PROG(PACO_IDL, PaCOIdlTool, yes, no, ${PACOPATH}/bin)
+ if test "x$PACO_IDL" = "xno";
+ then
+ PaCO_ok=no
+ AC_MSG_RESULT(PaCO++ binary not in ${PACOPATH})
+ fi
+else
+ PaCO_ok=no
+fi
+
+AC_MSG_CHECKING(for PaCO++)
+if test "x$PaCO_ok" = "xyes"
+then
+ AC_MSG_RESULT([yes])
+ PACO_IDL=${PACOPATH}/bin/PaCOIdlTool
+ AC_SUBST(PACO_IDL)
+ AC_SUBST(PACOPATH)
+ AC_SUBST(PACO_INCLUDES)
+ AC_SUBST(PACO_LIBS)
+else
+ AC_MSG_RESULT([no])
+fi
+])dnl
+dnl
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-timestamp='2004-03-12'
+timestamp='2006-02-23'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
+
# Originally written by Per Bothner <per@bothner.com>.
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry.
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
- echo "$timestamp" ; exit 0 ;;
+ echo "$timestamp" ; exit ;;
--version | -v )
- echo "$version" ; exit 0 ;;
+ echo "$version" ; exit ;;
--help | --h* | -h )
- echo "$usage"; exit 0 ;;
+ echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
;;
,,*) CC_FOR_BUILD=$CC ;;
,*,*) CC_FOR_BUILD=$HOST_CC ;;
-esac ;'
+esac ; set_cc_for_build= ;'
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24)
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
- exit 0 ;;
- amd64:OpenBSD:*:*)
- echo x86_64-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- amiga:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- arc:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- cats:OpenBSD:*:*)
- echo arm-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- hp300:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mac68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- macppc:OpenBSD:*:*)
- echo powerpc-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme88k:OpenBSD:*:*)
- echo m88k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvmeppc:OpenBSD:*:*)
- echo powerpc-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- pegasos:OpenBSD:*:*)
- echo powerpc-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- pmax:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- sgi:OpenBSD:*:*)
- echo mipseb-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- sun3:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- wgrisc:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:OpenBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+ exit ;;
*:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
+ *:SolidBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+ exit ;;
macppc:MirBSD:*:*)
echo powerppc-unknown-mirbsd${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:MirBSD:*:*)
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
alpha:OSF1:*:*)
case $UNAME_RELEASE in
*4.0)
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- exit 0 ;;
- Alpha*:OpenVMS:*:*)
- echo alpha-hp-vms
- exit 0 ;;
+ exit ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
# of the specific Alpha model?
echo alpha-pc-interix
- exit 0 ;;
+ exit ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
- exit 0 ;;
+ exit ;;
Amiga*:UNIX_System_V:4.0:*)
echo m68k-unknown-sysv4
- exit 0;;
+ exit ;;
*:[Aa]miga[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-amigaos
- exit 0 ;;
+ exit ;;
*:[Mm]orph[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-morphos
- exit 0 ;;
+ exit ;;
*:OS/390:*:*)
echo i370-ibm-openedition
- exit 0 ;;
+ exit ;;
+ *:z/VM:*:*)
+ echo s390-ibm-zvmoe
+ exit ;;
*:OS400:*:*)
echo powerpc-ibm-os400
- exit 0 ;;
+ exit ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
- exit 0;;
+ exit ;;
+ arm:riscos:*:*|arm:RISCOS:*:*)
+ echo arm-unknown-riscos
+ exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
echo hppa1.1-hitachi-hiuxmpp
- exit 0;;
+ exit ;;
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
else
echo pyramid-pyramid-bsd
fi
- exit 0 ;;
+ exit ;;
NILE*:*:*:dcosx)
echo pyramid-pyramid-svr4
- exit 0 ;;
+ exit ;;
DRS?6000:unix:4.0:6*)
echo sparc-icl-nx6
- exit 0 ;;
- DRS?6000:UNIX_SV:4.2*:7*)
+ exit ;;
+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
case `/usr/bin/uname -p` in
- sparc) echo sparc-icl-nx7 && exit 0 ;;
+ sparc) echo sparc-icl-nx7; exit ;;
esac ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
+ exit ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
+ exit ;;
i86pc:SunOS:5.*:*)
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
+ exit ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
+ exit ;;
sun4*:SunOS:*:*)
case "`/usr/bin/arch -k`" in
Series*|S4*)
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
- exit 0 ;;
+ exit ;;
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
echo sparc-sun-sunos${UNAME_RELEASE}
;;
esac
- exit 0 ;;
+ exit ;;
aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
# The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not
# "atarist" or "atariste" at least should have a processor
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
echo m68k-milan-mint${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
echo m68k-hades-mint${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
m68k:machten:*:*)
echo m68k-apple-machten${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
- exit 0 ;;
+ exit ;;
RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
2020:CLIX:*:* | 2430:CLIX:*:*)
echo clipper-intergraph-clix${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
exit (-1);
}
EOF
- $CC_FOR_BUILD -o $dummy $dummy.c \
- && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
- && exit 0
+ $CC_FOR_BUILD -o $dummy $dummy.c &&
+ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+ SYSTEM_NAME=`$dummy $dummyarg` &&
+ { echo "$SYSTEM_NAME"; exit; }
echo mips-mips-riscos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
Motorola:PowerMAX_OS:*:*)
echo powerpc-motorola-powermax
- exit 0 ;;
+ exit ;;
Motorola:*:4.3:PL8-*)
echo powerpc-harris-powermax
- exit 0 ;;
+ exit ;;
Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
echo powerpc-harris-powermax
- exit 0 ;;
+ exit ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
- exit 0 ;;
+ exit ;;
m88k:CX/UX:7*:*)
echo m88k-harris-cxux7
- exit 0 ;;
+ exit ;;
m88k:*:4*:R4*)
echo m88k-motorola-sysv4
- exit 0 ;;
+ exit ;;
m88k:*:3*:R3*)
echo m88k-motorola-sysv3
- exit 0 ;;
+ exit ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
else
echo i586-dg-dgux${UNAME_RELEASE}
fi
- exit 0 ;;
+ exit ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
- exit 0 ;;
+ exit ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
echo m88k-motorola-sysv3
- exit 0 ;;
+ exit ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
echo m88k-tektronix-sysv3
- exit 0 ;;
+ exit ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
echo m68k-tektronix-bsd
- exit 0 ;;
+ exit ;;
*:IRIX*:*:*)
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
- exit 0 ;;
+ exit ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
i*86:AIX:*:*)
echo i386-ibm-aix
- exit 0 ;;
+ exit ;;
ia64:AIX:*:*)
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
- exit 0 ;;
+ exit ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
eval $set_cc_for_build
exit(0);
}
EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
- echo rs6000-ibm-aix3.2.5
+ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+ then
+ echo "$SYSTEM_NAME"
+ else
+ echo rs6000-ibm-aix3.2.5
+ fi
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
else
echo rs6000-ibm-aix3.2
fi
- exit 0 ;;
+ exit ;;
*:AIX:*:[45])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
- exit 0 ;;
+ exit ;;
*:AIX:*:*)
echo rs6000-ibm-aix
- exit 0 ;;
+ exit ;;
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4
- exit 0 ;;
+ exit ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
- exit 0 ;; # report: romp-ibm BSD 4.3
+ exit ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
echo rs6000-bull-bosx
- exit 0 ;;
+ exit ;;
DPX/2?00:B.O.S.:*:*)
echo m68k-bull-sysv3
- exit 0 ;;
+ exit ;;
9000/[34]??:4.3bsd:1.*:*)
echo m68k-hp-bsd
- exit 0 ;;
+ exit ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
- exit 0 ;;
+ exit ;;
9000/[34678]??:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
case "${UNAME_MACHINE}" in
esac
if [ ${HP_ARCH} = "hppa2.0w" ]
then
- # avoid double evaluation of $set_cc_for_build
- test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
+ eval $set_cc_for_build
+
+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
+ # generating 64-bit code. GNU and HP use different nomenclature:
+ #
+ # $ CC_FOR_BUILD=cc ./config.guess
+ # => hppa2.0w-hp-hpux11.23
+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+ # => hppa64-hp-hpux11.23
+
+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+ grep __LP64__ >/dev/null
then
HP_ARCH="hppa2.0w"
else
fi
fi
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
- exit 0 ;;
+ exit ;;
ia64:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ia64-hp-hpux${HPUX_REV}
- exit 0 ;;
+ exit ;;
3050*:HI-UX:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
exit (0);
}
EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
echo unknown-hitachi-hiuxwe2
- exit 0 ;;
+ exit ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
echo hppa1.1-hp-bsd
- exit 0 ;;
+ exit ;;
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
- exit 0 ;;
+ exit ;;
*9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
echo hppa1.0-hp-mpeix
- exit 0 ;;
+ exit ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
echo hppa1.1-hp-osf
- exit 0 ;;
+ exit ;;
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
- exit 0 ;;
+ exit ;;
i*86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
echo ${UNAME_MACHINE}-unknown-osf1mk
else
echo ${UNAME_MACHINE}-unknown-osf1
fi
- exit 0 ;;
+ exit ;;
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
- exit 0 ;;
+ exit ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
- exit 0 ;;
+ exit ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
- exit 0 ;;
+ exit ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
- exit 0 ;;
+ exit ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
- exit 0 ;;
+ exit ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
- exit 0 ;;
+ exit ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
+ exit ;;
CRAY*[A-Z]90:*:*:*)
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
-e 's/\.[^.]*$/.X/'
- exit 0 ;;
+ exit ;;
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
+ exit ;;
CRAY*T3E:*:*:*)
echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
+ exit ;;
CRAY*SV1:*:*:*)
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
+ exit ;;
*:UNICOS/mp:*:*)
- echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
+ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit 0 ;;
+ exit ;;
5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit 0 ;;
+ exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
sparc*:BSD/OS:*:*)
echo sparc-unknown-bsdi${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:FreeBSD:*:*)
- # Determine whether the default compiler uses glibc.
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <features.h>
- #if __GLIBC__ >= 2
- LIBC=gnu
- #else
- LIBC=
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
- # GNU/KFreeBSD systems have a "k" prefix to indicate we are using
- # FreeBSD's kernel, but not the complete OS.
- case ${LIBC} in gnu) kernel_only='k' ;; esac
- echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
- exit 0 ;;
+ case ${UNAME_MACHINE} in
+ pc98)
+ echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ *)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ esac
+ exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
- exit 0 ;;
+ exit ;;
i*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
- exit 0 ;;
+ exit ;;
+ i*:MSYS_NT-*:*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit ;;
+ i*:windows32*:*)
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
+ exit ;;
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
- exit 0 ;;
- x86:Interix*:[34]*)
- echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
- exit 0 ;;
+ exit ;;
+ x86:Interix*:[345]*)
+ echo i586-pc-interix${UNAME_RELEASE}
+ exit ;;
+ EM64T:Interix*:[345]*)
+ echo x86_64-unknown-interix${UNAME_RELEASE}
+ exit ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
- exit 0 ;;
+ exit ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
# UNAME_MACHINE based on the output of uname instead of i386?
echo i586-pc-interix
- exit 0 ;;
+ exit ;;
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
- exit 0 ;;
+ exit ;;
+ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+ echo x86_64-unknown-cygwin
+ exit ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin
- exit 0 ;;
+ exit ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
+ exit ;;
*:GNU:*:*)
# the GNU system
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
- exit 0 ;;
+ exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
- exit 0 ;;
+ exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
- exit 0 ;;
+ exit ;;
arm*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
cris:Linux:*:*)
echo cris-axis-linux-gnu
- exit 0 ;;
+ exit ;;
+ crisv32:Linux:*:*)
+ echo crisv32-axis-linux-gnu
+ exit ;;
+ frv:Linux:*:*)
+ echo frv-unknown-linux-gnu
+ exit ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
mips:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#endif
#endif
EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
- test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^CPU/{
+ s: ::g
+ p
+ }'`"
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
mips64:Linux:*:*)
eval $set_cc_for_build
#endif
#endif
EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
- test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^CPU/{
+ s: ::g
+ p
+ }'`"
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
+ or32:Linux:*:*)
+ echo or32-unknown-linux-gnu
+ exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
- exit 0 ;;
+ exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
PA8*) echo hppa2.0-unknown-linux-gnu ;;
*) echo hppa-unknown-linux-gnu ;;
esac
- exit 0 ;;
+ exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
- exit 0 ;;
+ exit ;;
sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
+ vax:Linux:*:*)
+ echo ${UNAME_MACHINE}-dec-linux-gnu
+ exit ;;
x86_64:Linux:*:*)
echo x86_64-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so
# first see if it will tell us. cd to the root directory to prevent
;;
a.out-i386-linux)
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
- exit 0 ;;
+ exit ;;
coff-i386)
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
- exit 0 ;;
+ exit ;;
"")
# Either a pre-BFD a.out linker (linux-gnuoldld) or
# one that does not give us useful --help.
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
- exit 0 ;;
+ exit ;;
esac
# Determine whether the default compiler is a.out or elf
eval $set_cc_for_build
LIBC=gnulibc1
# endif
#else
- #ifdef __INTEL_COMPILER
+ #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__sun)
LIBC=gnu
#else
LIBC=gnuaout
LIBC=dietlibc
#endif
EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
- test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
- test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^LIBC/{
+ s: ::g
+ p
+ }'`"
+ test x"${LIBC}" != x && {
+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ exit
+ }
+ test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
# sysname and nodename.
echo i386-sequent-sysv4
- exit 0 ;;
+ exit ;;
i*86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
- exit 0 ;;
+ exit ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
echo ${UNAME_MACHINE}-pc-os2-emx
- exit 0 ;;
+ exit ;;
i*86:XTS-300:*:STOP)
echo ${UNAME_MACHINE}-unknown-stop
- exit 0 ;;
+ exit ;;
i*86:atheos:*:*)
echo ${UNAME_MACHINE}-unknown-atheos
- exit 0 ;;
- i*86:syllable:*:*)
+ exit ;;
+ i*86:syllable:*:*)
echo ${UNAME_MACHINE}-pc-syllable
- exit 0 ;;
+ exit ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
- exit 0 ;;
+ exit ;;
i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
else
echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
fi
- exit 0 ;;
- i*86:*:5:[78]*)
+ exit ;;
+ i*86:*:5:[678]*)
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
case `/bin/uname -X | grep "^Machine"` in
*486*) UNAME_MACHINE=i486 ;;
*Pentium) UNAME_MACHINE=i586 ;;
*Pent*|*Celeron) UNAME_MACHINE=i686 ;;
esac
echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
- exit 0 ;;
+ exit ;;
i*86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
else
echo ${UNAME_MACHINE}-pc-sysv32
fi
- exit 0 ;;
+ exit ;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i386.
echo i386-pc-msdosdjgpp
- exit 0 ;;
+ exit ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
- exit 0 ;;
+ exit ;;
paragon:*:*:*)
echo i860-intel-osf1
- exit 0 ;;
+ exit ;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
fi
- exit 0 ;;
+ exit ;;
mini*:CTIX:SYS*5:*)
# "miniframe"
echo m68010-convergent-sysv
- exit 0 ;;
+ exit ;;
mc68k:UNIX:SYSTEM5:3.51m)
echo m68k-convergent-sysv
- exit 0 ;;
+ exit ;;
M680?0:D-NIX:5.3:*)
echo m68k-diab-dnix
- exit 0 ;;
- M68*:*:R3V[567]*:*)
- test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
- 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
+ exit ;;
+ M68*:*:R3V[5678]*:*)
+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && echo i486-ncr-sysv4 && exit 0 ;;
+ && { echo i486-ncr-sysv4; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
- exit 0 ;;
+ exit ;;
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
SM[BE]S:UNIX_SV:*:*)
echo mips-dde-sysv${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
RM*:ReliantUNIX-*:*:*)
echo mips-sni-sysv4
- exit 0 ;;
+ exit ;;
RM*:SINIX-*:*:*)
echo mips-sni-sysv4
- exit 0 ;;
+ exit ;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
else
echo ns32k-sni-sysv
fi
- exit 0 ;;
+ exit ;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
- exit 0 ;;
+ exit ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <hewes@openmarket.com>.
# How about differentiating between stratus architectures? -djm
echo hppa1.1-stratus-sysv4
- exit 0 ;;
+ exit ;;
*:*:*:FTX*)
# From seanf@swdc.stratus.com.
echo i860-stratus-sysv4
- exit 0 ;;
+ exit ;;
+ i*86:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo ${UNAME_MACHINE}-stratus-vos
+ exit ;;
*:VOS:*:*)
# From Paul.Green@stratus.com.
echo hppa1.1-stratus-vos
- exit 0 ;;
+ exit ;;
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
news*:NEWS-OS:6*:*)
echo mips-sony-newsos6
- exit 0 ;;
+ exit ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
- exit 0 ;;
+ exit ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo powerpc-be-beos
- exit 0 ;;
+ exit ;;
BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
echo powerpc-apple-beos
- exit 0 ;;
+ exit ;;
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos
- exit 0 ;;
+ exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
SX-5:SUPER-UX:*:*)
echo sx5-nec-superux${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
SX-6:SUPER-UX:*:*)
echo sx6-nec-superux${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:Rhapsody:*:*)
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:Darwin:*:*)
- case `uname -p` in
- *86) UNAME_PROCESSOR=i686 ;;
- powerpc) UNAME_PROCESSOR=powerpc ;;
+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+ case $UNAME_PROCESSOR in
+ unknown) UNAME_PROCESSOR=powerpc ;;
esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = "x86"; then
UNAME_MACHINE=pc
fi
echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:QNX:*:4*)
echo i386-pc-qnx
- exit 0 ;;
+ exit ;;
+ NSE-?:NONSTOP_KERNEL:*:*)
+ echo nse-tandem-nsk${UNAME_RELEASE}
+ exit ;;
NSR-?:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:NonStop-UX:*:*)
echo mips-compaq-nonstopux
- exit 0 ;;
+ exit ;;
BS2000:POSIX*:*:*)
echo bs2000-siemens-sysv
- exit 0 ;;
+ exit ;;
DS/*:UNIX_System_V:*:*)
echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:Plan9:*:*)
# "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86
UNAME_MACHINE="$cputype"
fi
echo ${UNAME_MACHINE}-unknown-plan9
- exit 0 ;;
+ exit ;;
*:TOPS-10:*:*)
echo pdp10-unknown-tops10
- exit 0 ;;
+ exit ;;
*:TENEX:*:*)
echo pdp10-unknown-tenex
- exit 0 ;;
+ exit ;;
KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
echo pdp10-dec-tops20
- exit 0 ;;
+ exit ;;
XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
echo pdp10-xkl-tops20
- exit 0 ;;
+ exit ;;
*:TOPS-20:*:*)
echo pdp10-unknown-tops20
- exit 0 ;;
+ exit ;;
*:ITS:*:*)
echo pdp10-unknown-its
- exit 0 ;;
+ exit ;;
SEI:*:*:SEIUX)
echo mips-sei-seiux${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:DragonFly:*:*)
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- exit 0 ;;
+ exit ;;
+ *:*VMS:*:*)
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ case "${UNAME_MACHINE}" in
+ A*) echo alpha-dec-vms ; exit ;;
+ I*) echo ia64-dec-vms ; exit ;;
+ V*) echo vax-dec-vms ; exit ;;
+ esac ;;
+ *:XENIX:*:SysV)
+ echo i386-pc-xenix
+ exit ;;
+ i*86:skyos:*:*)
+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+ exit ;;
+ i*86:rdos:*:*)
+ echo ${UNAME_MACHINE}-pc-rdos
+ exit ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
- printf ("arm-acorn-riscix"); exit (0);
+ printf ("arm-acorn-riscix\n"); exit (0);
#endif
#if defined (hp300) && !defined (hpux)
}
EOF
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
# Apollos put the system type in the environment.
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
# Convex versions that predate uname can use getsysinfo(1)
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
- exit 0 ;;
+ exit ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
- exit 0 ;;
+ exit ;;
c34*)
echo c34-convex-bsd
- exit 0 ;;
+ exit ;;
c38*)
echo c38-convex-bsd
- exit 0 ;;
+ exit ;;
c4*)
echo c4-convex-bsd
- exit 0 ;;
+ exit ;;
esac
fi
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from
- ftp://ftp.gnu.org/pub/gnu/config/
+ http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+ http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
If the version you run ($0) is already up to date, please
send the following data and any information you think might be
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-timestamp='2004-03-12'
+timestamp='2006-02-23'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
+
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry.
#
version="\
GNU config.sub ($timestamp)
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
- echo "$timestamp" ; exit 0 ;;
+ echo "$timestamp" ; exit ;;
--version | -v )
- echo "$version" ; exit 0 ;;
+ echo "$version" ; exit ;;
--help | --h* | -h )
- echo "$usage"; exit 0 ;;
+ echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
*local*)
# First pass through any local machine types.
echo $1
- exit 0;;
+ exit ;;
* )
break ;;
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
- nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
- kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+ nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+ storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis)
+ -apple | -axis | -knuth | -cray)
os=
basic_machine=$1
;;
-hiux*)
os=-hiuxwe2
;;
+ -sco6)
+ os=-sco5v6
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
-sco5)
os=-sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
+ -sco5v6*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
-sco*)
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+ | bfin \
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
| fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
- | m32r | m32rle | m68000 | m68k | m88k | mcore \
+ | m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
+ | mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa64 | mipsisa64el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
+ | mt \
| msp430 \
+ | nios | nios2 \
| ns16k | ns32k \
- | openrisc | or32 \
+ | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
- | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
- | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
+ | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
+ | sparcv8 | sparcv9 | sparcv9b \
| strongarm \
| tahoe | thumb | tic4x | tic80 | tron \
| v850 | v850e \
| we32k \
- | x86 | xscale | xstormy16 | xtensa \
+ | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
| z8k)
basic_machine=$basic_machine-unknown
;;
+ m32c)
+ basic_machine=$basic_machine-unknown
+ ;;
m6811 | m68hc11 | m6812 | m68hc12)
# Motorola 68HC11/12.
basic_machine=$basic_machine-unknown
;;
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
;;
+ ms1)
+ basic_machine=mt-unknown
+ ;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* \
- | bs2000-* \
+ | bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
- | clipper-* | cydra-* \
+ | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
| ip2k-* | iq2000-* \
| m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | mcore-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
+ | mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39-* | mipstx39el-* \
+ | mmix-* \
+ | mt-* \
| msp430-* \
- | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
+ | nios-* | nios2-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
- | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
- | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+ | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
+ | sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tron-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
- | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
- | xtensa-* \
+ | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
+ | xstormy16-* | xtensa-* \
| ymp-* \
| z8k-*)
;;
+ m32c-*)
+ ;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
386bsd)
basic_machine=j90-cray
os=-unicos
;;
+ craynv)
+ basic_machine=craynv-cray
+ os=-unicosmp
+ ;;
cr16c)
basic_machine=cr16c-unknown
os=-elf
crds | unos)
basic_machine=m68k-crds
;;
+ crisv32 | crisv32-* | etraxfs*)
+ basic_machine=crisv32-axis
+ ;;
cris | cris-* | etrax*)
basic_machine=cris-axis
;;
basic_machine=m88k-motorola
os=-sysv3
;;
+ djgpp)
+ basic_machine=i586-pc
+ os=-msdosdjgpp
+ ;;
dpx20 | dpx20-*)
basic_machine=rs6000-bull
os=-bosx
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
- mmix*)
- basic_machine=mmix-knuth
- os=-mmixware
- ;;
monitor)
basic_machine=m68k-rom68k
os=-coff
basic_machine=i386-pc
os=-msdos
;;
+ ms1-*)
+ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+ ;;
mvs)
basic_machine=i370-ibm
os=-mvs
np1)
basic_machine=np1-gould
;;
- nv1)
- basic_machine=nv1-cray
- os=-unicosmp
- ;;
nsr-tandem)
basic_machine=nsr-tandem
;;
basic_machine=hppa1.1-oki
os=-proelf
;;
- or32 | or32-*)
+ openrisc | openrisc-*)
basic_machine=or32-unknown
- os=-coff
;;
os400)
basic_machine=powerpc-ibm
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
+ pc98)
+ basic_machine=i386-pc
+ ;;
+ pc98-*)
+ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
pentium | p5 | k5 | k6 | nexgen | viac3)
basic_machine=i586-pc
;;
basic_machine=i586-unknown
os=-pw32
;;
+ rdos)
+ basic_machine=i386-pc
+ os=-rdos
+ ;;
rom68k)
basic_machine=m68k-rom68k
os=-coff
basic_machine=hppa1.1-winbond
os=-proelf
;;
+ xbox)
+ basic_machine=i686-pc
+ os=-mingw32
+ ;;
xps | xps100)
basic_machine=xps100-honeywell
;;
romp)
basic_machine=romp-ibm
;;
+ mmix)
+ basic_machine=mmix-knuth
+ ;;
rs6000)
basic_machine=rs6000-ibm
;;
we32k)
basic_machine=we32k-att
;;
- sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
+ sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
- sh64)
- basic_machine=sh64-unknown
- ;;
sparc | sparcv8 | sparcv9 | sparcv9b)
basic_machine=sparc-sun
;;
| -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+ | -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+ | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
- | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+ | -skyos* | -haiku* | -rdos*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
os=`echo $os | sed -e 's|nto|nto-qnx|'`
;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
- | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
;;
-mac*)
-kaos*)
os=-kaos
;;
+ -zvmoe)
+ os=-zvmoe
+ ;;
-none)
;;
*)
*-be)
os=-beos
;;
+ *-haiku)
+ os=-haiku
+ ;;
*-ibm)
os=-aix
;;
+ *-knuth)
+ os=-mmixware
+ ;;
*-wec)
os=-proelf
;;
esac
echo $basic_machine$os
-exit 0
+exit
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# ltmain.sh - Provide generalized library-building support services.
# NOTE: Changing this file will not affect anything until you rerun configure.
#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
# Free Software Foundation, Inc.
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# function.
progpath="$0"
-# define SED for historic ltconfig's generated by Libtool 1.3
-test -z "$SED" && SED=sed
-
# The name of this program:
progname=`echo "$progpath" | $SED $basename`
modename="$progname"
PROGRAM=ltmain.sh
PACKAGE=libtool
-VERSION=1.5.6
-TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42)"
+VERSION="1.5.22 Debian 1.5.22-4"
+TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes.
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
# Check that we have a working $echo.
if test "X$1" = X--no-reexec; then
Xsed="${SED}"' -e 1s/^X//'
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
# test EBCDIC or ASCII
-case `echo A|tr A '\301'` in
- A) # EBCDIC based system
- SP2NL="tr '\100' '\n'"
- NL2SP="tr '\r\n' '\100\100'"
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ SP2NL='tr \040 \012'
+ NL2SP='tr \015\012 \040\040'
;;
- *) # Assume ASCII based system
- SP2NL="tr '\040' '\012'"
- NL2SP="tr '\015\012' '\040\040'"
+ *) # EBCDIC based system
+ SP2NL='tr \100 \n'
+ NL2SP='tr \r\n \100\100'
;;
esac
fi
# Make sure IFS has a sensible default
-: ${IFS="
-"}
+lt_nl='
+'
+IFS=" $lt_nl"
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
$echo "$modename: not configured to build any kind of library" 1>&2
show="$echo"
show_help=
execute_dlfiles=
+duplicate_deps=no
+preserve_args=
lo2o="s/\\.lo\$/.${objext}/"
o2lo="s/\\.${objext}\$/.lo/"
# Shell function definitions:
# This seems to be the best place for them
+# func_mktempdir [string]
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible. If
+# given, STRING is the basename for that directory.
+func_mktempdir ()
+{
+ my_template="${TMPDIR-/tmp}/${1-$progname}"
+
+ if test "$run" = ":"; then
+ # Return a directory name, but don't create it in dry-run mode
+ my_tmpdir="${my_template}-$$"
+ else
+
+ # If mktemp works, use that first and foremost
+ my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+ if test ! -d "$my_tmpdir"; then
+ # Failing that, at least try and use $RANDOM to avoid a race
+ my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+ save_mktempdir_umask=`umask`
+ umask 0077
+ $mkdir "$my_tmpdir"
+ umask $save_mktempdir_umask
+ fi
+
+ # If we're not in dry-run mode, bomb out on failure
+ test -d "$my_tmpdir" || {
+ $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
+ exit $EXIT_FAILURE
+ }
+ fi
+
+ $echo "X$my_tmpdir" | $Xsed
+}
+
+
# func_win32_libid arg
# return the library type of file 'arg'
#
# Need a lot of goo to handle *both* DLLs and import libs
# Has to be a shell function in order to 'eat' the argument
# that is supplied when $file_magic_command is called.
-func_win32_libid () {
+func_win32_libid ()
+{
win32_libid_type="unknown"
win32_fileres=`file -L $1 2>/dev/null`
case $win32_fileres in
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
$EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
win32_nmres=`eval $NM -f posix -A $1 | \
- sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
- if test "X$win32_nmres" = "Ximport" ; then
- win32_libid_type="x86 archive import"
- else
- win32_libid_type="x86 archive static"
- fi
+ $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
+ case $win32_nmres in
+ import*) win32_libid_type="x86 archive import";;
+ *) win32_libid_type="x86 archive static";;
+ esac
fi
;;
*DLL*)
# Only attempt this if the compiler in the base compile
# command doesn't match the default compiler.
# arg is usually of the form 'gcc ...'
-func_infer_tag () {
+func_infer_tag ()
+{
if test -n "$available_tags" && test -z "$tagname"; then
CC_quoted=
for arg in $CC; do
esac
fi
}
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+ f_ex_an_ar_dir="$1"; shift
+ f_ex_an_ar_oldlib="$1"
+
+ $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
+ $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
+ if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
+ exit $EXIT_FAILURE
+ fi
+}
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+ my_gentop="$1"; shift
+ my_oldlibs=${1+"$@"}
+ my_oldobjs=""
+ my_xlib=""
+ my_xabs=""
+ my_xdir=""
+ my_status=""
+
+ $show "${rm}r $my_gentop"
+ $run ${rm}r "$my_gentop"
+ $show "$mkdir $my_gentop"
+ $run $mkdir "$my_gentop"
+ my_status=$?
+ if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
+ exit $my_status
+ fi
+
+ for my_xlib in $my_oldlibs; do
+ # Extract the objects.
+ case $my_xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+ *) my_xabs=`pwd`"/$my_xlib" ;;
+ esac
+ my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
+ my_xdir="$my_gentop/$my_xlib"
+
+ $show "${rm}r $my_xdir"
+ $run ${rm}r "$my_xdir"
+ $show "$mkdir $my_xdir"
+ $run $mkdir "$my_xdir"
+ exit_status=$?
+ if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
+ exit $exit_status
+ fi
+ case $host in
+ *-darwin*)
+ $show "Extracting $my_xabs"
+ # Do not bother doing anything if just a dry run
+ if test -z "$run"; then
+ darwin_orig_dir=`pwd`
+ cd $my_xdir || exit $?
+ darwin_archive=$my_xabs
+ darwin_curdir=`pwd`
+ darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
+ darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
+ if test -n "$darwin_arches"; then
+ darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
+ darwin_arch=
+ $show "$darwin_base_archive has multiple architectures $darwin_arches"
+ for darwin_arch in $darwin_arches ; do
+ mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+ cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+ cd "$darwin_curdir"
+ $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+ done # $darwin_arches
+ ## Okay now we have a bunch of thin objects, gotta fatten them up :)
+ darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
+ darwin_file=
+ darwin_files=
+ for darwin_file in $darwin_filelist; do
+ darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+ lipo -create -output "$darwin_file" $darwin_files
+ done # $darwin_filelist
+ ${rm}r unfat-$$
+ cd "$darwin_orig_dir"
+ else
+ cd "$darwin_orig_dir"
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ fi # $darwin_arches
+ fi # $run
+ ;;
+ *)
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ ;;
+ esac
+ my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+ done
+ func_extract_archives_result="$my_oldobjs"
+}
# End of Shell function definitions
#####################################
# Darwin sucks
-#eval std_shrext=\"$shrext_cmds\"
-
-# And fixing for Darwin sucks for everybody else
-if test -z "$shrext_cmds" && test -n "$shrext"; then
- eval shrext_cmds=\"$shrext\"
-fi
eval std_shrext=\"$shrext_cmds\"
-# This value is evaluated to 32768, so place it here as a compatilibity hack
-# because older libtool.m4 didn't define this variable
-test -z "$max_cmd_len" && max_cmd_len=32768
+disable_libs=no
# Parse our command line options once, thoroughly.
while test "$#" -gt 0
--version)
$echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
$echo
- $echo "Copyright (C) 2003 Free Software Foundation, Inc."
+ $echo "Copyright (C) 2005 Free Software Foundation, Inc."
$echo "This is free software; see the source for copying conditions. There is NO"
$echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
- exit $EXIT_SUCCESS
+ exit $?
;;
--config)
for tagname in $taglist; do
${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
done
- exit $EXIT_SUCCESS
+ exit $?
;;
--debug)
else
$echo "disable static libraries"
fi
- exit $EXIT_SUCCESS
+ exit $?
;;
--finish) mode="finish" ;;
preserve_args="$preserve_args $arg"
;;
- --tag) prevopt="--tag" prev=tag ;;
+ --tag)
+ prevopt="--tag"
+ prev=tag
+ preserve_args="$preserve_args --tag"
+ ;;
--tag=*)
set tag "$optarg" ${1+"$@"}
shift
exit $EXIT_FAILURE
fi
+case $disable_libs in
+no)
+ ;;
+shared)
+ build_libtool_libs=no
+ build_old_libs=yes
+ ;;
+static)
+ build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+ ;;
+esac
+
# If this variable is set in any of the actions, the command in it
# will be execed at the end. This prevents here-documents from being
# left over by shells.
# Infer the operation mode.
if test -z "$mode"; then
$echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
- $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
+ $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
case $nonopt in
*cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
mode=link
for arg
do
- case "$arg_mode" in
+ case $arg_mode in
arg )
# do not "continue". Instead, add this to base_compile
lastarg="$arg"
case $lastarg in
# Double-quote args containing other shell metacharacters.
# Many Bourne shells cannot handle close brackets correctly
- # in scan sets, so we specify it separately.
+ # in scan sets, and some SunOS ksh mistreat backslash-escaping
+ # in scan sets (worked around with variable expansion),
+ # and furthermore cannot handle '|' '&' '(' ')' in scan sets
+ # at all, so we specify them separately.
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
lastarg="\"$lastarg\""
;;
esac
done
+ qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
+ case $qlibobj in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ qlibobj="\"$qlibobj\"" ;;
+ esac
+ test "X$libobj" != "X$qlibobj" \
+ && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
+ && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
if test "X$xdir" = "X$obj"; then
$run $rm $removelist
exit $EXIT_FAILURE
fi
- $echo $srcfile > "$lockfile"
+ $echo "$srcfile" > "$lockfile"
fi
if test -n "$fix_srcfile_path"; then
eval srcfile=\"$fix_srcfile_path\"
fi
+ qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
+ case $qsrcfile in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ qsrcfile="\"$qsrcfile\"" ;;
+ esac
$run $rm "$libobj" "${libobj}T"
fbsd_hideous_sh_bug=$base_compile
if test "$pic_mode" != no; then
- command="$base_compile $srcfile $pic_flag"
+ command="$base_compile $qsrcfile $pic_flag"
else
# Don't build PIC code
- command="$base_compile $srcfile"
+ command="$base_compile $qsrcfile"
fi
if test ! -d "${xdir}$objdir"; then
$show "$mkdir ${xdir}$objdir"
$run $mkdir ${xdir}$objdir
- status=$?
- if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
- exit $status
+ exit_status=$?
+ if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
+ exit $exit_status
fi
fi
if test "$build_old_libs" = yes; then
if test "$pic_mode" != yes; then
# Don't build PIC code
- command="$base_compile $srcfile"
+ command="$base_compile $qsrcfile"
else
- command="$base_compile $srcfile $pic_flag"
+ command="$base_compile $qsrcfile $pic_flag"
fi
if test "$compiler_c_o" = yes; then
command="$command -o $obj"
no_install=no
objs=
non_pic_objects=
+ notinst_path= # paths that contain not-installed libtool libraries
precious_files_regex=
prefer_static_libs=no
preload=no
if test -n "$link_static_flag"; then
dlopen_self=$dlopen_self_static
fi
+ prefer_static_libs=yes
else
if test -z "$pic_flag" && test -n "$link_static_flag"; then
dlopen_self=$dlopen_self_static
fi
+ prefer_static_libs=built
fi
build_libtool_libs=no
build_old_libs=yes
- prefer_static_libs=yes
break
;;
esac
if test -z "$pic_object" || test "$pic_object" = none ; then
arg="$non_pic_object"
fi
+ else
+ # If the PIC object exists, use it instead.
+ # $xdir was prepended to $pic_object above.
+ non_pic_object="$pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
fi
else
# Only an error if not doing a dry-run.
prev=
continue
;;
+ darwin_framework|darwin_framework_skip)
+ test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ prev=
+ continue
+ ;;
*)
eval "$prev=\"\$arg\""
prev=
continue
;;
+ -framework|-arch|-isysroot)
+ case " $CC " in
+ *" ${arg} ${1} "* | *" ${arg} ${1} "*)
+ prev=darwin_framework_skip ;;
+ *) compiler_flags="$compiler_flags $arg"
+ prev=darwin_framework ;;
+ esac
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ continue
+ ;;
+
-inst-prefix-dir)
prev=inst_prefix
continue
absdir=`cd "$dir" && pwd`
if test -z "$absdir"; then
$echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
- exit $EXIT_FAILURE
+ absdir="$dir"
+ notinst_path="$notinst_path $dir"
fi
dir="$absdir"
;;
esac
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
case :$dllsearchpath: in
*":$dir:"*) ;;
*) dllsearchpath="$dllsearchpath:$dir";;
esac
+ case :$dllsearchpath: in
+ *":$testbindir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$testbindir";;
+ esac
;;
esac
continue
-l*)
if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
case $host in
- *-*-cygwin* | *-*-pw32* | *-*-beos*)
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
# These systems don't actually have a C or math library (as such)
continue
;;
- *-*-mingw* | *-*-os2*)
+ *-*-os2*)
# These systems don't actually have a C library (as such)
test "X$arg" = "X-lc" && continue
;;
- *-*-openbsd* | *-*-freebsd*)
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc due to us having libc/libc_r.
test "X$arg" = "X-lc" && continue
;;
# Rhapsody C and math libraries are in the System framework
deplibs="$deplibs -framework System"
continue
+ ;;
+ *-*-sco3.2v5* | *-*-sco5v6*)
+ # Causes problems with __ctype
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+ # Compiler inserts libc in the correct place for threads to work
+ test "X$arg" = "X-lc" && continue
+ ;;
esac
elif test "X$arg" = "X-lc_r"; then
case $host in
- *-*-openbsd* | *-*-freebsd*)
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc_r directly, use -pthread flag.
continue
;;
continue
;;
+ # Tru64 UNIX uses -model [arg] to determine the layout of C++
+ # classes, name mangling, and exception handling.
+ -model)
+ compile_command="$compile_command $arg"
+ compiler_flags="$compiler_flags $arg"
+ finalize_command="$finalize_command $arg"
+ prev=xcompiler
+ continue
+ ;;
+
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
- deplibs="$deplibs $arg"
+ compiler_flags="$compiler_flags $arg"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
continue
;;
continue
;;
- # gcc -m* arguments should be passed to the linker via $compiler_flags
- # in order to pass architecture information to the linker
- # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo
- # but this is not reliable with gcc because gcc may use -mfoo to
- # select a different linker, different libraries, etc, while
- # -Wl,-mfoo simply passes -mfoo to the linker.
- -m*)
+ # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
+ # -r[0-9][0-9]* specifies the processor on the SGI compiler
+ # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
+ # +DA*, +DD* enable 64-bit mode on the HP compiler
+ # -q* pass through compiler args for the IBM compiler
+ # -m* pass through architecture-specific compiler args for GCC
+ # -m*, -t[45]*, -txscale* pass through architecture-specific
+ # compiler args for GCC
+ # -pg pass through profiling flag for GCC
+ # @file GCC response files
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
+ -t[45]*|-txscale*|@*)
+
# Unknown arguments in both finalize_command and compile_command need
# to be aesthetically quoted because they are evaled later.
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
esac
compile_command="$compile_command $arg"
finalize_command="$finalize_command $arg"
- if test "$with_gcc" = "yes" ; then
- compiler_flags="$compiler_flags $arg"
- fi
+ compiler_flags="$compiler_flags $arg"
continue
;;
if test -z "$pic_object" || test "$pic_object" = none ; then
arg="$non_pic_object"
fi
+ else
+ # If the PIC object exists, use it instead.
+ # $xdir was prepended to $pic_object above.
+ non_pic_object="$pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
fi
else
# Only an error if not doing a dry-run.
if test ! -d "$output_objdir"; then
$show "$mkdir $output_objdir"
$run $mkdir $output_objdir
- status=$?
- if test "$status" -ne 0 && test ! -d "$output_objdir"; then
- exit $status
+ exit_status=$?
+ if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
+ exit $exit_status
fi
fi
newlib_search_path=
need_relink=no # whether we're linking any uninstalled libtool libraries
notinst_deplibs= # not-installed libtool libraries
- notinst_path= # paths that contain not-installed libtool libraries
case $linkmode in
lib)
passes="conv link"
case $pass in
dlopen) libs="$dlfiles" ;;
dlpreopen) libs="$dlprefiles" ;;
- link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+ link)
+ libs="$deplibs %DEPLIBS%"
+ test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
+ ;;
esac
fi
if test "$pass" = dlopen; then
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
- deplibs="$deplib $deplibs"
+ compiler_flags="$compiler_flags $deplib"
fi
continue
;;
$echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
continue
fi
- if test "$pass" = conv; then
- deplibs="$deplib $deplibs"
- continue
- fi
name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
for search_ext in .la $std_shrext .so .a; do
fi
case $linkmode in
lib)
- if test "$deplibs_check_method" != pass_all; then
+ valid_a_lib=no
+ case $deplibs_check_method in
+ match_pattern*)
+ set dummy $deplibs_check_method
+ match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+ if eval $echo \"$deplib\" 2>/dev/null \
+ | $SED 10q \
+ | $EGREP "$match_pattern_regex" > /dev/null; then
+ valid_a_lib=yes
+ fi
+ ;;
+ pass_all)
+ valid_a_lib=yes
+ ;;
+ esac
+ if test "$valid_a_lib" != yes; then
$echo
$echo "*** Warning: Trying to link with static lib archive $deplib."
$echo "*** I have the capability to make that library automatically link in when"
esac # case $deplib
if test "$found" = yes || test -f "$lib"; then :
else
- $echo "$modename: cannot find the library \`$lib'" 1>&2
+ $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
exit $EXIT_FAILURE
fi
# it will not redefine variables installed, or shouldnotlink
installed=yes
shouldnotlink=no
+ avoidtemprpath=
+
# Read the .la file
case $lib in
dir="$libdir"
absdir="$libdir"
fi
+ test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
else
- dir="$ladir/$objdir"
- absdir="$abs_ladir/$objdir"
- # Remove this search path later
- notinst_path="$notinst_path $abs_ladir"
+ if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ dir="$ladir"
+ absdir="$abs_ladir"
+ # Remove this search path later
+ notinst_path="$notinst_path $abs_ladir"
+ else
+ dir="$ladir/$objdir"
+ absdir="$abs_ladir/$objdir"
+ # Remove this search path later
+ notinst_path="$notinst_path $abs_ladir"
+ fi
fi # $installed = yes
name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
if test -n "$library_names" &&
{ test "$prefer_static_libs" = no || test -z "$old_library"; }; then
# We need to hardcode the library path
- if test -n "$shlibpath_var"; then
+ if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
# Make sure the rpath contains only unique directories.
case "$temp_rpath " in
*" $dir "*) ;;
*" $absdir "*) ;;
- *) temp_rpath="$temp_rpath $dir" ;;
+ *) temp_rpath="$temp_rpath $absdir" ;;
esac
fi
fi
link_static=no # Whether the deplib will be linked statically
+ use_static_libs=$prefer_static_libs
+ if test "$use_static_libs" = built && test "$installed" = yes ; then
+ use_static_libs=no
+ fi
if test -n "$library_names" &&
- { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+ { test "$use_static_libs" = no || test -z "$old_library"; }; then
if test "$installed" = no; then
notinst_deplibs="$notinst_deplibs $lib"
need_relink=yes
if test "$hardcode_direct" = no; then
add="$dir/$linklib"
case $host in
- *-*-sco3.2v5* ) add_dir="-L$dir" ;;
+ *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
+ *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+ *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
+ *-*-unixware7*) add_dir="-L$dir" ;;
*-*-darwin* )
# if the lib is a module then we can not link against
# it, someone is ignoring the new warnings I added
- if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
+ if /usr/bin/file -L $add 2> /dev/null |
+ $EGREP ": [^:]* bundle" >/dev/null ; then
$echo "** Warning, lib $linklib is a module, not a shared library"
if test -z "$old_library" ; then
$echo
add_dir="-L$dir"
# Try looking first in the location we're being installed to.
if test -n "$inst_prefix_dir"; then
- case "$libdir" in
+ case $libdir in
[\\/]*)
add_dir="$add_dir -L$inst_prefix_dir$libdir"
;;
add_dir="-L$libdir"
# Try looking first in the location we're being installed to.
if test -n "$inst_prefix_dir"; then
- case "$libdir" in
+ case $libdir in
[\\/]*)
add_dir="$add_dir -L$inst_prefix_dir$libdir"
;;
fi
fi
else
- convenience="$convenience $dir/$old_library"
- old_convenience="$old_convenience $dir/$old_library"
deplibs="$dir/$old_library $deplibs"
link_static=yes
fi
*) continue ;;
esac
case " $deplibs " in
- *" $depdepl "*) ;;
- *) deplibs="$depdepl $deplibs" ;;
+ *" $path "*) ;;
+ *) deplibs="$path $deplibs" ;;
esac
case " $deplibs " in
- *" $path "*) ;;
- *) deplibs="$deplibs $path" ;;
+ *" $depdepl "*) ;;
+ *) deplibs="$depdepl $deplibs" ;;
esac
done
fi # link_all_deplibs != no
age="$number_minor"
revision="$number_minor"
;;
+ *)
+ $echo "$modename: unknown library version type \`$version_type'" 1>&2
+ $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit $EXIT_FAILURE
+ ;;
esac
;;
no)
# Check that each of the things are valid numbers.
case $current in
- [0-9]*) ;;
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*)
- $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
+ $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
exit $EXIT_FAILURE
;;
esac
case $revision in
- [0-9]*) ;;
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*)
- $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
+ $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
exit $EXIT_FAILURE
;;
esac
case $age in
- [0-9]*) ;;
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*)
- $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
+ $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
exit $EXIT_FAILURE
;;
versuffix="$major.$age.$revision"
# Darwin ld doesn't like 0 for these options...
minor_current=`expr $current + 1`
- verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+ verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
;;
freebsd-aout)
# Eliminate all temporary directories.
for path in $notinst_path; do
- lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
- deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
- dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
+ lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
+ deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
+ dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
done
if test -n "$xrpath"; then
*-*-netbsd*)
# Don't link with libc until the a.out ld.so is fixed.
;;
- *-*-openbsd* | *-*-freebsd*)
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc due to us having libc/libc_r.
- test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-sco3.2v5* | *-*-sco5v6*)
+ # Causes problems with __ctype
+ ;;
+ *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+ # Compiler inserts libc in the correct place for threads to work
;;
*)
# Add libc to deplibs on all other systems if necessary.
int main() { return 0; }
EOF
$rm conftest
- $LTCC -o conftest conftest.c $deplibs
+ $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
if test "$?" -eq 0 ; then
ldd_output=`ldd conftest`
for i in $deplibs; do
- name="`expr $i : '-l\(.*\)'`"
+ name=`expr $i : '-l\(.*\)'`
# If $name is empty we are operating on a -L argument.
if test "$name" != "" && test "$name" -ne "0"; then
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
# Error occurred in the first compile. Let's try to salvage
# the situation: Compile a separate program for each library.
for i in $deplibs; do
- name="`expr $i : '-l\(.*\)'`"
+ name=`expr $i : '-l\(.*\)'`
# If $name is empty we are operating on a -L argument.
if test "$name" != "" && test "$name" != "0"; then
$rm conftest
- $LTCC -o conftest conftest.c $i
+ $LTCC $LTCFLAGS -o conftest conftest.c $i
# Did it work?
if test "$?" -eq 0 ; then
ldd_output=`ldd conftest`
set dummy $deplibs_check_method
file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
for a_deplib in $deplibs; do
- name="`expr $a_deplib : '-l\(.*\)'`"
+ name=`expr $a_deplib : '-l\(.*\)'`
# If $name is empty we are operating on a -L argument.
if test "$name" != "" && test "$name" != "0"; then
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
set dummy $deplibs_check_method
match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
for a_deplib in $deplibs; do
- name="`expr $a_deplib : '-l\(.*\)'`"
+ name=`expr $a_deplib : '-l\(.*\)'`
# If $name is empty we are operating on a -L argument.
if test -n "$name" && test "$name" != "0"; then
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
deplibs=$newdeplibs
fi
+
+ # move library search paths that coincide with paths to not yet
+ # installed libraries to the beginning of the library search list
+ new_libs=
+ for path in $notinst_path; do
+ case " $new_libs " in
+ *" -L$path/$objdir "*) ;;
+ *)
+ case " $deplibs " in
+ *" -L$path/$objdir "*)
+ new_libs="$new_libs -L$path/$objdir" ;;
+ esac
+ ;;
+ esac
+ done
+ for deplib in $deplibs; do
+ case $deplib in
+ -L*)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) new_libs="$new_libs $deplib" ;;
+ esac
+ ;;
+ *) new_libs="$new_libs $deplib" ;;
+ esac
+ done
+ deplibs="$new_libs"
+
+
# All the library-specific variables (install_libdir is set above).
library_names=
old_library=
fi
lib="$output_objdir/$realname"
+ linknames=
for link
do
linknames="$linknames $link"
# The command line is too long to execute in one step.
$show "using reloadable object file for export list..."
skipped_export=:
+ # Break out early, otherwise skipped_export may be
+ # set to false by a later but shorter cmd.
+ break
fi
done
IFS="$save_ifs"
fi
tmp_deplibs=
- inst_prefix_arg=
for test_deplib in $deplibs; do
case " $convenience " in
*" $test_deplib "*) ;;
*)
- if test -n "$inst_prefix_dir" && (echo "$test_deplib" | grep -- "$inst_prefix_dir" >/dev/null); then
- inst_prefix_arg="$test_deplib"
- else
- tmp_deplibs="$tmp_deplibs $test_deplib"
- fi
+ tmp_deplibs="$tmp_deplibs $test_deplib"
;;
esac
done
deplibs="$tmp_deplibs"
- if test -n "$inst_prefix_arg"; then
- deplibs="$inst_prefix_arg $deplibs"
- fi
if test -n "$convenience"; then
if test -n "$whole_archive_flag_spec"; then
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
else
gentop="$output_objdir/${outputname}x"
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
- $show "$mkdir $gentop"
- $run $mkdir "$gentop"
- status=$?
- if test "$status" -ne 0 && test ! -d "$gentop"; then
- exit $status
- fi
generated="$generated $gentop"
- for xlib in $convenience; do
- # Extract the objects.
- case $xlib in
- [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
- *) xabs=`pwd`"/$xlib" ;;
- esac
- xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
- xdir="$gentop/$xlib"
-
- $show "${rm}r $xdir"
- $run ${rm}r "$xdir"
- $show "$mkdir $xdir"
- $run $mkdir "$xdir"
- status=$?
- if test "$status" -ne 0 && test ! -d "$xdir"; then
- exit $status
- fi
- # We will extract separately just the conflicting names and we will no
- # longer touch any unique names. It is faster to leave these extract
- # automatically by $AR in one run.
- $show "(cd $xdir && $AR x $xabs)"
- $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
- if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
- $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
- $AR t "$xabs" | sort | uniq -cd | while read -r count name
- do
- i=1
- while test "$i" -le "$count"
- do
- # Put our $i before any first dot (extension)
- # Never overwrite any file
- name_to="$name"
- while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
- do
- name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
- done
- $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
- $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
- i=`expr $i + 1`
- done
- done
- fi
-
- libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
- done
+ func_extract_archives $gentop $convenience
+ libobjs="$libobjs $func_extract_archives_result"
fi
fi
-
+
if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
eval flag=\"$thread_safe_flag_spec\"
linker_flags="$linker_flags $flag"
fi
fi
- if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
+ if test "X$skipped_export" != "X:" &&
+ len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
:
else
save_libobjs=$libobjs
fi
save_output=$output
+ output_la=`$echo "X$output" | $Xsed -e "$basename"`
# Clear the reloadable object creation command queue and
# initialize k to one.
delfiles=
last_robj=
k=1
- output=$output_objdir/$save_output-${k}.$objext
+ output=$output_objdir/$output_la-${k}.$objext
# Loop over the list of objects to be linked.
for obj in $save_libobjs
do
eval test_cmds=\"$reload_cmds $objlist $last_robj\"
if test "X$objlist" = X ||
- { len=`expr "X$test_cmds" : ".*"` &&
+ { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
test "$len" -le "$max_cmd_len"; }; then
objlist="$objlist $obj"
else
# the last one created.
eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
fi
- last_robj=$output_objdir/$save_output-${k}.$objext
+ last_robj=$output_objdir/$output_la-${k}.$objext
k=`expr $k + 1`
- output=$output_objdir/$save_output-${k}.$objext
+ output=$output_objdir/$output_la-${k}.$objext
objlist=$obj
len=1
fi
eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
fi
- # Set up a command to remove the reloadale object files
+ # Set up a command to remove the reloadable object files
# after they are used.
i=0
while test "$i" -lt "$k"
do
i=`expr $i + 1`
- delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
+ delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
done
$echo "creating a temporary reloadable object file: $output"
IFS="$save_ifs"
eval cmd=\"$cmd\"
$show "$cmd"
- $run eval "$cmd" || exit $?
+ $run eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+ fi
+
+ exit $lt_exit
+ }
done
IFS="$save_ifs"
# Restore the uninstalled library and exit
if test "$mode" = relink; then
$run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
+
+ if test -n "$convenience"; then
+ if test -z "$whole_archive_flag_spec"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ fi
+ fi
+
exit $EXIT_SUCCESS
fi
eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
else
gentop="$output_objdir/${obj}x"
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
- $show "$mkdir $gentop"
- $run $mkdir "$gentop"
- status=$?
- if test "$status" -ne 0 && test ! -d "$gentop"; then
- exit $status
- fi
generated="$generated $gentop"
- for xlib in $convenience; do
- # Extract the objects.
- case $xlib in
- [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
- *) xabs=`pwd`"/$xlib" ;;
- esac
- xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
- xdir="$gentop/$xlib"
-
- $show "${rm}r $xdir"
- $run ${rm}r "$xdir"
- $show "$mkdir $xdir"
- $run $mkdir "$xdir"
- status=$?
- if test "$status" -ne 0 && test ! -d "$xdir"; then
- exit $status
- fi
- # We will extract separately just the conflicting names and we will no
- # longer touch any unique names. It is faster to leave these extract
- # automatically by $AR in one run.
- $show "(cd $xdir && $AR x $xabs)"
- $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
- if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
- $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
- $AR t "$xabs" | sort | uniq -cd | while read -r count name
- do
- i=1
- while test "$i" -le "$count"
- do
- # Put our $i before any first dot (extension)
- # Never overwrite any file
- name_to="$name"
- while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
- do
- name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
- done
- $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
- $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
- i=`expr $i + 1`
- done
- done
- fi
-
- reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
- done
+ func_extract_archives $gentop $convenience
+ reload_conv_objs="$reload_objs $func_extract_archives_result"
fi
fi
;;
esac
+
+ # move library search paths that coincide with paths to not yet
+ # installed libraries to the beginning of the library search list
+ new_libs=
+ for path in $notinst_path; do
+ case " $new_libs " in
+ *" -L$path/$objdir "*) ;;
+ *)
+ case " $compile_deplibs " in
+ *" -L$path/$objdir "*)
+ new_libs="$new_libs -L$path/$objdir" ;;
+ esac
+ ;;
+ esac
+ done
+ for deplib in $compile_deplibs; do
+ case $deplib in
+ -L*)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) new_libs="$new_libs $deplib" ;;
+ esac
+ ;;
+ *) new_libs="$new_libs $deplib" ;;
+ esac
+ done
+ compile_deplibs="$new_libs"
+
+
compile_command="$compile_command $compile_deplibs"
finalize_command="$finalize_command $finalize_deplibs"
fi
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
case :$dllsearchpath: in
*":$libdir:"*) ;;
*) dllsearchpath="$dllsearchpath:$libdir";;
esac
+ case :$dllsearchpath: in
+ *":$testbindir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$testbindir";;
+ esac
;;
esac
done
# Prepare the list of exported symbols
if test -z "$export_symbols"; then
- export_symbols="$output_objdir/$output.exp"
+ export_symbols="$output_objdir/$outputname.exp"
$run $rm $export_symbols
- $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+ $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+ case $host in
+ *cygwin* | *mingw* )
+ $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
else
- $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
- $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
+ $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+ $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
$run eval 'mv "$nlist"T "$nlist"'
+ case $host in
+ *cygwin* | *mingw* )
+ $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
fi
fi
#endif
/* The mapping between symbol names and symbols. */
+"
+
+ case $host in
+ *cygwin* | *mingw* )
+ $echo >> "$output_objdir/$dlsyms" "\
+/* DATA imports from DLLs on WIN32 can't be const, because
+ runtime relocations are performed -- see ld's documentation
+ on pseudo-relocs */
+struct {
+"
+ ;;
+ * )
+ $echo >> "$output_objdir/$dlsyms" "\
const struct {
+"
+ ;;
+ esac
+
+
+ $echo >> "$output_objdir/$dlsyms" "\
const char *name;
lt_ptr address;
}
esac
# Now compile the dynamic symbol file.
- $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
- $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+ $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+ $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
# Clean up the generated files.
$show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
$run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
# Transform the symbol file into the correct name.
- compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
- finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ case $host in
+ *cygwin* | *mingw* )
+ if test -f "$output_objdir/${outputname}.def" ; then
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
+ else
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ fi
+ ;;
+ * )
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ ;;
+ esac
;;
*)
$echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
# We have no uninstalled library dependencies, so finalize right now.
$show "$link_command"
$run eval "$link_command"
- status=$?
+ exit_status=$?
# Delete the generated files.
if test -n "$dlsyms"; then
$run $rm "$output_objdir/${outputname}S.${objext}"
fi
- exit $status
+ exit $exit_status
fi
if test -n "$shlibpath_var"; then
esac
case $host in
*cygwin* | *mingw* )
- cwrappersource=`$echo ${objdir}/lt-${output}.c`
- cwrapper=`$echo ${output}.exe`
- $rm $cwrappersource $cwrapper
- trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+ output_name=`basename $output`
+ output_path=`dirname $output`
+ cwrappersource="$output_path/$objdir/lt-$output_name.c"
+ cwrapper="$output_path/$output_name.exe"
+ $rm $cwrappersource $cwrapper
+ trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
cat > $cwrappersource <<EOF
#include <malloc.h>
#include <stdarg.h>
#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/stat.h>
#if defined(PATH_MAX)
# define LT_PATHMAX PATH_MAX
#endif
#ifndef DIR_SEPARATOR
-#define DIR_SEPARATOR '/'
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
#endif
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
defined (__OS2__)
-#define HAVE_DOS_BASED_FILE_SYSTEM
-#ifndef DIR_SEPARATOR_2
-#define DIR_SEPARATOR_2 '\\'
-#endif
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# ifndef DIR_SEPARATOR_2
+# define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+# define PATH_SEPARATOR_2 ';'
+# endif
#endif
#ifndef DIR_SEPARATOR_2
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
#endif /* DIR_SEPARATOR_2 */
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
#define XFREE(stale) do { \
if (stale) { free ((void *) stale); stale = 0; } \
} while (0)
+/* -DDEBUG is fairly common in CFLAGS. */
+#undef DEBUG
+#if defined DEBUGWRAPPER
+# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
+#else
+# define DEBUG(format, ...)
+#endif
+
const char *program_name = NULL;
void * xmalloc (size_t num);
char * xstrdup (const char *string);
-char * basename (const char *name);
-char * fnqualify(const char *path);
+const char * base_name (const char *name);
+char * find_executable(const char *wrapper);
+int check_executable(const char *path);
char * strendzap(char *str, const char *pat);
void lt_fatal (const char *message, ...);
char **newargz;
int i;
- program_name = (char *) xstrdup ((char *) basename (argv[0]));
+ program_name = (char *) xstrdup (base_name (argv[0]));
+ DEBUG("(main) argv[0] : %s\n",argv[0]);
+ DEBUG("(main) program_name : %s\n",program_name);
newargz = XMALLOC(char *, argc+2);
EOF
- cat >> $cwrappersource <<EOF
- newargz[0] = "$SHELL";
+ cat >> $cwrappersource <<EOF
+ newargz[0] = (char *) xstrdup("$SHELL");
EOF
- cat >> $cwrappersource <<"EOF"
- newargz[1] = fnqualify(argv[0]);
+ cat >> $cwrappersource <<"EOF"
+ newargz[1] = find_executable(argv[0]);
+ if (newargz[1] == NULL)
+ lt_fatal("Couldn't find %s", argv[0]);
+ DEBUG("(main) found exe at : %s\n",newargz[1]);
/* we know the script has the same name, without the .exe */
/* so make sure newargz[1] doesn't end in .exe */
strendzap(newargz[1],".exe");
for (i = 1; i < argc; i++)
newargz[i+1] = xstrdup(argv[i]);
newargz[argc+1] = NULL;
+
+ for (i=0; i<argc+1; i++)
+ {
+ DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
+ ;
+ }
+
EOF
- cat >> $cwrappersource <<EOF
+ case $host_os in
+ mingw*)
+ cat >> $cwrappersource <<EOF
+ execv("$SHELL",(char const **)newargz);
+EOF
+ ;;
+ *)
+ cat >> $cwrappersource <<EOF
execv("$SHELL",newargz);
EOF
+ ;;
+ esac
- cat >> $cwrappersource <<"EOF"
+ cat >> $cwrappersource <<"EOF"
+ return 127;
}
void *
;
}
-char *
-basename (const char *name)
+const char *
+base_name (const char *name)
{
const char *base;
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
/* Skip over the disk name in MSDOS pathnames. */
- if (isalpha (name[0]) && name[1] == ':')
+ if (isalpha ((unsigned char)name[0]) && name[1] == ':')
name += 2;
#endif
for (base = name; *name; name++)
if (IS_DIR_SEPARATOR (*name))
base = name + 1;
- return (char *) base;
+ return base;
+}
+
+int
+check_executable(const char * path)
+{
+ struct stat st;
+
+ DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
+ if ((!path) || (!*path))
+ return 0;
+
+ if ((stat (path, &st) >= 0) &&
+ (
+ /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
+#if defined (S_IXOTH)
+ ((st.st_mode & S_IXOTH) == S_IXOTH) ||
+#endif
+#if defined (S_IXGRP)
+ ((st.st_mode & S_IXGRP) == S_IXGRP) ||
+#endif
+ ((st.st_mode & S_IXUSR) == S_IXUSR))
+ )
+ return 1;
+ else
+ return 0;
}
+/* Searches for the full path of the wrapper. Returns
+ newly allocated full path name if found, NULL otherwise */
char *
-fnqualify(const char *path)
+find_executable (const char* wrapper)
{
- size_t size;
- char *p;
+ int has_slash = 0;
+ const char* p;
+ const char* p_next;
+ /* static buffer for getcwd */
char tmp[LT_PATHMAX + 1];
+ int tmp_len;
+ char* concat_name;
- assert(path != NULL);
+ DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
- /* Is it qualified already? */
+ if ((wrapper == NULL) || (*wrapper == '\0'))
+ return NULL;
+
+ /* Absolute path? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
+ {
+ concat_name = xstrdup (wrapper);
+ if (check_executable(concat_name))
+ return concat_name;
+ XFREE(concat_name);
+ }
+ else
+ {
+#endif
+ if (IS_DIR_SEPARATOR (wrapper[0]))
+ {
+ concat_name = xstrdup (wrapper);
+ if (check_executable(concat_name))
+ return concat_name;
+ XFREE(concat_name);
+ }
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
- if (isalpha (path[0]) && path[1] == ':')
- return xstrdup (path);
+ }
#endif
- if (IS_DIR_SEPARATOR (path[0]))
- return xstrdup (path);
- /* prepend the current directory */
- /* doesn't handle '~' */
+ for (p = wrapper; *p; p++)
+ if (*p == '/')
+ {
+ has_slash = 1;
+ break;
+ }
+ if (!has_slash)
+ {
+ /* no slashes; search PATH */
+ const char* path = getenv ("PATH");
+ if (path != NULL)
+ {
+ for (p = path; *p; p = p_next)
+ {
+ const char* q;
+ size_t p_len;
+ for (q = p; *q; q++)
+ if (IS_PATH_SEPARATOR(*q))
+ break;
+ p_len = q - p;
+ p_next = (*q == '\0' ? q : q + 1);
+ if (p_len == 0)
+ {
+ /* empty path: current directory */
+ if (getcwd (tmp, LT_PATHMAX) == NULL)
+ lt_fatal ("getcwd failed");
+ tmp_len = strlen(tmp);
+ concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
+ memcpy (concat_name, tmp, tmp_len);
+ concat_name[tmp_len] = '/';
+ strcpy (concat_name + tmp_len + 1, wrapper);
+ }
+ else
+ {
+ concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
+ memcpy (concat_name, p, p_len);
+ concat_name[p_len] = '/';
+ strcpy (concat_name + p_len + 1, wrapper);
+ }
+ if (check_executable(concat_name))
+ return concat_name;
+ XFREE(concat_name);
+ }
+ }
+ /* not found in PATH; assume curdir */
+ }
+ /* Relative path | not found in path: prepend cwd */
if (getcwd (tmp, LT_PATHMAX) == NULL)
lt_fatal ("getcwd failed");
- size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
- p = XMALLOC(char, size);
- sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
- return p;
+ tmp_len = strlen(tmp);
+ concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
+ memcpy (concat_name, tmp, tmp_len);
+ concat_name[tmp_len] = '/';
+ strcpy (concat_name + tmp_len + 1, wrapper);
+
+ if (check_executable(concat_name))
+ return concat_name;
+ XFREE(concat_name);
+ return NULL;
}
char *
va_end (ap);
}
EOF
- # we should really use a build-platform specific compiler
- # here, but OTOH, the wrappers (shell script and this C one)
- # are only useful if you want to execute the "real" binary.
- # Since the "real" binary is built for $host, then this
- # wrapper might as well be built for $host, too.
- $run $LTCC -s -o $cwrapper $cwrappersource
- ;;
- esac
- $rm $output
- trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
+ # we should really use a build-platform specific compiler
+ # here, but OTOH, the wrappers (shell script and this C one)
+ # are only useful if you want to execute the "real" binary.
+ # Since the "real" binary is built for $host, then this
+ # wrapper might as well be built for $host, too.
+ $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
+ ;;
+ esac
+ $rm $output
+ trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
$echo > $output "\
#! $SHELL
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
-if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
relink_command=\"$relink_command\"
# Backslashes separate directories on plain windows
*-*-mingw | *-*-os2*)
$echo >> $output "\
- exec \$progdir\\\\\$program \${1+\"\$@\"}
+ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
"
;;
*)
$echo >> $output "\
- exec \$progdir/\$program \${1+\"\$@\"}
+ exec \"\$progdir/\$program\" \${1+\"\$@\"}
"
;;
esac
fi
else
# The program doesn't exist.
- \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
+ \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
\$echo \"This script is just a wrapper for \$program.\" 1>&2
$echo \"See the $PACKAGE documentation for more information.\" 1>&2
exit $EXIT_FAILURE
if test -n "$addlibs"; then
gentop="$output_objdir/${outputname}x"
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
- $show "$mkdir $gentop"
- $run $mkdir "$gentop"
- status=$?
- if test "$status" -ne 0 && test ! -d "$gentop"; then
- exit $status
- fi
generated="$generated $gentop"
- # Add in members from convenience archives.
- for xlib in $addlibs; do
- # Extract the objects.
- case $xlib in
- [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
- *) xabs=`pwd`"/$xlib" ;;
- esac
- xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
- xdir="$gentop/$xlib"
-
- $show "${rm}r $xdir"
- $run ${rm}r "$xdir"
- $show "$mkdir $xdir"
- $run $mkdir "$xdir"
- status=$?
- if test "$status" -ne 0 && test ! -d "$xdir"; then
- exit $status
- fi
- # We will extract separately just the conflicting names and we will no
- # longer touch any unique names. It is faster to leave these extract
- # automatically by $AR in one run.
- $show "(cd $xdir && $AR x $xabs)"
- $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
- if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
- $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
- $AR t "$xabs" | sort | uniq -cd | while read -r count name
- do
- i=1
- while test "$i" -le "$count"
- do
- # Put our $i before any first dot (extension)
- # Never overwrite any file
- name_to="$name"
- while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
- do
- name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
- done
- $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
- $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
- i=`expr $i + 1`
- done
- done
- fi
-
- oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
- done
+ func_extract_archives $gentop $addlibs
+ oldobjs="$oldobjs $func_extract_archives_result"
fi
# Do each command in the archive commands.
if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
cmds=$old_archive_from_new_cmds
else
+ # POSIX demands no paths to be encoded in archives. We have
+ # to avoid creating archives with duplicate basenames if we
+ # might have to extract them afterwards, e.g., when creating a
+ # static archive out of a convenience library, or when linking
+ # the entirety of a libtool archive into another (currently
+ # not supported by libtool).
+ if (for obj in $oldobjs
+ do
+ $echo "X$obj" | $Xsed -e 's%^.*/%%'
+ done | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ $echo "copying selected object files to avoid basename conflicts..."
+
+ if test -z "$gentop"; then
+ gentop="$output_objdir/${outputname}x"
+ generated="$generated $gentop"
+
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "$mkdir $gentop"
+ $run $mkdir "$gentop"
+ exit_status=$?
+ if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
+ exit $exit_status
+ fi
+ fi
+
+ save_oldobjs=$oldobjs
+ oldobjs=
+ counter=1
+ for obj in $save_oldobjs
+ do
+ objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+ case " $oldobjs " in
+ " ") oldobjs=$obj ;;
+ *[\ /]"$objbase "*)
+ while :; do
+ # Make sure we don't pick an alternate name that also
+ # overlaps.
+ newobj=lt$counter-$objbase
+ counter=`expr $counter + 1`
+ case " $oldobjs " in
+ *[\ /]"$newobj "*) ;;
+ *) if test ! -f "$gentop/$newobj"; then break; fi ;;
+ esac
+ done
+ $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+ $run ln "$obj" "$gentop/$newobj" ||
+ $run cp "$obj" "$gentop/$newobj"
+ oldobjs="$oldobjs $gentop/$newobj"
+ ;;
+ *) oldobjs="$oldobjs $obj" ;;
+ esac
+ done
+ fi
+
eval cmds=\"$old_archive_cmds\"
if len=`expr "X$cmds" : ".*"` &&
objlist=
concat_cmds=
save_oldobjs=$oldobjs
- # GNU ar 2.10+ was changed to match POSIX; thus no paths are
- # encoded into archives. This makes 'ar r' malfunction in
- # this piecewise linking case whenever conflicting object
- # names appear in distinct ar calls; check, warn and compensate.
- if (for obj in $save_oldobjs
- do
- $echo "X$obj" | $Xsed -e 's%^.*/%%'
- done | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
- $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
- AR_FLAGS=cq
- fi
+
# Is there a better way of finding the last object in the list?
for obj in $save_oldobjs
do
oldobjs="$objlist $obj"
objlist="$objlist $obj"
eval test_cmds=\"$old_archive_cmds\"
- if len=`expr "X$test_cmds" : ".*"` &&
+ if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
test "$len" -le "$max_cmd_len"; then
:
else
# install_prog (especially on Windows NT).
if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
# Allow the use of GNU shtool's install command.
- $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
+ $echo "X$nonopt" | grep shtool > /dev/null; then
# Aesthetically quote it.
arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
arg="\"$arg\""
;;
esac
shift
else
install_prog=
- arg="$nonopt"
+ arg=$nonopt
fi
# The real first argument should be the name of the installation program.
# Aesthetically quote it.
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
arg="\"$arg\""
;;
esac
do
if test -n "$dest"; then
files="$files $dest"
- dest="$arg"
+ dest=$arg
continue
fi
case $arg in
-d) isdir=yes ;;
- -f) prev="-f" ;;
- -g) prev="-g" ;;
- -m) prev="-m" ;;
- -o) prev="-o" ;;
+ -f)
+ case " $install_prog " in
+ *[\\\ /]cp\ *) ;;
+ *) prev=$arg ;;
+ esac
+ ;;
+ -g | -m | -o) prev=$arg ;;
-s)
stripme=" -s"
continue
;;
- -*) ;;
-
+ -*)
+ ;;
*)
# If the previous option needed an argument, then skip it.
if test -n "$prev"; then
prev=
else
- dest="$arg"
+ dest=$arg
continue
fi
;;
# Aesthetically quote the argument.
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
arg="\"$arg\""
;;
esac
if test "$#" -gt 0; then
# Delete the old symlinks, and create new ones.
+ # Try `ln -sf' first, because the `ln' binary might depend on
+ # the symlink we replace! Solaris /bin/ln does not understand -f,
+ # so we also need to try rm && ln -s.
for linkname
do
if test "$linkname" != "$realname"; then
- $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
- $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+ $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
+ $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
fi
done
fi
IFS="$save_ifs"
eval cmd=\"$cmd\"
$show "$cmd"
- $run eval "$cmd" || exit $?
+ $run eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+ fi
+
+ exit $lt_exit
+ }
done
IFS="$save_ifs"
fi
notinst_deplibs=
relink_command=
- # To insure that "foo" is sourced, and not "foo.exe",
- # finese the cygwin/MSYS system by explicitly sourcing "foo."
- # which disallows the automatic-append-.exe behavior.
- case $build in
- *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
- *) wrapperdot=${wrapper} ;;
- esac
+ # Note that it is not necessary on cygwin/mingw to append a dot to
+ # foo even if both foo and FILE.exe exist: automatic-append-.exe
+ # behavior happens only for exec(3), not for open(2)! Also, sourcing
+ # `FILE.' does not work on cygwin managed mounts.
+ #
# If there is no directory component, then add one.
- case $file in
- */* | *\\*) . ${wrapperdot} ;;
- *) . ./${wrapperdot} ;;
+ case $wrapper in
+ */* | *\\*) . ${wrapper} ;;
+ *) . ./${wrapper} ;;
esac
# Check the variables that should have been set.
done
relink_command=
- # To insure that "foo" is sourced, and not "foo.exe",
- # finese the cygwin/MSYS system by explicitly sourcing "foo."
- # which disallows the automatic-append-.exe behavior.
- case $build in
- *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
- *) wrapperdot=${wrapper} ;;
- esac
+ # Note that it is not necessary on cygwin/mingw to append a dot to
+ # foo even if both foo and FILE.exe exist: automatic-append-.exe
+ # behavior happens only for exec(3), not for open(2)! Also, sourcing
+ # `FILE.' does not work on cygwin managed mounts.
+ #
# If there is no directory component, then add one.
- case $file in
- */* | *\\*) . ${wrapperdot} ;;
- *) . ./${wrapperdot} ;;
+ case $wrapper in
+ */* | *\\*) . ${wrapper} ;;
+ *) . ./${wrapper} ;;
esac
outputname=
if test "$fast_install" = no && test -n "$relink_command"; then
if test "$finalize" = yes && test -z "$run"; then
- tmpdir="/tmp"
- test -n "$TMPDIR" && tmpdir="$TMPDIR"
- tmpdir="$tmpdir/libtool-$$"
- save_umask=`umask`
- umask 0077
- if $mkdir "$tmpdir"; then
- umask $save_umask
- else
- umask $save_umask
- $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
- continue
- fi
+ tmpdir=`func_mktempdir`
file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
outputname="$tmpdir/$file"
# Replace the output file specification.
fi
# remove .exe since cygwin /usr/bin/install will append another
- # one anyways
+ # one anyway
case $install_prog,$host in
*/usr/bin/install*,*cygwin*)
case $file:$destfile in
# Exit here if they wanted silent mode.
test "$show" = : && exit $EXIT_SUCCESS
- $echo "----------------------------------------------------------------------"
+ $echo "X----------------------------------------------------------------------" | $Xsed
$echo "Libraries have been installed in:"
for libdir in $libdirs; do
$echo " $libdir"
$echo
$echo "See any operating system documentation about shared libraries for"
$echo "more information, such as the ld(1) and ld.so(8) manual pages."
- $echo "----------------------------------------------------------------------"
+ $echo "X----------------------------------------------------------------------" | $Xsed
exit $EXIT_SUCCESS
;;
rmfiles="$rmfiles $objdir/$n"
done
test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
- test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
- if test "$mode" = uninstall; then
+ case "$mode" in
+ clean)
+ case " $library_names " in
+ # " " in the beginning catches empty $dlname
+ *" $dlname "*) ;;
+ *) rmfiles="$rmfiles $objdir/$dlname" ;;
+ esac
+ test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+ ;;
+ uninstall)
if test -n "$library_names"; then
# Do each command in the postuninstall commands.
cmds=$postuninstall_cmds
IFS="$save_ifs"
fi
# FIXME: should reinstall the best remaining shared library.
- fi
+ ;;
+ esac
fi
;;
$echo
$echo "Try \`$modename --help' for more information about other modes."
-exit $EXIT_SUCCESS
+exit $?
# The TAGs below are defined such that we never get into a situation
# in which we disable both kinds of libraries. Given conflicting
# configuration. But we'll never go from static-only to shared-only.
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
-build_libtool_libs=no
-build_old_libs=yes
+disable_libs=shared
# ### END LIBTOOL TAG CONFIG: disable-shared
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
-build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
+disable_libs=static
# ### END LIBTOOL TAG CONFIG: disable-static
# Local Variables:
* Standard Constructor for generic Component, used in derived class
* Connection to Registry and Notification
* \param orb Object Request broker given by Container
- * \parap poa Portable Object Adapter from Container (normally root_poa)
+ * \param poa Portable Object Adapter from Container (normally root_poa)
* \param contId container CORBA id inside the server
* \param instanceName unique instance name for this object (see Container_i)
* \param interfaceName component class name
* Standard constructor for parallel component
* Connection Notification (no connection to Registry !)
* \param orb Object Request broker given by Container
- * \parap poa Portable Object Adapter from Container (normally root_poa)
+ * \param poa Portable Object Adapter from Container (normally root_poa)
* \param contId container CORBA id inside the server
* \param instanceName unique instance name for this object (see Container_i)
* \param interfaceName component class name
-I$(srcdir)/../ResourcesManager \
-I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
- @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
+ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
# This local variable defines the list of dependant libraries common to all target in this package.
COMMON_LIBS =\
Container_i.cxx \
SALOME_FileTransfer_i.cxx \
SALOME_FileRef_i.cxx \
- SALOME_ContainerManager.cxx \
- Container_init_python.cxx
+ Container_init_python.cxx \
+ SALOME_ContainerManager.cxx
libSalomeContainer_la_CPPFLAGS =\
$(COMMON_CPPFLAGS)
libSalomeContainer_la_LIBADD =\
$(COMMON_LIBS)
+if WITH_PACO_PARALLEL
+libSalomeContainer_la_CPPFLAGS += -DWITH_PACO_PARALLEL @PACO_INCLUDES@
+libSalomeContainer_la_LIBADD += @PACO_LIBS@
+endif
#
# ===============================================================
SALOME_Container_CPPFLAGS =\
$(COMMON_CPPFLAGS)
-
SALOME_Container_LDADD =\
libSalomeContainer.la \
$(COMMON_LIBS) \
../Basics/libSALOMEBasics.la
-
SALOME_ContainerManagerServer_SOURCES =\
- SALOME_ContainerManagerServer.cxx
+ SALOME_ContainerManagerServer.cxx
SALOME_ContainerManagerServer_CPPFLAGS=\
$(COMMON_CPPFLAGS)
SALOME_ContainerManagerServer_LDADD =\
libSalomeContainer.la \
$(COMMON_LIBS) \
- ../Basics/libSALOMEBasics.la
+ ../Basics/libSALOMEBasics.la
+
+
#define CONTAINER_EXPORT
#endif
-#endif
\ No newline at end of file
+#endif
+
#include <vector>
#include "Utils_CorbaException.hxx"
+#ifdef WITH_PACO_PARALLEL
+#include "PaCO++.h"
+#endif
+
#define TIME_OUT_TO_LAUNCH_CONT 21
using namespace std;
}
}
+#ifdef WITH_PACO_PARALLEL
+//=============================================================================
+/*! CORBA Method:
+ * Find or Start a suitable PaCO++ Parallel Container in a list of machines.
+ * \param params Machine Parameters required for the container
+ * \param possibleComputers list of machines usable for find or start
+ *
+ * \return CORBA container reference.
+ */
+//=============================================================================
+Engines::Container_ptr
+SALOME_ContainerManager::
+FindOrStartParallelContainer(const Engines::MachineParameters& params_const,
+ const Engines::MachineList& possibleComputers)
+{
+ CORBA::Object_var obj;
+ Engines::Container_ptr ret = Engines::Container::_nil();
+ Engines::MachineParameters params(params_const);
+
+ // Step 1 : Try to find a suitable container
+ // Currently not as good as could be since
+ // we have to verified the number of nodes of the container
+ // if a user tell that.
+ ret = FindContainer(params, possibleComputers);
+
+ if(CORBA::is_nil(ret)) {
+ // Step 2 : Starting a new parallel container
+ INFOS("[FindOrStartParallelContainer] Starting a parallel container");
+
+ // Step 2.1 : Choose a computer
+ string theMachine = _ResManager->FindBest(possibleComputers);
+ if(theMachine == "") {
+ INFOS("[FindOrStartParallelContainer] !!!!!!!!!!!!!!!!!!!!!!!!!!");
+ INFOS("[FindOrStartParallelContainer] No possible computer found");
+ INFOS("[FindOrStartParallelContainer] !!!!!!!!!!!!!!!!!!!!!!!!!!");
+ }
+ else {
+ INFOS("[FindOrStartParallelContainer] on machine : " << theMachine);
+ string command;
+ if(theMachine == GetHostname()) {
+ // Step 3 : starting parallel container proxy
+ params.hostname = CORBA::string_dup(theMachine.c_str());
+ Engines::MachineParameters params_proxy(params);
+ command = _ResManager->BuildCommandToLaunchLocalParallelContainer("SALOME_ParallelContainerProxy", params_proxy, "xterm");
+ // LaunchParallelContainer uses this value to know if it launches the proxy or the nodes
+ params_proxy.nb_component_nodes = 0;
+ obj = LaunchParallelContainer(command, params_proxy, _NS->ContainerName(params));
+ ret = Engines::Container::_narrow(obj);
+
+ // Step 4 : starting parallel container nodes
+ command = _ResManager->BuildCommandToLaunchLocalParallelContainer("SALOME_ParallelContainerNode", params, "xterm");
+ string name = _NS->ContainerName(params) + "Node";
+ LaunchParallelContainer(command, params, name);
+
+ // Step 5 : connecting nodes and the proxy to actually create a parallel container
+ try {
+ for (int i = 0; i < params.nb_component_nodes; i++) {
+
+ char buffer [5];
+ snprintf(buffer,5,"%d",i);
+ string name_cont = name + string(buffer);
+
+ string theNodeMachine(CORBA::string_dup(params.hostname));
+ string containerNameInNS = _NS->BuildContainerNameForNS(name_cont.c_str(),theNodeMachine.c_str());
+ int count = TIME_OUT_TO_LAUNCH_CONT;
+ obj = _NS->Resolve(containerNameInNS.c_str());
+ while (CORBA::is_nil(obj) && count) {
+ INFOS("[FindOrStartParallelContainer] CONNECTION FAILED !!!!!!!!!!!!!!!!!!!!!!!!");
+#ifndef WNT
+ sleep(1) ;
+#else
+ Sleep(1000);
+#endif
+ count-- ;
+ obj = _NS->Resolve(containerNameInNS.c_str());
+ }
+
+ PaCO::InterfaceParallel_var node = PaCO::InterfaceParallel::_narrow(obj);
+ MESSAGE("[FindOrStartParallelContainer] Deploying node : " << name);
+ node->deploy(i);
+ }
+ }
+ catch(CORBA::SystemException& e)
+ {
+ INFOS("Caught CORBA::SystemException. : " << e);
+ }
+ catch(PortableServer::POA::ServantAlreadyActive&)
+ {
+ INFOS("Caught CORBA::ServantAlreadyActiveException");
+ }
+ catch(CORBA::Exception&)
+ {
+ INFOS("Caught CORBA::Exception.");
+ }
+ catch(std::exception& exc)
+ {
+ INFOS("Caught std::exception - "<<exc.what());
+ }
+ catch(...)
+ {
+ INFOS("Caught unknown exception.");
+ }
+ INFOS("[FindOrStartParallelContainer] node " << name << " deployed");
+ }
+
+ else {
+ INFOS("[FindOrStartParallelContainer] Currently parallel containers are launched only on the local host");
+ }
+ }
+ }
+ return ret;
+}
+#else
+//=============================================================================
+/*! CORBA Method:
+ * Find or Start a suitable PaCO++ Parallel Container in a list of machines.
+ * \param params Machine Parameters required for the container
+ * \param possibleComputers list of machines usable for find or start
+ *
+ * \return CORBA container reference.
+ */
+//=============================================================================
+Engines::Container_ptr
+SALOME_ContainerManager::
+FindOrStartParallelContainer(const Engines::MachineParameters& params,
+ const Engines::MachineList& possibleComputers)
+{
+ Engines::Container_ptr ret = Engines::Container::_nil();
+ INFOS("[FindOrStartParallelContainer] is disabled !");
+ INFOS("[FindOrStartParallelContainer] recompile SALOME Kernel to enable parallel extension");
+ return ret;
+}
+#endif
+
//=============================================================================
/*!
*
return Engines::Container::_nil();
}
+//=============================================================================
+/*! This method launches the parallel container.
+ * It will may be placed on the ressources manager.
+ *
+ * \param command to launch
+ * \param container's parameters
+ * \param name of the container
+ *
+ * \return CORBA container reference
+ */
+//=============================================================================
+CORBA::Object_ptr
+SALOME_ContainerManager::LaunchParallelContainer(const std::string& command,
+ const Engines::MachineParameters& params,
+ const std::string& name)
+{
+ CORBA::Object_ptr obj = CORBA::Object::_nil();
+ string containerNameInNS;
+
+ if (params.nb_component_nodes == 0) {
+ INFOS("[LaunchParallelContainer] launching the proxy of the parallel container");
+ int status = system(command.c_str());
+ if (status == -1) {
+ INFOS("[LaunchParallelContainer] failed : system command status -1");
+ }
+ else if (status == 217) {
+ INFOS("[LaunchParallelContainer] failed : system command status 217");
+ }
+
+ int count = TIME_OUT_TO_LAUNCH_CONT;
+ string theMachine(CORBA::string_dup(params.hostname));
+ containerNameInNS = _NS->BuildContainerNameForNS((char*) name.c_str(),theMachine.c_str());
+
+ INFOS("[LaunchContainer] Waiting for Parallel Container proxy on " << theMachine);
+ while (CORBA::is_nil(obj) && count) {
+#ifndef WNT
+ sleep(1) ;
+#else
+ Sleep(1000);
+#endif
+ count-- ;
+ obj = _NS->Resolve(containerNameInNS.c_str());
+ }
+ }
+ else {
+ INFOS("[LaunchParallelContainer] launching the nodes of the parallel container");
+ int status = system(command.c_str());
+ if (status == -1) {
+ INFOS("[LaunchParallelContainer] failed : system command status -1");
+ }
+ else if (status == 217) {
+ INFOS("[LaunchParallelContainer] failed : system command status 217");
+ }
+ // We are waiting all the nodes
+ for (int i = 0; i < params.nb_component_nodes; i++) {
+ obj = CORBA::Object::_nil();
+ int count = TIME_OUT_TO_LAUNCH_CONT;
+
+ // Name of the node
+ char buffer [5];
+ snprintf(buffer,5,"%d",i);
+ string name_cont = name + string(buffer);
+
+ // I don't like this...
+ string theMachine(CORBA::string_dup(params.hostname));
+ containerNameInNS = _NS->BuildContainerNameForNS((char*) name_cont.c_str(),theMachine.c_str());
+ cerr << "[LaunchContainer] Waiting for Parllel Container node " << containerNameInNS << " on " << theMachine << endl;
+ while (CORBA::is_nil(obj) && count) {
+#ifndef WNT
+ sleep(1) ;
+#else
+ Sleep(1000);
+#endif
+ count-- ;
+ obj = _NS->Resolve(containerNameInNS.c_str());
+ }
+ }
+ }
+
+ if ( CORBA::is_nil(obj) ) {
+ INFOS("[LaunchParallelContainer] failed");
+ }
+ return obj;
+}
+
//=============================================================================
/*!
* Get Id for container: a parallel container registers in Naming Service
static const char *_ContainerManagerNameInNS;
+ // Parallel extension
+ Engines::Container_ptr
+ FindOrStartParallelContainer(const Engines::MachineParameters& params,
+ const Engines::MachineList& possibleComputer);
protected:
Engines::Container_ptr
FindContainer(const Engines::MachineParameters& params,
FindContainer(const Engines::MachineParameters& params,
const char *theMachine);
+ // Parallel extension
+ CORBA::Object_ptr
+ LaunchParallelContainer(const std::string& command,
+ const Engines::MachineParameters& params,
+ const std::string& name);
+
long GetIdForContainer(void);
long _id;
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : ConnectionManager_i.cxx
+// Author : André RIBES (EDF)
+// Module : KERNEL
+
+#include "ConnectionManager_i.hxx"
+#include "SALOME_NamingService.hxx"
+
+ConnectionManager_i::ConnectionManager_i(CORBA::ORB_ptr orb) {
+ SALOME_NamingService * ns = new SALOME_NamingService(orb);
+ const char * ConnectionManagerNameInNS = "/ConnectionManager";
+ ns->Register(_this(), ConnectionManagerNameInNS);
+
+ current_id = 0;
+ pthread_mutex_init(&mutex, NULL);
+}
+
+ConnectionManager_i::~ConnectionManager_i() {}
+
+Engines::ConnectionManager::connectionId
+ConnectionManager_i::connect(Engines::DSC_ptr uses_component,
+ const char* uses_port_name,
+ Engines::DSC_ptr provides_component,
+ const char* provides_port_name)
+throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::BadPortType,
+ Engines::DSC::NilPort)
+{
+
+ Ports::Port_ptr p_port = provides_component->get_provides_port(provides_port_name, false);
+ uses_component->connect_uses_port(uses_port_name, p_port);
+ provides_component->connect_provides_port(provides_port_name);
+
+ // Creating a new connection id.
+ // We use a mutex for multithreaded applications.
+ pthread_mutex_lock(&mutex);
+ Engines::ConnectionManager::connectionId rtn_id = current_id;
+ current_id += 1;
+ pthread_mutex_unlock(&mutex);
+
+ // Creating a new structure containing connection's infos.
+ connection_infos * infos = new connection_infos();
+ infos->uses_component = Engines::DSC::_duplicate(uses_component);
+ infos->uses_port_name = uses_port_name;
+ infos->provides_component = Engines::DSC::_duplicate(provides_component);
+ infos->provides_port_name = provides_port_name;
+ infos->provides_port = Ports::Port::_duplicate(p_port);
+
+ // Adding the new connection into the map.
+ ids[rtn_id] = infos;
+
+ return rtn_id;
+}
+
+void
+ConnectionManager_i::disconnect(const Engines::ConnectionManager::connectionId id,
+ Engines::DSC::Message message)
+throw (Engines::ConnectionManager::BadId)
+{
+ // Connection id exist ?
+ ids_it = ids.find(id);
+ if (ids_it == ids.end())
+ throw Engines::ConnectionManager::BadId();
+
+ // TODO
+ // We need to catch exceptions if one of these disconnect operation fails.
+ connection_infos * infos = ids[id];
+ infos->provides_component->disconnect_provides_port(infos->provides_port_name.c_str(),
+ message);
+ infos->uses_component->disconnect_uses_port(infos->uses_port_name.c_str(),
+ Ports::Port::_duplicate(infos->provides_port),
+ message);
+ delete infos;
+ ids.erase(id);
+}
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : ConnectionManager_i.hxx
+// Author : André RIBES (EDF)
+// Module : KERNEL
+
+#ifndef _CONNECTION_MANAGER_I_HXX_
+#define _CONNECTION_MANAGER_I_HXX_
+
+#include <iostream>
+#include <map>
+#include <pthread.h>
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(DSC_Engines)
+
+/*! \class ConnectionManager_i
+ * \brief This class implements the interface Engines::ConnectionManager.
+ */
+class ConnectionManager_i :
+ public virtual POA_Engines::ConnectionManager
+{
+ public :
+ ConnectionManager_i(CORBA::ORB_ptr orb);
+ virtual ~ConnectionManager_i();
+
+ /*!
+ * CORBA method : connect two ports of two components.
+ * \see Engines::ConnectionManager::connect
+ */
+ Engines::ConnectionManager::connectionId connect(Engines::DSC_ptr uses_component,
+ const char* uses_port_name,
+ Engines::DSC_ptr provides_component,
+ const char* provides_port_name)
+ throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::BadPortType,
+ Engines::DSC::NilPort);
+
+ /*!
+ * CORBA method : releases a connection performed with
+ * ConnectionManager_i::connect.
+ *
+ * \see Engines::ConnectionManager::disconnect
+ */
+ void disconnect(const Engines::ConnectionManager::connectionId id,
+ Engines::DSC::Message message)
+ throw (Engines::ConnectionManager::BadId);
+
+ private :
+
+ struct connection_infos {
+ Engines::DSC_ptr uses_component;
+ std::string uses_port_name;
+ Engines::DSC_ptr provides_component;
+ std::string provides_port_name;
+ Ports::Port_ptr provides_port;
+ };
+
+ typedef std::map<Engines::ConnectionManager::connectionId,
+ connection_infos *> ids_type;
+ typedef std::map<Engines::ConnectionManager::connectionId,
+ connection_infos *>::iterator ids_it_type;
+
+ ids_type ids;
+ ids_it_type ids_it;
+
+ int current_id;
+ pthread_mutex_t mutex;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : DSC_Callbacks.hxx
+// Author : André RIBES (EDF)
+// Module : KERNEL
+
+#ifndef _DSC_CALLBACKS_HXX_
+#define _DSC_CALLBACKS_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(DSC_Engines)
+
+/*! \class DSC_Callbacks
+ * \brief This is an abstract class that defines methods that the component
+ * uses to prevent the component user code that the state of the component has changed.
+ * Currently only port's connection modifications are signaled.
+ */
+class DSC_Callbacks
+{
+ public:
+ DSC_Callbacks() {}
+ virtual ~DSC_Callbacks() {}
+
+ /*!
+ * This method is used by the component when the number of connection
+ * on a provides port changes. This information helps the user code to detect
+ * operation on its ports.
+ *
+ *
+ * \param provides_port_name the name of the provides name that has changed.
+ * \param connection_nbr the new number of connection on the provides port.
+ * \param message contains informations about the modification of the port.
+ */
+ virtual void provides_port_changed(const char* provides_port_name,
+ int connection_nbr,
+ const Engines::DSC::Message message) = 0;
+
+ /*!
+ * This method is used by the component when the number of connection
+ * on a uses port changes. This information helps the user code to detect
+ * operation on its ports.
+ *
+ *
+ * \param uses_port_name the name of the uses name that has changed.
+ * \param new_uses_port the new sequence representing the uses port.
+ * \param message contains informations about the modification of the port.
+ */
+ virtual void uses_port_changed(const char* uses_port_name,
+ Engines::DSC::uses_port * new_uses_port,
+ const Engines::DSC::Message message) = 0;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : DSC_i.cxx
+// Author : André RIBES (EDF)
+// Module : KERNEL
+
+#include "DSC_i.hxx"
+
+Engines_DSC_i::
+Engines_DSC_i(CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName,
+ bool notif) : Engines_Component_i(orb,
+ poa,
+ contId,
+ instanceName,
+ interfaceName)
+{
+ std::cout << "--Engines_DSC_i: MARK 1 --" << instanceName << "----" << std::endl;
+}
+
+Engines_DSC_i::~Engines_DSC_i() {}
+
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : DSC_i.hxx
+// Author : André RIBES (EDF)
+// Module : KERNEL
+
+#ifndef _DSC_I_HXX_
+#define _DSC_I_HXX_
+
+#include <iostream>
+#include <map>
+#include <string.h>
+#include <assert.h>
+
+#include "SALOME_Component_i.hxx"
+#include "DSC_interface.hxx"
+
+/*! \class Engines_DSC_i
+ * \brief This class implements the interface Engines::DSC
+ *
+ * The implementation of methods are performed by the class Engines_DSC_interface.
+ */
+class Engines_DSC_i:
+ public Engines_Component_i, // keyword virtual is not use to be able to
+ // call the right Engines_Component_i constructor.
+ // If virtual is used, a derived class of Engines_DSC_i
+ // will have to call the right Engines_Component_i constructor.
+ public virtual POA_Engines::DSC,
+ public Engines_DSC_interface
+{
+public:
+ Engines_DSC_i(CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName,
+ bool notif = false);
+
+ virtual ~Engines_DSC_i();
+
+ /*!
+ * \see Engines::DSC::add_provides_port
+ */
+ virtual void add_provides_port(Ports::Port_ptr ref,
+ const char* provides_port_name,
+ Ports::PortProperties_ptr port_prop)
+ throw (Engines::DSC::PortAlreadyDefined,
+ Engines::DSC::NilPort,
+ Engines::DSC::BadProperty) {
+ Engines_DSC_interface::add_provides_port(ref,
+ provides_port_name,
+ port_prop);
+ }
+
+ /*!
+ * \see Engines::DSC::add_uses_port
+ */
+ virtual void add_uses_port(const char* repository_id,
+ const char* uses_port_name,
+ Ports::PortProperties_ptr port_prop)
+ throw (Engines::DSC::PortAlreadyDefined,
+ Engines::DSC::BadProperty) {
+ Engines_DSC_interface::add_uses_port(repository_id,
+ uses_port_name,
+ port_prop);
+ }
+
+ /*!
+ * \see Engines::DSC::get_provides_port
+ */
+ virtual Ports::Port_ptr get_provides_port(const char* provides_port_name,
+ const CORBA::Boolean connection_error)
+ throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::PortNotConnected) {
+ return Engines_DSC_interface::get_provides_port(provides_port_name,
+ connection_error);
+ }
+
+ /*!
+ * \see Engines::DSC::get_uses_port
+ */
+ virtual Engines::DSC::uses_port * get_uses_port(const char* uses_port_name)
+ throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::PortNotConnected) {
+ return Engines_DSC_interface::get_uses_port(uses_port_name);
+ }
+
+ /*!
+ * \see Engines::DSC::connect_provides_port
+ */
+ virtual void connect_provides_port(const char* provides_port_name)
+ throw (Engines::DSC::PortNotDefined) {
+ Engines_DSC_interface::connect_provides_port(provides_port_name);
+ }
+
+ /*!
+ * \see Engines::DSC::connect_uses_port
+ */
+ virtual void connect_uses_port(const char* uses_port_name,
+ Ports::Port_ptr provides_port_ref)
+ throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::BadPortType,
+ Engines::DSC::NilPort) {
+ Engines_DSC_interface::connect_uses_port(uses_port_name,
+ provides_port_ref);
+ }
+
+ /*!
+ * \see Engines::DSC::is_connected
+ */
+ virtual CORBA::Boolean is_connected(const char* port_name)
+ throw (Engines::DSC::PortNotDefined) {
+ return Engines_DSC_interface::is_connected(port_name);
+ }
+
+ /*!
+ * \see Engines::DSC::disconnect_provides_port
+ */
+ virtual void disconnect_provides_port(const char* provides_port_name,
+ const Engines::DSC::Message message)
+ throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::PortNotConnected) {
+ Engines_DSC_interface::disconnect_provides_port(provides_port_name,
+ message);
+ }
+
+ /*!
+ * \see Engines::DSC::disconnect_uses_port
+ */
+ virtual void disconnect_uses_port(const char* uses_port_name,
+ Ports::Port_ptr provides_port_ref,
+ const Engines::DSC::Message message)
+ throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::PortNotConnected,
+ Engines::DSC::BadPortReference) {
+ Engines_DSC_interface::disconnect_uses_port(uses_port_name,
+ provides_port_ref,
+ message);
+ }
+
+ /*!
+ * \see Engines::DSC::get_port_properties
+ */
+ virtual Ports::PortProperties_ptr get_port_properties(const char* port_name)
+ throw (Engines::DSC::PortNotDefined) {
+ return Engines_DSC_interface::get_port_properties(port_name);
+ }
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : DSC_interface.cxx
+// Author : André RIBES (EDF)
+// Module : KERNEL
+
+#include "DSC_interface.hxx"
+
+Engines_DSC_interface::Engines_DSC_interface() {}
+
+Engines_DSC_interface::~Engines_DSC_interface() {}
+
+void
+Engines_DSC_interface::add_provides_port(Ports::Port_ptr ref,
+ const char* provides_port_name,
+ Ports::PortProperties_ptr port_prop)
+throw (Engines::DSC::PortAlreadyDefined,
+ Engines::DSC::NilPort,
+ Engines::DSC::BadProperty)
+{
+ // Method args test
+ assert(provides_port_name);
+ if (CORBA::is_nil(ref))
+ throw Engines::DSC::NilPort();
+ if (CORBA::is_nil(port_prop))
+ throw Engines::DSC::BadProperty();
+
+ my_ports_it = my_ports.find(provides_port_name);
+ if (my_ports_it == my_ports.end()) {
+ // Creating a new port provides
+ port_t * new_port = new port_t();
+ new_port->type = provides;
+ new_port->connection_nbr = 0;
+ new_port->provides_port_ref = Ports::Port::_duplicate(ref);
+ new_port->port_prop = Ports::PortProperties::_duplicate(port_prop);
+
+ // Port into the port's map
+ my_ports[provides_port_name] = new_port;
+ }
+ else
+ throw Engines::DSC::PortAlreadyDefined();
+}
+
+void
+Engines_DSC_interface::add_uses_port(const char* repository_id,
+ const char* uses_port_name,
+ Ports::PortProperties_ptr port_prop)
+throw (Engines::DSC::PortAlreadyDefined,
+ Engines::DSC::BadProperty)
+{
+ // Method args test
+ // Note : We can't be shure that repository id
+ // is a correct CORBA id.
+ assert(repository_id);
+ assert(uses_port_name);
+ if (CORBA::is_nil(port_prop))
+ throw Engines::DSC::BadProperty();
+
+ my_ports_it = my_ports.find(uses_port_name);
+ if (my_ports_it == my_ports.end()) {
+ // Creating a new uses port
+ port_t * new_port = new port_t();
+ new_port->type = uses;
+ new_port->connection_nbr = 0;
+ new_port->uses_port_refs.length(0);
+ new_port->repository_id = repository_id;
+ new_port->port_prop = Ports::PortProperties::_duplicate(port_prop);
+
+ // Port into port's map
+ my_ports[uses_port_name] = new_port;
+ }
+ else
+ throw Engines::DSC::PortAlreadyDefined();
+}
+
+Ports::Port_ptr
+Engines_DSC_interface::get_provides_port(const char* provides_port_name,
+ const CORBA::Boolean connection_error)
+ throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::PortNotConnected,
+ Engines::DSC::BadPortType)
+{
+ // Method arg test
+ assert(provides_port_name);
+
+ Ports::Port_ptr rtn_port = Ports::Port::_nil();
+// std::cout << "---- DSC_Interface : MARK 1 ---- Recherche de : " << provides_port_name << "----" << std::endl;
+// ports::iterator it;
+// std::cout << "----> ";
+// for(it=my_ports.begin();it!=my_ports.end();++it)
+// std::cout << "|"<<(*it).first<<"|, ";
+// std::cout << std::endl;
+
+ // Searching the port
+ my_ports_it = my_ports.find(provides_port_name);
+ if (my_ports_it == my_ports.end())
+ throw Engines::DSC::PortNotDefined();
+ if (my_ports[provides_port_name]->type != provides) {
+ Engines::DSC::BadPortType BPT;
+ BPT.expected = CORBA::string_dup("Expected a provides port");
+ BPT.received = CORBA::string_dup((std::string("Received a uses/none port : ")+provides_port_name).c_str());
+ throw BPT;
+ }
+
+ if (my_ports[provides_port_name]->connection_nbr == 0 && connection_error)
+ throw Engines::DSC::PortNotConnected();
+
+ rtn_port = Ports::Port::_duplicate(my_ports[provides_port_name]->provides_port_ref);
+ return rtn_port;
+}
+
+Engines::DSC::uses_port *
+Engines_DSC_interface::get_uses_port(const char* uses_port_name)
+ throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::PortNotConnected,
+ Engines::DSC::BadPortType)
+{
+ // Method arg test
+ assert(uses_port_name);
+
+ Engines::DSC::uses_port * rtn_port = NULL;
+
+ // Searching the uses port
+ my_ports_it = my_ports.find(uses_port_name);
+ if (my_ports_it == my_ports.end())
+ throw Engines::DSC::PortNotDefined();
+ if (my_ports[uses_port_name]->type != uses){
+ Engines::DSC::BadPortType BPT;
+ BPT.expected = CORBA::string_dup("Expected a uses port");
+ BPT.received = CORBA::string_dup((std::string("Received a provides/none port : ")+uses_port_name).c_str());
+ std::cout << "---- DSC_Interface : MARK 1 ---- exception : " << uses_port_name << "----" << std::endl;
+ throw BPT;
+ }
+
+ // Is the port connected ?
+ if (my_ports[uses_port_name]->connection_nbr > 0) {
+ rtn_port = new Engines::DSC::uses_port(my_ports[uses_port_name]->uses_port_refs);
+ }
+ else
+ {
+ std::cout << "---- DSC_Interface : MARK 2 ---- exception : " << uses_port_name << "----" << std::endl;
+ throw Engines::DSC::PortNotConnected();
+ }
+
+ return rtn_port;
+}
+
+void
+Engines_DSC_interface::connect_provides_port(const char* provides_port_name)
+ throw (Engines::DSC::PortNotDefined)
+{
+ // Method arg test
+ assert(provides_port_name);
+
+ // Searching the provides port
+ my_ports_it = my_ports.find(provides_port_name);
+ if (my_ports_it == my_ports.end())
+ throw Engines::DSC::PortNotDefined();
+ if (my_ports[provides_port_name]->type != provides)
+ throw Engines::DSC::PortNotDefined();
+
+
+ // Adding a new connection
+ my_ports[provides_port_name]->connection_nbr += 1;
+ // User code is informed
+ provides_port_changed(provides_port_name,
+ my_ports[provides_port_name]->connection_nbr,
+ Engines::DSC::AddingConnection
+ );
+}
+
+void
+Engines_DSC_interface::connect_uses_port(const char* uses_port_name,
+ Ports::Port_ptr provides_port_ref)
+ throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::BadPortType,
+ Engines::DSC::NilPort)
+{
+ // Method arg test
+ assert(uses_port_name);
+
+ if (CORBA::is_nil(provides_port_ref))
+ throw Engines::DSC::NilPort();
+
+ // Searching the uses port
+ my_ports_it = my_ports.find(uses_port_name);
+ if (my_ports_it == my_ports.end())
+ throw Engines::DSC::PortNotDefined();
+ if (my_ports[uses_port_name]->type != uses) {
+ Engines::DSC::BadPortType BPT;
+ BPT.expected = CORBA::string_dup("Expected a uses port");
+ BPT.received = CORBA::string_dup((std::string("Received a provides/none port : ")+uses_port_name).c_str());
+ throw BPT;
+ }
+
+ // repository_id test
+ const char * repository_id = my_ports[uses_port_name]->repository_id.c_str();
+ if (provides_port_ref->_is_a(repository_id))
+ {
+ // Adding provides port into the uses port sequence
+ CORBA::ULong lgth = my_ports[uses_port_name]->uses_port_refs.length();
+ my_ports[uses_port_name]->
+ uses_port_refs.length(lgth + 1);
+ my_ports[uses_port_name]->uses_port_refs[lgth] =
+ Ports::Port::_duplicate(provides_port_ref);
+
+ // Adding a new connection
+ my_ports[uses_port_name]->connection_nbr += 1;
+ // User code is informed
+ uses_port_changed(uses_port_name,
+ new Engines::DSC::uses_port(my_ports[uses_port_name]->uses_port_refs),
+ Engines::DSC::AddingConnection);
+ }
+ else {
+ Engines::DSC::BadPortType BPT;
+ BPT.expected = CORBA::string_dup("Expected ...");
+ BPT.received = CORBA::string_dup((std::string("Received an incorrect repository id type ")+
+ repository_id).c_str());
+ throw BPT;
+ }
+
+}
+
+CORBA::Boolean
+Engines_DSC_interface::is_connected(const char* port_name)
+ throw (Engines::DSC::PortNotDefined)
+{
+ CORBA::Boolean rtn = false;
+
+ // Method arg test
+ assert(port_name);
+
+ my_ports_it = my_ports.find(port_name);
+ if (my_ports_it == my_ports.end())
+ throw Engines::DSC::PortNotDefined();
+
+ // Is it connected ?
+ if (my_ports[port_name]->connection_nbr > 0)
+ rtn = true;
+
+ return rtn;
+}
+
+void
+Engines_DSC_interface::disconnect_provides_port(const char* provides_port_name,
+ const Engines::DSC::Message message)
+throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::PortNotConnected)
+{
+ // Method args test
+ assert(provides_port_name);
+
+ my_ports_it = my_ports.find(provides_port_name);
+ if (my_ports_it == my_ports.end())
+ throw Engines::DSC::PortNotDefined();
+ if (my_ports[provides_port_name]->type != provides)
+ throw Engines::DSC::PortNotDefined();
+
+ // Is it connected ?
+ if (my_ports[provides_port_name]->connection_nbr > 0)
+ {
+ my_ports[provides_port_name]->connection_nbr -= 1;
+ provides_port_changed(provides_port_name,
+ my_ports[provides_port_name]->connection_nbr,
+ message);
+ }
+ else
+ throw Engines::DSC::PortNotConnected();
+}
+
+void
+Engines_DSC_interface::disconnect_uses_port(const char* uses_port_name,
+ Ports::Port_ptr provides_port_ref,
+ const Engines::DSC::Message message)
+throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::PortNotConnected,
+ Engines::DSC::BadPortReference)
+{
+ // Method args test
+ assert(uses_port_name);
+
+ my_ports_it = my_ports.find(uses_port_name);
+ if (my_ports_it == my_ports.end())
+ throw Engines::DSC::PortNotDefined();
+ if (my_ports[uses_port_name]->type != uses)
+ throw Engines::DSC::PortNotDefined();
+
+ if (CORBA::is_nil(provides_port_ref))
+ throw Engines::DSC::BadPortReference();
+
+ // Is it connected ?
+ if (my_ports[uses_port_name]->connection_nbr > 0) {
+ CORBA::Long port_index = -1;
+ CORBA::ULong seq_length = my_ports[uses_port_name]->uses_port_refs.length();
+ for(int i = 0; i < seq_length; i++)
+ {
+ if (my_ports[uses_port_name]->uses_port_refs[i]->_is_equivalent(provides_port_ref))
+ {
+ port_index = i;
+ break;
+ }
+ }
+ if (port_index == -1)
+ throw Engines::DSC::BadPortReference();
+
+ my_ports[uses_port_name]->connection_nbr -= 1;
+ Engines::DSC::uses_port * new_uses_port =
+ new Engines::DSC::uses_port();
+ new_uses_port->length(seq_length - 1);
+
+ int index_ancien = 0;
+ int index_nouveau = 0;
+ for(;index_ancien < seq_length;) {
+ if (index_ancien == port_index)
+ {
+ // Rien a faire !
+ // On ne change pas le index du nouveau tableau
+ index_ancien += 1;
+ }
+ else
+ {
+ (*new_uses_port)[index_nouveau] = my_ports[uses_port_name]->uses_port_refs[index_ancien];
+ index_ancien += 1;
+ index_nouveau += 1;
+ }
+ }
+
+ // New uses port's sequence
+ my_ports[uses_port_name]->uses_port_refs = *new_uses_port;
+
+ // The user code is informed
+ uses_port_changed(uses_port_name,
+ new_uses_port,
+ message);
+ }
+ else
+ throw Engines::DSC::PortNotConnected();
+}
+
+Ports::PortProperties_ptr
+Engines_DSC_interface::get_port_properties(const char* port_name)
+ throw (Engines::DSC::PortNotDefined)
+{
+ Ports::PortProperties_ptr rtn_properties = Ports::PortProperties::_nil();
+
+ // Method arg test
+ assert(port_name);
+
+ my_ports_it = my_ports.find(port_name);
+ if (my_ports_it == my_ports.end())
+ throw Engines::DSC::PortNotDefined();
+
+ rtn_properties = Ports::PortProperties::_duplicate(my_ports[port_name]->port_prop);
+ return rtn_properties;
+}
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : DSC_interface.hxx
+// Author : André RIBES (EDF)
+// Module : KERNEL
+
+#ifndef _DSC_INTERFACE_HXX_
+#define _DSC_INTERFACE_HXX_
+
+#include <iostream>
+#include <map>
+#include <string.h>
+#include <assert.h>
+
+#include "DSC_Callbacks.hxx"
+
+/*! \class Engines_DSC_interface
+ * \brief This class implements the interface Engines::DSC
+ *
+ * This class is used by the sequential DSC implementation
+ * and the parallel DSC implementation.
+ */
+class Engines_DSC_interface:
+ public DSC_Callbacks
+{
+public:
+ Engines_DSC_interface();
+ virtual ~Engines_DSC_interface();
+
+ /*!
+ * \see Engines::DSC::add_provides_port
+ */
+ virtual void add_provides_port(Ports::Port_ptr ref,
+ const char* provides_port_name,
+ Ports::PortProperties_ptr port_prop)
+ throw (Engines::DSC::PortAlreadyDefined,
+ Engines::DSC::NilPort,
+ Engines::DSC::BadProperty);
+
+ /*!
+ * \see Engines::DSC::add_uses_port
+ */
+ virtual void add_uses_port(const char* repository_id,
+ const char* uses_port_name,
+ Ports::PortProperties_ptr port_prop)
+ throw (Engines::DSC::PortAlreadyDefined,
+ Engines::DSC::BadProperty);
+
+ /*!
+ * \see Engines::DSC::get_provides_port
+ */
+ virtual Ports::Port_ptr get_provides_port(const char* provides_port_name,
+ const CORBA::Boolean connection_error)
+ throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::PortNotConnected,
+ Engines::DSC::BadPortType);
+
+ /*!
+ * \see Engines::DSC::get_uses_port
+ */
+ virtual Engines::DSC::uses_port * get_uses_port(const char* uses_port_name)
+ throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::PortNotConnected,
+ Engines::DSC::BadPortType);
+
+ /*!
+ * \see Engines::DSC::connect_provides_port
+ *
+ * \note This method uses Callbacks mechanism to inform the provides
+ * port how much uses ports are connected with. Currently, the provides
+ * port doesn't know its uses ports references. It's framework or application role
+ * to manage connections between ports.
+ */
+ virtual void connect_provides_port(const char* provides_port_name)
+ throw (Engines::DSC::PortNotDefined);
+
+ /*!
+ * \see Engines::DSC::connect_uses_port
+ *
+ * \note This method uses Callbacks mechanism to inform the uses
+ * port how much provides ports are connected with.
+ */
+ virtual void connect_uses_port(const char* uses_port_name,
+ Ports::Port_ptr provides_port_ref)
+ throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::BadPortType,
+ Engines::DSC::NilPort);
+
+ /*!
+ * \see Engines::DSC::is_connected
+ */
+ virtual CORBA::Boolean is_connected(const char* port_name)
+ throw (Engines::DSC::PortNotDefined);
+
+ /*!
+ * \see Engines::DSC::disconnect_provides_port
+ *
+ * \note This method uses Callbacks mechanism to inform the provides
+ * port how much uses ports are connected with. Currently, the provides
+ * port doesn't know its uses ports references. It's framework or application role
+ * to manage connections between ports.
+ */
+ virtual void disconnect_provides_port(const char* provides_port_name,
+ const Engines::DSC::Message message)
+ throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::PortNotConnected);
+
+ /*!
+ * \see Engines::DSC::disconnect_uses_port
+ *
+ *
+ * \note This method uses Callbacks mechanism to inform the uses
+ * port how much provides ports are connected with.
+ *
+ * \warning The new sequence of the uses port is sended by the callback.
+ * The old sequence is not destoyed. Is uses port user's role to destroy
+ * the sequence.
+ */
+ virtual void disconnect_uses_port(const char* uses_port_name,
+ Ports::Port_ptr provides_port_ref,
+ const Engines::DSC::Message message)
+ throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::PortNotConnected,
+ Engines::DSC::BadPortReference);
+
+ /*!
+ * \see Engines::DSC::get_port_properties
+ */
+ virtual Ports::PortProperties_ptr get_port_properties(const char* port_name)
+ throw (Engines::DSC::PortNotDefined);
+
+protected:
+
+ /*-------------------------------------------------*/
+ /* Definition des types pour le stockage des ports */
+
+ enum port_type {uses, provides, none};
+
+ struct port_t {
+ port_type type;
+ int connection_nbr;
+
+ // Specifique aux uses port
+ Engines::DSC::uses_port uses_port_refs;
+ std::string repository_id;
+
+ // Specifique aux provides port;
+ Ports::Port_ptr provides_port_ref;
+
+ Ports::PortProperties_ptr port_prop;
+ };
+
+ typedef std::map<std::string, port_t *> ports;
+
+ /*-------------------------------------------------*/
+ /*-------------------------------------------------*/
+
+ ports my_ports;
+ ports::iterator my_ports_it;
+};
+
+#endif
--- /dev/null
+# Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# 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.
+#
+# 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
+#
+#
+#
+# File : Makefile.am
+# Author : André RIBES (EDF)
+# Module : KERNEL
+
+include $(top_srcdir)/salome_adm/unix/make_common_starter.am
+
+#
+# ===============================================================
+# Header to be installed
+# ===============================================================
+#
+# header files
+salomeinclude_HEADERS = ConnectionManager_i.hxx \
+ DSC_Callbacks.hxx \
+ DSC_i.hxx \
+ DSC_interface.hxx \
+ PortProperties_i.hxx
+#
+# ===============================================================
+# Local definitions
+# ===============================================================
+#
+
+# This local variable defines the list of CPPFLAGS common to all target in this package.
+COMMON_CPPFLAGS= -I$(top_srcdir)/src/Container \
+ -I$(top_srcdir)/src/Notification \
+ -I$(top_srcdir)/src/SALOMELocalTrace \
+ -I$(top_srcdir)/src/Basics \
+ -I$(top_srcdir)/src/NamingService \
+ -I$(top_srcdir)/src/Utils \
+ -I$(top_builddir)/salome_adm/unix \
+ -I$(top_builddir)/idl \
+ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
+
+# This local variable defines the list of dependant libraries common to all target in this package.
+COMMON_LIBS = $(top_builddir)/src/Container/libSalomeContainer.la \
+ @CORBA_LIBS@
+
+#
+# ===============================================================
+# Libraries targets
+# ===============================================================
+#
+lib_LTLIBRARIES = libSalomeDSCContainer.la
+
+libSalomeDSCContainer_la_SOURCES = DSC_i.cxx \
+ DSC_interface.cxx \
+ PortProperties_i.cxx
+
+libSalomeDSCContainer_la_CXXFLAGS = $(COMMON_CPPFLAGS)
+
+libSalomeDSCContainer_la_LIBADD = $(COMMON_LIBS)
+
+libSalomeDSCContainer_la_LDFLAGS = -no-undefined -version-info=0:0:0
+
+#
+# ===============================================================
+# Executables targets
+# ===============================================================
+#
+bin_PROGRAMS = SALOME_ConnectionManagerServer
+
+SALOME_ConnectionManagerServer_SOURCES = SALOME_ConnectionManagerServer.cxx \
+ ConnectionManager_i.cxx
+
+SALOME_ConnectionManagerServer_CXXFLAGS = $(COMMON_CPPFLAGS)
+
+SALOME_ConnectionManagerServer_LDADD = $(top_builddir)/idl/libSalomeIDLKernel.la \
+ $(top_builddir)/src/NamingService/libSalomeNS.la \
+ $(top_builddir)/src/SALOMELocalTrace/libSALOMELocalTrace.la
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : PortProperties_i.cxx
+// Author : André RIBES (EDF)
+// Module : KERNEL
+
+#include "PortProperties_i.hxx"
+
+PortProperties_i::PortProperties_i() {}
+
+PortProperties_i::~PortProperties_i() {}
+
+void
+PortProperties_i::set_property(const char * name, const CORBA::Any& value)
+ throw (Ports::NotDefined, Ports::BadType)
+{
+ // Default case, the object has no properties.
+ throw Ports::NotDefined();
+}
+
+CORBA::Any*
+PortProperties_i::get_property(const char* name)
+ throw (Ports::NotDefined)
+{
+ // Default case, the object has no properties.
+ throw Ports::NotDefined();
+}
+
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : PortProperties_i.hxx
+// Author : André RIBES (EDF)
+// Module : KERNEL
+
+#ifndef _PORTPROPERTIES_I_HXX_
+#define _PORTPROPERTIES_I_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOME_Ports)
+
+/*! \class PortProperties_i
+ * \brief This class implements the interface Ports::PortProperties.
+ */
+class PortProperties_i:
+ public virtual POA_Ports::PortProperties
+{
+ public:
+ PortProperties_i();
+ virtual ~PortProperties_i();
+
+ /*!
+ * CORBA method : set a value to a property
+ * \see Ports::PortProperties::set_property
+ */
+ virtual void set_property(const char * name,
+ const CORBA::Any& value)
+ throw (Ports::NotDefined, Ports::BadType);
+
+ /*!
+ * CORBA method : get the value of a property
+ * \see Ports::PortProperties::get_property
+ */
+ virtual CORBA::Any* get_property(const char* name)
+ throw (Ports::NotDefined);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : SALOME_ConnectionManagerServer.cxx
+// Author : André RIBES (EDF)
+// Module : KERNEL
+
+#include "ConnectionManager_i.hxx"
+#include "utilities.h"
+#include <iostream>
+
+using namespace std;
+
+int main(int argc, char* argv[])
+{
+ PortableServer::POA_var root_poa;
+ PortableServer::POAManager_var pman;
+ CORBA::Object_var obj;
+ CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+ try{
+ obj = orb->resolve_initial_references("RootPOA");
+ if(!CORBA::is_nil(obj))
+ root_poa = PortableServer::POA::_narrow(obj);
+ if(!CORBA::is_nil(root_poa))
+ pman = root_poa->the_POAManager();
+
+ // We create a ConnectionManager.
+ // It is automatically added to the RootPOA into its constructor.
+ new ConnectionManager_i(orb);
+
+ pman->activate();
+ orb->run();
+ }catch(CORBA::SystemException&){
+ MESSAGE("Caught CORBA::SystemException.");
+ }catch(PortableServer::POA::WrongPolicy&){
+ MESSAGE("Caught CORBA::WrongPolicyException.");
+ }catch(PortableServer::POA::ServantAlreadyActive&){
+ MESSAGE("Caught CORBA::ServantAlreadyActiveException");
+ }catch(CORBA::Exception&){
+ MESSAGE("Caught CORBA::Exception.");
+ }catch(std::exception& exc){
+ MESSAGE("Caught std::exception - "<<exc.what());
+ }catch(...){
+ MESSAGE("Caught unknown exception.");
+ }
+ END_OF(argv[0]);
+}
+
--- /dev/null
+# Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# 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.
+#
+# 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
+#
+#
+#
+# File : Makefile.am
+# Author : André RIBES (EDF)
+# Module : KERNEL
+
+include $(top_srcdir)/salome_adm/unix/make_common_starter.am
+
+#
+# ===============================================================
+# Header to be installed
+# ===============================================================
+#
+# header files
+salomeinclude_HEADERS = basic_port_factory.hxx \
+ data_short_port_provides.hxx \
+ data_short_port_uses.hxx
+
+#
+# ===============================================================
+# Local definitions
+# ===============================================================
+#
+
+# This local variable defines the list of CPPFLAGS common to all target in this package.
+COMMON_CPPFLAGS= -I$(top_builddir)/idl \
+ -I$(top_srcdir)/src/DSC/DSC_Basic \
+ -I$(top_srcdir)/src/DSC/DSC_User \
+ -I$(top_builddir)/salome_adm/unix \
+ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
+
+# This local variable defines the list of dependant libraries common to all target in this package.
+COMMON_LIBS =
+
+#
+# ===============================================================
+# Libraries targets
+# ===============================================================
+#
+
+lib_LTLIBRARIES = libSalomeDSCSupervBasic.la
+
+libSalomeDSCSupervBasic_la_SOURCES = basic_port_factory.cxx \
+ data_short_port_uses.cxx \
+ data_short_port_provides.cxx
+
+libSalomeDSCSupervBasic_la_CXXFLAGS = $(COMMON_CPPFLAGS)
+
+libSalomeDSCSupervBasic_la_LDFLAGS = -no-undefined -version-info=0:0:0
+
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : basic_port_factory.cxx
+// Author : André RIBES (EDF)
+// Module : KERNEL
+
+#include "basic_port_factory.hxx"
+
+basic_port_factory::basic_port_factory() {}
+
+basic_port_factory::~basic_port_factory() {}
+
+provides_port *
+basic_port_factory::create_data_servant(string type) {
+ provides_port * rtn_port = NULL;
+ if (type == "short") {
+ rtn_port = new data_short_port_provides();
+ }
+ return rtn_port;
+}
+
+uses_port *
+basic_port_factory::create_data_proxy(string type) {
+ uses_port * rtn_port = NULL;
+ if (type == "short")
+ rtn_port = new data_short_port_uses();
+ return rtn_port;
+}
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : basic_port_factory.hxx
+// Author : André RIBES (EDF)
+// Module : KERNEL
+
+#ifndef _BASIC_PORT_FACTORY_HXX_
+#define _BASIC_PORT_FACTORY_HXX_
+
+#include "data_short_port_provides.hxx"
+#include "data_short_port_uses.hxx"
+
+using namespace std;
+
+/*! \class basic_port_factory
+ * \brief This class is an example of factory for DSC_User ports.
+ *
+ * This class implements the methods to be able
+ * to be used by Superv_Component_i.
+ * It builds basic ports.
+ */
+class basic_port_factory
+{
+ public:
+ basic_port_factory();
+ virtual ~basic_port_factory();
+
+ /*!
+ * This method creates a provides port of Basic ports.
+ *
+ * \param type the basic port's type.
+ * \return a pointer of the provides port.
+ */
+ virtual provides_port * create_data_servant(string type);
+
+ /*!
+ * This method creates a uses port of Basic ports.
+ *
+ * \param type the basic port's type.
+ * \return a pointer of the uses port.
+ */
+ virtual uses_port * create_data_proxy(string type);
+};
+
+#endif
+
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : data_short_port_provides.cxx
+// Author : André RIBES (EDF)
+// Module : KERNEL
+
+#include "data_short_port_provides.hxx"
+
+data_short_port_provides::data_short_port_provides() {
+ _val = 0;
+}
+
+data_short_port_provides::~data_short_port_provides() {}
+
+void
+data_short_port_provides::put(CORBA::Short data) {
+ _val = data;
+}
+
+CORBA::Short
+data_short_port_provides::get() {
+ return _val;
+}
+
+Ports::Port_ptr
+data_short_port_provides::get_port_ref() {
+ return this->_this();
+}
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : data_short_port_provides.hxx
+// Author : André RIBES (EDF)
+// Module : KERNEL
+
+#ifndef _DATA_SHORT_PORT_PROVIDES_HXX_
+#define _DATA_SHORT_PORT_PROVIDES_HXX_
+
+#include <iostream>
+#include "SALOME_Ports.hh"
+#include "provides_port.hxx"
+
+/*! \class data_short_port_provides
+ * \brief This class a port that sends a CORBA short with
+ * the basic port policy.
+ */
+class data_short_port_provides :
+ public virtual POA_Ports::Data_Short_Port,
+ public virtual provides_port
+{
+ public :
+ data_short_port_provides();
+ virtual ~data_short_port_provides();
+
+ /*!
+ * This method implements the CORBA method of the interface.
+ * \see Ports::Data_Short_Port::put
+ */
+ virtual void put(CORBA::Short data);
+
+ /*!
+ * This method is used by the component to get
+ * the last value received.
+ *
+ * \return the last value received (default 0).
+ */
+ virtual CORBA::Short get();
+
+ /*!
+ * This method gives the port CORBA reference.
+ *
+ * \return port's CORBA reference.
+ */
+ virtual Ports::Port_ptr get_port_ref();
+
+ private :
+ CORBA::Short _val;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : data_short_port_uses.cxx
+// Author : André RIBES (EDF)
+// Module : KERNEL
+
+#include "data_short_port_uses.hxx"
+#include <iostream>
+using namespace std;
+
+data_short_port_uses::data_short_port_uses() {
+ _my_port = Ports::Data_Short_Port::_nil();
+ _my_ports = NULL;
+}
+
+data_short_port_uses::~data_short_port_uses() {}
+
+const char *
+data_short_port_uses::get_repository_id() {
+ return "IDL:Ports/Data_Short_Port:1.0";
+}
+
+bool
+data_short_port_uses::set_port(Ports::Port_ptr port) {
+ _my_port = Ports::Data_Short_Port::_narrow(port);
+}
+
+void
+data_short_port_uses::put(CORBA::Short data) {
+// if (!CORBA::is_nil(_my_port))
+// _my_port->put(data);
+ if (!_my_ports)
+ cerr << "data_short_port_uses::put is NULL" << endl;
+ else
+ {
+ for(int i = 0; i < _my_ports->length(); i++)
+ {
+ Ports::Data_Short_Port_ptr port = Ports::Data_Short_Port::_narrow((*_my_ports)[i]);
+ port->put(data);
+ }
+ }
+}
+
+void
+data_short_port_uses::uses_port_changed(Engines::DSC::uses_port * new_uses_port,
+ const Engines::DSC::Message message)
+{
+ if (_my_ports)
+ delete _my_ports;
+
+ cerr << "data_short_port_uses::uses_port_changed" << endl;
+ _my_ports = new Engines::DSC::uses_port(*new_uses_port);
+}
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : data_short_port_uses.hxx
+// Author : André RIBES (EDF)
+// Module : KERNEL
+
+#ifndef _DATA_SHORT_PORT_USES_HXX_
+#define _DATA_SHORT_PORT_USES_HXX_
+
+#include "uses_port.hxx"
+#include "SALOME_Ports.hh"
+
+/*! \class data_short_port_uses
+ * \brief This class a port that sends a CORBA short with
+ * the basic port policy.
+ */
+class data_short_port_uses :
+ public virtual uses_port
+{
+ public :
+ data_short_port_uses();
+ virtual ~data_short_port_uses();
+
+ /*!
+ * This method is used by the component to get
+ * port's CORBA repository id
+ *
+ * \return port's CORBA repository id
+ */
+ virtual const char * get_repository_id();
+
+ /*!
+ * \warning deprecated
+ */
+ virtual bool set_port(Ports::Port_ptr port);
+
+ /*!
+ * This method is used by the component to send
+ * a short value to all the provides ports connected.
+ *
+ * \param data the short sended.
+ */
+ virtual void put(CORBA::Short data);
+
+ /*!
+ * This method is a callback for be aware of modification
+ * of the port's connections.
+ *
+ * \param new_uses_port the new uses port's sequence.
+ * \param message message associated to the modification.
+ */
+ virtual void uses_port_changed(Engines::DSC::uses_port * new_uses_port,
+ const Engines::DSC::Message message);
+
+ private :
+ Ports::Data_Short_Port_ptr _my_port;
+ Engines::DSC::uses_port * _my_ports;
+};
+
+#endif
+
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : DSC_Exception.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+
+#ifndef DSC_EXCEPTION_HXX
+#define DSC_EXCEPTION_HXX
+
+#include "Utils_SALOME_Exception.hxx"
+#include <string>
+#include <iostream>
+#include <sstream>
+#include <memory>
+
+#include "utilities.h"
+
+#ifndef WNT
+extern "C"
+{
+#endif
+#include <string.h>
+#ifndef WNT
+}
+#endif
+
+
+#ifdef _DEBUG_
+# ifdef __GNUC__
+# define LOC(message) (message), __FILE__ , __LINE__ , __FUNCTION__
+# else
+# define LOC(message) (message), __FILE__, __LINE__
+# endif
+#else
+# define LOC(message) (message)
+#endif
+
+
+#ifndef SWIG
+/**
+ * Class OSS is useful when streaming data through a function
+ * that expect a string as parameter
+ */
+class OSS
+{
+private:
+ std::ostringstream oss_;
+
+public:
+ explicit OSS() : oss_() {}
+
+ template <class T>
+ OSS & operator<<(T obj)
+ {
+ oss_ << obj;
+ return *this;
+ }
+
+ operator std::string()
+ {
+ return oss_.str();
+ }
+
+ // Surtout ne pas écrire le code suivant:
+ // car oss_.str() renvoie une string temporaire
+ // operator const char*()
+ // {
+ // return oss_.str().c_str();
+ // }
+
+}; /* end class OSS */
+#endif
+
+
+// Cette fonction provient de Utils_SALOME_Exception
+// Solution pas très élégante mais contrainte par les manques de la classe SALOME_Exception
+const char *makeText( const char *text, const char *fileName, const unsigned int lineNumber);
+
+struct DSC_Exception : public SALOME_Exception {
+
+ // Attention, en cas de modification des paramètres par défaut
+ // il est necessaire de les repporter dans la macro DSC_EXCEPTION ci-dessous
+ // Le constructeur de la SALOME_Exception demande une chaine non vide
+ // Du coup on est obliger de la désallouer avant d'y mettre la notre
+ // car le what n'est pas virtuel donc il faut que le contenu de SALOME_Exception::_text
+ // soit utilisable.
+ // Ne pas mettre lineNumber=0 à cause du calcul log dans la SALOME_Exception si fileName est défini
+ DSC_Exception( const std::string & text,
+ const char *fileName="",
+ const unsigned int lineNumber=0,
+ const char *funcName="" ):
+ SALOME_Exception(text.c_str()) ,
+ _dscText(text),
+ _filefuncName(setFileFuncName(fileName?fileName:"",funcName?funcName:"")),
+ _lineNumber(lineNumber),
+ _exceptionName("DSC_Exception")
+ {
+ // Mise en cohérence avec l'exception SALOME (à revoir)
+ delete [] ((char*)SALOME_Exception::_text);
+ if (! _filefuncName.empty() )
+ SALOME_Exception::_text = makeText(text.c_str(),_filefuncName.c_str(),lineNumber) ;
+ else
+ SALOME_Exception::_text = makeText(text.c_str(),0,lineNumber) ;
+
+ OSS oss ;
+ oss << _exceptionName ;
+ if (!_filefuncName.empty() ) oss << " in " << _filefuncName;
+ if (_lineNumber) oss << " [" << _lineNumber << "]";
+ oss << " : " << _dscText;
+ _what = oss;
+ }
+
+ virtual const char* what( void ) const throw ()
+ {
+ return _what.c_str() ;
+ }
+
+ // L'opérateur = de SALOME_Exception n'est pas défini
+ // problème potentiel concernant la recopie de son pointeur _text
+
+ // Le destructeur de la SALOME_Exception devrait être virtuel
+ // sinon pb avec nos attributs de type pointeur.
+ virtual ~DSC_Exception(void) throw() {};
+
+private:
+
+ std::string setFileFuncName(const char * fileName, const char * funcName) {
+ ASSERT(fileName);
+ ASSERT(funcName);
+ OSS oss;
+ if ( strcmp(fileName,"") )
+ oss << fileName << "##" << funcName;
+
+ return oss;
+ };
+
+ //DSC_Exception(void) {};
+protected:
+ std::string _dscText;
+ std::string _filefuncName;
+ std::string _exceptionName;
+ int _lineNumber;
+ std::string _what;
+};
+
+#define DSC_EXCEPTION(Derived) struct Derived : public DSC_Exception { \
+ Derived ( const std::string & text, const char *fileName="", const unsigned int lineNumber=0, const char *funcName="" \
+ ) : DSC_Exception(text,fileName,lineNumber,funcName) { \
+ _exceptionName = #Derived; \
+ } \
+ virtual ~Derived(void) throw();\
+};\
+
+//Sert à eviter le problème d'identification RTTI des exceptions
+//Crée un unique typeInfo pour tous les bibliothèques composants SALOME
+//dans un fichier cxx
+#define DSC_EXCEPTION_CXX(NameSpace,Derived) NameSpace::Derived::~Derived(void) throw() {};
+
+#endif /* DSC_EXCEPTION_HXX */
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : AdjacentFunctor.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-01-24 16:30:34 +0100 (mer, 24 jan 2007) $
+// Id : $Id$
+
+
+#ifndef _ADJACENT_FUNCTOR_HXX_
+#define _ADJACENT_FUNCTOR_HXX_
+
+#include "ConstTraits.hxx"
+// Pour affichage
+#include "DisplayPair.hxx"
+//
+
+// Suppose que le container est trié
+template < typename T > struct AdjacentFunctor {
+
+ typedef typename ConstTrait<T>::NonConstType TNoConst;
+ const T & _minValue;
+ T _maxValue;
+ TNoConst _max;
+ TNoConst _min;
+ bool _minFound,_maxFound,_equal;
+
+ AdjacentFunctor(const T& value):_minValue(value),_maxValue(value),
+ _minFound(false),_maxFound(false),
+ _equal(false) {}
+
+ // Suppose que les valeurs passées en paramètres sont triées par ordre croissant
+ bool operator()(const T &v1) {
+ std::cout << "AdjacentFunctor: " << _minValue << _maxValue << std::endl;
+ std::cout << "AdjacentFunctor: " << _min << _max << std::endl;
+ if ( v1 <= _minValue && v1 >= _maxValue)
+ {
+ _equal= true;
+ std::cout << "AdjacentFunctor: _equal : " << v1 << std::endl;
+ return true;
+ }
+ if ( v1 < _minValue )
+ {
+ _min=v1;_minFound=true;
+ std::cout << "AdjacentFunctor: _minFound : " <<_min << std::endl;
+ }
+ else if ( v1 > _maxValue )
+ {
+ _max=v1;_maxFound=true;
+ std::cout << "AdjacentFunctor: _maxFound : " <<_max << std::endl;
+ }
+
+
+ /*
+ if ( v1 < _minValue) {
+ std::cout << "EE1: _min : " << _min << std::endl;
+ _min=v1;_minFound=true;
+ std::cout << "AdjacentFunctor: _minFound : " <<_min << ", _minValue " << _minValue << std::endl;
+ } else if ( v1 > _maxValue ) {
+ _max=v1;_maxFound=true;
+ std::cout << "AdjacentFunctor: _maxFound : " <<_max << ", _maxValue " << _maxValue << std::endl;
+ } else {
+ _equal= true;
+ std::cout << "AdjacentFunctor: _equal : " << v1<< ", _minValue " << _minValue << ", _maxValue " << _maxValue << std::endl;
+ return true;
+ } // end if
+ */
+
+ //std::cout << "AdjacentFunctor: _minFound : " <<_min << ", _maxFound " << _max << std::endl;
+ return ( _minFound && _maxFound );
+ }
+
+ void setMaxValue(const T & value) {_maxValue = value;}
+ bool isEqual() const { return _equal;}
+ bool isBounded() const { return _minFound && _maxFound;}
+ bool getBounds(TNoConst & min, TNoConst & max) const {
+ std::cout << "_minFound : " <<_minFound << ", _maxFound " << _maxFound << std::endl;
+ if (_minFound && _maxFound ) { min=_min; max=_max; return true; }
+ return false;
+ }
+ void reset() { _minFound = false; _maxFound = false; _equal = false; };
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : AdjacentPredicate.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $
+// Id : $Id$
+
+#ifndef __ADJACENT_PREDICATE__
+#define __ADJACENT_PREDICATE__
+
+#include <functional>
+#include <utility>
+#include "DisplayPair.hxx"
+
+template < typename T >
+struct AdjacentPredicate : public std::binary_function < T, T, bool >
+{
+ T _value;
+ AdjacentPredicate(const T& value):_value(value){}
+ bool operator()(const T &v1, const T& v2) const {
+ return (v1 <= _value ) && (_value < v2) ;
+ }
+};
+
+// Pour les MAPs avec une clef sous forme de pair
+template <typename T1, typename T2, typename T3>
+struct AdjacentPredicate< std::pair<const std::pair<T1,T2>, T3 > > :
+ public std::binary_function < std::pair<const std::pair<T1,T2>, T3 >,
+ std::pair<const std::pair<T1,T2>, T3 >, bool >
+{
+ std::pair<T1,T2> _value;
+ AdjacentPredicate(const std::pair<T1,T2> & value):_value(value){
+ std::cout << "1-Initializing with value " << _value << std::endl;
+ }
+ bool operator()( const std::pair<const std::pair<T1,T2>, T3 > & v1,
+ const std::pair<const std::pair<T1,T2>, T3 > v2) const {
+ std::cout << "1-> :" << v1 << "," << v2 << " " << std::endl;
+ return (v1.first <= _value ) && (_value < v2.first) ;
+ }
+};
+
+template <typename T1, typename T2>
+struct AdjacentPredicate< std::pair<T1,T2> > : public std::binary_function < std::pair<T1,T2>, std::pair<T1,T2>, bool >
+{
+ T1 _value;
+ AdjacentPredicate(const T1 & value):_value(value){
+ std::cout << "2-Initializing with value " << _value << std::endl;
+ }
+ bool operator()( const std::pair<T1,T2> & v1, const std::pair<T1,T2>& v2) const {
+ std::cout << "2-> :" << &(v1.first) << "," << &(v2.first) << " " << std::endl;
+ return (v1.first <= _value ) && (_value < v2.first) ;
+ }
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : Calcium.c
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Id : $Id$
+
+#include "calcium.h"
+#include <stdlib.h>
+#include <stdio.h>
+
+// Interface C de SalomeCalcium
+
+typedef int InfoType;
+typedef int bool;
+
+// INTERFACES DE LECTURE
+
+
+// Definition des méthodes calcium étendues
+// permettant le 0 copy.
+//const char * nomvar
+#define CALCIUM_EXT_LECT_INTERFACE_C_(_name,_timeType,_type,_typeName,_qual) \
+ InfoType ecp_##_name (void * component, int mode, \
+ _timeType * ti, _timeType * tf, int * i, \
+ char * nomvar, int bufferLength, \
+ int * nRead, _type _qual ** data ) { \
+ size_t _nRead; \
+ long _i=*i; \
+ \
+ /* std::cerr << "-------- CalciumInterface(C Part) MARK 1 ------------------" << std::endl; */ \
+ InfoType info = ecp_lecture_##_typeName (component, mode, ti, tf, &_i, \
+ nomvar, bufferLength, &_nRead, \
+ data ); \
+ /* std::cout << "-------- CalciumInterface(C Part), Valeur de data : " << std::endl; */ \
+ /* std::cout << "Ptr :" << *data << std::endl; */ \
+ /* for (int j=0; j<_nRead;++j) */ \
+ /* printf("--- Valeur de data[%d] : %d \n",j,(*data)[j]); */ \
+ /* std::cout << "Ptr :" << *data << std::endl; */ \
+ /* */ \
+ /* std::cerr << "-------- CalciumInterface(C Part) MARK 2 ------------------" << std::endl; */ \
+ if(mode == CP_SEQUENTIEL) \
+ *i = _i; \
+ *nRead=_nRead; \
+ /* std::cerr << "-------- CalciumInterface(C Part) MARK 3 ------------------" << std::endl; */ \
+ \
+ return info; \
+ }; \
+ void ecp_##_name##_free ( _type _qual * data) { \
+ ecp_lecture_##_typeName##_free(data); \
+ };
+
+CALCIUM_EXT_LECT_INTERFACE_C_(len,float,int,int,);
+CALCIUM_EXT_LECT_INTERFACE_C_(lre,float,float,float,);
+CALCIUM_EXT_LECT_INTERFACE_C_(ldb,double,double,double,);
+CALCIUM_EXT_LECT_INTERFACE_C_(llo,float,bool,bool,);
+CALCIUM_EXT_LECT_INTERFACE_C_(lcp,float,float,cplx,);
+#define STAR *
+// CALCIUM_EXT_LECT_INTERFACE_C_(lch,float,char,STAR[]);
+// La signature n'est pas la même pour les chaines de caractères il y a aussi
+// la taille des chaines
+
+//const char * nomvar
+
+#define CALCIUM_LECT_INTERFACE_C_(_name,_timeType,_type,_typeName,_qual) \
+ InfoType cp_##_name (void * component, int mode, \
+ _timeType * ti, _timeType * tf, int * i, \
+ char * nomvar, int bufferLength, \
+ int * nRead, _type _qual * data ) { \
+ size_t _nRead; \
+ long _i=*i; \
+ fflush(stdout); \
+ fflush(stderr); \
+ fprintf(stderr,"Beginning of CPLxx: %s %d %f\n",nomvar,*i,*ti); \
+ \
+ if ( (data == NULL) || (bufferLength < 1) ) return CPNTNULL; \
+ \
+ InfoType info = ecp_lecture_##_typeName (component, mode, ti, tf, &_i, \
+ nomvar, bufferLength, &_nRead, \
+ &data ); \
+ if(mode == CP_SEQUENTIEL) \
+ *i = _i; \
+ *nRead=_nRead; \
+ fprintf(stderr,"End of CPLxx: %s %d \n",nomvar,*i); \
+ fflush(stdout); \
+ fflush(stderr); \
+ \
+ return info; \
+ }; \
+ void cp_##_name##_free ( _type _qual * data) { \
+ ecp_lecture_##_typeName##_free(data); \
+ };
+
+
+// Definition des méthodes calcium standard
+
+CALCIUM_LECT_INTERFACE_C_(len,float,int,int,);
+CALCIUM_LECT_INTERFACE_C_(lre,float,float,float,);
+CALCIUM_LECT_INTERFACE_C_(ldb,double,double,double,);
+CALCIUM_LECT_INTERFACE_C_(llo,float,bool,bool,);
+CALCIUM_LECT_INTERFACE_C_(lcp,float,float,cplx,);
+#define STAR *
+// CALCIUM_LECT_INTERFACE_C_(lch,float,char,STAR);
+
+
+// INTERFACES DE DÉBUT ET DE FIN DE COUPLAGE
+
+InfoType cp_cd (void * component, char * instanceName) {
+ /* TODO : Trouver le nom de l'instance SALOME*/
+ if (instanceName) strcpy(instanceName,"UNDEFINED");
+ return CPOK;
+}
+InfoType cp_fin (void * component, int code) {
+ /* TODO : gérer avec les callbacks des ports DSC */
+
+ InfoType info = ecp_fin_(component,code);
+
+ return info;
+}
+
+
+
+#define CALCIUM_ECR_INTERFACE_C_(_name,_timeType,_type,_typeName,_qual) \
+ InfoType cp_##_name (void * component, int mode, \
+ _timeType t, int i, \
+ char * nomvar, int nbelem, \
+ _type _qual * data ) { \
+ \
+ /*long _i=i;*/ \
+ fflush(stdout); \
+ fflush(stderr); \
+ fprintf(stderr,"Beginning of CPExx: %s %d %f\n",nomvar,i,t); \
+ if ( (data == NULL) || (nbelem < 1) ) return CPNTNULL; \
+ printf("cp_name : Valeur de nomvar %s\n",nomvar); \
+ \
+ InfoType info = ecp_ecriture_##_typeName (component, mode, &t, i, \
+ nomvar, nbelem, \
+ data ); \
+ fprintf(stderr,"End of CPExx: %s %d \n",nomvar,i); \
+ fflush(stdout); \
+ fflush(stderr); \
+ \
+ return info; \
+ }; \
+
+
+// Definition des méthodes calcium standard
+
+CALCIUM_ECR_INTERFACE_C_(een,float,int,int,);
+CALCIUM_ECR_INTERFACE_C_(ere,float,float,float,);
+CALCIUM_ECR_INTERFACE_C_(edb,double,double,double,);
+CALCIUM_ECR_INTERFACE_C_(elo,float,bool,bool,);
+CALCIUM_ECR_INTERFACE_C_(ecp,float,float,cplx,);
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : CalciumCouplingPolicy.cxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Id : $Id$
+
+#include "CalciumCouplingPolicy.hxx"
+
+CalciumCouplingPolicy::CalciumCouplingPolicy():_dependencyType(CalciumTypes::UNDEFINED_DEPENDENCY),
+ _storageLevel(CalciumTypes::UNLIMITED_STORAGE_LEVEL),
+ _dateCalSchem(CalciumTypes::TI_SCHEM),
+ _interpolationSchem(CalciumTypes::L1_SCHEM),
+ _extrapolationSchem(CalciumTypes::UNDEFINED_EXTRA_SCHEM),
+ _alpha(0.0),_deltaT(CalciumTypes::EPSILON),
+ _disconnectDirective(CalciumTypes::UNDEFINED_DIRECTIVE){};
+
+void CalciumCouplingPolicy::setDependencyType (CalciumTypes::DependencyType dependencyType) {_dependencyType=dependencyType;}
+CalciumTypes::DependencyType CalciumCouplingPolicy::getDependencyType () const { return _dependencyType;}
+
+void CalciumCouplingPolicy::setStorageLevel (size_t storageLevel) {
+ if ( storageLevel < 1 && (storageLevel != CalciumTypes::UNLIMITED_STORAGE_LEVEL) )
+ throw DATASTREAM_EXCEPTION(LOC("Un niveau < 1 n'est pas autorisé"));
+ _storageLevel = storageLevel;
+}
+size_t CalciumCouplingPolicy::getStorageLevel () const {return _storageLevel;}
+void CalciumCouplingPolicy::setDateCalSchem (CalciumTypes::DateCalSchem dateCalSchem) {
+ if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY )
+ throw DATASTREAM_EXCEPTION(LOC("Il est impossible de positionner un schéma temporel sur un port qui n'est pas en dépendance temporelle"));
+ _dateCalSchem = dateCalSchem;
+}
+
+CalciumTypes::DateCalSchem CalciumCouplingPolicy::getDateCalSchem () const { return _dateCalSchem; }
+
+void CalciumCouplingPolicy::setAlpha(double alpha) {
+ if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY )
+ throw DATASTREAM_EXCEPTION(LOC("Il est impossible de positionner alpha sur un port qui n'est pas en dépendance temporelle"));
+
+ if ( 0 <= alpha <= 1 ) _alpha = alpha;
+ else
+ throw DATASTREAM_EXCEPTION(LOC("Le paramètre alpha doit être compris entre [0,1]"));
+}
+
+double CalciumCouplingPolicy::getAlpha() const { return _alpha; }
+
+void CalciumCouplingPolicy::setDeltaT(double deltaT ) {
+ if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY )
+ throw DATASTREAM_EXCEPTION(LOC("Le paramètre deltaT sur un port qui n'est pas en dépendance temporelle n'a pas de sens"));
+ if ( 0 <= deltaT <= 1 ) _deltaT = deltaT;
+ else
+ throw(DATASTREAM_EXCEPTION(LOC("Le paramètre deltaT doit être compris entre [0,1]")));
+}
+double CalciumCouplingPolicy::getDeltaT() const {return _deltaT;}
+
+void CalciumCouplingPolicy::setInterpolationSchem (CalciumTypes::InterpolationSchem interpolationSchem) {
+ if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY )
+ throw DATASTREAM_EXCEPTION(LOC("Le paramètre InterpolationSchem sur un port qui n'est pas en dépendance temporelle n'a pas de sens"));
+ _interpolationSchem=interpolationSchem;
+}
+
+void CalciumCouplingPolicy::setExtrapolationSchem (CalciumTypes::ExtrapolationSchem extrapolationSchem) {
+ if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY )
+ throw DATASTREAM_EXCEPTION(LOC("Le paramètre ExtrapolationSchem sur un port qui n'est pas en dépendance temporelle n'a pas de sens"));
+_extrapolationSchem=extrapolationSchem;
+}
+
+CalciumTypes::InterpolationSchem CalciumCouplingPolicy::getInterpolationSchem () const { return _interpolationSchem; };
+CalciumTypes::ExtrapolationSchem CalciumCouplingPolicy::getExtrapolationSchem () const { return _extrapolationSchem; };
+
+
+CalciumCouplingPolicy::TimeType
+CalciumCouplingPolicy::getEffectiveTime(CalciumCouplingPolicy::TimeType ti,
+ CalciumCouplingPolicy::TimeType tf) {
+ if ( _dateCalSchem == CalciumTypes::TI_SCHEM ) return ti;
+ if ( _dateCalSchem == CalciumTypes::TF_SCHEM ) return tf;
+
+ //CalciumTypes::ALPHA_SCHEM
+ return tf*_alpha + ti*(1-_alpha);
+}
+
+void CalciumCouplingPolicy::disconnect(bool provideLastGivenValue) {
+ // TODO Réveiller les ports en attente ! OU timeout ?
+ if (provideLastGivenValue) {
+ std::cout << "-------- CalciumCouplingPolicy::disconnect CP_CONT ------------------" << std::endl;
+ _disconnectDirective = CalciumTypes::CONTINUE;
+ } else {
+ std::cout << "-------- CalciumCouplingPolicy::disconnect CP_ARRET ------------------" << std::endl;
+ _disconnectDirective = CalciumTypes::STOP;
+ }
+ //Wakeup get data if any
+ //wakeupWaiting();
+
+// if (waitingForAnyDataId || waitingForConvenientDataId);
+// cond_instance.signal();
+
+}
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : CalciumCouplingPolicy.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Id : $Id$
+
+#ifndef __CALCIUM_COUPLING_POLICY__
+#define __CALCIUM_COUPLING_POLICY__
+
+#include <vector>
+#include <map>
+#include "DisplayPair.hxx"
+#include "CouplingPolicy.hxx"
+#include "AdjacentFunctor.hxx"
+#include "lambda.hpp"
+#include "CalciumTypes.hxx"
+#include "DSC_Exception.hxx"
+typedef DSC_Exception DATASTREAM_EXCEPTION;
+
+class CalciumCouplingPolicy : public CouplingPolicy {
+
+
+public:
+
+ template <typename T_TIME, typename T_TAG > class InternalDataIdContainer;
+ template <typename T_TIME, typename T_TAG > friend class InternalDataIdContainer;
+ template <typename DataManipulator > friend class BoundedDataIdProcessor;
+ template <typename DataManipulator > friend class EraseDataIdProcessor;
+ template <typename DataManipulator > friend class DisconnectProcessor;
+
+ typedef CalciumTypes::DependencyType DependencyType;
+ typedef CalciumTypes::DateCalSchem DateCalSchem;
+ typedef CalciumTypes::InterpolationSchem InterpolationSchem;
+ typedef CalciumTypes::ExtrapolationSchem ExtrapolationSchem;
+ typedef CalciumTypes::DisconnectDirective DisconnectDirective;
+
+private:
+ DependencyType _dependencyType;
+ size_t _storageLevel;
+ DateCalSchem _dateCalSchem;
+ InterpolationSchem _interpolationSchem;
+ ExtrapolationSchem _extrapolationSchem;
+ double _alpha;
+ double _deltaT;
+ DisconnectDirective _disconnectDirective;
+
+public:
+ CalciumCouplingPolicy();
+
+ void setDependencyType (DependencyType dependencyType);
+ DependencyType getDependencyType () const;
+
+ void setStorageLevel (size_t storageLevel);
+ size_t getStorageLevel () const;
+
+ void setDateCalSchem (DateCalSchem dateCalSchem);
+ DateCalSchem getDateCalSchem () const;
+
+ void setAlpha(double alpha);
+ double getAlpha() const ;
+
+ void setDeltaT(double deltaT );
+ double getDeltaT() const ;
+
+ void setInterpolationSchem (InterpolationSchem interpolationSchem);
+ void setExtrapolationSchem (ExtrapolationSchem extrapolationSchem);
+ InterpolationSchem getInterpolationSchem () const ;
+ ExtrapolationSchem getExtrapolationSchem () const ;
+
+ // Classe DataId rassemblant les paramètres de la méthode PORT::put
+ // qui identifient l'instance d'une donnée pour Calcium
+ // Rem : Le DataId doit pouvoir être une key dans une map stl
+ // typedef CORBA::Double TimeType;
+ // typedef CORBA::Long TagType;
+ typedef double TimeType;
+ typedef long TagType;
+ typedef std::pair< TimeType , TagType > DataId;
+ typedef InternalDataIdContainer < TimeType , TagType > DataIdContainer;
+ typedef std::vector< DataId >::iterator iterator;
+
+ template <typename T_TIME, typename T_TAG >
+ struct InternalDataIdContainer;
+
+ inline TimeType getTime(const DataId &dataId) const { return dataId.first;}
+ inline TagType getTag (const DataId &dataId) const { return dataId.second;}
+
+ // TODO : Vérifier l'application pour tous les types de données
+ template <typename DataManipulator> struct BoundedDataIdProcessor;
+ template <typename DataManipulator> struct EraseDataIdProcessor;
+ template <typename DataManipulator> struct DisconnectProcessor;
+
+ // Renvoie isEqual si le dataId attendu est trouvé dans storedDataIds :
+ // - l'itérateur wDataIt1 pointe alors sur ce dataId
+ // Renvoie isBounded si le dataId attendu n'est pas trouvé mais encadrable et
+ // que la politique de couplage gére ce cas de figure
+ // - l'itérateur wDataIt1 est tel que wDataIt1->first < wdataId < (wDataIt1+1)->first
+ // Le container doit être associatif
+ template < typename AssocContainer >
+ bool isDataIdConveniant( AssocContainer & storedDatas,
+ const typename AssocContainer::key_type & expectedDataId,
+ bool & isEqual, bool & isBounded,
+ typename AssocContainer::iterator & wDataIt1) const;
+
+ TimeType getEffectiveTime(TimeType ti, TimeType tf);
+
+ void disconnect(bool provideLastGivenValue);
+ virtual void wakeupWaiting(){};
+
+}; //Fin de CalciumCouplingPolicy
+
+
+
+//************* DEFINITION DES METHODES ET OBJETS TEMPLATES *************//
+
+
+
+// Définition du container de DataId pour répondre au concept
+// de mode de couplage
+template <typename T_TIME, typename T_TAG >
+struct CalciumCouplingPolicy::InternalDataIdContainer : public std::vector< std::pair< T_TIME,T_TAG> > {
+ typedef std::vector < DataId > DataIdVect;
+
+ InternalDataIdContainer(const DataId & dataId,
+ const CalciumCouplingPolicy & policy
+ ):std::vector< std::pair< T_TIME,T_TAG> >() {
+ // Ignore les paramètres qui ne sont pas en rapport avec le type de dépendance
+ switch (policy._dependencyType) {
+ case CalciumTypes::TIME_DEPENDENCY:
+ this->push_back(DataId(dataId.first,0));
+ break;
+ case CalciumTypes::ITERATION_DEPENDENCY:
+ this->push_back(DataId(0,dataId.second));
+ break;
+ default:
+ throw(DATASTREAM_EXCEPTION(LOC("The dependency type must be set by setDependencyType before calling DataIdContainer contructor")));
+ break;
+ }
+ };
+};
+
+
+// TODO : Vérifier l'application pour tous les types de données
+// DESACTIVER POUR ?BOOL? et CHAR *
+template <typename DataManipulator>
+struct CalciumCouplingPolicy::BoundedDataIdProcessor{
+
+ CalciumCouplingPolicy _couplingPolicy;
+
+ BoundedDataIdProcessor(CalciumCouplingPolicy couplingPolicy):
+ _couplingPolicy(couplingPolicy) {};
+
+ // Méthode implémentant l'interpolation temporelle
+ template < typename MapIterator >
+ void inline apply (typename iterator_t<MapIterator>::value_type & data,
+ const DataId & dataId, const MapIterator & it1) {
+
+ typedef typename iterator_t<MapIterator>::value_type value_type;
+ typedef typename DataManipulator::InnerType InnerType;
+ typedef typename DataManipulator::Type Type;
+
+ MapIterator it2=it1; ++it2;
+ size_t dataSize1 = DataManipulator::size(it1->second);
+ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Taille de donnée dataId1 : " << dataSize1 << std::endl;
+
+ // Gérer dans calcium la limite de la taille du buffer donnée par
+ // l'utilisateur.
+ size_t dataSize2 = DataManipulator::size(it2->second);
+ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Taille de donnée dataId2 : " << dataSize2 << std::endl;
+
+ size_t dataSize = std::min< size_t >( dataSize1, dataSize2 );
+ DataId dataId2 = it2->first;
+ DataId dataId1 = it1->first;
+ TimeType t2 = dataId2.first;
+ TimeType t1 = dataId1.first;
+ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t1 : " << t1 << std::endl;
+ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t2 : " << t2 << std::endl;
+ TimeType t = dataId.first;
+ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t : " << t << std::endl;
+ TimeType timeDiff = t2-t1;
+ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de timeDiff : " << timeDiff << std::endl;
+ TimeType coeff = (t2-t)/timeDiff;
+ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de coeff : " << coeff << std::endl;
+
+ InnerType const * const InIt1 = DataManipulator::getPointer(it1->second);
+ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données à t1 : " << std::endl;
+ std::copy(InIt1,InIt1+dataSize1,std::ostream_iterator<InnerType>(std::cout," "));
+ std::cout << std::endl;
+ InnerType const * const InIt2 = DataManipulator::getPointer(it2->second);
+ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données à t2 : " << std::endl;
+ std::copy(InIt2,InIt2+dataSize2,std::ostream_iterator<InnerType>(std::cout," "));
+ std::cout << std::endl;
+ Type dataOut = DataManipulator::create(dataSize);
+ InnerType * const OutIt = DataManipulator::getPointer(dataOut);
+
+ if ( timeDiff == 0.0 || _couplingPolicy._interpolationSchem == CalciumTypes::L0_SCHEM ) {
+ std::copy(InIt1,InIt1+dataSize,OutIt);
+ } else {
+
+ boost::lambda::placeholder1_type _1;
+ boost::lambda::placeholder2_type _2;
+ // REM : Pour des buffers de type int
+ // le compilo indiquera warning: converting to `long int' from `Double'
+ std::transform(InIt1,InIt1+dataSize,InIt2,OutIt,
+ ( _1 - _2 ) * coeff + _2 );
+ }
+ std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données calculées à t : " << std::endl;
+ std::copy(OutIt,OutIt+dataSize,std::ostream_iterator<InnerType>(std::cout," "));
+ std::cout << std::endl;
+ data = dataOut;
+
+ }
+};
+
+// Renvoie isEqual si le dataId attendu est trouvé dans storedDataIds :
+// - l'itérateur wDataIt1 pointe alors sur ce dataId
+// Renvoie isBounded si le dataId attendu n'est pas trouvé mais encadrable et
+// que la politique de couplage gére ce cas de figure
+// - l'itérateur wDataIt1 est tel que wDataIt1->first < wdataId < (wDataIt1+1)->first
+// Le container doit être associatif
+template < typename AssocContainer >
+bool CalciumCouplingPolicy::isDataIdConveniant( AssocContainer & storedDatas, const typename AssocContainer::key_type & expectedDataId,
+ bool & isEqual, bool & isBounded, typename AssocContainer::iterator & wDataIt1) const {
+
+ // Rem : le type key_type == DataId
+ typedef typename AssocContainer::key_type key_type;
+ AdjacentFunctor< key_type > af(expectedDataId);
+ if ( _dependencyType == CalciumTypes::TIME_DEPENDENCY )
+ {
+ std::cout << "-------- time expected : " << expectedDataId.first << std::endl;
+ std::cout << "-------- time expected corrected : " << expectedDataId.first*(1.0-_deltaT) << std::endl;
+ af.setMaxValue(key_type(expectedDataId.first*(1.0-_deltaT),0));
+ }
+ isBounded = false;
+
+ // Rem 1 :
+ // L'algo adjacent_find ne peut être utilisé avec l'AdjacentPredicate
+ // - si la table contient un seul élément l'algorithme adjacent_find retourne end()
+ // que se soit l'élément attendu ou non
+ // - si la table contient deux éléments dont le dernier est celui recherché
+ // l'algorithme adjacent_find retourne end() aussi
+ // d'ou la necessité d'effectuer un find avant ou d'écrire un algorithme ad hoc
+
+ // Rem 2 :
+ //
+ // L'algo find_if ne peut être utilisé car il recopie l'AdjacentFunctor
+ // qui ne peut alors pas mémoriser ses états précédents
+ //
+
+ // Un codage en reverse serait plus efficace
+ typename AssocContainer::iterator prev = storedDatas.begin();
+ typename AssocContainer::iterator current = prev;
+ while ( (current != storedDatas.end()) && !af(current->first) )
+ {
+ std::cout << "------- stored time : " << current->first << std::endl;
+ // if ( af(current->first) ) break;
+ prev = current++;
+ }
+
+ isEqual = af.isEqual();
+
+ // On considère qu'il n'est pas possible d'encadrer en dépendance itérative,
+ // on se veut pas calculer d'interpolation.
+ if ( _dependencyType == CalciumTypes::TIME_DEPENDENCY) isBounded = af.isBounded();
+
+ if ( isEqual ) wDataIt1 = current;
+ else
+ if (isBounded) wDataIt1 = prev;
+ else
+ wDataIt1 = storedDatas.end();
+
+ std::cout << "-------- isDataIdConvenient : isEqual : " << isEqual << " , isBounded " << isBounded << std::endl;
+
+ return isEqual || isBounded;
+}
+
+// PAS ENCORE TESTE AVEC UN NIVEAU POSITIONNE
+// Supprime les DataId et les données associées
+// du container associative quand le nombre
+// de données stockées dépasse le niveau CALCIUM.
+// Cette méthode est appelée de GenericPort::Get
+// TODO : Elle devrait également être appelée dans GenericPort::Put
+// mais il faut étudier les interactions avec GenericPort::Get et GenericPort::next
+template < typename DataManipulator >
+struct CalciumCouplingPolicy::EraseDataIdProcessor {
+
+ CalciumCouplingPolicy _couplingPolicy;
+
+ EraseDataIdProcessor(CalciumCouplingPolicy couplingPolicy):
+ _couplingPolicy(couplingPolicy) {};
+
+ template < typename Container >
+ void apply(Container & storedDatas,
+ typename Container::iterator & wDataIt1 ) const {
+
+ typedef typename Container::key_type key_type;
+ typedef typename Container::value_type value_type;
+ typedef typename Container::iterator iterator;
+
+ std::cout << "-------- CalciumCouplingPolicy::eraseDataId, storedDatasSize : " << storedDatas.size() << std::endl;
+
+ if ( _couplingPolicy._storageLevel == CalciumTypes::UNLIMITED_STORAGE_LEVEL ) return;
+
+ size_t storedDatasSize = storedDatas.size();
+ long s = storedDatasSize - _couplingPolicy._storageLevel;
+ if (s > 0 ) {
+ size_t dist=distance(storedDatas.begin(),wDataIt1);
+ for (int i=0; i<s; ++i) {
+ DataManipulator::delete_data((*storedDatas.begin()).second);
+ storedDatas.erase(storedDatas.begin());
+ }
+ // Si l'itérateur pointait sur une valeur que l'on vient de supprimer
+ if (dist < s ) {
+ throw(DATASTREAM_EXCEPTION(LOC(OSS()<< "La gestion du niveau CALCIUM "
+ << _couplingPolicy._storageLevel <<
+ " vient d'entraîner la suppression de la donnée à renvoyer")));
+ }
+ }
+ std::cout << "-------- CalciumCouplingPolicy::eraseDataId, new storedDatasSize : " << storedDatas.size() << std::endl;
+ return;
+
+ }
+};
+
+
+// Lorsque cette méthode est appelée l'expectedDataId n'a pas été trouvé
+// et n'est pas non plus encadrée (en mode temporel)
+// Si l'on effectue pas de traitement particulier la méthode renvoie false
+// Si le port a reçu une directive STOP une exception est levée
+// Si le port a reçu une directive CONTINUE, on localise l'expected
+template < typename DataManipulator >
+struct CalciumCouplingPolicy::DisconnectProcessor {
+
+ CalciumCouplingPolicy _couplingPolicy;
+
+ DisconnectProcessor(CalciumCouplingPolicy couplingPolicy):
+ _couplingPolicy(couplingPolicy) {};
+
+ template < typename Container, typename DataId >
+ bool apply(Container & storedDatas,
+ const DataId & expectedDataId,
+ typename Container::iterator & wDataIt1 ) const {
+
+ typedef typename Container::key_type key_type;
+ typedef typename Container::value_type value_type;
+ typedef typename Container::iterator iterator;
+
+ // Pas de traitement particulier a effectuer
+ std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK1 --------" << std::endl;
+ if ( _couplingPolicy._disconnectDirective == CalciumTypes::UNDEFINED_DIRECTIVE ) return false;
+ std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor, CP_CONT : " << (*wDataIt1).first << std::endl;
+ std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK2 --------" << std::endl;
+ throw(DATASTREAM_EXCEPTION(LOC(OSS()<< "La directive CP_ARRET"
+ << " provoque l'interruption de toute lecture de données")));
+ std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK3 --------" << std::endl;
+
+ // S'il n'y a plus de données indique que l'on a pas pu effectuer de traitement
+ if ( storedDatas.empty() )
+ throw(DATASTREAM_EXCEPTION(LOC(OSS()<< "La directive CP_CONT"
+ << " est active mais aucune donnée n'est disponible.")));
+
+ // expectedDataId n'a ni été trouvé dans storedDataIds ni encadré mais il se peut
+ // qu'en mode itératif il ne soit pas plus grand que le plus grand DataId stocké auquel
+ // cas on doit renvoyer une expection car on n'est plus connecté et on ne pourra jamais
+ // fournir de données pour ce dataId.
+ std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK4 --------" << std::endl;
+
+ iterator it1 = storedDatas.lower_bound(expectedDataId);
+ if (it1 != storedDatas.end())
+ throw(DATASTREAM_EXCEPTION(LOC(OSS()<< "La directive CP_CONT"
+ << " est active mais le dataId demandé est inférieur ou égal au dernier reçu.")));
+
+
+ wDataIt1 = storedDatas.end();
+ --wDataIt1;
+ std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor, CP_CONT : " << (*wDataIt1).first << std::endl;
+
+ return true;
+ }
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : CalciumGenericProvidesPort.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Id : $Id$
+
+#ifndef _CALCIUM_GENERIC_PROVIDES_PORT_HXX_
+#define _CALCIUM_GENERIC_PROVIDES_PORT_HXX_
+
+#include "PortProperties_i.hxx"
+
+#include "calcium_provides_port.hxx"
+
+#include "GenericProvidesPort.hxx"
+#include "CalciumCouplingPolicy.hxx"
+
+#include "CorbaTypes2CalciumTypes.hxx"
+#include "CalciumTypes2CorbaTypes.hxx"
+
+#include "DSC_Exception.hxx"
+#include <iostream>
+
+//
+// Cette macro CPP remplace une déclaration : template <typename CorbaInterface, typename CorbaDataManipulator >
+// mais permet surtout de générer différentes classes (dont le nom est spécifié par specificPortName )
+//
+// Variante: Creer un trait qui à partir de CorbaInterface déduit CorbaDataManipulator
+// et simplifier la classe
+//
+// L'utilisation conjointe du paramètre ... et de __VA_ARGS__ au lieu d'un 'CorbaDataManipulator' permet
+// d'invoquer la macro avec un troisième token contenant une virgule
+// (qui est considéré comme un séparateur d'argument par le PP )
+
+#define CALCIUM_GENERIC_PROVIDES_PORT_HXX(specificPortName,CorbaInterface,...) \
+ class specificPortName : public virtual CorbaInterface , \
+ public virtual POA_Ports::PortProperties, \
+ public GenericProvidesPort< __VA_ARGS__ , CalciumCouplingPolicy, calcium_provides_port > { \
+ public : \
+ typedef __VA_ARGS__ DataManipulator; \
+ typedef DataManipulator::Type CorbaDataType; \
+ typedef GenericPort< DataManipulator , \
+ CalciumCouplingPolicy > Port; \
+ \
+ virtual ~ specificPortName (); \
+ \
+ inline void disconnect(bool provideLastGivenValue) { \
+ Port::disconnect(provideLastGivenValue); \
+ } \
+ inline void setDependencyType(CalciumTypes::DependencyType dependencyType) { \
+ Port::setDependencyType(dependencyType); \
+ } \
+ inline CalciumTypes::DependencyType getDependencyType () const { \
+ return Port::getDependencyType(); \
+ } \
+ inline void setStorageLevel (size_t storageLevel) { \
+ Port::setStorageLevel(storageLevel); \
+ } \
+ inline size_t getStorageLevel () const { \
+ return Port::getStorageLevel(); \
+ } \
+ inline void setDateCalSchem (CalciumTypes::DateCalSchem dateCalSchem) { \
+ Port::setDateCalSchem (dateCalSchem); \
+ } \
+ inline CalciumTypes::DateCalSchem getDateCalSchem () const { \
+ return Port::getDateCalSchem (); \
+ } \
+ inline void setAlpha(double alpha) { \
+ Port::setAlpha(alpha); \
+ } \
+ inline double getAlpha() const { \
+ return Port::getAlpha(); \
+ } \
+ inline void setDeltaT(double deltaT ) { \
+ Port::setDeltaT(deltaT); \
+ } \
+ inline double getDeltaT() const { \
+ return Port::getDeltaT(); \
+ } \
+ inline void setInterpolationSchem (CalciumTypes::InterpolationSchem interpolationSchem) { \
+ Port::setInterpolationSchem(interpolationSchem); \
+ } \
+ inline void setExtrapolationSchem (CalciumTypes::ExtrapolationSchem extrapolationSchem) { \
+ Port::setExtrapolationSchem(extrapolationSchem); \
+ } \
+ inline CalciumTypes::InterpolationSchem getInterpolationSchem() const { \
+ return Port::getInterpolationSchem(); \
+ } \
+ inline CalciumTypes::ExtrapolationSchem getExtrapolationSchem() const { \
+ return Port::getExtrapolationSchem(); \
+ } \
+ \
+ inline void put( DataManipulator::CorbaInType data, \
+ CORBA::Double time, CORBA::Long tag) { \
+ Port::put(data, time, tag); \
+ } \
+ \
+ inline Ports::Port_ptr get_port_ref() { \
+ return _this(); \
+ } \
+ \
+ Ports::PortProperties_ptr get_port_properties() { \
+ return POA_Ports::PortProperties::_this(); \
+ } \
+ \
+ virtual void set_property(const char * name, const CORBA::Any& value) \
+ throw (Ports::NotDefined, Ports::BadType, Ports::BadValue); \
+ \
+ virtual CORBA::Any* get_property(const char* name) \
+ throw (Ports::NotDefined); \
+ \
+ }; \
+
+
+
+
+#define CALCIUM_GENERIC_PROVIDES_PORT_CXX(specificPortName) \
+ \
+ specificPortName::~specificPortName(void) {}; \
+ \
+ void specificPortName::set_property(const char * name, const CORBA::Any& value) \
+ throw (Ports::NotDefined, Ports::BadType, Ports::BadValue) { \
+ \
+ const std::string key(name); \
+ CORBA::Long sl; \
+ CORBA::Double alpha,delta; \
+ Ports::Calcium_Ports::DependencyType dt; \
+ Ports::Calcium_Ports::DateCalSchem dcs; \
+ Ports::Calcium_Ports::InterpolationSchem is; \
+ Ports::Calcium_Ports::ExtrapolationSchem es; \
+ bool ok=false; \
+ \
+ try { \
+ \
+ if (key == "StorageLevel" ) \
+ {if ( ok=(value >>= sl) ) Port::setStorageLevel(sl);} \
+ else if (key == "Alpha" ) \
+ {if ( ok=(value >>= alpha) ) Port::setAlpha(alpha);} \
+ else if (key == "DeltaT" ) \
+ {if ( ok=(value >>= delta) ) Port::setDeltaT(delta);} \
+ else if (key == "DependencyType" ) \
+ {if ( ok=( value >>= dt) ) Port::setDependencyType(dependencyType[dt]);} \
+ else if (key == "DateCalSchem" ) \
+ {if ( ok=(value >>= dcs) ) \
+ Port::setDateCalSchem(dateCalSchem[dcs]);} \
+ else if (key == "InterpolationSchem") \
+ {if ( ok=(value >>= is) ) \
+ Port::setInterpolationSchem(interpolationSchem[is]);} \
+ else if (key == "ExtrapolationSchem") \
+ {if ( ok=(value >>= es) ) \
+ Port::setExtrapolationSchem(extrapolationSchem[es]);} \
+ else \
+ throw Ports::NotDefined(); \
+ if (!ok) throw Ports::BadType(); \
+ \
+ } catch ( const DSC_Exception & ex ) { \
+ \
+ std::cerr << ex.what() << std::endl; \
+ throw Ports::BadValue(); \
+ } \
+ } \
+ \
+ \
+ CORBA::Any* specificPortName::get_property(const char* name) \
+ throw (Ports::NotDefined) { \
+ const std::string key(name); \
+ CORBA::Any* value=new CORBA::Any; \
+ if (key == "StorageLevel" ) \
+ { (*value) <<= static_cast<CORBA::Long>(Port::getStorageLevel()); } \
+ else if (key == "Alpha" ) \
+ { *value <<= (CORBA::Double) Port::getAlpha();} \
+ else if (key == "DeltaT" ) \
+ { *value <<= (CORBA::Double) Port::getDeltaT();} \
+ else if (key == "DependencyType" ) \
+ { *value <<= corbaDependencyType[Port::getDependencyType()];} \
+ else if (key == "DateCalSchem" ) \
+ { *value <<= corbaDateCalSchem[Port::getDateCalSchem()];} \
+ else if (key == "InterpolationSchem") \
+ { *value <<= corbaInterpolationSchem[Port::getInterpolationSchem()];} \
+ else if (key == "ExtrapolationSchem") \
+ { *value <<= corbaExtrapolationSchem[Port::getExtrapolationSchem()];} \
+ else { \
+ delete value; \
+ throw Ports::NotDefined(); \
+ } \
+ return value; \
+ };
+
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : CalciumGenericUsesPort.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Id : $Id$
+
+#ifndef _CALCIUM_GENERIC_USES_PORT_HXX_
+#define _CALCIUM_GENERIC_USES_PORT_HXX_
+
+#include "GenericUsesPort.hxx"
+#include "calcium_uses_port.hxx"
+
+template <typename DataManipulator, typename CorbaPortType, char * repositoryName >
+class CalciumGenericUsesPort : public GenericUsesPort<DataManipulator,CorbaPortType, repositoryName,
+ calcium_uses_port >
+{
+public :
+ virtual ~CalciumGenericUsesPort() {};
+ void disconnect(bool provideLastGivenValue);
+
+};
+
+
+template <typename DataManipulator,typename CorbaPortType, char * repositoryName >
+void
+CalciumGenericUsesPort< DataManipulator,CorbaPortType, repositoryName >::disconnect(bool provideLastGivenValue ) {
+
+ typedef typename CorbaPortType::_ptr_type CorbaPortTypePtr;
+
+ if (!this->_my_ports)
+ throw DSC_Exception(LOC("There is no connected provides port to communicate with."));
+
+ for(int i = 0; i < this->_my_ports->length(); i++) {
+ CorbaPortTypePtr port = CorbaPortType::_narrow((*this->_my_ports)[i]);
+ try {
+ std::cerr << "-------- CalciumGenericUsesPort<>::disconnect"<< std::endl;
+
+ port->disconnect(provideLastGivenValue);
+ } catch(const CORBA::SystemException& ex){
+ throw DSC_Exception(LOC(OSS() << "Impossible d'invoquer la méthode disconnect sur le port provide n°"
+ << i << "( i>= 0)"));
+ }
+ }
+
+}
+
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : CalciumInterface.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-03-01 13:27:58 +0100 (jeu, 01 mar 2007) $
+// Id : $Id$
+
+#ifndef _CALCIUM_INTERFACE_HXX_
+#define _CALCIUM_INTERFACE_HXX_
+
+#include <string>
+#include <vector>
+#include <iostream>
+#include "Superv_Component_i.hxx"
+#include "DatastreamException.hxx"
+#include "CalciumTypes.hxx"
+#include "CalciumGenericUsesPort.hxx"
+#include "Copy2UserSpace.hxx"
+#include "Copy2CorbaSpace.hxx"
+#include "CalciumPortTraits.hxx"
+
+#include <stdio.h>
+
+
+// Déplacer cette information dans CorbaTypeManipulator
+// Gérer en même temps la recopie profonde.
+
+template <typename T1, typename T2>
+struct IsSameType {
+ static const bool value = false;
+};
+template <typename T1>
+struct IsSameType<T1,T1> {
+ static const bool value = true;
+};
+
+
+
+
+class CalciumInterface {
+public :
+
+
+ static void
+ ecp_fin (Superv_Component_i & component, bool provideLastGivenValue)
+ {
+ std::vector<std::string> usesPortNames;
+ std::vector<std::string>::const_iterator it;
+ component.get_uses_port_names(usesPortNames);
+
+ //récupérer le type de réel su port est un peu difficile
+ //car l'interface nous donne aucune indication
+ uses_port *myUsesPort;
+
+ for (it=usesPortNames.begin(); it != usesPortNames.end(); ++it) {
+ try {
+ component.Superv_Component_i::get_port(myUsesPort,(*it).c_str());
+ calcium_uses_port* myCalciumUsesPort=
+ dynamic_cast<calcium_uses_port*>(myUsesPort);
+ std::cerr << "-------- CalciumInterface(ecp_fin) MARK 1 -|"<< *it <<"|----"<<
+ typeid(myUsesPort).name() <<"-------------" <<
+ typeid(myCalciumUsesPort).name() <<"-------------" << std::endl;
+ if ( !myCalciumUsesPort )
+ throw Superv_Component_i::BadCast(LOC(OSS()<<"Impossible de convertir le port "
+ << *it << " en port de type calcium_uses_port." ));
+ myCalciumUsesPort->disconnect(provideLastGivenValue);
+ } catch ( const Superv_Component_i::PortNotDefined & ex) {
+ std::cerr << ex.what() << std::endl;
+ throw (DatastreamException(CalciumTypes::CPNMVR,ex));
+ } catch ( const Superv_Component_i::PortNotConnected & ex) {
+ std::cerr << ex.what() << std::endl;;
+ throw (DatastreamException(CalciumTypes::CPLIEN,ex));
+ } catch ( const Superv_Component_i::BadCast & ex) {
+ std::cerr << ex.what() << std::endl;
+ throw (DatastreamException(CalciumTypes::CPTPVR,ex));
+ } // Laisse passer les autres exceptions.
+ }
+ }
+
+
+ // Uniquement appelé par l'utilisateur s'il a passé un pointeur de données NULL
+ // à l'appel de ecp_lecture (demande de 0 copie)
+ template <typename T1 > static void
+ ecp_free ( T1 * dataPtr )
+ {
+ ecp_free<T1,T1> ( dataPtr );
+ }
+
+ template <typename T1,typename T2 > static void
+ ecp_free ( T1 * dataPtr )
+ {
+
+ typedef typename ProvidesPortTraits<T2>::PortType PortType;
+ typedef typename PortType::DataManipulator DataManipulator;
+ typedef typename DataManipulator::Type DataType; // Attention != T
+ typedef typename DataManipulator::InnerType InnerType;
+
+ DeleteTraits<IsSameType<T1,InnerType>::value >::apply(dataPtr);
+
+ }
+
+ template <typename T1 > static void
+ ecp_lecture ( Superv_Component_i & component,
+ CalciumTypes::DependencyType dependencyType,
+ double & ti,
+ double const & tf,
+ long & i,
+ const string & nomVar,
+ size_t bufferLength,
+ size_t & nRead,
+ T1 * &data )
+ {
+ ecp_lecture<T1,T1> (component,dependencyType,ti,tf,
+ i,nomVar,bufferLength,nRead,data);
+
+ }
+
+ template <typename T1, typename T2 > static void
+ ecp_lecture ( Superv_Component_i & component,
+ CalciumTypes::DependencyType dependencyType,
+ double & ti,
+ double const & tf,
+ long & i,
+ const string & nomVar,
+ size_t bufferLength,
+ size_t & nRead,
+ T1 * &data )
+ {
+
+ assert(&component);
+
+ typedef typename ProvidesPortTraits<T2>::PortType PortType;
+ typedef typename PortType::DataManipulator DataManipulator;
+ typedef typename DataManipulator::Type CorbaDataType; // Attention != T
+ typedef typename DataManipulator::InnerType InnerType;
+
+ CorbaDataType corbaData;
+ long ilong;
+
+ std::cerr << "-------- CalciumInterface(ecp_lecture) MARK 1 ------------------" << std::endl;
+
+ if (nomVar.empty())
+ throw DatastreamException(CalciumTypes::CPNMVR,
+ LOC("Le nom de la variable est <nul>"));
+ PortType * port;
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 2 ------------------" << std::endl;
+
+ try {
+ port = component.Superv_Component_i::get_port< PortType > (nomVar.c_str());
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 3 ------------------" << std::endl;
+ } catch ( const Superv_Component_i::PortNotDefined & ex) {
+ std::cerr << ex.what() << std::endl;
+ throw (DatastreamException(CalciumTypes::CPNMVR,ex));
+ } catch ( const Superv_Component_i::PortNotConnected & ex) {
+ std::cerr << ex.what() << std::endl;;
+ throw (DatastreamException(CalciumTypes::CPLIEN,ex));
+ // VERIFIER LES CAS DES CODES : CPINARRET, CPSTOPSEQ, CPCTVR, CPLIEN
+ } catch ( const Superv_Component_i::BadCast & ex) {
+ std::cerr << ex.what() << std::endl;
+ throw (DatastreamException(CalciumTypes::CPTPVR,ex));
+ }
+
+ // mode == mode du port
+ CalciumTypes::DependencyType portDependencyType;
+ try {
+ portDependencyType = port->getDependencyType();
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 4 ------------------" << std::endl;
+ } catch ( const DSC_Exception & ex ) {
+ std::cerr << ex.what() << std::endl;;
+ throw (DatastreamException(CalciumTypes::CPIT,ex));
+ }
+
+ if ( portDependencyType == CalciumTypes::UNDEFINED_DEPENDENCY )
+ throw DatastreamException(CalciumTypes::CPIT,
+ LOC(OSS()<<"Le mode de dépendance de la variable "
+ << nomVar << " est indéfini."));
+
+ if ( ( portDependencyType != dependencyType ) &&
+ ( dependencyType != CalciumTypes::SEQUENCE_DEPENDENCY ) )
+ throw DatastreamException(CalciumTypes::CPITVR,
+ LOC(OSS()<<"Le mode de dépendance de la variable "
+ << nomVar << " ne correspond pas au mode demandé."));
+
+
+ if ( dependencyType == CalciumTypes::TIME_DEPENDENCY ) {
+ corbaData = port->get(ti,tf, 0);
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 5 ------------------" << std::endl;
+ }
+ else if ( dependencyType == CalciumTypes::ITERATION_DEPENDENCY ) {
+ corbaData = port->get(0, i);
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 6 ------------------" << std::endl;
+ } else {
+ // Lecture en séquence
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 7 ------------------" << std::endl;
+ corbaData = port->next(ti,i);
+ }
+
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 8 ------------------" << std::endl;
+ size_t corbaDataSize = DataManipulator::size(corbaData);
+ std::cout << "-------- CalciumInterface(ecp_lecture) corbaDataSize : " << corbaDataSize << std::endl;
+
+ // Vérifie si l'utilisateur demande du 0 copie
+ if ( data == NULL ) {
+ if ( bufferLength != 0 ) {
+ MESSAGE("bufferLength devrait valoir 0 pour l'utilisation du mode sans copie (data==NULL)");
+ }
+ nRead = corbaDataSize;
+ // Si les types T et InnerType sont différents, il faudra effectuer tout de même une recopie
+ if (!IsSameType<T1,InnerType>::value) data = new T1[nRead];
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 9 ------------------" << std::endl;
+ // On essaye de faire du 0 copy si les types T et InnerType sont les mêmes
+ Copy2UserSpace< IsSameType<T1,InnerType>::value >::apply(data,corbaData,nRead);
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 10 ------------------" << std::endl;
+ // Attention : Seul CalciumCouplingPolicy via eraseDataId doit décider de supprimer ou non
+ // la donnée corba associée à un DataId ! Ne pas effectuer la desallocation suivante :
+ // old : Dans les deux cas la structure CORBA n'est plus utile
+ // old : Si !IsSameType<T1,InnerType>::value l'objet CORBA est détruit avec son contenu
+ // old : Dans l'autre cas seul la coquille CORBA est détruite
+ // tjrs correct : Dans les deux cas l'utilisateur devra appeler ecp_free (version modifiée)
+ // DataManipulator::delete_data(corbaData);
+ } else {
+ nRead = std::min < size_t > (corbaDataSize,bufferLength);
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 11 ------------------" << std::endl;
+ Copy2UserSpace<false>::apply(data,corbaData,nRead);
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 12 ------------------" << std::endl;
+ // Attention : Seul CalciumCouplingPolicy via eraseDataId doit décider de supprimer ou non
+ // la donnée corba associée à un DataId ! Ne pas effectuer la desallocation suivante :
+ // DataManipulator::delete_data(corbaData);
+ }
+ std::cout << "-------- CalciumInterface(ecp_lecture), Valeur de data : " << std::endl;
+ std::copy(data,data+nRead,std::ostream_iterator<T1>(std::cout," "));
+ std::cout << "Ptr :" << data << std::endl;
+
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 13 ------------------" << std::endl;
+
+
+ return;
+ }
+
+
+ template <typename T1> static void
+ ecp_ecriture ( Superv_Component_i & component,
+ CalciumTypes::DependencyType dependencyType,
+ double const & t,
+ long const & i,
+ const string & nomVar,
+ size_t bufferLength,
+ T1 & data ) {
+ ecp_ecriture<T1,T1> (component,dependencyType,t,i,nomVar,bufferLength,data);
+ }
+
+ template <typename T1, typename T2> static void
+ ecp_ecriture ( Superv_Component_i & component,
+ CalciumTypes::DependencyType dependencyType,
+ double const & t,
+ long const & i,
+ const string & nomVar,
+ size_t bufferLength,
+ T1 & data )
+ {
+
+ assert(&component);
+
+ //typedef typename StarTrait<TT>::NonStarType T;
+ typedef typename UsesPortTraits<T2>::PortType PortType;
+ typedef typename ProvidesPortTraits<T2>::PortType ProvidesPortType;
+ typedef typename ProvidesPortType::DataManipulator DataManipulator;
+ // Verifier que l'on peut définir UsesPortType::DataManipulator
+ // typedef typename PortType::DataManipulator DataManipulator;
+ typedef typename DataManipulator::Type CorbaDataType; // Attention != T1
+ typedef typename DataManipulator::InnerType InnerType;
+
+ std::cerr << "-------- CalciumInterface(ecriture) MARK 1 ------------------" << std::endl;
+ if ( nomVar.empty() ) throw DatastreamException(CalciumTypes::CPNMVR,
+ LOC("Le nom de la variable est <nul>"));
+ PortType * port;
+ std::cout << "-------- CalciumInterface(ecriture) MARK 2 ------------------" << std::endl;
+
+ try {
+ port = component.Superv_Component_i::get_port< PortType > (nomVar.c_str());
+ std::cout << "-------- CalciumInterface(ecriture) MARK 3 ------------------" << std::endl;
+ } catch ( const Superv_Component_i::PortNotDefined & ex) {
+ std::cerr << ex.what() << std::endl;
+ throw (DatastreamException(CalciumTypes::CPNMVR,ex));
+ } catch ( const Superv_Component_i::PortNotConnected & ex) {
+ std::cerr << ex.what() << std::endl;;
+ throw (DatastreamException(CalciumTypes::CPLIEN,ex));
+ // VERIFIER LES CAS DES CODES : CPINARRET, CPSTOPSEQ, CPCTVR, CPLIEN
+ } catch ( const Superv_Component_i::BadCast & ex) {
+ std::cerr << ex.what() << std::endl;
+ throw (DatastreamException(CalciumTypes::CPTPVR,ex));
+ }
+
+ // mode == mode du port
+ // On pourrait créer la méthode CORBA dans le mode de Couplage CALCIUM.
+ // et donc ajouter cette cette méthode uniquement dans l'IDL calcium !
+
+// CalciumTypes::DependencyType portDependencyType;
+// try {
+// portDependencyType = port->getDependencyType();
+// std::cout << "-------- CalciumInterface(ecriture) MARK 4 ------------------" << std::endl;
+// } catch ( const DSC_Exception & ex ) {
+// std::cerr << ex.what() << std::endl;;
+// throw (DatastreamException(CalciumTypes::CPIT,ex));
+// }
+
+ if ( dependencyType == CalciumTypes::UNDEFINED_DEPENDENCY )
+ throw DatastreamException(CalciumTypes::CPIT,
+ LOC(OSS()<<"Le mode de dépendance demandé pour la variable "
+ << nomVar << " est indéfini."));
+
+ if ( dependencyType == CalciumTypes::SEQUENCE_DEPENDENCY )
+ throw DatastreamException(CalciumTypes::CPIT,
+ LOC(OSS()<<"Le mode de dépendance SEQUENCE_DEPENDENCY pour la variable "
+ << nomVar << " est impossible en écriture."));
+
+ // Il faudrait que le port provides génère une exception si le mode donnée n'est pas
+ // le bon. La seule façon de le faire est d'envoyer -1 en temps si on n'est en itération
+ // et vice-versa pour informer les provides port du mode dans lequel on est. Sinon il faut
+ // modifier l'interface IDL pour y ajouter un mode de dépendance !
+ // ---->
+// if ( portDependencyType != dependencyType )
+// throw DatastreamException(CalciumTypes::CPITVR,
+// LOC(OSS()<<"Le mode de dépendance de la variable "
+// << nomVar << " ne correspond pas au mode demandé."));
+
+
+ if ( bufferLength < 1 )
+ throw DatastreamException(CalciumTypes::CPNTNULL,
+ LOC(OSS()<<"Le buffer a envoyer est de taille nulle "));
+
+
+ std::cout << "-------- CalciumInterface(ecriture) MARK 7 ------------------" << std::endl;
+ CorbaDataType corbaData;
+
+
+ // Si les types Utilisateurs et CORBA sont différents
+ // il faut effectuer une recopie sinon on utilise directement le
+ // buffer data pour constituer la séquence
+ // TODO :
+ // - Attention en mode asynchrone il faudra eventuellement
+ // faire une copie des données même si elles sont de même type.
+ // - En cas de collocalisation (du port provide et du port uses)
+ // il est necessaire d'effectuer une recopie du buffer car la
+ // séquence est envoyée au port provide par une référence sur
+ // la séquence locale. Or la méthode put récupère le buffer directement
+ // qui est alors le buffer utilisateur. Il pourrait alors arrivé que :
+ // * Le recepteur efface le buffer emetteur
+ // * Le port lui-même efface le buffer de l'ulisateur !
+ // Cette copie est effectuée dans GenericPortUses::put
+ // en fonction de la collocalisation ou non.
+ // - En cas de connection multiples d'un port uses distant vers plusieurs port provides
+ // collocalisés les ports provides partagent la même copie de la donnée !
+ // Il faut effectuer une copie dans le port provides.
+ // Cette copie est effectuée dans GenericPortUses::put
+ // en fonction de la collocalisation ou non.
+ Copy2CorbaSpace<IsSameType<T1,InnerType>::value >::apply(corbaData,data,bufferLength);
+
+ //TODO : GERER LES EXCEPTIONS ICI : ex le port n'est pas connecté
+ if ( dependencyType == CalciumTypes::TIME_DEPENDENCY ) {
+ port->put(*corbaData,t, -1);
+ //Le -1 peut être traité par le cst DataIdContainer et transformé en 0
+ //Etre obligé de mettre une étoile ds (*corbadata) va poser des pb pour les types <> seq
+ std::cout << "-------- CalciumInterface(ecriture) MARK 5 ------------------" << std::endl;
+ }
+ else if ( dependencyType == CalciumTypes::ITERATION_DEPENDENCY ) {
+ port->put(*corbaData,-1, i);
+ std::cout << "-------- CalciumInterface(ecriture) MARK 6 ------------------" << std::endl;
+ }
+
+
+ std::cout << "-------- CalciumInterface(ecriture), Valeur de corbaData : " << std::endl;
+ for (int i = 0; i < corbaData->length(); ++i)
+ cout << "-------- CalciumInterface(ecriture), corbaData[" << i << "] = " << (*corbaData)[i] << endl;
+
+ // if ( !IsSameType<T1,InnerType>::value ) delete corbaData;
+ // Supprime l'objet CORBA avec eventuellement les données qu'il contient (case de la recopie)
+ delete corbaData;
+
+ std::cout << "-------- CalciumInterface(ecriture) MARK 7 ------------------" << std::endl;
+
+ return;
+ }
+
+};
+
+// Interface C/C++
+
+// En CALCIUM l'utilisation de données de type double
+// implique des dates de type double, pour les autres
+// types de données les dates sont de type float
+template <class T> struct CalTimeType {
+ typedef float TimeType;
+};
+
+template <> struct CalTimeType<double> {
+ typedef double TimeType;
+};
+
+extern "C" CalciumTypes::InfoType
+ecp_fin_ (void * component, int code) {
+
+ Superv_Component_i * _component = static_cast<Superv_Component_i *>(component);
+
+ bool provideLastGivenValue = false;
+ if (code == CalciumTypes::CP_CONT ) provideLastGivenValue = true;
+
+ try {
+ CalciumInterface::ecp_fin( *_component,
+ provideLastGivenValue);
+ } catch ( const DatastreamException & ex) { //tester l'arrêt par exception
+ std::cerr << ex.what() << std::endl;
+ return ex.getInfo();
+ }
+ return CalciumTypes::CPOK;
+};
+
+
+#define CALCIUM_C2CPP_INTERFACE_(_name,_type,_qual) \
+ extern "C" CalciumTypes::InfoType ecp_lecture_##_name (void * component, int dependencyType, \
+ CalTimeType< _type _qual >::TimeType * ti, \
+ CalTimeType< _type _qual >::TimeType * tf, long * i, \
+ const char * const nomvar, size_t bufferLength, \
+ size_t * nRead, _type _qual ** data ) { \
+ Superv_Component_i * _component = static_cast<Superv_Component_i *>(component); \
+ double _ti=*ti; \
+ double _tf=*tf; \
+ size_t _nRead=0; \
+ size_t _bufferLength=bufferLength; \
+ CalciumTypes::DependencyType _dependencyType= \
+ static_cast<CalciumTypes::DependencyType>(dependencyType); \
+ \
+ if ( IsSameType< _name , cplx >::value ) _bufferLength*=2; \
+ std::cout << "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" << std::endl; \
+ try { \
+ CalciumInterface::ecp_lecture< _type, _name >( *_component, \
+ _dependencyType, \
+ _ti, _tf, *i, \
+ nomvar, \
+ _bufferLength, _nRead, *data); \
+ } catch ( const DatastreamException & ex) { \
+ std::cerr << ex.what() << std::endl; \
+ return ex.getInfo(); \
+ } \
+ if ( IsSameType< _name , cplx >::value ) { *nRead=_nRead/2; \
+ std::cout << "-------- CalciumInterface(lecture Inter Part) IsSameType cplx -------------" << std::endl; \
+ std::cout << "-------- CalciumInterface(lecture Inter Part) _nRead : " << _nRead << std::endl; \
+ std::cout << "-------- CalciumInterface(lecture Inter Part) *nRead : " << *nRead << std::endl; \
+ } else *nRead = _nRead; \
+ if (_dependencyType == CalciumTypes::CP_SEQUENTIEL ) \
+ *ti=(CalTimeType< _type _qual >::TimeType)(_ti); \
+ std::cout << "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data << std::endl; \
+ for (int i=0; i<_nRead;++i) \
+ printf("-------- CalciumInterface(lecture Inter Part), Valeur de data (typage entier) data[%d] : %d \n",i,(*data)[i]); \
+ std::cout << "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data << std::endl; \
+ return CalciumTypes::CPOK; \
+ }; \
+ extern "C" void ecp_lecture_##_name##_free ( _type _qual * data) { \
+ CalciumInterface::ecp_free< _type, _name >(data); \
+ }; \
+ extern "C" CalciumTypes::InfoType ecp_ecriture_##_name (void * component, int dependencyType, \
+ CalTimeType< _type _qual >::TimeType *t, \
+ long i, \
+ const char * const nomvar, size_t bufferLength, \
+ _type _qual * data ) { \
+ Superv_Component_i * _component = static_cast<Superv_Component_i *>(component); \
+ /* Je ne sais pas pourquoi, je n'arrive pas à passer t par valeur : corruption de la pile*/ \
+ double _t=*t; \
+ size_t _bufferLength=bufferLength; \
+ if ( IsSameType< _name , cplx >::value ) _bufferLength=_bufferLength*2; \
+ std::cout << "-------- CalciumInterface(ecriture Inter Part) MARK 1 ------------------" << std::endl; \
+ try { \
+ printf("-------- CalciumInterface(ecriture Inter Part), cp_name : Nom de la var. de type %s : %s\n",#_type,nomvar); \
+ std::string essai(nomvar); \
+ std::cout << "----------->-" << nomvar << std::endl; \
+ CalciumInterface::ecp_ecriture< _type, _name >( *_component, \
+ static_cast<CalciumTypes::DependencyType>(dependencyType), \
+ _t,i,nomvar,_bufferLength,*data); \
+ } catch ( const DatastreamException & ex) { \
+ std::cerr << ex.what() << std::endl; \
+ return ex.getInfo(); \
+ } \
+ std::cout << "-------- CalciumInterface(ecriture Inter Part), Valeur de data : " << std::endl; \
+ std::cout << "-------- CalciumInterface(ecriture Inter Part), Ptr(1) :" << data << std::endl; \
+ for (int i=0; i<_bufferLength;++i) \
+ printf("-------- CalciumInterface(ecriture Inter Part), Valeur de data (typage entier) data[%d] : %d \n",i,data[i]); \
+ std::cout << "-------- CalciumInterface(ecriture Inter Part), Ptr(2) :" << data << std::endl; \
+ return CalciumTypes::CPOK; \
+ }; \
+
+
+
+#define STAR *
+CALCIUM_C2CPP_INTERFACE_(int,int,);
+CALCIUM_C2CPP_INTERFACE_(float,float, );
+CALCIUM_C2CPP_INTERFACE_(double,double,);
+CALCIUM_C2CPP_INTERFACE_(bool,bool,);
+CALCIUM_C2CPP_INTERFACE_(cplx,float,);
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : CalciumPortTraits.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
+// Id : $Id$
+
+#ifndef _PORT_TRAITS_HXX_
+#define _PORT_TRAITS_HXX_
+
+#include "Superv_Component_i.hxx"
+
+
+struct UnknownPortType {};
+template <class T> struct ProvidesPortTraits {
+ typedef UnknownPortType PortType;
+};
+template <> struct ProvidesPortTraits<int> {
+ typedef calcium_integer_port_provides PortType;
+};
+template <> struct ProvidesPortTraits<long> {
+ typedef calcium_integer_port_provides PortType;
+};
+template <> struct ProvidesPortTraits<float> {
+ typedef calcium_real_port_provides PortType;
+};
+template <> struct ProvidesPortTraits<double> {
+ typedef calcium_double_port_provides PortType;
+};
+template <> struct ProvidesPortTraits<char *> {
+ typedef calcium_string_port_provides PortType;
+};
+template <> struct ProvidesPortTraits<bool> {
+ typedef calcium_logical_port_provides PortType;
+};
+
+// Définition du type cplx pour disciminer ce type de port
+// de celui du float
+struct cplx {};
+template <> struct ProvidesPortTraits<cplx> {
+ typedef calcium_complex_port_provides PortType;
+};
+
+template < typename T > struct StarTrait { typedef T NonStarType; };
+template < typename T > struct StarTrait< T * > { typedef T NonStarType; };
+
+template <class T> struct UsesPortTraits {
+ typedef UnknownPortType PortType;
+};
+template <> struct UsesPortTraits<int> {
+ typedef calcium_integer_port_uses PortType;
+};
+template <> struct UsesPortTraits<long> {
+ typedef calcium_integer_port_uses PortType;
+};
+template <> struct UsesPortTraits<float> {
+ typedef calcium_real_port_uses PortType;
+};
+template <> struct UsesPortTraits<double> {
+ typedef calcium_double_port_uses PortType;
+};
+template <> struct UsesPortTraits<char *> {
+ typedef calcium_string_port_uses PortType;
+};
+template <> struct UsesPortTraits<bool> {
+ typedef calcium_logical_port_uses PortType;
+};
+template <> struct UsesPortTraits<cplx> {
+ typedef calcium_complex_port_uses PortType;
+};
+
+#endif
--- /dev/null
+#include "CalciumProvidesPort.hxx"
+
+
+CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_integer_port_provides)
+
+CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_real_port_provides)
+
+CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_double_port_provides)
+
+CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_complex_port_provides)
+
+CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_logical_port_provides)
+
+CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_string_port_provides)
--- /dev/null
+// Eric Fayolle - EDF R&D
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-03-01 13:40:26 +0100 (Thu, 01 Mar 2007) $
+// Id : $Id$
+
+#ifndef _CALCIUM_PORT_PROVIDES_HXX_
+#define _CALCIUM_PORT_PROVIDES_HXX_
+
+#include "Calcium_Ports.hh"
+#include "CalciumGenericProvidesPort.hxx"
+#include "CalciumCouplingPolicy.hxx"
+
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_integer_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Integer_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_long,CORBA::Long> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_real_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Real_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_float,CORBA::Float> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_double_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Double_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_double,CORBA::Double> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_complex_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Complex_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_float,CORBA::Float> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_logical_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Logical_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_boolean,CORBA::Boolean> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_string_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_String_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_string,char *> ) \
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : CalciumTypes.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
+// Id : $Id$
+
+#ifndef __CALCIUM_TYPES__
+#define __CALCIUM_TYPES__
+
+namespace CalciumTypes {
+
+
+ const float EPSILON = 1.e-6;
+
+
+ /* Type de dependance des variables */
+ const int CP_TEMPS = 40;
+ const int CP_ITERATION = 41;
+ const int CP_SEQUENTIEL = 42;
+ /* Mode de dependance inconnu */
+ const int CPIT = 6;
+
+ /* Directive de continuation d'une instance */
+ const int CP_CONT = 20;
+ const int CP_ARRET = 21;
+
+ /* Type d'interpolation */
+ const int CP_LINEAIRE = 100;
+ const int CP_ESCALIER = 101;
+
+
+ /* Repere dans cycle de temps */
+ const int TI = 110;
+ const int TF = 111;
+
+
+ /* Niveaux */
+ const int CP_ILLIMITE = -70;
+ const int CP_AUTESP = -71;
+
+
+
+ typedef int InfoType ;
+ const int UNLIMITED_STORAGE_LEVEL = CP_ILLIMITE;
+ typedef enum {UNDEFINED_DEPENDENCY=CPIT,TIME_DEPENDENCY=CP_TEMPS,
+ ITERATION_DEPENDENCY=CP_ITERATION,
+ // TYPE uniquement utilisé ds CalciumInterface
+ SEQUENCE_DEPENDENCY =CP_SEQUENTIEL
+ } DependencyType;
+ typedef enum {TI_SCHEM=TI,TF_SCHEM=TF,ALPHA_SCHEM} DateCalSchem;
+ typedef enum {L0_SCHEM=CP_ESCALIER,L1_SCHEM=CP_LINEAIRE} InterpolationSchem;
+ typedef enum {UNDEFINED_EXTRA_SCHEM,E0_SCHEM,E1_SCHEM} ExtrapolationSchem;
+ typedef enum {UNDEFINED_DIRECTIVE,CONTINUE=CP_CONT,STOP=CP_ARRET} DisconnectDirective;
+
+ /* Codes d'erreur */
+
+ /* Pas d'erreur */
+ const int CPOK = 0;
+
+ /* Emetteur inconnu */
+ const int CPERIU = 1;
+
+ /* Nom de variable inconnu */
+ const int CPNMVR = 2;
+
+ /* Type entree/sortie incompatible */
+ const int CPIOVR = 3;
+
+ /* Type inconnu */
+ const int CPTP = 4;
+
+ /* Type de variable incompatible */
+ const int CPTPVR = 5;
+
+ /* Mode de dependance inconnu */
+ // Déclaré au dessus
+ // const int CPIT = 6;
+
+ /* Mode dependance incompatible */
+ const int CPITVR = 7;
+
+ /* Requete non autorisee */
+ const int CPRENA = 8;
+
+ /* Type de deconnexion incorrect */
+ const int CPDNTP = 9;
+
+ /* Directive de deconnexion incorrecte */
+ const int CPDNDI = 10;
+
+ /* Nom de code inconnu */
+ const int CPNMCD = 11;
+
+ /* Nom d'instance inconnu */
+ const int CPNMIN = 12;
+
+ /* Attente */
+ const int CPATTENTE = 13;
+
+ /* Blocage */
+ const int CPBLOC = 14;
+
+ /* Nombre de valeurs transmises egal a zero */
+ const int CPNTNULL = 15;
+
+ /* Longueur de variable insuffisante */
+ const int CPLGVR = 16;
+
+ /* L'instance doit s'arreter */
+ const int CPSTOP = 17;
+
+ /* Arret anormal */
+ const int CPATAL = 18;
+
+ /* Coupleur absent */
+ const int CPNOCP = 19;
+
+ /* Variable sortante non connectee */
+ const int CPCTVR = 20;
+
+ /* Nombre de pas a executer egal a zero */
+ const int CPPASNULL = 21;
+
+ /* Machine inconnue */
+ const int CPMACHINE = 22;
+
+ /* COUPLAGE_GROUPE non positionnee */
+ const int CPGRNU = 23;
+
+ /* Groupe d'instances incorrect */
+ const int CPGRIN = 24;
+
+ /* Fin du fichier d'entree */
+ const int CPFINFICH = 25;
+
+ /* Erreur de format dans un fichier */
+ const int CPERRFICH = 26;
+
+ /* Requete d'avance de n pas annulee */
+ /* par passage en mode NORMAL */
+ const int CPNORERR = 27;
+
+ /* Coupleur en mode NORMAL pour une */
+ /* requete RUN_N_PAS ou DEF_* */
+ const int CPRUNERR = 28;
+
+ /* Option inconnue */
+ const int CPOPT = 29;
+
+ /* Valeur d'option inconnue */
+ const int CPVALOPT = 30;
+
+ /* Ecriture impossible par effacement */
+ const int CPECREFF = 31;
+
+ /* Lecture d'une variable non connectee */
+ /* ou n'appartenant pas a un lien VAS */
+ /* ou VAV s'il s'agit d'une sortante */
+ const int CPLIEN = 32;
+
+ /* Lecture d'une variable d'une instance*/
+ /* deconnectee avec directive CP_ARRET */
+ const int CPINARRET = 33;
+
+ /* Les lectures sequentielles ne pourront plus */
+ /* etre satisfaites : instance productrice arretee */
+ const int CPSTOPSEQ = 34;
+
+ /* Erreur dans la chaine de declaration */
+ const int CPDECL = 35;
+
+ /* Erreur dans l'execution de l'instance ajoutee */
+ const int CPINEXEC = 36;
+
+ /* Erreur PVM */
+ // const int CPPVM = 37;
+ // const int CPCOM = 37;
+ /* Erreur detectee au niveau de l'int CPERRINST = 38;
+ /* Mode d'execution non defini */
+ const int CPMODE = 39;
+
+ /* Instance deconnectee */
+ const int CPINSTDEC = 40;
+
+}
+#endif
--- /dev/null
+// Eric Fayolle - EDF R&D
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-03-01 13:40:26 +0100 (Thu, 01 Mar 2007) $
+// Id : $Id$
+
+#include "CalciumTypes2CorbaTypes.hxx"
+#include <iostream>
+
+using namespace std;
+
+CORBA_DATE_CAL_SCHEM::CORBA_DATE_CAL_SCHEM() : map<CalciumTypes::DateCalSchem,
+ Ports::Calcium_Ports::DateCalSchem>()
+{
+ map<CalciumTypes::DateCalSchem,
+ Ports::Calcium_Ports::DateCalSchem > &
+ table = ( map<CalciumTypes::DateCalSchem,
+ Ports::Calcium_Ports::DateCalSchem > & ) *this ;
+
+table[CalciumTypes::TI_SCHEM ] = Ports::Calcium_Ports::TI_SCHEM ;
+table[CalciumTypes::TF_SCHEM ] = Ports::Calcium_Ports::TF_SCHEM ;
+table[CalciumTypes::ALPHA_SCHEM ] = Ports::Calcium_Ports::ALPHA_SCHEM ;
+}
+
+
+Ports::Calcium_Ports::DateCalSchem CORBA_DATE_CAL_SCHEM::operator[]( const CalciumTypes::DateCalSchem &c ) const
+{
+ map<CalciumTypes::DateCalSchem,
+ Ports::Calcium_Ports::DateCalSchem > &table = (map<CalciumTypes::DateCalSchem,
+ Ports::Calcium_Ports::DateCalSchem >&)*this ;
+ assert( table.find( (CalciumTypes::DateCalSchem)c ) != table.end() ) ;
+ return table[ (CalciumTypes::DateCalSchem)c ] ;
+}
+
+const CORBA_DATE_CAL_SCHEM corbaDateCalSchem ;
+
+
+
+CORBA_DEPENDENCY_TYPE::CORBA_DEPENDENCY_TYPE() : map<CalciumTypes::DependencyType,
+ Ports::Calcium_Ports::DependencyType >()
+{
+ map<CalciumTypes::DependencyType,
+ Ports::Calcium_Ports::DependencyType > &
+ table = ( map<CalciumTypes::DependencyType,
+ Ports::Calcium_Ports::DependencyType > & ) *this ;
+
+table[CalciumTypes::TIME_DEPENDENCY ] = Ports::Calcium_Ports::TIME_DEPENDENCY ;
+table[CalciumTypes::ITERATION_DEPENDENCY ] = Ports::Calcium_Ports::ITERATION_DEPENDENCY ;
+table[CalciumTypes::UNDEFINED_DEPENDENCY ] = Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ;
+
+
+std::cout << "CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::TIME_DEPENDENCY<<"] : "<<
+ table[CalciumTypes::TIME_DEPENDENCY] << std::endl;
+std::cout << "CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::ITERATION_DEPENDENCY<<"] : "<<
+ table[CalciumTypes::ITERATION_DEPENDENCY] << std::endl;
+std::cout << "CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::UNDEFINED_DEPENDENCY<<"] : "<<
+ table[CalciumTypes::UNDEFINED_DEPENDENCY] << std::endl;
+}
+
+
+Ports::Calcium_Ports::DependencyType CORBA_DEPENDENCY_TYPE::operator[]( const CalciumTypes::DependencyType &c ) const
+{
+ map<CalciumTypes::DependencyType,
+ Ports::Calcium_Ports::DependencyType > &
+ table = (map<CalciumTypes::DependencyType,
+ Ports::Calcium_Ports::DependencyType >& ) *this ;
+
+std::cout << "CORBA_DEPENDENCY_TYPE() : ::operator["<<c<<"]: " << table[c] << std::endl;
+
+ assert( table.find( (CalciumTypes::DependencyType)c ) != table.end() ) ;
+ return table[ (CalciumTypes::DependencyType)c ] ;
+}
+
+const CORBA_DEPENDENCY_TYPE corbaDependencyType ;
+
+
+
+
+CORBA_INTERPOLATION_SCHEM::CORBA_INTERPOLATION_SCHEM() : map<CalciumTypes::InterpolationSchem,
+ Ports::Calcium_Ports::InterpolationSchem > ()
+{
+ map<CalciumTypes::InterpolationSchem,
+ Ports::Calcium_Ports::InterpolationSchem > &
+ table = ( map<CalciumTypes::InterpolationSchem,
+ Ports::Calcium_Ports::InterpolationSchem > & ) *this ;
+
+ table[CalciumTypes::L0_SCHEM ] = Ports::Calcium_Ports::L0_SCHEM ;
+ table[CalciumTypes::L1_SCHEM ] = Ports::Calcium_Ports::L1_SCHEM ;
+}
+
+
+Ports::Calcium_Ports::InterpolationSchem CORBA_INTERPOLATION_SCHEM::operator[]( const CalciumTypes::InterpolationSchem &c ) const
+{
+ map<CalciumTypes::InterpolationSchem,
+ Ports::Calcium_Ports::InterpolationSchem > &table =
+ (map<CalciumTypes::InterpolationSchem,
+ Ports::Calcium_Ports::InterpolationSchem >& ) *this ;
+
+ assert( table.find( (CalciumTypes::InterpolationSchem)c ) != table.end() ) ;
+ return table[ (CalciumTypes::InterpolationSchem)c ] ;
+}
+
+const CORBA_INTERPOLATION_SCHEM corbaInterpolationSchem ;
+
+
+
+CORBA_EXTRAPOLATION_SCHEM::CORBA_EXTRAPOLATION_SCHEM() : map<CalciumTypes::ExtrapolationSchem,
+ Ports::Calcium_Ports::ExtrapolationSchem > ()
+{
+ map<CalciumTypes::ExtrapolationSchem,
+ Ports::Calcium_Ports::ExtrapolationSchem > &
+ table = ( map<CalciumTypes::ExtrapolationSchem,
+ Ports::Calcium_Ports::ExtrapolationSchem > & ) *this ;
+
+ table[CalciumTypes::E0_SCHEM ] = Ports::Calcium_Ports::E0_SCHEM ;
+ table[CalciumTypes::E1_SCHEM ] = Ports::Calcium_Ports::E1_SCHEM ;
+ table[CalciumTypes::UNDEFINED_EXTRA_SCHEM ] = Ports::Calcium_Ports::UNDEFINED_EXTRA_SCHEM ;
+}
+
+
+Ports::Calcium_Ports::ExtrapolationSchem CORBA_EXTRAPOLATION_SCHEM::operator[]( const CalciumTypes::ExtrapolationSchem &c ) const
+{
+ map<CalciumTypes::ExtrapolationSchem,
+ Ports::Calcium_Ports::ExtrapolationSchem > &table =
+ (map<CalciumTypes::ExtrapolationSchem,
+ Ports::Calcium_Ports::ExtrapolationSchem >& ) *this ;
+
+ assert( table.find( (CalciumTypes::ExtrapolationSchem)c ) != table.end() ) ;
+ return table[ (CalciumTypes::ExtrapolationSchem)c ] ;
+}
+
+const CORBA_EXTRAPOLATION_SCHEM corbaExtrapolationSchem ;
--- /dev/null
+// Eric Fayolle - EDF R&D
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-03-01 13:40:26 +0100 (Thu, 01 Mar 2007) $
+// Id : $Id$
+
+#ifndef _CALCIUMTYPES_TO_CORBATYPES_HXX_
+#define _CALCIUMTYPES_TO_CORBATYPES_HXX_
+
+#include "Calcium_Ports.hh"
+#include "CalciumTypes.hxx"
+
+#include <map>
+#include <cassert>
+
+
+class CORBA_DATE_CAL_SCHEM : public std::map<CalciumTypes::DateCalSchem,
+ Ports::Calcium_Ports::DateCalSchem >
+{
+public :
+
+ CORBA_DATE_CAL_SCHEM();
+ Ports::Calcium_Ports::DateCalSchem operator[]( const CalciumTypes::DateCalSchem &c ) const;
+};
+
+
+extern const CORBA_DATE_CAL_SCHEM corbaDateCalSchem ;
+
+class CORBA_DEPENDENCY_TYPE : public std::map<CalciumTypes::DependencyType,
+ Ports::Calcium_Ports::DependencyType>
+{
+public :
+
+ CORBA_DEPENDENCY_TYPE();
+ Ports::Calcium_Ports::DependencyType operator[]( const CalciumTypes::DependencyType &c ) const;
+};
+
+extern const CORBA_DEPENDENCY_TYPE corbaDependencyType ;
+
+class CORBA_INTERPOLATION_SCHEM : public std::map<CalciumTypes::InterpolationSchem,
+ Ports::Calcium_Ports::InterpolationSchem>
+{
+public :
+
+ CORBA_INTERPOLATION_SCHEM();
+ Ports::Calcium_Ports::InterpolationSchem operator[]( const CalciumTypes::InterpolationSchem &c ) const;
+} ;
+
+extern const CORBA_INTERPOLATION_SCHEM corbaInterpolationSchem ;
+
+class CORBA_EXTRAPOLATION_SCHEM : public std::map<CalciumTypes::ExtrapolationSchem,
+ Ports::Calcium_Ports::ExtrapolationSchem>
+{
+public :
+
+ CORBA_EXTRAPOLATION_SCHEM();
+ Ports::Calcium_Ports::ExtrapolationSchem operator[]( const CalciumTypes::ExtrapolationSchem &c ) const;
+} ;
+
+extern const CORBA_EXTRAPOLATION_SCHEM corbaExtrapolationSchem ;
+
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : CalciumTypesManipulator.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+
+#ifndef _CALCIUM_TYPES_MANIPULATOR_HXX_
+#define _CALCIUM_TYPES_MANIPULATOR_HXX_
+
+//Cette classe n'est pas necessaire pour l'instant.
+#include "Calcium_Ports.hh"
+
+template <typename PortType> struct CalciumTypesManipulator :
+ public seq_u_manipulation<Ports::Calcium_Ports::seq_complex,
+ Ports::Calcium_Ports::Complex> {
+ static bool needInterpolation=true;
+}
+
+template <POA_Ports::Calcium_Ports::Calcium_Complex_Port> struct CalciumTypesManipulator :
+ public seq_u_manipulation<Ports::Calcium_Ports::seq_complex,
+ Ports::Calcium_Ports::Complex> {
+ static bool needInterpolation=true;
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : Copy2CorbaSpace.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-07 18:26:44 +0100 (mer, 07 fév 2007) $
+// Id : $Id$
+
+#ifndef _COPY_TO_CORBA_SPACE_HXX_
+#define _COPY_TO_CORBA_SPACE_HXX_
+
+#include <string>
+#include <iostream>
+#include "CalciumPortTraits.hxx"
+
+template <bool zerocopy>
+struct Copy2CorbaSpace {
+
+ template <class T1, class T2>
+ static void apply( T1 * & corbaData, T2 & data, size_t nRead){
+
+ typedef typename ProvidesPortTraits<T2>::PortType PortType;
+ //typedef typename UsesPortTraits<T2>::PortType PortType;
+ typedef typename PortType::DataManipulator DataManipulator;
+ typedef typename DataManipulator::InnerType InnerType;
+
+ std::cerr << "-------- Copy2CorbaSpace<true> MARK 1 ------------------" << std::endl;
+ // Crée le type corba à partir du data sans lui en donner la propriété
+ corbaData = DataManipulator::create(nRead,&data,false);
+ std::cerr << "-------- Copy2CorbaSpace<true> MARK 2 --(dataPtr : "
+ << DataManipulator::getPointer(corbaData,false)<<")----------------" << std::endl;
+
+ }
+};
+
+// Cas ou il faut effectuer une recopie
+template <> struct
+Copy2CorbaSpace<false> {
+
+ template <class T1, class T2>
+ static void apply( T1 * & corbaData, T2 & data, size_t nRead){
+
+ typedef typename ProvidesPortTraits<T2>::PortType PortType;
+ // typedef typename UsesPortTraits<T2>::PortType PortType;
+ typedef typename PortType::DataManipulator DataManipulator;
+ typedef typename DataManipulator::InnerType InnerType;
+
+ corbaData = DataManipulator::create(nRead);
+ InnerType * dataPtr = DataManipulator::getPointer(corbaData,false);
+
+ std::cerr << "-------- Copy2CorbaSpace<false> MARK 1 --(dataPtr : " <<
+ dataPtr<<")----------------" << std::endl;
+
+ std::copy(&data,&data+nRead,dataPtr);
+
+ std::cerr << "-------- Copy2CorbaSpace<false> MARK 2 --(nRead: "<<nRead<<")-------------" << std::endl;
+
+ std::cerr << "-------- Copy2CorbaSpace<false> MARK 3 : " ;
+ std::copy(dataPtr,dataPtr+nRead,std::ostream_iterator<InnerType>(std::cout," "));
+ std::cout << std::endl;
+ std::cerr << "-------- Copy2CorbaSpace<false> MARK 4 --(data : " <<data<<") :" ;
+ for (int i=0; i<nRead; ++i)
+ std::cerr << (*corbaData)[i] << " ";
+ std::cout << std::endl;
+
+ }
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : Copy2UserSpace.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-13 11:09:09 +0100 (mar, 13 fév 2007) $
+// Id : $Id$
+
+#ifndef _COPY_TO_USER_SPACE_HXX_
+#define _COPY_TO_USER_SPACE_HXX_
+
+#include <string>
+#include <iostream>
+#include "CalciumPortTraits.hxx"
+
+//Cas du zero copie
+template <bool zerocopy >
+struct Copy2UserSpace{
+
+ template <class T1, class T2>
+ static void apply( T1 * & data, T2 & corbaData, size_t nRead ){
+
+ typedef typename ProvidesPortTraits<T1>::PortType PortType;
+ typedef typename PortType::DataManipulator DataManipulator;
+ typedef typename DataManipulator::InnerType InnerType;
+
+ // Devient propriétaire des données contenues dans la structure CORBA
+ // (allouées par allocbuff() pour une séquence)
+ InnerType * dataPtr = DataManipulator::getPointer(corbaData,true);
+
+ // Cette ligne poserait uun problème dans la méthode appelante, si elle
+ // ne testait pas que les types utilisateurs et CORBA sont identiques :
+ // ex : InnerType == Corba::Long et d'un T == int
+ data = dataPtr;
+
+ // L'utilisateur a la charge de la desallocation
+ // il devra appeler la méthode ecp_free pour désallouer le contenu de la séquence CORBA
+ // La structure CORBA sera désallouer le cas échéant dans la méthode appelante
+ }
+};
+
+// Cas où il faut effectuer une recopie
+template <>
+struct Copy2UserSpace<false>{
+
+ //Recopie le contenu de la donnée CORBA dans le buffer utilisateur de longueur
+ //nRead
+ template <class T1, class T2>
+ static void apply( T1 * &data, T2 & corbaData, size_t nRead){
+
+ typedef typename ProvidesPortTraits<T1>::PortType PortType;
+ typedef typename PortType::DataManipulator DataManipulator;
+ typedef typename DataManipulator::InnerType InnerType;
+
+ size_t corbaDataSize = DataManipulator::size (corbaData);
+ // Récupère un pointeur sur les données contenues dans la structure CORBA sans en devenir propriétaire
+ InnerType * dataPtr = DataManipulator::getPointer(corbaData,false);
+
+ // Attention : Pour les chaines ou tout autre object complexe il faut utiliser une recopie profonde !
+ // Recopie des données dans le buffer allouée par l'utilisateur
+ // OU
+ // Recopie des données dans le buffer allouée la méthode appelante
+ // dans le cas d'une demande utilisateur 0 copie mais sur
+ // des types utilisateurs et CORBA incompatibles.
+ std::cerr << "-------- Copy2UserSpace<false> MARK 1 --(dataPtr : " <<dataPtr<<")----------------" << std::endl;
+
+ std::copy(dataPtr,dataPtr+nRead,data);
+
+ std::cerr << "-------- Copy2UserSpace<false> MARK 2 --(nRead: "<<nRead<<")-------------" << std::endl;
+
+ std::cerr << "-------- Copy2UserSpace<false> MARK 3 --(data : " <<data<<") :";
+ std::copy(data,data+nRead,std::ostream_iterator<T1>(std::cout," "));
+ std::cout << std::endl;
+
+ }
+};
+
+
+template <bool rel>
+struct DeleteTraits {
+ template <typename T>
+ static void apply(T * dataPtr) {
+
+ typedef typename ProvidesPortTraits<T>::PortType PortType;
+ typedef typename PortType::DataManipulator DataManipulator;
+ //typedef typename DataManipulator::Type DataType; // Attention != T
+
+ // Attention : Seul CalciumCouplingPolicy via eraseDataId doit décider de supprimer ou non
+ // la donnée corba associée à un DataId ! Ne pas effectuer la desallocation suivante :
+ // DataManipulator::relPointer(dataPtr);
+ }
+};
+
+// Cas où une recopie avait été effectuée
+template <>
+struct DeleteTraits<false>{
+ template <typename T>
+ static void apply(T * dataPtr) {
+ delete[] dataPtr;
+ }
+};
+
+#endif
--- /dev/null
+// Eric Fayolle - EDF R&D
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-03-01 13:40:26 +0100 (Thu, 01 Mar 2007) $
+// Id : $Id$
+
+#include "CorbaTypes2CalciumTypes.hxx"
+#include <iostream>
+
+using namespace std;
+
+DATE_CAL_SCHEM::DATE_CAL_SCHEM() : map<Ports::Calcium_Ports::DateCalSchem,
+ CalciumTypes::DateCalSchem>()
+{
+ map<Ports::Calcium_Ports::DateCalSchem,
+ CalciumTypes::DateCalSchem > &
+ table = ( map<Ports::Calcium_Ports::DateCalSchem,
+ CalciumTypes::DateCalSchem > & ) *this ;
+
+table[Ports::Calcium_Ports::TI_SCHEM ] = CalciumTypes::TI_SCHEM ;
+table[Ports::Calcium_Ports::TF_SCHEM ] = CalciumTypes::TF_SCHEM ;
+table[Ports::Calcium_Ports::ALPHA_SCHEM ] = CalciumTypes::ALPHA_SCHEM ;
+}
+
+
+CalciumTypes::DateCalSchem DATE_CAL_SCHEM::operator[]( const Ports::Calcium_Ports::DateCalSchem &c ) const
+{
+ map<Ports::Calcium_Ports::DateCalSchem,
+ CalciumTypes::DateCalSchem> &table = (map<Ports::Calcium_Ports::DateCalSchem,
+ CalciumTypes::DateCalSchem>&)*this ;
+ assert( table.find( (Ports::Calcium_Ports::DateCalSchem)c ) != table.end() ) ;
+ return table[ (Ports::Calcium_Ports::DateCalSchem)c ] ;
+}
+
+const DATE_CAL_SCHEM dateCalSchem ;
+
+
+
+DEPENDENCY_TYPE::DEPENDENCY_TYPE() : map<Ports::Calcium_Ports::DependencyType,
+ CalciumTypes::DependencyType>()
+{
+ map<Ports::Calcium_Ports::DependencyType,
+ CalciumTypes::DependencyType > &
+ table = ( map<Ports::Calcium_Ports::DependencyType,
+ CalciumTypes::DependencyType > & ) *this ;
+
+table[Ports::Calcium_Ports::TIME_DEPENDENCY ] = CalciumTypes::TIME_DEPENDENCY ;
+table[Ports::Calcium_Ports::ITERATION_DEPENDENCY ] = CalciumTypes::ITERATION_DEPENDENCY ;
+table[Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ] = CalciumTypes::UNDEFINED_DEPENDENCY ;
+
+
+std::cout << "DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::TIME_DEPENDENCY<<"] : "<<
+ table[Ports::Calcium_Ports::TIME_DEPENDENCY] << std::endl;
+std::cout << "DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::ITERATION_DEPENDENCY<<"] : "<<
+ table[Ports::Calcium_Ports::ITERATION_DEPENDENCY] << std::endl;
+std::cout << "DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::UNDEFINED_DEPENDENCY<<"] : "<<
+ table[Ports::Calcium_Ports::UNDEFINED_DEPENDENCY] << std::endl;
+}
+
+
+CalciumTypes::DependencyType DEPENDENCY_TYPE::operator[]( const Ports::Calcium_Ports::DependencyType &c ) const
+{
+ map<Ports::Calcium_Ports::DependencyType,
+ CalciumTypes::DependencyType> &table = (map<Ports::Calcium_Ports::DependencyType,
+ CalciumTypes::DependencyType>&)*this ;
+
+std::cout << "DEPENDENCY_TYPE() : ::operator["<<c<<"]: " << table[c] << std::endl;
+
+ assert( table.find( (Ports::Calcium_Ports::DependencyType)c ) != table.end() ) ;
+ return table[ (Ports::Calcium_Ports::DependencyType)c ] ;
+}
+
+const DEPENDENCY_TYPE dependencyType ;
+
+
+
+
+INTERPOLATION_SCHEM::INTERPOLATION_SCHEM() : map<Ports::Calcium_Ports::InterpolationSchem,
+ CalciumTypes::InterpolationSchem > ()
+{
+ map<Ports::Calcium_Ports::InterpolationSchem,
+ CalciumTypes::InterpolationSchem > &
+ table = ( map<Ports::Calcium_Ports::InterpolationSchem,
+ CalciumTypes::InterpolationSchem > & ) *this ;
+
+ table[Ports::Calcium_Ports::L0_SCHEM ] = CalciumTypes::L0_SCHEM ;
+ table[Ports::Calcium_Ports::L1_SCHEM ] = CalciumTypes::L1_SCHEM ;
+}
+
+
+CalciumTypes::InterpolationSchem INTERPOLATION_SCHEM::operator[]( const Ports::Calcium_Ports::InterpolationSchem &c ) const
+{
+ map<Ports::Calcium_Ports::InterpolationSchem,
+ CalciumTypes::InterpolationSchem> &table =
+ (map<Ports::Calcium_Ports::InterpolationSchem,
+ CalciumTypes::InterpolationSchem>& ) *this ;
+
+ assert( table.find( (Ports::Calcium_Ports::InterpolationSchem)c ) != table.end() ) ;
+ return table[ (Ports::Calcium_Ports::InterpolationSchem)c ] ;
+}
+
+const INTERPOLATION_SCHEM interpolationSchem ;
+
+
+
+EXTRAPOLATION_SCHEM::EXTRAPOLATION_SCHEM() : map<Ports::Calcium_Ports::ExtrapolationSchem,
+ CalciumTypes::ExtrapolationSchem > ()
+{
+ map<Ports::Calcium_Ports::ExtrapolationSchem,
+ CalciumTypes::ExtrapolationSchem > &
+ table = ( map<Ports::Calcium_Ports::ExtrapolationSchem,
+ CalciumTypes::ExtrapolationSchem > & ) *this ;
+
+ table[Ports::Calcium_Ports::E0_SCHEM ] = CalciumTypes::E0_SCHEM ;
+ table[Ports::Calcium_Ports::E1_SCHEM ] = CalciumTypes::E1_SCHEM ;
+ table[Ports::Calcium_Ports::UNDEFINED_EXTRA_SCHEM ] = CalciumTypes::UNDEFINED_EXTRA_SCHEM ;
+}
+
+
+CalciumTypes::ExtrapolationSchem EXTRAPOLATION_SCHEM::operator[]( const Ports::Calcium_Ports::ExtrapolationSchem &c ) const
+{
+ map<Ports::Calcium_Ports::ExtrapolationSchem,
+ CalciumTypes::ExtrapolationSchem> &table =
+ (map<Ports::Calcium_Ports::ExtrapolationSchem,
+ CalciumTypes::ExtrapolationSchem>& ) *this ;
+
+ assert( table.find( (Ports::Calcium_Ports::ExtrapolationSchem)c ) != table.end() ) ;
+ return table[ (Ports::Calcium_Ports::ExtrapolationSchem)c ] ;
+}
+
+const EXTRAPOLATION_SCHEM extrapolationSchem ;
--- /dev/null
+// Eric Fayolle - EDF R&D
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-03-01 13:40:26 +0100 (Thu, 01 Mar 2007) $
+// Id : $Id$
+
+#ifndef _CORBATYPES_TO_CALCIUMTYPES_HXX_
+#define _CORBATYPES_TO_CALCIUMTYPES_HXX_
+
+#include "Calcium_Ports.hh"
+#include "CalciumTypes.hxx"
+
+#include <map>
+#include <cassert>
+
+
+class DATE_CAL_SCHEM : public std::map<Ports::Calcium_Ports::DateCalSchem,
+ CalciumTypes::DateCalSchem>
+{
+public :
+
+ DATE_CAL_SCHEM();
+ CalciumTypes::DateCalSchem operator[]( const Ports::Calcium_Ports::DateCalSchem &c ) const;
+};
+
+
+extern const DATE_CAL_SCHEM dateCalSchem ;
+
+class DEPENDENCY_TYPE : public std::map<Ports::Calcium_Ports::DependencyType,
+ CalciumTypes::DependencyType>
+{
+public :
+
+ DEPENDENCY_TYPE();
+ CalciumTypes::DependencyType operator[]( const Ports::Calcium_Ports::DependencyType &c ) const;
+};
+
+extern const DEPENDENCY_TYPE dependencyType ;
+
+class INTERPOLATION_SCHEM : public std::map<Ports::Calcium_Ports::InterpolationSchem,
+ CalciumTypes::InterpolationSchem>
+{
+public :
+
+ INTERPOLATION_SCHEM();
+ CalciumTypes::InterpolationSchem operator[]( const Ports::Calcium_Ports::InterpolationSchem &c ) const;
+} ;
+
+extern const INTERPOLATION_SCHEM interpolationSchem ;
+
+class EXTRAPOLATION_SCHEM : public std::map<Ports::Calcium_Ports::ExtrapolationSchem,
+ CalciumTypes::ExtrapolationSchem>
+{
+public :
+
+ EXTRAPOLATION_SCHEM();
+ CalciumTypes::ExtrapolationSchem operator[]( const Ports::Calcium_Ports::ExtrapolationSchem &c ) const;
+} ;
+
+extern const EXTRAPOLATION_SCHEM extrapolationSchem ;
+
+
+#endif
--- /dev/null
+# Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# 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.
+#
+# 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
+#
+#
+#
+# File : Makefile.am
+# Author : André RIBES (EDF), Eric Fayolle (EDF)
+# Module : KERNEL
+#
+
+include $(top_srcdir)/salome_adm/unix/make_common_starter.am
+
+#
+# ===============================================================
+# Header to be installed
+# ===============================================================
+#
+# header files
+salomeinclude_HEADERS = calcium_port_factory.hxx \
+ CorbaTypes2CalciumTypes.hxx \
+ CalciumTypes2CorbaTypes.hxx \
+ CalciumGenericProvidesPort.hxx \
+ calcium_uses_port.hxx \
+ CalciumGenericUsesPort.hxx \
+ calcium_provides_port.hxx \
+ CalciumProvidesPort.hxx \
+ calcium_integer_port_uses.hxx \
+ calcium_real_port_uses.hxx \
+ calcium_double_port_uses.hxx \
+ calcium_string_port_uses.hxx \
+ calcium_logical_port_uses.hxx \
+ calcium_complex_port_uses.hxx \
+ CalciumCouplingPolicy.hxx \
+ CalciumTypes.hxx \
+ CalciumInterface.hxx \
+ Copy2UserSpace.hxx \
+ Copy2CorbaSpace.hxx \
+ CalciumPortTraits.hxx \
+ calcium.h \
+ calciumP.h \
+ version.h \
+ calcium.hf
+#
+# ===============================================================
+# Local definitions
+# ===============================================================
+#
+
+# This local variable defines the list of CPPFLAGS common to all target in this package.
+COMMON_CPPFLAGS= -I$(top_srcdir)/src/DSC/DSC_User \
+ -I$(top_srcdir)/src/DSC/DSC_User/Datastream \
+ -I$(top_srcdir)/src/DSC/DSC_Basic \
+ -I$(top_srcdir)/src/SALOMELocalTrace \
+ -I$(top_srcdir)/src/Basics \
+ -I$(top_srcdir)/src/Utils \
+ -I$(top_builddir)/salome_adm/unix \
+ -I$(top_builddir)/idl \
+ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
+
+# This local variable defines the list of dependant libraries common to all target in this package.
+COMMON_LIBS = @CORBA_LIBS@
+
+#
+# ===============================================================
+# Libraries targets
+# ===============================================================
+#
+noinst_LTLIBRARIES = libSalomeCalcium.la
+
+libSalomeCalcium_la_SOURCES = calcium_port_factory.cxx \
+ calcium_uses_port.cxx \
+ calcium_provides_port.cxx\
+ calcium_repository_types.cxx \
+ CalciumCouplingPolicy.cxx \
+ CorbaTypes2CalciumTypes.cxx \
+ CalciumTypes2CorbaTypes.cxx \
+ CalciumProvidesPort.cxx \
+ calcium_destructors_port_uses.cxx
+
+libSalomeCalcium_la_CXXFLAGS = $(COMMON_CPPFLAGS)
+
+libSalomeCalcium_la_LDFLAGS = -no-undefined -version-info=0:0:0
+
+lib_LTLIBRARIES = libCalciumC.la
+
+libCalciumC_la_SOURCES = Calcium.c
+
+#
+# ===============================================================
+# Executables targets
+# ===============================================================
+#
+noinst_PROGRAMS = test_DataIdContainer
+
+test_DataIdContainer_SOURCES = test_DataIdContainer.cxx
+
+test_DataIdContainer_CXXFLAGS = $(COMMON_CPPFLAGS)
+
+test_DataIdContainer_LDADD = libSalomeCalcium.la $(top_builddir)/src/Utils/libOpUtil.la
+
+test_DataIdContainer_LDFLAGS = $(COMMON_LIBS)
+
--- /dev/null
+/* Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+ * CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+ *
+ * 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.
+ *
+ * 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
+ *
+ *
+ *
+ * File : calcium.h
+ * Author : Eric Fayolle (EDF)
+ * Module : KERNEL
+ */
+
+/* Outils d'Aide au Couplage de Code de Calcul : $Id$ */
+
+#ifndef __CALCIUM_H
+#define __CALCIUM_H
+
+#include <version.h>
+#include <calciumP.h>
+
+#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
+#define CPNeedPrototype 1
+#else
+#define CPNeedPrototype 0
+#endif
+
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/* */
+/* */
+/* Fonctions de connexion */
+/* */
+/* */
+extern int cp_cd(
+/* ----- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ char * /* S Nom de l instance appelante*/
+#endif
+);
+
+
+/* */
+/* */
+/* Fonction de deconnexion */
+/* */
+/* */
+extern int cp_fin(
+/* ------ */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Directive de continuation */
+ /* CP_CONT ou CP_ARRET */
+#endif
+);
+
+
+
+/* */
+/* */
+/* Fonctions de lecture bloquante */
+/* */
+/* */
+extern int cp_len(
+/* ------ */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Type de dependance ou de lecture */
+ /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */,
+ float * /* E/S Borne inf de l'intervalle de lecture */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ float * /* E Borne Sup de l'intervalle de lecture */,
+ int * /* E/S Pas d'iteration a lire */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ char * /* E Nom de la variable a lire */,
+ int /* E Nombre max de valeurs a lire */,
+ int * /* S Nombre de valeurs rellement lues */,
+ int * /* S Tableau d'entiers pour stocker les */
+ /* valeurs lues */
+#endif
+);
+
+extern int cp_lre(
+/* ------ */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Type de dependance ou de lecture */
+ /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */,
+ float * /* E/S Borne inf de l'intervalle de lecture */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ float * /* E Borne Sup de l'intervalle de lecture */,
+ int * /* E/S Pas d'iteration a lire */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ char * /* E Nom de la variable a lire */,
+ int /* E Nombre max de valeurs a lire */,
+ int * /* S Nombre de valeurs rellement lues */,
+ float * /* S Tableau de flottants pour stocker les */
+ /* valeurs lues */
+#endif
+);
+
+extern int cp_ldb(
+/* ------ */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Type de dependance ou de lecture */
+ /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */,
+ double* /* E/S Borne inf de l'intervalle de lecture */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ double* /* E Borne Sup de l'intervalle de lecture */,
+ int * /* E/S Pas d'iteration a lire */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ char * /* E Nom de la variable a lire */,
+ int /* E Nombre max de valeurs a lire */,
+ int * /* S Nombre de valeurs rellement lues */,
+ double* /* S Tableau de doubles pour stocker les */
+ /* valeurs lues */
+#endif
+);
+
+extern int cp_lcp(
+/* ------ */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Type de dependance ou de lecture */
+ /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */,
+ float * /* E/S Borne inf de l'intervalle de lecture */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ float * /* E Borne Sup de l'intervalle de lecture */,
+ int * /* E/S Pas d'iteration lire */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ char * /* E Nom de la variable a lire */,
+ int /* E Nombre max de valeurs a lire */,
+ int * /* S Nombre de valeurs rellement lues */,
+ float * /* S Tableau de flottants pour stocker les */
+ /* valeurs lues (dimension = 2 * le nombre */
+ /* de valeurs lues) */
+#endif
+);
+
+extern int cp_llo(
+/* ------ */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Type de dependance ou de lecture */
+ /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */,
+ float * /* E/S Borne inf de l'intervalle de lecture */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ float * /* E Borne Sup de l'intervalle de lecture */,
+ int * /* E/S Pas d'iteration a lire */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ char * /* E Nom de la variable a lire */,
+ int /* E Nombre max de valeurs a lire */,
+ int * /* S Nombre de valeurs rellement lues */,
+ int * /* S Tableau d 'entier pour stocker les */
+ /* valeurs lues (remplace le logiques) */
+#endif
+);
+
+extern int cp_lch(
+/* ------ */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Type de dependance ou de lecture */
+ /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */,
+ float * /* E/S Borne inf de l'intervalle de lecture */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ float * /* E Borne Sup de l'intervalle de lecture */,
+ int * /* E/S Pas d'iteration a lire */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ char * /* E Nom de la variable a lire */,
+ int /* E Nombre max de valeurs a lire */,
+ int * /* S Nombre de valeurs rellement lues */,
+ char *[]/* S Tableau de chaines pour stocker les */
+ /* valeurs lues (remplace le logiques) */,
+ int /* E Taille des chaines du tablaeu */
+#endif
+);
+
+
+
+/* */
+/* */
+/* Fonctions de lecture non bloquantes */
+/* */
+/* */
+extern int cp_nlen(
+/* ------- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Type de dependance ou de lecture */
+ /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */,
+ float * /* E/S Borne inf de l'intervalle de lecture */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ float * /* E Borne Sup de l'intervalle de lecture */,
+ int * /* E/S Pas d'iteration a lire */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ char * /* E Nom de la variable a lire */,
+ int /* E Nombre max de valeurs a lire */,
+ int * /* S Nombre de valeurs rellement lues */,
+ int * /* S Tableau d'entiers pour stocker les */
+ /* valeurs lues */
+#endif
+);
+
+extern int cp_nlre(
+/* ------- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Type de dependance ou de lecture */
+ /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */,
+ float * /* E/S Borne inf de l'intervalle de lecture */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ float * /* E Borne Sup de l'intervalle de lecture */,
+ int * /* E/S Pas d'iteration a lire */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ char * /* E Nom de la variable a lire */,
+ int /* E Nombre max de valeurs a lire */,
+ int * /* S Nombre de valeurs rellement lues */,
+ float * /* S Tableau de flottants pour stocker les */
+ /* valeurs lues */
+#endif
+);
+
+extern int cp_nldb(
+/* ------- */
+
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Type de dependance ou de lecture */
+ /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */,
+ double */* E/S Borne inf de l'intervalle de lecture */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ double */* E Borne Sup de l'intervalle de lecture */,
+ int * /* E/S Pas d'iteration a lire */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ char * /* E Nom de la variable a lire */,
+ int /* E Nombre max de valeurs a lire */,
+ int * /* S Nombre de valeurs rellement lues */,
+ double* /* S Tableau de doubles pour stocker les */
+ /* valeurs lues */
+#endif
+);
+
+extern int cp_nlcp(
+/* ------- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Type de dependance ou de lecture */
+ /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */,
+ float * /* E/S Borne inf de l'intervalle de lecture */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ float * /* E Borne Sup de l'intervalle de lecture */,
+ int * /* E/S Pas d'iteration lire */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ char * /* E Nom de la variable a lire */,
+ int /* E Nombre max de valeurs a lire */,
+ int * /* S Nombre de valeurs rellement lues */,
+ float * /* S Tableau de flottants pour stocker les */
+ /* valeurs lues (dimension = 2 * le nombre */
+ /* de valeurs lues) */
+#endif
+);
+
+extern int cp_nllo(
+/* ------- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Type de dependance ou de lecture */
+ /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */,
+ float * /* E/S Borne inf de l'intervalle de lecture */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ float * /* E Borne Sup de l'intervalle de lecture */,
+ int * /* E/S Pas d'iteration a lire */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ char * /* E Nom de la variable a lire */,
+ int /* E Nombre max de valeurs a lire */,
+ int * /* S Nombre de valeurs rellement lues */,
+ int * /* S Tableau d 'entier pour stocker les */
+ /* valeurs lues (remplace le logiques) */
+#endif
+);
+
+extern int cp_nlch(
+/* ------- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Type de dependance ou de lecture */
+ /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */,
+ float * /* E/S Borne inf de l'intervalle de lecture */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ float * /* E Borne Sup de l'intervalle de lecture */,
+ int * /* E/S Pas d'iteration a lire */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ char * /* E Nom de la variable a lire */,
+ int /* E Nombre max de valeurs a lire */,
+ int * /* S Nombre de valeurs rellement lues */,
+ char *[]/* S Tableau de chaines pour stocker les */
+ /* valeurs lues (remplace le logiques) */,
+ int /* E Taille des chaines du tablaeu */
+#endif
+);
+
+
+
+
+/* */
+/* */
+/* Fonctions d'ecriture */
+/* */
+/* */
+
+extern int cp_een(
+/* ------ */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Type de dependance */
+ /* CP_TEMPS, CP_ITERATION */,
+ float /* E Pas de temps a ecrire */,
+ int /* E Pas d'iteration a ecrire */,
+ char * /* E Nom de la variable a ecrire */,
+ int /* E Nombre de valeurs a ecrire */,
+ int * /* E Tableau d'entiers a ecrire */
+#endif
+);
+
+extern int cp_ere(
+/* ------ */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Type de dependance */
+ /* CP_TEMPS, CP_ITERATION */,
+ float /* E Pas de temps a ecrire */,
+ int /* E Pas d'iteration a ecrire */,
+ char * /* E Nom de la variable a ecrire */,
+ int /* E Nombre de valeurs a ecrire */,
+ float * /* E Tableau de flottants a ecrire */
+#endif
+);
+
+extern int cp_edb(
+/* ------ */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Type de dependance */
+ /* CP_TEMPS, CP_ITERATION */,
+ double /* E Pas de temps a ecrire */,
+ int /* E Pas d'iteration a ecrire */,
+ char * /* E Nom de la variable a ecrire */,
+ int /* E Nombre de valeurs a ecrire */,
+ double* /* E Tableau de doubles a ecrire */
+#endif
+);
+
+extern int cp_ecp(
+/* ------ */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Type de dependance */
+ /* CP_TEMPS, CP_ITERATION */,
+ float /* E Pas de temps a ecrire */,
+ int /* E Pas d'iteration a ecrire */,
+ char * /* E Nom de la variable a ecrire */,
+ int /* E Nombre de valeurs a ecrire */,
+ float * /* E Tableau de flottants a ecrire */
+ /* (dimension = 2 * le nombre de valeurs */
+ /* a ecrire */
+#endif
+);
+
+extern int cp_elo(
+/* ------ */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Type de dependance */
+ /* CP_TEMPS, CP_ITERATION */,
+ float /* E Pas de temps a ecrire */,
+ int /* E Pas d'iteration a ecrire */,
+ char * /* E Nom de la variable a ecrire */,
+ int /* E Nombre de valeurs a ecrire */,
+ int * /* E Tableau d'entiers a ecrire */
+#endif
+);
+
+extern int cp_ech(
+/* ------ */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Type de dependance */
+ /* CP_TEMPS, CP_ITERATION */,
+ float /* E Pas de temps a ecrire */,
+ int /* E Pas d'iteration a ecrire */,
+ char * /* E Nom de la variable a ecrire */,
+ int /* E Nombre de valeurs a ecrire */,
+ char *[]/* E Tableau de chaines a ecrire */,
+ int /* E Taille des chaines a ecrire */
+#endif
+);
+
+
+
+
+/* */
+/* */
+/* Fonctions de fin de pas */
+/* */
+/* */
+extern int cp_aufp(
+/* ------- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */
+#endif
+);
+
+extern int cp_infp(
+/* ------- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */
+#endif
+);
+
+extern int cp_fini(
+/* ------- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Tous les pas <= a cette valeur */
+ /* seront oublies par le coupleur */
+#endif
+);
+
+extern int cp_fint(
+/* ------- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ float /* E Tous les pas <= a cette valeur */
+ /* seront oublies par le coupleur */
+#endif
+);
+
+
+
+/* */
+/* */
+/* Fonctions d'effacement */
+/* */
+/* */
+extern int cp_effi(
+/* ------- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ char * /* E Nom de la variable a effacer */,
+ int /* E Tous les pas >= a cette valeurt */
+ /* seront effaces par le coupleur */
+#endif
+);
+
+
+extern int cp_efft(
+/* ------- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ char * /* E Nom de la variable a effacer */,
+ float /* E Tous les pas >= a cette valeur */
+ /* seront effaces par le coupleur */
+#endif
+);
+
+
+
+/* */
+/* */
+/* Fonctions de mode d'execution */
+/* */
+/* */
+extern int cp_pause(
+/* -------- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */
+#endif
+);
+
+extern int cp_run(
+/* ------ */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */
+#endif
+);
+
+extern int cp_npas(
+/* ------- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Nombre de pas a executer */
+#endif
+);
+
+
+
+/* */
+/* */
+/* Fonctions de configuration dynamique */
+/* */
+/* */
+extern int cp_dfcode(
+/* -------- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ char * /* E Declaration du code */
+#endif
+);
+
+extern int cp_dfinst(
+/* -------- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ char * /* E Declaration de l'instance */
+#endif
+);
+
+extern int cp_dflien(
+/* -------- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ char * /* E Declaration du lien */
+#endif
+);
+
+
+
+/* */
+/* */
+/* Fonctions d'interrogation */
+/* */
+/* */
+extern int cp_ivers(
+/* -------- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ char * /* S Repertoire ACCC */,
+ char * /* S Repertoire ACCC */
+#endif
+);
+
+
+extern int cp_icd(
+/* ------ */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Longueur du tableau passe en parametre */,
+ int * /* S Nombre de codes retournes */,
+ char *[]/* S Tableau contenant les noms des codes */
+#endif
+);
+
+extern int cp_iincd(
+/* -------- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ char * /* E Nom du code dont on veut les instances */,
+ int /* E Longueur du tableau passe en parametre */,
+ int * /* S Nombre d'instances retournees */,
+ char *[]/* S Tableau contenant les noms des instances */
+#endif
+);
+
+extern int cp_ivr(
+/* ------ */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Longueur des tableaux passes en parametre */,
+ int * /* S Nombre de variables retournees */,
+ char *[]/* S Tableau contenant les noms des instances */,
+ char *[]/* S Tableau contenant les noms des variables */
+#endif
+);
+
+extern int cp_ivrcd(
+/* -------- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ char * /* E Nom du code dont on veut les variables */,
+ int /* E Longueur des tableaux passes en parametre */,
+ int * /* S Nombre de variables retournees */,
+ char *[]/* S Tableau contenant les noms des variables */
+#endif
+);
+
+extern int cp_ivrin(
+/* -------- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ char * /* E Nom de l'instance dont on veut la liste */
+ /* des variables */,
+ char * /* S Nom du code pere de l'instance */,
+ int /* E Longueur du tableau pour les variables */
+ /* entrantes */,
+ int /* E Longueur du tableau pour les variables */
+ /* sortantes */,
+ int * /* S Nombre de variables entrantes retournees */,
+ int * /* S Nombre de variables sortantes retournees */,
+ char *[]/* S Tableau contenant les noms des variables */
+ /* entrantes */,
+ char *[]/* S Tableau contenant les noms des variables */
+ /* sortantes */
+#endif
+);
+
+extern int cp_icavr(
+/* -------- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ char * /* E Nom de l'instance contenant la variable */,
+ char * /* E Nom local de la variable */,
+ int * /* S Sens de la variable */,
+ int * /* S Dependance de la variable */,
+ int * /* S Type de la variable */,
+ int /* E Longueur des tableaux permettant de */
+ /* recueillir les pas de temps et d'iteration*/,
+ int * /* S Nombre de codes retournes */,
+ float * /* S Tableau contenant les pas de temps */,
+ int * /* S Tableau contenant les pas d'iterations */
+#endif
+);
+
+extern int cp_ilien(
+/* -------- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ char * /* E Nom global de la variable */,
+ int /* E Longueur des tableaux pour les noms des */
+ /* instances et des variables */,
+ int * /* S Nombre de variables participant au lien */,
+ char *[]/* S Tableau contenant les noms des instances */,
+ char *[]/* S Tableau contenant les noms des variables */,
+ int * /* S Type du lien */,
+ int * /* S Niveau du lien */,
+ int * /* S Tableau des parametres d'interpolation */
+ /* des variables entrantes */,
+ float * /* S Tableau des valeurs de delta utilisees */
+ /* pour les variables entrantes */,
+ int * /* S Tableau des parametres d'extrapolation */
+ /* des variables entrantes */
+#endif
+);
+
+
+
+/* */
+/* */
+/* Fonctions de manipulation d'options */
+/* */
+/* */
+extern int cp_setopt(
+/* --------- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Numero identifiant l'option a modifier */,
+ int /* E Valeur a donner a l'option */
+#endif
+);
+
+extern int cp_getopt(
+/* --------- */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Numero identifiant l'option a consulter */,
+ int * /* S Valeur recupereee de l'option */
+#endif
+);
+
+
+
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+
+#endif
--- /dev/null
+C Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+C CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Lesser General Public
+C License as published by the Free Software Foundation; either
+C version 2.1 of the License.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+C Lesser General Public License for more details.
+C
+C You should have received a copy of the GNU Lesser General Public
+C License along with this library; if not, write to the Free Software
+C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+C
+C See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+C
+C
+C
+C File : version.h
+C Author : Eric Fayolle (EDF)
+C Module : KERNEL
+C
+C Outils d'Aide au Couplage de Code de Calcul : $Id$
+
+ INTEGER CP_ENTIER, CP_REEL, CP_DREEL, CP_COMPLEXE,
+ . CP_LOGIQUE, CP_CHAINE,
+ . ENTIER,REEL,DREEL,COMPLEXE,LOGIQUE,CHAINE,
+ . CP_NORMALE, CP_ANORMALE,
+ . CP_CONT, CP_ARRET,
+ . CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL,
+ . CP_IN, CP_OUT,
+ . IN, OUT,
+ . CP_ILLIMITE, CP_AUTESP,
+ . CP_LINEAIRE, CP_ESCALIER, CP_AUCUNE,
+ . CP_ROUTE, CP_ERREURS,
+ . CP_ROUTE_NORMAL, CP_ROUTE_DIRECT,
+ . CP_AUTO, CP_BLOCAGE, CP_MANUEL,
+ . CP_ATTENTE, CP_IMMEDIATE
+ INTEGER CPLVAV, CPLVAF, CPLVAS, CPLCAV, CPLFAV,
+ . VARIABLE_LEN, CODE_LEN, INSTANCE_LEN,
+ . CPOK, CPEIU, CPNMVR, CPIOVR, CPTP, CPTPVR,
+ . CPIT, CPITVR, CPRENA, CPDNTP, CPDNDI,
+ . CPNMCD, CPNMIN, CPATTENTE, CPBLOC, CPNTNULL,
+ . CPLGVR, CPSTOP, CPATAL, CPNOCP, CPCTVR,
+ . CPPASNULL, CPMACHINE, CPGRNU, CPGRIN,
+ . CPFINFICH, CPERRFICH, CPNORERR, CPRUNERR,
+ . CPOPT, CPVALOPT, CPECREFF, CPLIEN, CPINARRET,
+ . CPSTOPSEQ, CPDECL, CPINEXEC, CPPVM, CPERRINST
+
+ PARAMETER (VARIABLE_LEN = 144 ,
+ . CODE_LEN = 72 ,
+ . INSTANCE_LEN = 72)
+
+ PARAMETER (CP_NORMALE = 10, CP_ANORMALE = 11)
+
+ PARAMETER (CP_CONT = 20, CP_ARRET = 21)
+
+ PARAMETER (CP_ENTIER = 30, CP_REEL = 31,
+ . CP_DREEL = 32, CP_COMPLEXE = 33,
+ . CP_LOGIQUE = 34, CP_CHAINE = 35)
+
+ PARAMETER (ENTIER = 30, REEL = 31,
+ . DREEL = 32, COMPLEXE = 33,
+ . LOGIQUE = 34, CHAINE = 35)
+
+ PARAMETER (CP_TEMPS= 40, CP_ITERATION = 41,
+ . CP_SEQUENTIEL = 42)
+
+ PARAMETER (CP_IN = 50, CP_OUT = 51)
+ PARAMETER (IN = 50, OUT = 51)
+
+ PARAMETER (CP_ILLIMITE = -70, CP_AUTESP = -71)
+
+ PARAMETER (CP_LINEAIRE = 100, CP_ESCALIER = 101, CP_AUCUNE = 121)
+
+ PARAMETER (CP_ROUTE = 131, CP_ERREURS = 132)
+
+ PARAMETER (CP_ROUTE_NORMAL = 133, CP_ROUTE_DIRECT = 134)
+
+ PARAMETER (CP_AUTO = 135, CP_BLOCAGE = 136, CP_MANUEL = 137)
+
+ PARAMETER (CP_ATTENTE = 24, CP_IMMEDIATE = 141)
+
+ PARAMETER (CPLVAV = 151, CPLVAF = 152, CPLVAS = 153,
+ . CPLCAV = 154, CPLFAV = 155)
+
+ PARAMETER (CPOK = 0 , CPEIU = 1 , CPNMVR = 2,
+ . CPIOVR = 3 , CPTP = 4 , CPTPVR = 5,
+ . CPIT = 6 , CPITVR = 7 , CPRENA = 8,
+ . CPDNTP = 9 , CPDNDI = 10, CPNMCD = 11,
+ . CPNMIN = 12, CPATTENTE = 13, CPBLOC = 14,
+ . CPNTNULL = 15, CPLGVR = 16, CPSTOP = 17,
+ . CPATAL = 18, CPNOCP = 19, CPCTVR = 20,
+ . CPPASNULL = 21, CPMACHINE = 22, CPGRNU = 23,
+ . CPGRIN = 24, CPFINFICH = 25, CPERRFICH = 26,
+ . CPNORERR = 27, CPRUNERR = 28, CPOPT = 29,
+ . CPVALOPT = 30, CPECREFF = 31, CPLIEN = 32,
+ . CPINARRET = 33, CPSTOPSEQ = 34, CPDECL = 35,
+ . CPINEXEC = 36, CPPVM = 37, CPERRINST = 38)
+
--- /dev/null
+/* Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+ * CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+ *
+ * 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.
+ *
+ * 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
+ *
+ *
+ *
+ * File : calciumP.h
+ * Author : Eric Fayolle (EDF)
+ * Module : KERNEL
+ */
+
+/* Outils d'Aide au Couplage de Code de Calcul : $Id$ */
+#ifndef __CONST_H
+#define __CONST_H
+
+#ifndef TrueOrFalse
+#define TrueOrFalse int
+#define TRUE 1
+#define FALSE 0
+#endif
+
+/* Definition d'un type de donnes pour le stockage du */
+/* des pas de temps */
+#ifdef CRAY
+#define Temps float
+#define FORMAT_TEMPS "%lf"
+#else
+#define Temps double
+#define FORMAT_TEMPS "%lg"
+#endif
+
+/* Precision relative pour tests d'egalite sur les temps */
+#define EPSILON 1.e-6
+
+/* Tailles utilisees lors des transmissions des noms */
+#define VERSION_LEN 144
+#define CODE_LEN 72
+#define VARIABLE_LEN 144
+#define INSTANCE_LEN 72
+#define DRIVER_LEN 72
+
+
+/* Tailles maximums */
+#define ARCHI_LEN 64
+#define ENV_VAR_LEN 256
+#define ACCC_LEN 256
+#define PVM_LEN 256
+#define USER_LEN 256
+#define MACHINE_LEN 256
+#define COMMAND_LEN 256
+#define MAX_LEN 256
+#define FICHIER_LEN 256
+
+/* Nombre de lignes dans une page du fichier erreur *
+ * de trace */
+#define NB_LIGNE_ERREUR 45
+#define NB_LIGNE_TRACE 45
+
+
+
+/* Type d'arret d'une instance */
+#define CP_NORMALE 10
+#define CP_ANORMALE 11
+
+/* Directive de continuation d'une instance */
+#define CP_CONT 20
+#define CP_ARRET 21
+
+/* Etat d'une instance */
+#define CP_INITIAL 22
+#define CP_NON_CONNECTE 23
+#define CP_ATTENTE 24
+#define CP_EXECUTION 25
+#define CP_DECONNECTE 26
+#define CP_TERMINE 27
+
+/* Type de variables */
+#define CP_ENTIER 30
+#define CP_REEL 31
+#define CP_DREEL 32
+#define CP_COMPLEXE 33
+#define CP_LOGIQUE 34
+#define CP_CHAINE 35
+
+/* Type de dependance des variables */
+#define CP_TEMPS 40
+#define CP_ITERATION 41
+#define CP_SEQUENTIEL 42
+
+/* Send des variables */
+#define CP_IN 50
+#define CP_OUT 51
+
+/* Type des instances */
+#define CP_NORMAL 60
+#define CP_ESPION 62
+
+/* Niveaux */
+#define CP_ILLIMITE -70
+#define CP_AUTESP -71
+
+/* Mode de trace */
+#define CP_SANS 80
+#define CP_SUCCINCT 81
+#define CP_DETAILLE 82
+
+
+/* Mode d'execution */
+/* La valeur CP_NORMAL definie pour les types */
+/* est aussi utilisee */
+#define CP_PAUSE 91
+
+
+/* Type d'interpolation */
+#define CP_LINEAIRE 100
+#define CP_ESCALIER 101
+
+
+/* Repere dans cycle de temps */
+#define TI 110
+#define TF 111
+
+/* Mode de nettoyage des donnees d'un lien */
+#define CP_TOUTES 120
+#define CP_AUCUNE 121
+#define CP_PAS 122
+
+/* Options configurables */
+#define CP_ROUTE 131
+#define CP_ERREURS 132
+
+/* Valeurs pour l'option CP_ROUTE */
+#define CP_ROUTE_NORMAL 133
+#define CP_ROUTE_DIRECT 134
+
+/* Valeurs pour l'option Comportement en cas d'erreur */
+#define CP_AUTO 135
+#define CP_BLOCAGE 136
+#define CP_MANUEL 137
+
+/* Type de requete de lecture */
+/* La valeur CP_ATTENTE define pour l'etat d'une */
+/* instance est aussi utilisee */
+#define CP_IMMEDIATE 141
+
+/* Definition des types de lien */
+#define CPLVAV 151
+#define CPLVAF 152
+#define CPLVAS 153
+#define CPLCAV 154
+#define CPLFAV 155
+
+/* Codes des entetes des messages (Evenemet *) */
+#define ERREUR 1000
+#define CONNEXION 1001
+#define EMISSION 1002
+#define DECONNEXION 1003
+#define LECTURE_VARIABLE 1004
+#define ECRITURE_VARIABLE 1005
+#define FIN_DE_PAS 1006
+#define AUIN_FIN_DE_PAS 1007
+#define EFFACEMENT 1008
+#define MODE_EXEC 1009
+#define RUN_N_PAS 1010
+#define DEF_CODE 1011
+#define DEF_INSTANCE 1012
+#define DEF_LIEN 1013
+#define DEM_VERSION 1014
+#define SET_OPTION 1015
+#define DEM_OPTION 1016
+#define DEM_CODES 1017
+#define DEM_INSTS_DE_CODE 1018
+#define DEM_VARIABLES 1019
+#define DEM_VARS_DE_CODE 1020
+#define DEM_VARS_DE_INST 1021
+#define DEM_CARS_DE_VARIABLE 1022
+#define DEM_CARS_DE_LIEN 1023
+#define ENV_VALEURS_VARIABLE 1024
+#define ENV_OPTION 1025
+#define ENV_CODES 1026
+#define ENV_INSTS_DE_CODE 1027
+#define ENV_VARIABLES 1028
+#define ENV_VARS_DE_CODE 1029
+#define ENV_VARS_DE_INST 1030
+#define ENV_CARS_DE_VARIABLE 1031
+#define ENV_CARS_DE_LIEN 1032
+#define ENV_TOPOLOGY 1033
+#define R_ENV_TOPOLOGY 1034
+#define ENV_MACHINE 1035
+#define R_ENV_MACHINE 1036
+#define ENV_CODE 1037
+#define R_ENV_CODE 1038
+#define ENV_INSTANCE 1039
+#define R_ENV_INSTANCE 1040
+#define ENV_VAR 1041
+#define R_ENV_VAR 1042
+#define ENV_LIEN 1043
+#define R_ENV_LIEN 1044
+#define ENV_ATTRIBUTS 1045
+#define R_ENV_ATTRIBUTS 1046
+#define ENV_VDATA 1047
+#define R_ENV_VDATA 1048
+
+
+
+
+
+
+
+
+
+/* Message PVM */
+#define P_HOST_DELETE 2000
+#define P_TASK_EXIT 2001
+
+
+
+
+
+/* Codes d'erreur */
+
+/* Pas d'erreur */
+#define CPOK 0
+
+/* Emetteur inconnu */
+#define CPERIU 1
+
+/* Nom de variable inconnu */
+#define CPNMVR 2
+
+/* Type entree/sortie incompatible */
+#define CPIOVR 3
+
+/* Type inconnu */
+#define CPTP 4
+
+/* Type de variable incompatible */
+#define CPTPVR 5
+
+/* Mode de dependance inconnu */
+#define CPIT 6
+
+/* Mode dependance incompatible */
+#define CPITVR 7
+
+/* Requete non autorisee */
+#define CPRENA 8
+
+/* Type de deconnexion incorrect */
+#define CPDNTP 9
+
+/* Directive de deconnexion incorrecte */
+#define CPDNDI 10
+
+/* Nom de code inconnu */
+#define CPNMCD 11
+
+/* Nom d'instance inconnu */
+#define CPNMIN 12
+
+/* Attente */
+#define CPATTENTE 13
+
+/* Blocage */
+#define CPBLOC 14
+
+/* Nombre de valeurs transmises egal a zero */
+#define CPNTNULL 15
+
+/* Longueur de variable insuffisante */
+#define CPLGVR 16
+
+/* L'instance doit s'arreter */
+#define CPSTOP 17
+
+/* Arret anormal */
+#define CPATAL 18
+
+/* Coupleur abscent */
+#define CPNOCP 19
+
+/* Variable sortante non connectee */
+#define CPCTVR 20
+
+/* Nombre de pas a executer egal a zero */
+#define CPPASNULL 21
+
+/* Machine inconnue */
+#define CPMACHINE 22
+
+/* COUPLAGE_GROUPE non positionnee */
+#define CPGRNU 23
+
+/* Groupe d'instances incorrect */
+#define CPGRIN 24
+
+/* Fin du fichier d'entree */
+#define CPFINFICH 25
+
+/* Erreur de format dans un fichier */
+#define CPERRFICH 26
+
+/* Requete d'avance de n pas annullee */
+/* par passage en mode NORMAL */
+#define CPNORERR 27
+
+/* Coupleur en mode NORMAL pour une */
+/* requete RUN_N_PAS ou DEF_* */
+#define CPRUNERR 28
+
+/* Option inconnue */
+#define CPOPT 29
+
+/* Valeur d'option inconnue */
+#define CPVALOPT 30
+
+/* Ecriture impossible par effacement */
+#define CPECREFF 31
+
+/* Lecture d'une variable non connectee */
+/* ou n'appartenant pas a un lien VAS */
+/* ou VAV s'il s'agit d'une sortante */
+#define CPLIEN 32
+
+/* Lecture d'une variable d'une instance*/
+/* deconnectee avec directive CP_ARRET */
+#define CPINARRET 33
+
+/* Les lectures sequentielles ne pourront plus */
+/* etre satisfaites : instance productrice arretee */
+#define CPSTOPSEQ 34
+
+/* Erreur dans la chaine de declaration */
+#define CPDECL 35
+
+/* Erreur dans l'execution de l'instance ajoutee */
+#define CPINEXEC 36
+
+/* Erreur PVM */
+#define CPPVM 37
+
+/* Erreur detectee au niveau de l'interface de couplage */
+#define CPERRINST 38
+
+
+/* IDM : les deux define suivants ont ete rajoutes a la main*/
+
+/* Erreur de mode d'execution non defini */
+#define CPMODE 39
+
+/* Erreur d'instance deconnectee */
+#define CPINSTDEC 40
+
+/* Codes des evenements pour le fichier de trace */
+
+/* Debut du couplage */
+#define DEBUT_COUPLAGE 0
+
+/* Fin du couplage */
+#define FIN_COUPLAGE 1
+
+/* Execution d'une instance par Oacc */
+#define EXEC 2
+
+/* Connexion d'une instance */
+#define CPCD 3
+
+/* Permission d'emettre accordee a l'instance */
+#define CPALLOW 4
+
+/* Requete d'ecriture */
+#define CPECRI 5
+
+/* Requete de lecture */
+#define DEB_LECT 6
+
+/* Envoi des donnees suite a une requete de lecture */
+#define FIN_LECT 7
+
+/* Deconnexion d'une instance */
+#define CPFIN 8
+
+/* Requete de fin de pas */
+#define CPFINP 9
+
+/* Requete d'autorisation de fin de pas */
+#define CPAUFP 10
+
+/* Requete d'interdiction de fin de pas */
+#define CPINFP 11
+
+/* Requete d'effacement */
+#define CPEFF 12
+
+/* Signal d'arret d'une instance */
+#define STOP 13
+
+/* Avis de blocage suite a une requete de lecture */
+#define BLOCAGE 14
+
+/* Requete de passage en mode pause */
+#define CPPAUSE 15
+
+/* Requete de passage en mode normal */
+#define CPNORMAL 16
+
+/* Requete d'execution de n pas */
+#define CPNPAS 17
+
+/* Requete de definition d'un code */
+#define CPADCD 18
+
+/* Requete de definition d'une instance */
+#define CPADINCD 19
+
+/* Requete de definition d'un lien */
+#define CPADLN 20
+
+/* Requete d'identification de version */
+#define CPIVERS 21
+
+/* Requete de demande de la liste des codes */
+#define CPICD 22
+
+/* Requete de demande des instances d'un code */
+#define CPIINCD 23
+
+/* Requete de demande de la liste des variables globales*/
+#define CPIVR 24
+
+/* Requete de demande des variables d'un code */
+#define CPIVRCD 25
+
+/* Requete de demande des variables d'une instance */
+#define CPIVRIN 26
+
+/* Requete de demande d'info sur une variable globale */
+#define CPICAVR 27
+
+/* Requete de demande des caracteristiques d'un lien */
+#define CPIILIEN 28
+
+/* Requete de modification d'une option */
+#define CPSETOPT 29
+
+/* Requete de consultation d'une option */
+#define CPGETOPT 30
+
+/* Terminaison d'une tache PVM */
+#define TASK_EXIT 31
+
+/* Deconnexion d'une machine */
+#define HOST_DELETE 32
+
+
+#ifdef PRG_MAIN
+/* Fichier principal de la bibliotheque de couplage */
+
+
+char * CPMESSAGE[] = {
+ "Pas d'erreur",
+ "Emetteur inconnu",
+ "Nom de la variable inconnu",
+ "Code entree/sortie differents dans le coupleur et dans le code",
+ "Type de variable inconnu",
+ "Types de variable differents dans le coupleur et dans le code",
+ "Mode de dependance inconnu",
+ "Modes de dependance differents dans le coupleur et dans le code",
+ "Requete non autorisee",
+ "Type de deconnexion incorrect",
+ "Directive de deconnexion incorrecte",
+ "Nom de code inconnu",
+ "Nom d'instance inconnu",
+ "Requete en attente",
+ "Cas de blocage",
+ "Nombre de valeurs transmises egal a zero",
+ "Longueur de variable insuffisante",
+ "L'instance doit s'arreter",
+ "Arret anormal d'une instance",
+ "Coupleur abscent, execution manuelle",
+ "Variable sortante non connectee",
+ "Nombre de pas a executer egal a zero",
+ "Machine non declaree",
+ "La variable d'environnement COUPLAGE_GROUPE n'est pas positionnee",
+ "Le groupe d'instances indique par COUPLAGE_GROUPE est incorrect",
+ "Fin du fichier d'entree",
+ "Erreur de format dans le fichier d'entree",
+ "Requete annulee a cause du passage en mode NORMAL",
+ "Le coupleur est en mode d'execution normal",
+ "Option inconnue",
+ "Valeur d'option incorrecte",
+ "Ecriture impossible a cause d'une requete d'effacement",
+ "Lecture d'une variable incorrectement connectee",
+ "Lecture d'une variable d'une instance deconnectee avec CP_ARRET",
+ "Lectures sequentielles plus satisfaites",
+ "Erreur dans la chaine de declaration",
+ "Erreur dans le lancement de l'instance ajoutee",
+ "Erreur PVM",
+ "Erreur detectee au niveau de l'instance",
+ };
+
+#else
+
+extern char * CPMESSAGE[];
+
+#endif
+
+
+/* Type de variables */
+#define ENTIER 30
+#define REEL 31
+#define DREEL 32
+#define COMPLEXE 33
+#define LOGIQUE 34
+#define CHAINE 35
+
+/* Macro minuscule majuscule */
+#define TOUPPER(string) \
+{\
+ int i, number = strlen(string);\
+ for (i = 0; i < number; i++) string[i] = toupper(string[i]); \
+}
+
+/* Macro inferieur */
+#define INF(a,b) (a <= b ? a : b)
+
+/* Macro superieur */
+#define SUP(a,b) (a >= b ? a : b)
+
+
+#endif
+
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : calcium_complex_port_uses.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
+// Id : $Id$
+
+#ifndef _CALCIUM_COMPLEX_PORT_USES_HXX_
+#define _CALCIUM_COMPLEX_PORT_USES_HXX_
+
+#include "Calcium_Ports.hh"
+#include "GenericUsesPort.hxx"
+
+extern char _repository_Calcium_Complex_Port_name[];
+
+class calcium_complex_port_uses :
+ public virtual CalciumGenericUsesPort< seq_u_manipulation<Ports::Calcium_Ports::seq_float,
+ CORBA::Float >,
+ Ports::Calcium_Ports::Calcium_Complex_Port,
+ _repository_Calcium_Complex_Port_name
+ >
+{
+ public :
+
+ virtual ~calcium_complex_port_uses();
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : calcium_destructors_port_uses.cxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+#include "calcium_integer_port_uses.hxx"
+#include "calcium_real_port_uses.hxx"
+#include "calcium_double_port_uses.hxx"
+#include "calcium_string_port_uses.hxx"
+#include "calcium_logical_port_uses.hxx"
+#include "calcium_complex_port_uses.hxx"
+
+calcium_real_port_uses::~calcium_real_port_uses(void) {};
+calcium_double_port_uses::~calcium_double_port_uses(void) {};
+calcium_integer_port_uses::~calcium_integer_port_uses(void) {};
+calcium_logical_port_uses::~calcium_logical_port_uses(void) {};
+calcium_complex_port_uses::~calcium_complex_port_uses(void) {};
+calcium_string_port_uses::~calcium_string_port_uses(void) {};
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : calcium_double_port_uses.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
+// Id : $Id$
+
+#ifndef _CALCIUM_DOUBLE_PORT_USES_HXX_
+#define _CALCIUM_DOUBLE_PORT_USES_HXX_
+
+#include "Calcium_Ports.hh"
+#include "CalciumGenericUsesPort.hxx"
+
+extern char _repository_Calcium_Double_Port_name[];
+
+class calcium_double_port_uses :
+ public virtual CalciumGenericUsesPort< seq_u_manipulation<Ports::Calcium_Ports::seq_double,
+ CORBA::Double >,
+ Ports::Calcium_Ports::Calcium_Double_Port,
+ _repository_Calcium_Double_Port_name
+ >
+{
+ public :
+
+ virtual ~calcium_double_port_uses();
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : calcium_integer_port_uses.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
+// Id : $Id$
+
+#ifndef _CALCIUM_INTEGER_PORT_USES_HXX_
+#define _CALCIUM_INTEGER_PORT_USES_HXX_
+
+#include "Calcium_Ports.hh"
+#include "CalciumGenericUsesPort.hxx"
+
+extern char _repository_Calcium_Integer_Port_name[];
+
+class calcium_integer_port_uses :
+ public virtual CalciumGenericUsesPort< seq_u_manipulation<Ports::Calcium_Ports::seq_long,
+ CORBA::Long >,
+ Ports::Calcium_Ports::Calcium_Integer_Port,
+ _repository_Calcium_Integer_Port_name
+ >
+{
+ public :
+
+ virtual ~calcium_integer_port_uses();
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : calcium_logical_port_uses.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
+// Id : $Id$
+
+#ifndef _CALCIUM_LOGICAL_PORT_USES_HXX_
+#define _CALCIUM_LOGICAL_PORT_USES_HXX_
+
+#include "Calcium_Ports.hh"
+#include "CalciumGenericUsesPort.hxx"
+
+extern char _repository_Calcium_Logical_Port_name[];
+
+class calcium_logical_port_uses :
+ public virtual CalciumGenericUsesPort< seq_u_manipulation<Ports::Calcium_Ports::seq_boolean,
+ CORBA::Boolean >,
+ Ports::Calcium_Ports::Calcium_Logical_Port,
+ _repository_Calcium_Logical_Port_name
+ >
+{
+ public :
+
+ virtual ~calcium_logical_port_uses();
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : calcium_port_factory.cxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $
+// Id : $Id$
+
+#include "calcium_port_factory.hxx"
+
+calcium_port_factory::calcium_port_factory() {}
+
+calcium_port_factory::~calcium_port_factory() {}
+
+provides_port *
+calcium_port_factory::create_data_servant(string type) {
+ provides_port * rtn_port = NULL;
+
+ if ( type == "integer")
+ rtn_port = new calcium_integer_port_provides();
+ if ( type == "real")
+ rtn_port = new calcium_real_port_provides();
+ if ( type == "double")
+ rtn_port = new calcium_double_port_provides();
+ if ( type == "string")
+ rtn_port = new calcium_string_port_provides();
+ if ( type == "logical")
+ rtn_port = new calcium_logical_port_provides();
+ if ( type == "complex")
+ rtn_port = new calcium_complex_port_provides();
+
+ return rtn_port;
+}
+
+uses_port *
+calcium_port_factory::create_data_proxy(string type) {
+ uses_port * rtn_port = NULL;
+
+ if ( type == "integer")
+ rtn_port = new calcium_integer_port_uses();
+ if ( type == "real")
+ rtn_port = new calcium_real_port_uses();
+ if ( type == "double")
+ rtn_port = new calcium_double_port_uses();
+ if ( type == "string")
+ rtn_port = new calcium_string_port_uses();
+ if ( type == "logical")
+ rtn_port = new calcium_logical_port_uses();
+ if ( type == "complex")
+ rtn_port = new calcium_complex_port_uses();
+
+ return rtn_port;
+}
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : calcium_port_factory.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-03-01 13:36:05 +0100 (jeu, 01 mar 2007) $
+// Id : $Id$
+
+
+#ifndef _CALCIUM_PORT_FACTORY_HXX_
+#define _CALCIUM_PORT_FACTORY_HXX_
+
+#include "uses_port.hxx"
+#include "provides_port.hxx"
+#include <string>
+
+#include "CalciumProvidesPort.hxx"
+
+#include "calcium_integer_port_uses.hxx"
+#include "calcium_real_port_uses.hxx"
+#include "calcium_double_port_uses.hxx"
+#include "calcium_string_port_uses.hxx"
+#include "calcium_logical_port_uses.hxx"
+#include "calcium_complex_port_uses.hxx"
+
+using namespace std;
+
+class calcium_port_factory
+{
+ public:
+ calcium_port_factory();
+ virtual ~calcium_port_factory();
+
+ virtual provides_port * create_data_servant(string type);
+ virtual uses_port * create_data_proxy(string type);
+};
+
+#endif
+
--- /dev/null
+// Eric Fayolle - EDF R&D
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (Wed, 28 Feb 2007) $
+// Id : $Id$
+
+#include "calcium_provides_port.hxx"
+
+calcium_provides_port::calcium_provides_port() {}
+
+calcium_provides_port::~calcium_provides_port() {}
--- /dev/null
+// Eric Fayolle - EDF R&D
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (Wed, 28 Feb 2007) $
+// Id : $Id$
+
+#ifndef _CALCIUM_PROVIDES_PORT_HXX_
+#define _CALCIUM_PROVIDES_PORT_HXX_
+
+#include "provides_port.hxx"
+#include "CalciumTypes.hxx"
+
+class calcium_provides_port : public provides_port
+{
+public :
+
+ typedef CalciumTypes::DependencyType DependencyType;
+ typedef CalciumTypes::DateCalSchem DateCalSchem;
+ typedef CalciumTypes::InterpolationSchem InterpolationSchem;
+ typedef CalciumTypes::ExtrapolationSchem ExtrapolationSchem;
+ typedef CalciumTypes::DisconnectDirective DisconnectDirective;
+
+ calcium_provides_port();
+ virtual ~calcium_provides_port();
+
+ virtual void setDependencyType (DependencyType dependencyType) =0;
+ virtual DependencyType getDependencyType () const =0;
+
+ virtual void setStorageLevel (size_t storageLevel) =0;
+ virtual size_t getStorageLevel () const =0;
+
+ virtual void setDateCalSchem (DateCalSchem dateCalSchem) =0;
+ virtual DateCalSchem getDateCalSchem () const =0;
+
+ virtual void setAlpha(double alpha) =0;
+ virtual double getAlpha() const =0;
+
+ virtual void setDeltaT(double deltaT ) =0;
+ virtual double getDeltaT() const =0;
+
+ virtual void setInterpolationSchem (InterpolationSchem interpolationSchem) =0;
+ virtual void setExtrapolationSchem (ExtrapolationSchem extrapolationSchem) =0;
+ virtual InterpolationSchem getInterpolationSchem () const =0;
+ virtual ExtrapolationSchem getExtrapolationSchem () const =0;
+
+};
+
+#endif
+
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : calcium_real_port_uses.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
+// Id : $Id$
+
+#ifndef _CALCIUM_REAL_PORT_USES_HXX_
+#define _CALCIUM_REAL_PORT_USES_HXX_
+
+#include "Calcium_Ports.hh"
+#include "CalciumGenericUsesPort.hxx"
+
+
+extern char _repository_Calcium_Real_Port_name[];
+
+class calcium_real_port_uses :
+ public virtual CalciumGenericUsesPort< seq_u_manipulation<Ports::Calcium_Ports::seq_float,
+ CORBA::Float >,
+ Ports::Calcium_Ports::Calcium_Real_Port,
+ _repository_Calcium_Real_Port_name
+ >
+{
+ public :
+
+ virtual ~calcium_real_port_uses();
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : calcium_repository_types.cxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $
+// Id : $Id$
+
+#include "calcium_integer_port_uses.hxx"
+#include "calcium_real_port_uses.hxx"
+#include "calcium_double_port_uses.hxx"
+#include "calcium_complex_port_uses.hxx"
+#include "calcium_logical_port_uses.hxx"
+#include "calcium_string_port_uses.hxx"
+
+char _repository_Calcium_Integer_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Integer_Port:1.0";
+char _repository_Calcium_Real_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Real_Port:1.0";
+char _repository_Calcium_Double_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Double_Port:1.0";
+char _repository_Calcium_Complex_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Complex_Port:1.0";
+char _repository_Calcium_Logical_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Logical_Port:1.0";
+char _repository_Calcium_String_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_String_Port:1.0";
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : calcium_string_port_uses.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
+// Id : $Id$
+
+#ifndef _CALCIUM_STRING_PORT_USES_HXX_
+#define _CALCIUM_STRING_PORT_USES_HXX_
+
+#include "Calcium_Ports.hh"
+#include "CalciumGenericUsesPort.hxx"
+
+extern char _repository_Calcium_String_Port_name[];
+
+class calcium_string_port_uses :
+ public virtual CalciumGenericUsesPort< seq_u_manipulation<Ports::Calcium_Ports::seq_string,
+ char * >,
+ Ports::Calcium_Ports::Calcium_String_Port,
+ _repository_Calcium_String_Port_name
+ >
+{
+ public :
+
+ virtual ~calcium_string_port_uses();
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : calcium_uses_port.cxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
+// Id : $Id$
+
+#include "calcium_uses_port.hxx"
+
+calcium_uses_port::calcium_uses_port() {}
+
+calcium_uses_port::~calcium_uses_port() {}
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : calcium_uses_port.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
+// Id : $Id$
+
+#ifndef _CALCIUM_USES_PORT_HXX_
+#define _CALCIUM_USES_PORT_HXX_
+
+#include "uses_port.hxx"
+
+class calcium_uses_port : public uses_port
+{
+public :
+ calcium_uses_port();
+ virtual ~calcium_uses_port();
+ virtual void disconnect (bool provideLastGivenValue) {};
+};
+
+#endif
+
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : testInterpolation.cxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $
+// Id : $Id$
+
+#include "lambda.hpp"
+#include <vector>
+#include <algorithm>
+#include <iostream>
+
+struct MyRand {
+ static const double MAXVALUE = 150.0;
+ MyRand() { srand(getpid()); }
+ int operator()() const {
+ return 1+(int) ( MAXVALUE *rand()/(RAND_MAX +1.0));
+ }
+};
+
+int main() {
+
+ typedef double Type;
+ typedef double TimeType;
+ const int dataSize1=20;
+ const int dataSize2=30;
+ const int dataSize3=std::min< size_t >(dataSize1,dataSize2);
+ std::vector<Type> vect1(dataSize1),vect2(dataSize2),vect3(dataSize3);
+ MyRand myRand;
+
+ //TEST1
+ std::generate(vect1.begin(),vect1.end(),myRand);
+ std::cout << "Vecteur1 généré aléatoirement :" << std::endl;
+ copy(vect1.begin(),vect1.end(),std::ostream_iterator<Type>(std::cout," "));
+ std::cout<< std::endl;
+
+ std::generate(vect2.begin(),vect2.end(),myRand);
+ std::cout << "Vecteur2 généré aléatoirement :" << std::endl;
+ copy(vect2.begin(),vect2.end(),std::ostream_iterator<Type>(std::cout," "));
+ std::cout<< std::endl;
+ std::vector<Type>::iterator InIt1=vect1.begin(),InIt2=vect2.begin(),OutIt=vect3.begin();
+
+ TimeType t = 2.4;
+ TimeType t2 = 3.4;
+ TimeType t1 = 1.1;
+ TimeType deltaT = t2-t1;
+ TimeType coeff = (t2-t)/deltaT;
+
+ boost::lambda::placeholder1_type _1;
+ boost::lambda::placeholder2_type _2;
+
+ std::transform(InIt1,InIt1+dataSize3,InIt2,OutIt, ( _1 - _2 ) * coeff + _2 );
+
+ std::cout << "Vecteur3 calculé :" << std::endl;
+ copy(vect3.begin(),vect3.end(),std::ostream_iterator<Type>(std::cout," "));
+ std::cout<< std::endl;
+
+
+};
+
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : test_CalciumInterface.cxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-06 10:44:23 +0100 (mar, 06 fév 2007) $
+// Id : $Id$
+
+//Permet de vérifier la syntaxe du fichier .hxx à la compilation
+#include "CalciumInterface.hxx"
+
+int main(void) {
+ return 0;
+}
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : test_DataIdContainer.cxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-03-01 15:07:46 +0100 (jeu, 01 mar 2007) $
+// Id : $Id$
+
+#include "CalciumCouplingPolicy.hxx"
+
+#include "CalciumProvidesPort.hxx"
+#include "DatastreamException.hxx"
+
+using namespace CalciumTypes;
+
+class TEST1 : public CalciumCouplingPolicy {
+public:
+ int ret;
+ TEST1() {
+
+ ret=0;
+
+ CORBA::Long time=1,tag=1;
+ typedef CalciumCouplingPolicy::DataIdContainer DataIdContainer;
+ typedef CalciumCouplingPolicy::DataId DataId;
+
+ DataId dataId(time,tag); //potentiellement avec un troisième paramètre
+ try {
+ DataIdContainer dataIds(dataId,*this);
+
+ DataIdContainer::iterator dataIdIt = dataIds.begin();
+
+ if (!dataIds.empty())
+ for (;dataIdIt != dataIds.end();++dataIdIt) {
+ std::cout << "(*dataIdIt) must be equal to given dataId parameter : " << *dataIdIt;
+ std::cout << " == " << dataId << " : " << (ret = (*dataIdIt == dataId)) << std::endl;
+ }
+ } catch(const DATASTREAM_EXCEPTION & ex) {
+ ret=1;
+ std::cout << ex.what() << std::endl;
+ }
+
+ }
+};
+
+class TEST2 : public CalciumCouplingPolicy {
+
+public:
+ int ret;
+ TEST2() {
+
+ // Doit filtrer le mode de dépendance temporel car le mode est
+ // défini itératif
+ ret=0;
+
+ CORBA::Long time=1,tag=1;
+ typedef CalciumCouplingPolicy::DataIdContainer DataIdContainer;
+ typedef CalciumCouplingPolicy::DataId DataId;
+
+ DataId dataId(time,tag); //potentiellement avec un troisième paramètre
+ setDependencyType(ITERATION_DEPENDENCY);
+ DataIdContainer dataIds(dataId,*this);
+
+
+ DataIdContainer::iterator dataIdIt = dataIds.begin();
+
+ if (!dataIds.empty())
+ for (;dataIdIt != dataIds.end();++dataIdIt) {
+ std::cout << "(*dataIdIt) must be equal to given dataId parameter : " << *dataIdIt ;
+ std::cout << " == " << DataId(0,tag) << " : " << (ret = (*dataIdIt == DataId(0,tag))) << std::endl;
+
+ }
+ }
+};
+
+
+class TEST3 : public CalciumCouplingPolicy {
+public:
+ int ret;
+
+ TEST3() {
+
+ // Doit filtrer le mode de dépendance temporel car le mode est
+ // défini itératif
+ ret=0;
+
+ CORBA::Long time=1,tag=1;
+ typedef CalciumCouplingPolicy::DataIdContainer DataIdContainer;
+ typedef CalciumCouplingPolicy::DataId DataId;
+
+ DataId dataId(time,tag); //potentiellement avec un troisième paramètre
+ setDependencyType(TIME_DEPENDENCY);
+ DataIdContainer dataIds(dataId,*this);
+
+
+ DataIdContainer::iterator dataIdIt = dataIds.begin();
+
+ if (!dataIds.empty())
+ for (;dataIdIt != dataIds.end();++dataIdIt) {
+ std::cout << "(*dataIdIt) must be equal to given dataId parameter : " << *dataIdIt ;
+ std::cout << " == " << DataId(time,0) << " : " << (ret = (*dataIdIt == DataId(time,0))) << std::endl;
+
+ }
+ }
+};
+
+int main() {
+ TEST1 test1;
+ TEST2 test2;
+ TEST3 test3;
+ return !test1.ret+!test2.ret+!test3.ret;
+};
+
--- /dev/null
+/* Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+ * CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+ *
+ * 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.
+ *
+ * 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
+ *
+ *
+ *
+ * File : version.h
+ * Author : Eric Fayolle (EDF)
+ * Module : KERNEL
+ */
+
+/* Outils d'Aide au Couplage de Code de Calcul : $Id$ */
+#ifndef __VERSION_H
+#define __VERSION_H
+
+/* Constantes servant a memoriser les repertoires des versions */
+/* de CALCIUM et de PVM ayant servi a la generation d'un */
+/* executable */
+
+#define ACCC_REP "/home/fayolle/CALCIUM3.0"
+#define PVM_REP "/home/fayolle/pvm3"
+
+#endif
+
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : ConstTraits.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $
+// Id : $Id$
+
+#ifndef _CONST_TRAITS_HXX_
+#define _CONST_TRAITS_HXX_
+
+template < typename T > struct ConstTrait { typedef T NonConstType; };
+template < typename T > struct ConstTrait < const T > { typedef T NonConstType; };
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : CorbaTypeManipulator.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-07 18:26:44 +0100 (mer, 07 fév 2007) $
+// Id : $Id$
+
+#ifndef _TYPE_MANIPULATION_HXX_
+#define _TYPE_MANIPULATION_HXX_
+
+#include <iostream>
+#include <CORBA.h>
+
+using namespace std;
+
+// Classes manipulation
+// -------------------
+//
+// Ces différentes classes permettent d'unifier la manipulation des
+// différents types de données dans un port datastream
+// Les données sont maniées par valeur ou par pointeur
+// pour éviter les recopies de gros volume de données
+
+// Les classes présentes quatre méthodes :
+// - clone
+// - get_data
+// - delete_data
+// - dump
+// et
+// deux type :
+// - Type : Le type CORBA de la donnée manipulée
+// - InType : Le mapping CORBA pour un paramètre IN du type manipulé
+
+
+// Cette classe permet de manipuler des types CORBA
+// any, struct, union et sequence (utiliser plutôt les seq_manipulator)
+// Ces types sont manipulés par pointeur.
+// Les données reçues de CORBA sont systématiquement
+// dupliquées pour être conservées.
+// Quelque soit le type de donnée, les données sont considérées
+// comme une donnée unique (retour de size() == 1)
+template <typename T >
+class user_type_manipulation
+{
+public:
+ typedef T * Type;
+ // correspond au mapping corba des type any, struct,
+ // union, séquence en paramètre IN
+ typedef const T & CorbaInType;
+ typedef T InnerType;
+
+ // Operation de recuperation des donnees venant de l'ORB et
+ // creation d'une copie (memoire spécialement allouee)
+ static inline Type get_data(CorbaInType data) {
+ return new T(data);
+ }
+
+ // Pb si ownerShip == True car appel par l'utilisateur de relPointer !
+ static inline InnerType * const getPointer(Type data, bool ownerShip = false) {
+ return data;
+ }
+
+ static inline void relPointer(InnerType * dataPtr) {
+ delete dataPtr;
+ }
+
+ // Operation de clonage : par defaut, creation d'une copie en memoire allouee pour l'occasion
+ static inline Type clone(Type data) {
+ return new T (* data);
+ }
+ static inline Type clone(CorbaInType data) {
+ return new T (data);
+ }
+
+ // Operation de création
+ static inline Type create (size_t size=1) {
+ return new T();
+ }
+
+ // Operation de destruction d'une donnee
+ static inline void delete_data(Type data) {
+ delete data;
+ }
+
+ // Renvoie la taille de la donnée
+ static inline size_t size(Type data) {
+ return 1;
+ }
+
+ // Dump de l'objet pour deboguage: neant car on ne connait pas sa structure
+ static inline void dump (CorbaInType data) {}
+};
+
+
+// Gére les types CORBA atomiques ('Int', 'Char', 'Float', ...)
+// Gére les types enums
+// Gére les références d'objets CORBA
+// Ces types sont manipulés par valeur
+// Les méthodes getPointer ... ne devrait pas être utilisée
+// pour ce types de données
+template <typename T>
+class atom_manipulation
+{
+public:
+ typedef T Type;
+ // correspond au mapping corba des types simples en paramètre IN
+ typedef T CorbaInType;
+ typedef T InnerType;
+
+
+ // Operation de recuperation des donnees venant de l'ORB : une copie par affectation simple
+ static inline Type get_data(CorbaInType data) {
+ return data;
+ }
+
+ static inline InnerType * const getPointer(Type & data, bool getOwnerShip = false) {
+// InnerType * ptr;
+// if (getOwnerShip) {
+// ptr =new InnerType[1];*ptr=data;
+// return ptr;
+// } else
+// return &data;
+ return &data;
+ }
+
+// static inline void relPointer(InnerType * dataPtr) {
+// return;
+// delete[] dataPtr;
+// }
+
+// Je ne sais pas comment l'implémenter sans faire
+// d'allocation heap
+//static inline InnerType * allocPointer(size_t size=1) {
+// return new InnerType[1];
+ //}
+
+ // Operation de clonage : une copie par affectation simple
+ static inline Type clone(Type data) {
+ return data;
+ }
+
+ // Inutile car Type == CorbaInType
+ // static inline Type clone(CorbaInType data) {
+ // return data;
+ // }
+
+ // Operation de création
+// static inline Type create(size_t size=1,InnerType * data=NULL,
+// bool giveOwnerShip=false) {
+// Type dummy;
+// if (dataPtr)
+// return *data;
+// else
+// return dummy;
+// }
+
+ // Operation de destruction d'une donnee: rien a faire car pas de memoire a liberer
+ static inline void delete_data(Type data) {}
+ // Renvoie la taille de la donnée
+
+ static inline size_t size(Type data) {
+ return 1;
+ }
+
+ // Dump de l'objet pour deboguage : Affiche la donnee
+ static void inline dump (CorbaInType data) {
+ cerr << "[atom_manipulation] Data : " << data << endl;
+ }
+};
+
+
+// Gére un type sequence de taille illimitee (Unbounded)
+// Ces types sont manipulés par pointeur
+template <typename seq_T,typename elem_T>
+class seq_u_manipulation {
+
+public:
+ typedef seq_T * Type;
+ // correspond au mapping corba de la séquence en paramètre IN
+ typedef const seq_T & CorbaInType;
+ typedef elem_T InnerType;
+
+
+ // Operation de recuperation des donnees venant de l'ORB
+ // Remarque : On a un paramètre d'entrée de type const seq_T &
+ // et en sortie un seq_T *
+ static inline Type get_data(CorbaInType data) {
+ CORBA::Long len = data.length();
+ CORBA::Long max = data.maximum();
+ // Récupère et devient propriétaire des données reçues dans la séquence.
+ // La séquence sera désalloué (mais pas le buffer) au retour
+ // de la méthode put (car mapping de type IN : const seq & )
+ // ATTENTION TESTER p184 si le pointeur est null
+ // ATTENTION TESTER Si le flag release si la sequence contient des chaines
+ // ou des object refs
+ std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1 ------------------" << std::endl;
+ InnerType * p_data = const_cast<seq_T &>(data).get_buffer(true);
+ std::cout << "----seq_u_manipulation::get_data(..)-- MARK 2 ------"<< p_data <<"------------" << std::endl;
+
+ // Crée une nouvelle sequence propriétaire des données du buffer (pas de recopie)
+ // Les données seront automatiquement désallouées par appel interne à la méthode freebuf
+ // lors de la destruction de l'objet par appel à delete_data.
+ return new seq_T (max, len, p_data, true);
+ }
+
+ static inline size_t size(Type data) {
+ return data->length();
+ }
+
+ // Operation de destruction d'une donnee
+ static inline void delete_data(Type data) {
+ delete data;
+ }
+
+ // Operation de clonage : par defaut creation d'une copie en memoire allouee pour l'occasion
+ // Utilisation du constructeur du type seq_T
+ static inline Type clone(Type data) {
+ return new seq_T (*data) ;
+ }
+ static inline Type clone(CorbaInType data) {
+ return new seq_T (data);
+ }
+
+ // Permet de désallouer le buffer dont on détient le pointeur par appel
+ // à la méthode getPointer avec ownerShip=True si la séquence contenante
+ // à été détruite.
+ static inline InnerType * const getPointer(Type data, bool ownerShip = false) {
+ InnerType * p_data;
+ if (ownerShip) {
+ p_data = data->get_buffer(true);
+ delete_data(data);
+ } else
+ p_data = data->get_buffer(false);
+ return p_data;
+ }
+
+ // Permet de désallouer le buffer dont on détient le pointeur par appel
+ // à la méthode getPointer avec ownerShip=True si la séquence contenante
+ // à été détruite.
+ static inline void relPointer(InnerType * dataPtr) {
+ seq_T::freebuf(dataPtr);
+ }
+
+ // Permet d'allouer un buffer pour la séquence
+ static inline InnerType * allocPointer(size_t size ) {
+ return seq_T::allocbuf(size);
+ }
+
+ // Operation de création du type corba soit
+ // - Vide et de taille size
+ // - Utilisant les données du pointeur *data de taille size
+ // (généralement pas de recopie qlq soit l'ownership )
+ // data doit avoir été alloué par allocPointer si giveOwnerShip = true
+ static inline Type create(size_t size, InnerType * const data = NULL,
+ bool giveOwnerShip = false ) {
+ Type tmp;
+ if (!data) {
+ tmp = new seq_T();
+ tmp->length(size);
+ } else {
+ tmp = new seq_T(size,size,data,giveOwnerShip);
+ }
+ return tmp;
+ }
+
+ // Dump de l'objet pour deboguage
+ static void inline dump (CorbaInType data) {
+ // Affiche la longueur des donnees
+ cerr << "[seq_u_manipulation] Data length: " << data.length() << endl;
+ // Affiche la longueur des donnees
+ cerr << "[seq_u_manipulation] Data max: " << data.maximum() << endl;
+ }
+};
+
+
+// Gére un type sequence de taille limitée (bounded)
+// Ces types sont manipulés par pointeur
+// Cette classe diffère de la seq_u_manipulation
+// par la signature du constructeur de la séquence
+// utilisé dans le methode get_data
+template <typename seq_T,typename elem_T>
+class seq_b_manipulation {
+
+public:
+ typedef seq_T * Type;
+ typedef const seq_T & CorbaInType;
+ typedef elem_T InnerType;
+
+
+ // Operation de recuperation des donnees venant de l'ORB
+ // Sans opération de notre part, ces données seraient perdues
+ // au retour de la méthode put de GenericPort.
+ // Remarque : On a un paramètre d'entrée de type const seq_T &
+ // et en sortie un seq_T *
+ static inline Type get_data(CorbaInType data) {
+ CORBA::Long len = data.length();
+ // Récupère et devient propriétaire des données reçues dans la séquence
+ // la séquence sera désalloué (mais pas le buffer)
+ // au retour de la méthode put (car mapping de type IN : const seq & )
+ InnerType * p_data = const_cast<seq_T &>(data).get_buffer(true);
+ // Crée une nouvelle sequence propriétaire des données du buffer (généralement pas de recopie)
+ // Les données seront automatiquement désallouées par appel interne à la méthode freebuf
+ // lors de la destruction de l'objet par appel à delete_data.
+ return new seq_T (len, p_data, true);
+ }
+
+ static inline size_t size(Type data) {
+ return data->length();
+ }
+
+ // Operation de clonage : par defaut creation d'une copie en memoire allouee pour l'occasion
+ // Utilisation du constructeur du type seq_T
+ static inline Type clone(Type data) {
+ return new seq_T (* data);
+ }
+ static inline Type clone(CorbaInType data) {
+ return new seq_T (data);
+ }
+
+ // Operation de destruction d'une donnee CORBA
+ static inline void delete_data(Type data) {
+ delete data;
+ }
+
+ // Récupère un pointeur sur les données de type InnerType contenue dans la séquence
+ // si ownership=True, l'utilisateur devra appeler relPointer
+ // si ownership=False, l'utilisateur devra appeler delete_data sur la séquence contenante
+ static inline InnerType * const getPointer(Type data, bool getOwnerShip = false) {
+ InnerType * p_data;
+ if (getOwnerShip) {
+ p_data = data->get_buffer(true);
+ delete_data(data);
+ } else
+ p_data = data->get_buffer(false);
+ return p_data;
+ }
+
+ // Permet de désallouer le buffer dont on détient le pointeur par appel
+ // à la méthode getPointer avec ownerShip=True si la séquence contenante
+ // à été détruite.
+ static inline void relPointer(InnerType * dataPtr) {
+ seq_T::freebuf(dataPtr);
+ }
+
+ // Permet d'allouer un buffer pour la séquence
+ static inline InnerType * allocPointer(size_t size ) {
+ return seq_T::allocbuf(size);
+ }
+
+ // Operation de création du type corba soit
+ // - Vide et de taille size
+ // - Utilisant les données du pointeur *data de taille size
+ // (généralement pas de recopie qlq soit l'ownership )
+ // data doit avoir été alloué par allocPointer si giveOwnerShip = true
+ static inline Type create(size_t size, InnerType * const data = NULL,
+ bool giveOwnerShip = false ) {
+ Type tmp;
+ if (!data) {
+ tmp = new seq_T();
+ tmp->length(size);
+ } else {
+ tmp = new seq_T(size,data,giveOwnerShip);
+ }
+ return tmp;
+ }
+
+
+ // Dump de l'objet pour deboguage
+ static inline void dump (CorbaInType data) {
+ // Affiche la longueur des donnees
+ cerr << "[seq_b_manipulation] Data length: " << data.length() << endl;
+ }
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : CouplingPolicy.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
+// Id : $Id$
+
+#ifndef _COUPLING_POLICY_HXX_
+#define _COUPLING_POLICY_HXX_
+
+#include "IteratorTraits.hxx"
+#include "FindKeyPredicate.hxx"
+#include <algorithm>
+#include <functional>
+#include <iterator>
+
+// La politique de couplage doit définir
+// 1) le type DataId qui identifie une instance de données
+// 2) Un container de DataId appelé DataIdContainer et son itérateur
+// 3) Un constructeur de DataIdContainer qui initialise le container à partir d'un DataId
+
+////////// Le DataId //////////////
+// COUPLING_POLICY::DataId
+// est construit par DataId(T1 time,T2 tag)
+//
+// COUPLING_POLICY::DataIdContainer
+// qui défini
+// les types : DataIdContainer::iterator
+// les méthodes : begin(), end(), empty()
+// COUPLING_POLICY::DataIdContainer::iterator
+// qui défini
+// les méthodes : != , == , ++() , ()++, *(), =
+
+// COUPLING_POLICY::DataTable
+// std::map< DataId, DataType> DataTable;
+
+// Définir void COUPLING_POLICY::DataIdContainer(const DataId &, CouplingPolicy & )
+// qui initialise le container à partir d'un DataId
+
+// Opérateur d'affichage d'un dataId (les types doivent être affichables)
+
+
+class CouplingPolicy {
+
+public:
+
+ // Renvoie isEqual si le dataId attendu est trouvé dans storedDataIds :
+ // - l'itérateur wDataIt1 pointe alors sur ce dataId
+ // Cette méthode doit être redéfini dans le mode de couplage s'il veut gérer
+ // le cas d'un dataId damandé non trouvé mais encadrable
+ // par deux autres dataIds. La méthode renvoie alors isBounded== true et :
+ // - l'itérateur wDataIt1 doit être tel que :
+ // wDataIt1->first < wdataId < (wDataIt1+1)->first
+ template < typename Container >
+ bool isDataIdConveniant(Container & storedDatas,
+ const typename Container::key_type & expectedDataId,
+ bool & isEqual , bool & isBounded,
+ typename Container::iterator & wDataIt1 ) const {
+ typedef typename Container::key_type key_type;
+ typedef typename Container::value_type value_type;
+ typedef typename Container::iterator iterator;
+ isBounded = false;
+ FindKeyPredicate<value_type> fkp(expectedDataId);
+ wDataIt1 = std::find_if(storedDatas.begin(),storedDatas.end(),fkp);
+ isEqual = (wDataIt1 != storedDatas.end());
+ std::cout << "-------- Generic isDataIdConvenient : isEqual : " << isEqual << " , isBounded " << isBounded << std::endl;
+ return isEqual || isBounded;
+ }
+
+
+ // Méthode Vide déclarée ici pour définir son nom dans GenericPort
+ // Elle profite à tous les modes de couplages n'implémentant pas
+ // de comportement particulier dans la méthode get pour
+ // le cas d'une demande de dataId inexistant mais encadré par deux autres
+ template <typename DataManipulator>
+ struct BoundedDataIdProcessor{
+ BoundedDataIdProcessor(CouplingPolicy couplingPolicy) {};
+ template < typename Iterator, typename DataId >
+ void inline apply(typename iterator_t<Iterator>::value_type & data,
+ const DataId & dataId,
+ const Iterator & it1) {
+ typedef typename iterator_t<Iterator>::value_type value_type;
+ std::cout << "-------- Generic BoundedDataIdProcessor.apply() called " << std::endl;
+
+ }
+ };
+
+ // Supprime un DataId et ses données associées
+ // du container
+ // Cette méthode utilisée dans GenericPort::Get
+ // peut être surchargée pour par exemple
+ // conserver un historique.
+ template <typename DataManipulator>
+ struct EraseDataIdProcessor {
+
+ EraseDataIdProcessor(CouplingPolicy couplingPolicy) {};
+
+ template < typename Container >
+ void apply(Container & storedDatas,
+ typename Container::iterator & wDataIt1 ) const {
+ typedef typename Container::key_type key_type;
+ typedef typename Container::value_type value_type;
+ typedef typename Container::iterator iterator;
+
+ std::cout << "-------- Generic eraseDataId called " << std::endl;
+ }
+ };
+
+ // Lorsque cette méthode est appelée l'expectedDataId n'a pas été trouvé
+ // et n'est pas non plus encadrée (en mode temporel)
+ // Si l'on effectue pas de traitement particulier la méthode renvoie false
+ // Si le port a reçu une directive STOP une exception est levée
+ // Si le port a reçu une directive CONTINUE, on localise l'expected
+ template < typename DataManipulator >
+ struct DisconnectProcessor {
+
+ DisconnectProcessor(CouplingPolicy couplingPolicy) {};
+
+ template < typename Container, typename DataId >
+ bool apply(Container & storedDatas,
+ const DataId & expectedDataId,
+ typename Container::iterator & wDataIt1 ) const {
+ typedef typename Container::key_type key_type;
+ typedef typename Container::value_type value_type;
+ typedef typename Container::iterator iterator;
+
+ std::cout << "-------- Generic DisconnectProcessor called " << std::endl;
+ return true;
+ }
+ };
+
+ virtual ~CouplingPolicy() {}
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : DataIdFilter.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+/* Module Filtre
+ * -------------
+ *
+ * Implemente les fonctions de filtrage et conversion d'un port de DATASTREAM
+ *
+ * Rappel des fonctions du Filtrage:
+ * --------------------------------
+ *
+ * Dans une communication de type DATASTREAM, le destinataire indique à l'avance la liste
+ * des instances qu'il veut recevoir, c'est à dire celles qui lui sont nécessaires.
+ * Il indique pour cela la liste des 'times' et la liste des 'tags' qui
+ * caractérisent les instances désirées.
+ * Ces deux listes sont indépendantes. Toute instance dont les paramètres 'time' et
+ * 'tag' figurent dans la liste des 'times' et respectivement dans la liste des
+ * 'tags' est désirée par le destinataire.
+ * Par la suite, une telle instance sera acceptée par le port-DATASTREAM. Les autres
+ * seront rejetées.
+ *
+ * Le filtrage consiste à limiter les valeurs possibles du paramètre TIME ou TAG (un
+ * entier). La liste des valeurs possibles est décrite sous la forme d'une liste de
+ * valeurs ou de séquences arithmétiques de valeurs.
+ * Exemple:
+ * La liste 1; 3; 30:34; 40:50:2 autorise les valeurs 1 et 3 et toutes les valeurs
+ * comprises entre 30 et 34 inclus et toutes les valeurs de la séquence 40 à 50
+ * inclus par pas de 2, c'est à dire 40, 42, ... 50.
+ * On appelle règle élémentaire de filtrage celle spécifiant un élément de la liste
+ * des valeurs autorisées: soit une seule valeur, soit une séquence de valeurs. Une
+ * séquence de valeurs est spécifiée par sa valeur de départ, sa valeur de fin et
+ * son pas. Le filtrage est donc défini par une suite de règles de filtrage.
+ * La fonction élémentaire de configuration du filtrage sert à spécifier une règle
+ * de filtrage.
+ *
+ * Rappels des fonctions de conversion:
+ * -----------------------------------
+ *
+ * La conversion est intimement liée au filtrage car seules les valeurs passant le
+ * filtre sont converties. La conversion n'est pas obligatoire. Une valeur de TIME ou TAG
+ * entrante peut ne pas être convertie. Elle garde alors sa valeur et est gardée
+ * telle quelle pour l'objet destinataire.
+ * DATASTREAM peut associer une règle de conversion à chaque règle élémentaire de
+ * filtrage.
+ * La conversion consiste à changer:
+ * - un valeur de TIME ou TAG en une valeur différente
+ * - une séquence de valeurs en une autre séquence de valeurs de même taille
+ * (ex: 30:40 en 300:400:10)
+ * Mais la conversion permet aussi de transformer:
+ * - une valeur de TIME ou TAG unique en une séquence de valeurs (les données entrantes sont
+ * alors duppliquées et à chaque fois que l'objet destinataire réclame une donnée
+ * de la séquence, il reçoit en fait une copie de la donnée reçue une seule fois)
+ *
+ * - une séquence de valeurs en une valeur unique (alors, chaque donnée entrante
+ * associée à un TIME ou TAG de la séquence correspond à une donnée unique pour le
+ * destinataire: seule la dernière reçue est la donnée valide)
+ *
+ */
+
+#include <vector>
+#include <iostream>
+
+// Pour l'utilisation de "vector" de la STL
+using namespace std;
+
+// Classe filtre_elementaire
+//
+// Implémente une structure de donnée décrivant un filtre élémentaire
+// sur le paramètre TIME ou TAG; c'est
+// - soit une valeur entière unique
+// - soit une séquence arithmétique de valeurs
+//
+class filtre_elementaire
+{
+public:
+ int len; // Longueur de séquence ou 1 pour une valeur unique
+ int debut; // Début de la séquence ou valeur pour une valeur unique
+ int fin; // Fin de la séquence
+ int pas; // Pas de la séquence
+
+ // Constructeur par défaut
+ filtre_elementaire() {}
+
+ // Création d'un filtre élémentaire pour une valeur unique
+ filtre_elementaire(int valeur)
+ {
+ this->len = 1;
+ this->debut = valeur;
+ }
+
+ // Création d'un filtre élémentaire pour une séquence de valeurs entières
+ // Le pas par défaut est 1
+ filtre_elementaire (int _debut, int _fin, int _pas=1)
+ {
+ this->debut = _debut;
+ this->len = (_fin - _debut) / _pas;
+ if (this->len > 0)
+ {
+ this->fin = _debut + _pas * this->len; // Calcule la vrai borne de fin
+ this->pas = _pas;
+ this->len += 1; // Compte les bornes et non les intervalles
+ }
+ else // erreur de spécification: on ne prend que la première valeur
+ this->len = 1;
+ }
+
+ // Constructeur par copie
+ filtre_elementaire (filtre_elementaire &_f)
+ {
+ this->len = _f.len;
+ this->debut = _f.debut;
+ this->fin = _f.fin;
+ this->pas = _f.pas;
+ }
+};
+
+// Classe filtre_conversion
+//
+// Implémente le filtrage et la conversion du paramètre TIME ou TAG
+// des données reçues par un port DATASTREAM.
+//
+// Mode d'emploi:
+// 1) Création d'un objet
+// 2) Configuration de cet objet par passage de paramètres
+// de filtage et de conversion
+// 3) A la création d'un port DATASTREAM, on passe au constructeur
+// deux objets 'filtre_conversion', l'un pour le TIME, l'autre pour le TAG.
+// 4) A l'utilisation du port DATASTREAM, celui-ci appelle la méthode
+// "applique_filtre_conversion" pour opérer
+//
+class filtre_conversion
+{
+private:
+ // Structure de données décrivant une conversion élémentaire:
+ // un filtre élementaire
+ // et un pointeur éventuel vers les paramètres de conversion associés
+ class conversion_elementaire
+ {
+ public :
+ // Data
+ filtre_elementaire filtre;
+ filtre_elementaire * p_convers;
+
+ // Constructeur
+ conversion_elementaire() {}
+
+ // Constructeur par copie d'un objet non modifie (const)
+ conversion_elementaire (const conversion_elementaire& _ce)
+ {
+ *this = _ce;
+ }
+ // Remarque: le Constructeur par copie d'un objet existe par defaut mais sans le modificateur 'const'
+ // et l'emploi d'un objet comme element dans un vecteur oblige d'avoir un tel const-copy-constructor.
+ };
+
+ // Données de configuration de filtrage et conversion:
+ // une table de filtres élémentaires
+ // avec leurs données de conversion associées éventuelles
+ vector<conversion_elementaire> config;
+
+public:
+ // Constructeur: juste une allocation mémoire initiale
+ filtre_conversion() {}
+
+ // Destructeur:
+ // réclamer la mémoire utilisée par tous les éléments du vecteur config
+ ~filtre_conversion()
+ {
+ vector<conversion_elementaire>::iterator i;
+ for (i = this->config.begin(); i != this->config.end(); i ++)
+ {
+ delete (*i).p_convers;
+ }
+ }
+
+ // Configuration partielle par ajout d'un filtre élémentaire
+ bool config_elementaire (filtre_elementaire& _f)
+ {
+// cout << "ajout config_elementaire 1 " << this << endl;
+ conversion_elementaire conv_elem;
+
+ conv_elem.filtre = _f;
+ conv_elem.p_convers = NULL;
+
+ // Ajoute cette conversion/filtrage elementaire a la liste
+ this->config.push_back (conv_elem);
+
+// vector<conversion_elementaire>::iterator i;
+// cout << "liste apres ajout:" << endl;
+// for (i = this->config.begin(); i != this->config.end(); i ++)
+// {
+// cout << "config elem " << endl;
+// cout << "filtre: len, debut, fin, pas " << (*i).filtre.len << " " << (*i).filtre.debut << " " << (*i).filtre.fin << " " << (*i).filtre.pas << endl;
+// }
+
+ return true;
+ }
+
+ // Configuration partielle par ajout d'un filtre élémentaire
+ // et sa conversion associée
+ //
+ // Retourne false si les param de conversion sont incompatibles avec le filtre élémentaire.
+ // La configuration partielle est alors refusée.
+ //
+ bool config_elementaire (filtre_elementaire& _f, filtre_elementaire& _conv)
+ {
+// cout << "ajout config_elementaire 2 " << this << endl;
+
+ if (_f.len == 1 || _conv.len == 1 || _f.len == _conv.len)
+ {
+ conversion_elementaire conv_elem;
+ conv_elem.filtre = _f;
+ conv_elem.p_convers = new filtre_elementaire(_conv);
+
+ // Ajoute cette conversion/filtrage elementaire a la liste
+ this->config.push_back (conv_elem);
+
+// vector<conversion_elementaire>::iterator i;
+// cout << "liste apres ajout:" << endl;
+// for (i = this->config.begin(); i != this->config.end(); i ++)
+// {
+// cout << "config elem " << endl;
+// cout << "filtre: len, debut, fin, pas " << (*i).filtre.len << " " << (*i).filtre.debut << " " << (*i).filtre.fin << " " << (*i).filtre.pas << endl;
+// }
+
+ return true;
+ }
+ else
+ {
+ // Filtre et conversion incompatibles
+ return false;
+ }
+ }
+
+ // applique_filtre_conversion: Opération du filtre et de la conversion
+ template <typename T > T applique_filtre_conversion (T valeur_initiale, vector<T>& liste_conversions) const;
+};
+
+
+
+// filtre_conversion::applique_filtre_conversion: Opération du filtre et de la conversion
+//
+// Etant donné une valeur entière (de TIME ou de TAG), cette méthode détermine :
+// - si cette valeur passe le filtre
+// - dans le cas où une conversion existe, la liste des valeurs de conversion
+// qui correspondent à la valeur initiale
+//
+// Dans tous les cas, cette méthode retourne une liste de valeurs.
+// Dans le cas où il n'y a pas de conversion, cette liste a une longueur 1
+// et ne contient que la valeur initiale.
+//
+// Paramètre d'entrée : la valeur initiale (integer)
+//
+// Paramètre de sortie : la liste des valeurs après conversion (vector<int>)
+//
+// Valeur de retour : la longueur de la liste
+// si cette longueur est 0, c'est que la valeur initiale ne passe pas le filtre
+//
+template <typename T>
+T filtre_conversion::applique_filtre_conversion (T valeur_initiale, vector<T>& liste_conversions) const
+{
+ // Part d'une liste vierge
+ liste_conversions.clear();
+
+// cout << "config applique_filtre_conversion " << this << endl;
+
+ // Balaye tous les éléments de configuration
+ // et cherche pour chacun d'eux si la valeur initiale est présente parmi les valeurs filtrées
+
+ // Pour tous les éléments de configuration du filtrage/conversion
+ vector<conversion_elementaire>::const_iterator i;
+ for (i = config.begin(); i != config.end(); i ++)
+ {
+
+// cout << "config elem " << endl;
+// cout << "filtre: len, debut, fin, pas " << (*i).filtre.len << " " << (*i).filtre.debut << " " << (*i).filtre.fin << " " << (*i).filtre.pas << endl;
+
+ bool si_passe_filtre = false;
+
+ // Si la longueur du filtre est 1
+ if ((*i).filtre.len == 1) {
+ // Si la valeur initiale correspond à la valeur du filtre
+ if ((*i).filtre.debut == valeur_initiale)
+ si_passe_filtre = true;
+ } else {
+ // Si la valeur initiale est dans la séquence des valeurs du filtre
+ // la valeur est comprise dans les bornes [debut,fin]
+ // et sa distance du début de la séquence est modulo le pas
+ if ( ((*i).filtre.fin - valeur_initiale >= 0) == (valeur_initiale - (*i).filtre.debut >= 0)
+ && (valeur_initiale - (*i).filtre.debut) % (*i).filtre.pas == 0 ) {
+ si_passe_filtre = true;
+ }
+ }
+
+ // Si la valeur initiale passe le filtre
+ if (si_passe_filtre) {
+ // cout << "config: filtre passe " << endl;
+
+ // Si il y a une conversion à effectuer
+ if ((*i).p_convers != NULL) {
+
+ // Si la longueur du filtre est 1
+ if ((*i).filtre.len == 1) {
+
+ // Si la longueur des paramètres de conversion est aussi 1
+ if ((*i).p_convers->len == 1) {
+ // Ajoute la valeur de conversion à la liste des valeurs après conversion
+ liste_conversions.push_back ((*i).p_convers->debut);
+ } else {
+ // Ajoute la séquence de conversion à la liste des valeurs après conversion
+ for (int s = (*i).p_convers->debut; s != (*i).p_convers->fin; s += (*i).p_convers->pas) {
+ liste_conversions.push_back (s);
+ }
+ liste_conversions.push_back ((*i).p_convers->fin);
+ }
+
+ } else {
+ // Le filtre est une séquence qui est convertie en une autre séquence de même longueur
+ // Choisit la valeur au rang désiré dans la séquence de conversion
+ int rang = (valeur_initiale - (*i).filtre.debut) / (*i).filtre.pas;
+
+ int valeur_convertie = (*i).p_convers->debut + rang * (*i).p_convers->pas;
+
+ // Ajoute cette valeur à la liste des valeurs après conversion
+ liste_conversions.push_back (valeur_convertie);
+ }
+ } else {
+ // Ajoute la valeur initiale telle-quelle à la liste des valeurs après conversion
+ liste_conversions.push_back (valeur_initiale);
+ }
+ }
+ }
+
+ return liste_conversions.size();
+}
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : DatastreamException.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-06 17:20:28 +0100 (mar, 06 fév 2007) $
+// Id : $Id$
+
+#ifndef DATASTREAM_EXCEPTION_HXX
+#define DATASTREAM_EXCEPTION_HXX
+
+#include "DSC_Exception.hxx"
+#include "CalciumTypes.hxx"
+
+struct DatastreamException : public DSC_Exception {
+
+ DatastreamException( const CalciumTypes::InfoType info,
+ const string & text,
+ const char *fileName,
+ const unsigned int lineNumber,
+ const char *funcName):
+ DSC_Exception(text,fileName,lineNumber,funcName),_info(info)
+ {};
+
+
+ DatastreamException( const CalciumTypes::InfoType info,
+ const string & text ):
+ DSC_Exception(text),_info(info)
+ {};
+
+ DatastreamException(CalciumTypes::InfoType info, const DSC_Exception & ex ):
+ DSC_Exception(ex),_info(info) {};
+
+ virtual ~DatastreamException() throw() {};
+ CalciumTypes::InfoType getInfo() const { return _info;}
+ void setInfo(CalciumTypes::InfoType info) {_info=info;}
+
+private:
+ CalciumTypes::InfoType _info;
+};
+
+
+#endif /* DATASTREAM_EXCEPTION_HXX */
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : DisplayPair.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $
+// Id : $Id$
+
+#ifndef __DISPLAY_PAIR__
+#define __DISPLAY_PAIR__
+
+#include <iostream>
+
+template <typename T, typename U> std::ostream & operator <<(std::ostream & os, const std::pair<T,U> & p)
+{ os << "(" << p.first << "," << p.second << ")";
+ return os;
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : FindKeyPredicate.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $
+// Id : $Id$
+
+#ifndef __FIND_KEY_PREDICATE__
+#define __FIND_KEY_PREDICATE__
+
+#include <functional>
+#include <utility>
+#include "DisplayPair.hxx"
+
+template < typename T >
+struct FindKeyPredicate : public std::unary_function < T, bool >
+{
+ T _value;
+ FindKeyPredicate(const T& value):_value(value){}
+ inline bool operator()(const T &v1, const T& v2) const {
+ std::cout << "FindKeyPredicate Generic -> :" << &(v1.first) << std::endl;
+ return ( v1 == _value );
+ }
+};
+
+// Pour les MAPs avec une clef sous forme de pair
+// template <typename T1, typename T2, typename T3>
+// struct FindKeyPredicate< std::pair<const std::pair<T1,T2>, T3 > > :
+// public std::binary_function < std::pair<const std::pair<T1,T2>, T3 >,
+// std::pair<const std::pair<T1,T2>, T3 >, bool >
+// {
+// std::pair<T1,T2> _value;
+// FindKeyPredicate(const std::pair<T1,T2> & value):_value(value){
+// std::cout << "1-Initializing with value " << _value << std::endl;
+// }
+// bool operator()( const std::pair<const std::pair<T1,T2>, T3 > & v1,
+// const std::pair<const std::pair<T1,T2>, T3 > v2) const {
+// std::cout << "1-> :" << v1 << "," << v2 << " " << std::endl;
+// return (v1.first <= _value ) && (_value < v2.first) ;
+// }
+// };
+
+template <typename T1, typename T2>
+struct FindKeyPredicate< std::pair<T1,T2> > : public std::unary_function < std::pair<T1,T2>, bool >
+{
+ T1 _value;
+ FindKeyPredicate(const T1 & value):_value(value){
+ std::cout << "FindKeyPredicate 2-Initializing with value " << _value << std::endl;
+ }
+
+ inline bool operator()( const std::pair<T1,T2> & v1) const {
+ std::cout << "FindKeyPredicate 2-> :" << v1.first << std::endl;
+ return v1.first == _value ;
+ }
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : GenericPort.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
+// Id : $Id$
+
+#ifndef _GENERIC_PORT_HXX_
+#define _GENERIC_PORT_HXX_
+
+#include "CorbaTypeManipulator.hxx"
+
+// SALOME CORBA Exception
+#include "Utils_CorbaException.hxx"
+// SALOME C++ Exception
+#include "Utils_SALOME_Exception.hxx"
+
+#include <iostream>
+#include <map>
+
+// Inclusions pour l'affichage
+#include <algorithm>
+#include <iterator>
+
+// Classe GenericPort
+// --------------------------------
+//
+// Definition: Implemente un port de type "data-stream"
+// Cette implémentation gère tous les types de données définies par DataManipulator::type
+// Ce port est soumis à une politique d'itération sur les identificateurs de données (DataId)
+// Un identificateur de données est construit à partir d'un ou plusieurs paramètres de la méthode put
+// tels que : une date, une itération, un pas de temps ou une combinaison de ces paramètres.
+
+template < typename DataManipulator, class COUPLING_POLICY >
+class GenericPort : public COUPLING_POLICY {
+public:
+ // Type de données manipulés
+ typedef typename DataManipulator::Type DataType;
+ typedef typename DataManipulator::CorbaInType CorbaInDataType;
+
+ GenericPort();
+ virtual ~GenericPort();
+
+ template <typename TimeType,typename TagType> void put(CorbaInDataType data, TimeType time, TagType tag);
+ template <typename TimeType,typename TagType> DataType get(TimeType time, TagType tag);
+ template <typename TimeType,typename TagType> DataType get(TimeType ti, TimeType tf, TagType tag = 0);
+ template <typename TimeType,typename TagType> DataType next(TimeType &t, TagType &tag );
+ void close (PortableServer::POA_var poa, PortableServer::ObjectId_var id);
+ void wakeupWaiting();
+
+private:
+
+ // Type identifiant une instance de donnee. Exemple (time,tag)
+ typedef typename COUPLING_POLICY::DataId DataId;
+ typedef std::map< DataId, DataType> DataTable;
+
+ // Stockage des donnees recues et non encore distribuées
+ DataTable storedDatas ;
+
+ // Indicateur que le destinataire attend une instance particuliere de données
+ bool waitingForConvenientDataId;
+ // Indicateur que le destinataire attend n'importe qu'elle instance de données
+ bool waitingForAnyDataId;
+
+ // Identificateur de la donné que le destinataire (propriétaire du port) attend
+ DataId expectedDataId ;
+ // Sauvegarde du DataId courant pour la méthode next
+ DataId lastDataId;
+ bool lastDataIdSet;
+ // Exclusion mutuelle d'acces a la table des données reçues
+ omni_mutex storedDatas_mutex;
+ // Condition d'attente d'une instance (Le processus du Get attend la condition declaree par le processus Put)
+ omni_condition cond_instance;
+
+};
+
+template < typename DataManipulator, typename COUPLING_POLICY >
+GenericPort<DataManipulator, COUPLING_POLICY >::GenericPort() :
+ cond_instance(& this->storedDatas_mutex),waitingForConvenientDataId(false),
+ waitingForAnyDataId(false),lastDataIdSet(false) {}
+
+template < typename DataManipulator, typename COUPLING_POLICY>
+GenericPort<DataManipulator, COUPLING_POLICY>::~GenericPort() {
+ typename DataTable::iterator it;
+ // for (it=storedDatas.begin(); it!=storedDatas.end(); ++it) {
+ // std::cout << "~GenericPort() : destruction de la donnnée associée au DataId :"<< (*it).first << std::endl;
+ // DataManipulator::delete_data( (*it).second );
+ // }
+}
+
+template < typename DataManipulator, typename COUPLING_POLICY> void
+GenericPort<DataManipulator, COUPLING_POLICY>::close (PortableServer::POA_var poa,
+ PortableServer::ObjectId_var id) {
+ // Ferme le port en supprimant le servant
+ // La desactivation du servant du POA provoque sa suppression
+ poa->deactivate_object (id);
+}
+
+template < typename DataManipulator, typename COUPLING_POLICY> void
+GenericPort<DataManipulator, COUPLING_POLICY>::wakeupWaiting()
+{
+ std::cout << "-------- wakeupWaiting ------------------" << std::endl;
+ if (waitingForAnyDataId || waitingForConvenientDataId)
+ {
+ std::cout << "-------- wakeupWaiting:signal --------" << std::endl;
+ std::cout << std::flush;
+ cond_instance.signal();
+ }
+}
+
+/* Methode put_generique
+ *
+ * Stocke en memoire une instance de donnee (pointeur) que l'emetteur donne a l'intention du destinataire.
+ * Reveille le destinataire, si il y a lieu.
+ */
+template < typename DataManipulator, typename COUPLING_POLICY>
+template < typename TimeType,typename TagType>
+void GenericPort<DataManipulator, COUPLING_POLICY>::put(CorbaInDataType dataParam,
+ TimeType time,
+ TagType tag) {
+ fflush(stdout);
+ fflush(stderr);
+ try {
+ // Affichage des donnees pour DEBUGging
+ cerr << "parametres emis: " << time << ", " << tag << endl;
+ DataManipulator::dump(dataParam);
+
+ // L'intérêt des paramètres time et tag pour ce port est décidé dans la politique de couplage
+ // Il est possible de filtrer en prenant en compte uniquement un paramètre time/tag ou les deux
+ // Il est également possible de convertir les données recues ou bien de les dupliquer
+ // pour plusieurs valeurs de time et/ou tag (d'où la notion de container dans la politique de couplage)
+ typedef typename COUPLING_POLICY::DataIdContainer DataIdContainer;
+ typedef typename COUPLING_POLICY::DataId DataId;
+
+ DataId dataId(time,tag);
+ // Effectue les traitements spécifiques à la politique de couplage
+ // pour construire une liste d'ids (par filtrage, conversion ...)
+ // DataIdContainer dataIds(dataId,*(static_cast<const COUPLING_POLICY *>(this)));
+ DataIdContainer dataIds(dataId, *this);
+
+ typename DataIdContainer::iterator dataIdIt = dataIds.begin();
+
+ bool expectedDataReceived = false;
+
+ std::cout << "-------- Put : MARK 1 ------------------" << std::endl;
+ if ( dataIds.empty() ) return;
+ std::cout << "-------- Put : MARK 1bis ------------------" << std::endl;
+
+ // Recupere les donnees venant de l'ORB et relâche les structures CORBA
+ // qui n'auraient plus cours en sortie de méthode put
+ DataType data = DataManipulator::get_data(dataParam);
+
+
+ int nbOfIter = 0;
+
+ std::cout << "-------- Put : MARK 2 ------ "<< (dataIdIt == dataIds.end()) << "------------" << std::endl;
+ std::cout << "-------- Put : MARK 2bis "<< (*dataIdIt) <<"------------------" << std::endl;
+ storedDatas_mutex.lock();
+
+ for (;dataIdIt != dataIds.end();++dataIdIt) {
+
+ std::cout << "-------- Put : MARK 3 ------------------" << std::endl;
+ // Duplique l'instance de donnée pour les autres dataIds
+ if (nbOfIter > 0) data = DataManipulator::clone(data);
+ std::cout << "-------- Put : MARK 3bis -----"<< dataIdIt.operator*() <<"------------" << std::endl;
+
+ DataId currentDataId=*dataIdIt;
+
+ std::cerr << "processing dataId : "<< currentDataId << std::endl;
+
+ std::cout << "-------- Put : MARK 4 ------------------" << std::endl;
+
+ // Ajoute l'instance de la donnee a sa place dans la table de données
+ // ou remplace une instance précédente si elle existe
+
+ // Recherche la première clé telle quelle ne soit pas < currentDataId
+ // pour celà l'opérateur de comparaison storedDatas.key_comp() est utilisé
+ // <=> premier emplacement où l'on pourrait insérer notre DataId
+ // <=> en général équivaux à (*wDataIt).first >= currentDataId
+ typename DataTable::iterator wDataIt = storedDatas.lower_bound(currentDataId);
+ std::cout << "-------- Put : MARK 5 ------------------" << std::endl;
+
+ // On n'a pas trouvé de dataId supérieur au notre ou
+ // on a trouvé une clé > à cet Id
+ if (wDataIt == storedDatas.end() || storedDatas.key_comp()(currentDataId,(*wDataIt).first) ) {
+ std::cout << "-------- Put : MARK 6 ------------------" << std::endl;
+ // Ajoute la donnee dans la table
+ wDataIt = storedDatas.insert(wDataIt, make_pair (currentDataId, data));
+ } else {
+ // Si on n'est pas en fin de liste et qu'il n'y a pas de relation d'ordre strict
+ // entre notre dataId et le DataId pointé c'est qu'ils sont identiques
+ std::cout << "-------- Put : MARK 7 ------------------" << std::endl;
+ // Les données sont remplacées par les nouvelles valeurs
+ // lorsque que le dataId existe déjà
+ DataType old_data = (*wDataIt).second;
+ (*wDataIt).second = data;
+ // Detruit la vieille donnee
+ DataManipulator::delete_data (old_data);
+ }
+
+ std::cout << "-------- Put : MARK 8 ------------------" << std::endl;
+ // Compte le nombre de dataIds à traiter
+ ++nbOfIter;
+
+ std::cout << "-------- Put : waitingForConvenientDataId : " << waitingForConvenientDataId <<"---" << std::endl;
+ std::cout << "-------- Put : waitingForAnyDataId : " << waitingForAnyDataId <<"---" << std::endl;
+ std::cout << "-------- Put : currentDataId : " << currentDataId <<"---" << std::endl;
+ std::cout << "-------- Put : expectedDataId : " << expectedDataId <<"---" << std::endl;
+ std::cout << "-------- Put : MARK 9 ------------------" << std::endl;
+
+ // A simplifier mais :
+ // - pas possible de mettre des arguments optionnels à cause
+ // du type itérator qui n'est pas connu (pas de possibilité de déclarer un static )
+ // - compliquer de créer une méthode sans les paramètres inutiles tout en réutilisant
+ // la méthode initiale car cette dernière ne peut pas être déclarée virtuelle
+ // à cause de ses paramètres templates. Du coup, il faudrait aussi redéfinir la
+ // méthode simplifiée dans les classes définissant une politique
+ // de couplage particulière ...
+ bool dummy1,dummy2; typename DataTable::iterator dummy3;
+ // Par construction, les valeurs de waitingForAnyDataId, waitingForConvenientDataId et de
+ // expectedDataId ne peuvent pas être modifiées pendant le traitement de la boucle
+ // sur les dataIds (à cause du lock utilisé dans la méthode put et les méthodes get )
+ // rem : Utilisation de l'évaluation gauche droite su logical C or
+ if ( waitingForAnyDataId ||
+ ( waitingForConvenientDataId &&
+ isDataIdConveniant(storedDatas, expectedDataId, dummy1, dummy2, dummy3) )
+ ) {
+ std::cout << "-------- Put : MARK 10 ------------------" << std::endl;
+ //Doit pouvoir réveiller le get ici (a vérifier)
+ expectedDataReceived = true;
+ }
+ }
+
+ if (expectedDataReceived) {
+ std::cout << "-------- Put : MARK 11 ------------------" << std::endl;
+ // si waitingForAnyDataId était positionné, c'est forcément lui qui a activer
+ // expectedDataReceived à true
+ if (waitingForAnyDataId)
+ waitingForAnyDataId = false;
+ else
+ waitingForConvenientDataId = false;
+ // Reveille le thread du destinataire (stoppe son attente)
+ // Ne faudrait-il pas réveiller plutôt tous les threads ?
+ // Celui réveillé ne correspond pas forcément à celui qui demande
+ // cet expectedDataReceived.
+ // Pb1 : cas d'un un get séquentiel et d'un get sur un dataId que l'on vient de recevoir.
+ // Si l'on reveille le mauvais thread, l'autre va attendre indéfiniment ! (sauf timeout)
+ // Pb2 : également si deux attentes de DataIds même différents car on n'en stocke qu'un !
+ // Conclusion : Pour l'instant on ne gère pas un service multithreadé qui effectue
+ // des lectures simultanées sur le même port !
+ std::cout << "-------- Put : new datas available ------------------" << std::endl;
+ fflush(stdout);fflush(stderr);
+ cond_instance.signal();
+ }
+ std::cout << "-------- Put : MARK 12 ------------------" << std::endl;
+
+ // Deverouille l'acces a la table : On peut remonter l'appel au dessus de expected...
+ storedDatas_mutex.unlock();
+
+ std::cout << "-------- Put : MARK 13 ------------------" << std::endl;
+ fflush(stdout);
+ fflush(stderr);
+
+ } // Catch les exceptions SALOME//C++ pour la transformer en une exception SALOME//CORBA
+ catch ( const SALOME_Exception & ex ) {
+ // On évite de laisser un mutex
+ storedDatas_mutex.unlock();
+
+ std::cerr << ex;
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+
+}
+
+
+// Version du Get en 0 copy
+// ( n'effectue pas de recopie de la donnée trouvée dans storedDatas )
+// ( L'utilisateur devra être attentif à la politique de gestion de l'historique
+// spécifique au mode de couplage car il peut y avoir une suppression potentielle
+// d'une donnée utilisée directement dans le code utilisateur )
+// Le code doit prendre connaissance du transfert de propriété ou non des données
+// auprès du mode de couplage choisi.
+template < typename DataManipulator, typename COUPLING_POLICY >
+template < typename TimeType,typename TagType>
+typename DataManipulator::Type
+GenericPort<DataManipulator, COUPLING_POLICY>::get(TimeType time,
+ TagType tag)
+// REM : Laisse passer toutes les exceptions
+// En particulier les SALOME_Exceptions qui viennent de la COUPLING_POLICY
+// Pour déclarer le throw avec l'exception spécifique il faut que je vérifie
+// qu'un setunexpeted est positionné sinon le C++ arrête tout par appel à terminate
+{
+ typedef typename COUPLING_POLICY::DataId DataId;
+ // (Pointeur sur séquence) ou valeur..
+ DataType dataToTransmit ;
+ bool isEqual, isBounded;
+ typedef typename DataManipulator::InnerType InnerType;
+
+ std::cout << "-------- Get : MARK 1 ------------------" << std::endl;
+ expectedDataId = DataId(time,tag);
+ std::cout << "-------- Get : MARK 2 ------------------" << std::endl;
+
+ typename DataTable::iterator wDataIt1;
+
+ try {
+ storedDatas_mutex.lock(); // Gérer les Exceptions ds le corps de la méthode
+
+ while ( true ) {
+
+ // Renvoie isEqual si le dataId attendu est trouvé dans storedDatas :
+ // - l'itérateur wDataIt1 pointe alors sur ce dataId
+ // Renvoie isBounded si le dataId attendu n'est pas trouvé mais encadrable et
+ // que la politique gére ce cas de figure
+ // - l'itérateur wDataIt1 est tel que wDataIt1->first < wdataId < (wDataIt1+1)->first
+ // Méthode provenant de la COUPLING_POLICY
+ isDataIdConveniant(storedDatas,expectedDataId,isEqual,isBounded,wDataIt1);
+ std::cout << "-------- Get : MARK 3 ------------------" << std::endl;
+
+ // L'ordre des différents tests est important
+ if ( isEqual ) {
+
+ std::cout << "-------- Get : MARK 4 ------------------" << std::endl;
+ // La propriété de la données N'EST PAS transmise à l'utilisateur en mode CALCIUM.
+ // Si l'utilisateur supprime la donnée, storedDataIds devient incohérent
+ // C'est EraseDataId qui choisi ou non de supprimer la donnée
+ // Du coup interaction potentielle entre le 0 copy et gestion de l'historique
+ dataToTransmit = (*wDataIt1).second;
+
+ std::cout << "-------- Get : MARK 5 ------------------" << std::endl;
+ std::cout << "-------- Get : Données trouvées à t : " << std::endl;
+ typename DataManipulator::InnerType const * const InIt1 = DataManipulator::getPointer(dataToTransmit);
+ size_t N = DataManipulator::size(dataToTransmit);
+ std::copy(InIt1, InIt1 + N,
+ std::ostream_iterator< InnerType > (std::cout," "));
+ std::cout << std::endl;
+
+ // Décide de la suppression de certaines instances de données
+ // La donnée contenu dans la structure CORBA et son dataId sont désallouées
+ // Méthode provenant de la COUPLING_POLICY
+ typename COUPLING_POLICY::template EraseDataIdProcessor<DataManipulator> processEraseDataId(*this);
+ processEraseDataId.apply(storedDatas,wDataIt1);
+ std::cout << "-------- Get : MARK 6 ------------------" << std::endl;
+ break;
+
+ }
+ std::cout << "-------- Get : MARK 7 ------------------" << std::endl;
+
+ //if ( isBounded() && COUPLING_POLICY::template needToProcessBoundedDataId() ) {
+ // Le DataId demandé n'est pas trouvé mais est encadré ET la politique de couplage
+ // implémente une méthode processBoundedDataId capable de générer les données à retourner
+ if ( isBounded ) {
+ // Pour être cohérent avec la politique du bloc précédent
+ // on stocke la paire (dataId,données interpolées ).
+ // CALCIUM ne stockait pas les données interpolées.
+ // Cependant comme les données sont censées être produites
+ // par ordre croissant de DataId, de nouvelles données ne devrait pas améliorer
+ // l'interpolation.
+ // Les données calciulées sont donc stockées dans storedDatas.
+ // La propriété des données N'EST PAS transférée à l'utilisateur en mode CALCIUM.
+ std::cout << "-------- Get : MARK 8 ------------------" << std::endl;
+
+ typename COUPLING_POLICY::template BoundedDataIdProcessor<DataManipulator> processBoundedDataId(*this);
+ //si static BDIP::apply(dataToTransmit,expectedDataId,wDataIt1);
+ //ancienne version template processBoundedDataId<DataManipulator>(dataToTransmit,expectedDataId,wDataIt1);
+ //BDIP processBoundedDataId;
+ processBoundedDataId.apply(dataToTransmit,expectedDataId,wDataIt1);
+
+ // Il ne peut pas y avoir déjà une clé expectedDataId dans storedDatas (utilisation de la notation [] )
+ // Cette opération n'a peut être pas un caractère générique.
+ // A déplacer en paramètre de la méthode précédente ?
+ storedDatas[expectedDataId]=dataToTransmit;
+
+ std::cout << "-------- Get : Données calculées à t : " << std::endl;
+ typename DataManipulator::InnerType const * const InIt1 = DataManipulator::getPointer(dataToTransmit);
+ size_t N = DataManipulator::size(dataToTransmit);
+
+ std::copy(InIt1, InIt1 + N,
+ std::ostream_iterator< InnerType > (std::cout," "));
+ std::cout << std::endl;
+ std::cout << "-------- Get : MARK 9 ------------------" << std::endl;
+
+ typename COUPLING_POLICY::template EraseDataIdProcessor<DataManipulator> processEraseDataId(*this);
+ processEraseDataId.apply(storedDatas,wDataIt1);
+
+ break;
+ }
+
+ // Délègue au mode de couplage la gestion d'une demande de donnée non disponible
+ // si le port est deconnecté
+ typename COUPLING_POLICY::template DisconnectProcessor<DataManipulator> processDisconnect(*this);
+ if ( processDisconnect.apply(storedDatas, expectedDataId, wDataIt1) ) continue;
+
+ // Réception bloquante sur le dataId demandé
+ // Si l'instance de donnée n'est pas trouvee
+ std::cout << "-------- Get : MARK 10 ------------------" << std::endl;
+ //Positionné à faux dans la méthode put
+ waitingForConvenientDataId = true;
+ std::cout << "-------- Get : MARK 11 ------------------" << std::endl;
+
+ // Ici on attend que la méthode put recoive la donnée
+ std::cout << "-------- Get : waiting datas ------------------" << std::endl;
+ fflush(stdout);fflush(stderr);
+ cond_instance.wait();
+
+ std::cout << "-------- Get : MARK 12 ------------------" << std::endl;
+ }
+
+ } catch (...) {
+ storedDatas_mutex.unlock();
+ throw;
+ }
+
+ // Deverouille l'acces a la table
+ storedDatas_mutex.unlock();
+ std::cout << "-------- Get : MARK 13 ------------------" << std::endl;
+
+ // La propriété de la données N'EST PAS transmise à l'utilisateur en mode CALCIUM
+ // Si l'utilisateur supprime la donnée, storedDataIds devient incohérent
+ // c'est eraseDataId qui choisi ou non de supprimer la donnée
+ // Du coup interaction potentielle entre le 0 copy et gestion des niveaux
+ return dataToTransmit;
+
+}
+
+template < typename DataManipulator, typename COUPLING_POLICY >
+template < typename TimeType,typename TagType>
+typename DataManipulator::Type
+GenericPort<DataManipulator, COUPLING_POLICY>::get(TimeType ti,
+ TimeType tf,
+ TagType tag ) {
+ TimeType t = COUPLING_POLICY::getEffectiveTime(ti,tf);
+ return get(t,tag);
+}
+
+
+// Version du next en 0 copy
+// ( n'effectue pas de recopie de la donnée trouvée dans storedDatas )
+template < typename DataManipulator, typename COUPLING_POLICY >
+template < typename TimeType,typename TagType>
+typename DataManipulator::Type
+GenericPort<DataManipulator, COUPLING_POLICY>::next(TimeType &t,
+ TagType &tag ) {
+
+ typedef typename COUPLING_POLICY::DataId DataId;
+
+ DataType dataToTransmit;
+ DataId dataId;
+
+ try {
+ storedDatas_mutex.lock();// Gérer les Exceptions ds le corps de la méthode
+
+ std::cout << "-------- Next : MARK 1 ---lastDataIdSet ("<<lastDataIdSet<<")---------------" << std::endl;
+
+ typename DataTable::iterator wDataIt1;
+ wDataIt1 = storedDatas.end();
+
+ //Recherche le prochain dataId à renvoyer
+ if (lastDataIdSet)
+ wDataIt1 = storedDatas.upper_bound(lastDataId);
+ else if ( !storedDatas.empty() ) {
+ lastDataIdSet = true;
+ wDataIt1 = storedDatas.begin();
+ }
+
+ while ( storedDatas.empty() || wDataIt1 == storedDatas.end() ) {
+
+ // Délègue au mode de couplage la gestion d'une demande de donnée non disponible
+ // si le port est deconnecté
+ typename COUPLING_POLICY::template DisconnectProcessor<DataManipulator> processDisconnect(*this);
+ if ( processDisconnect.apply(storedDatas, lastDataId, wDataIt1) ) break;
+
+ std::cout << "-------- Next : MARK 2 ------------------" << std::endl;
+ //Positionné à faux dans la méthode put
+ waitingForAnyDataId = true;
+ std::cout << "-------- Next : MARK 3 ------------------" << std::endl;
+ // Ici on attend que la méthode put recoive la donnée
+ std::cout << "-------- Next : waiting datas ------------------" << std::endl;
+ fflush(stdout);fflush(stderr);
+ cond_instance.wait();
+
+ if (lastDataIdSet) {
+ std::cout << "-------- Next : MARK 4 ------------------" << std::endl;
+ wDataIt1 = storedDatas.upper_bound(lastDataId);
+ } else {
+ std::cout << "-------- Next : MARK 5 ------------------" << std::endl;
+ lastDataIdSet = true;
+ wDataIt1 = storedDatas.begin();
+ }
+ }
+
+ std::cout << "-------- Next : MARK 6 ------------------" << std::endl;
+
+ t = getTime( (*wDataIt1).first );
+ tag = getTag ( (*wDataIt1).first );
+ dataToTransmit = (*wDataIt1).second;
+
+ std::cout << "-------- Next : MARK 7 ------------------" << std::endl;
+ lastDataId = (*wDataIt1).first;
+
+ typename COUPLING_POLICY::template EraseDataIdProcessor<DataManipulator> processEraseDataId(*this);
+ processEraseDataId.apply(storedDatas, wDataIt1);
+
+ std::cout << "-------- Next : MARK 8 ------------------" << std::endl;
+ } catch (...) {
+ storedDatas_mutex.unlock();
+ throw;
+ }
+ storedDatas_mutex.unlock();
+
+ std::cout << "-------- Next : MARK 9 ------------------" << std::endl;
+
+ // La propriété de la données N'EST PAS transmise à l'utilisateur en mode CALCIUM
+ // Si l'utilisateur supprime la donnée, storedDataIds devient incohérent
+ // c'est eraseDataId qui choisi ou non de supprimer la donnée
+ // Du coup interaction potentielle entre le 0 copy et gestion des niveaux
+ return dataToTransmit;
+
+};
+
+#endif
--- /dev/null
+// Eric Fayolle - EDF R&D
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (Wed, 28 Feb 2007) $
+// Id : $Id$
+
+#ifndef _GENERIC_PROVIDES_PORT_HXX_
+#define _GENERIC_PROVIDES_PORT_HXX_
+
+#include "provides_port.hxx"
+#include "GenericPort.hxx"
+
+
+template <typename DataManipulator, typename CouplingPolicy, typename ProvidesPort=provides_port>
+class GenericProvidesPort : public ProvidesPort,
+ public GenericPort< DataManipulator , CouplingPolicy > {
+public :
+ // Type de données manipulés
+ typedef typename DataManipulator::Type DataType;
+ typedef typename DataManipulator::CorbaInType CorbaInDataType;
+
+ virtual ~GenericProvidesPort() {};
+
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : GenericUsesPort.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
+// Id : $Id$
+
+#ifndef _GENERIC_USES_PORT_HXX_
+#define _GENERIC_USES_PORT_HXX_
+
+#include "CorbaTypeManipulator.hxx"
+
+#include "uses_port.hxx"
+#include "SALOME_Ports.hh"
+
+#include "DSC_Exception.hxx"
+
+// #define GENERATE_USES_PORT(dataManip,portType,portName) \
+// const char * _repository_##portType##_name_ = "IDL:Ports/##portType##:1.0"; \
+// GenericUsesPort< dataManip, portType, _repository_##portType##_name_ > portName;
+
+//ex : GENERATE_USES_PORT(Ports::Data_Short_Port,data_short_port);
+
+template <typename DataManipulator, typename CorbaPortType, char * repositoryName, typename UsesPort=uses_port>
+class GenericUsesPort : public UsesPort
+{
+public :
+ // Type de données manipulés
+ typedef typename DataManipulator::Type DataType;
+ typedef typename DataManipulator::CorbaInType CorbaInDataType;
+
+ GenericUsesPort();
+ virtual ~GenericUsesPort();
+
+ virtual const char * get_repository_id();
+ virtual bool set_port(Ports::Port_ptr port);
+ template <typename TimeType,typename TagType>
+ void put(CorbaInDataType data, TimeType time, TagType tag);
+
+ virtual void uses_port_changed(Engines::DSC::uses_port * new_uses_port,
+ const Engines::DSC::Message message);
+
+protected :
+ Engines::DSC::uses_port * _my_ports;
+};
+
+
+template <typename DataManipulator,typename CorbaPortType, char * repositoryName, typename UsesPort >
+GenericUsesPort< DataManipulator,CorbaPortType, repositoryName, UsesPort >::GenericUsesPort() {
+ _my_ports = NULL;
+}
+
+template <typename DataManipulator,typename CorbaPortType, char * repositoryName, typename UsesPort >
+GenericUsesPort< DataManipulator,CorbaPortType, repositoryName, UsesPort >::~GenericUsesPort() {}
+
+template <typename DataManipulator,typename CorbaPortType, char * repositoryName, typename UsesPort >
+const char *
+GenericUsesPort< DataManipulator,CorbaPortType, repositoryName, UsesPort >::get_repository_id() {
+ return repositoryName;
+}
+
+
+template <typename DataManipulator,typename CorbaPortType, char * repositoryName, typename UsesPort >
+bool
+GenericUsesPort< DataManipulator,CorbaPortType, repositoryName, UsesPort >::set_port(Ports::Port_ptr port) {
+ if (_my_ports) {
+ size_t n = _my_ports->length()+1;
+ _my_ports->length(n);
+ (*_my_ports)[n]=CorbaPortType::_narrow(port);
+ return true;
+ } else {
+ // Vérifier si port is_nil
+ _my_ports = new Engines::DSC::uses_port();
+ _my_ports->length(1);
+ (*_my_ports)[0]=CorbaPortType::_narrow(port);
+ return true;
+ }
+ return false;
+}
+
+template <typename DataManipulator,typename CorbaPortType, char * repositoryName, typename UsesPort >
+template <typename TimeType,typename TagType>
+void
+GenericUsesPort< DataManipulator,CorbaPortType, repositoryName, UsesPort >::put( CorbaInDataType data,
+ TimeType time,
+ TagType tag) {
+ typedef typename CorbaPortType::_ptr_type CorbaPortTypePtr;
+ if (!_my_ports)
+ throw DSC_Exception(LOC("There is no connected provides port to communicate with."));
+
+ // PB1 : Cf remarque dans CalciumInterface, si on n'effectue pas de copie
+ // du buffer !
+ // PB2 : Si les ports provides auquels on envoie data sont collocalisés
+ // ils vont partagés le même buffer (à cause de notre optim ds get_data)
+ // il faut alors effectuer une copie ici.
+ // Pour l'instant on résoud PB2 en créant une copie de la donnée en cas
+ // de connexions multiples. Il faudra tester la collocalisation.
+ DataType copyOfData; // = data; PB1
+ for(int i = 0; i < _my_ports->length(); i++) {
+
+ CorbaPortTypePtr port = CorbaPortType::_narrow((*_my_ports)[i]);
+ //if (i) { PB1
+ copyOfData = DataManipulator::clone(data);
+ std::cout << "-------- GenericUsesPort::put : Copie de data("
+ //<< DataManipulator::getPointer(data)
+ <<") vers copyOfData ("
+ <<DataManipulator::getPointer(copyOfData)
+ <<")------------------" << std::endl;
+ //} PB1
+ try {
+ port->put(*copyOfData,time,tag); // catcher les exceptions
+ } catch(const CORBA::SystemException& ex){
+ DataManipulator::delete_data(copyOfData);
+ throw DSC_Exception(LOC(OSS() << "Impossible d'invoquer la méthode put sur le port n°"
+ << i << "( i>= 0)"));
+
+ }
+ //if (i) PB1
+ // La séquence est détruite avec le buffer si on n'est pas collocalisé
+ // La séquence est détruite sans son buffer sinon (cf comportement de get_data
+ // appelée dans put (port provides)
+ DataManipulator::delete_data(copyOfData);
+ }
+}
+
+
+template <typename DataManipulator, typename CorbaPortType, char * repositoryName, typename UsesPort>
+void
+GenericUsesPort< DataManipulator, CorbaPortType, repositoryName, UsesPort
+ >::uses_port_changed(Engines::DSC::uses_port * new_uses_port,
+ const Engines::DSC::Message message)
+{
+ if (_my_ports) delete _my_ports;
+
+ std::cerr << "GenericUsesPort::uses_port_changed" << endl;
+ _my_ports = new Engines::DSC::uses_port(*new_uses_port);
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : IteratorTraits.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $
+// Id : $Id$
+
+#ifndef _ITERATOR_TRAITS_HXX_
+#define _ITERATOR_TRAITS_HXX_
+
+// Trait permettant d'accéder au type de donnée stockée
+// dans une map
+template < typename MapIterator >
+struct iterator_t {
+ typedef typename MapIterator::value_type value_type1;
+ typedef typename value_type1::second_type value_type;
+};
+
+#endif
--- /dev/null
+# Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# 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.
+#
+# 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
+#
+#
+#
+# File : Makefile.am
+# Author : André RIBES (EDF), Eric Fayolle (EDF)
+# Module : KERNEL
+
+include $(top_srcdir)/salome_adm/unix/make_common_starter.am
+
+SUBDIRS = Palm Calcium
+
+#
+# ===============================================================
+# Header to be installed
+# ===============================================================
+#
+# header files
+salomeinclude_HEADERS = GenericPort.hxx \
+ GenericProvidesPort.hxx \
+ GenericUsesPort.hxx \
+ DataIdFilter.hxx \
+ CorbaTypeManipulator.hxx \
+ CouplingPolicy.hxx \
+ DisplayPair.hxx \
+ FindKeyPredicate.hxx \
+ AdjacentFunctor.hxx \
+ IteratorTraits.hxx \
+ ConstTraits.hxx \
+ lambda.hpp \
+ DatastreamException.hxx
+
+#
+# ===============================================================
+# Local definitions
+# ===============================================================
+#
+
+# This local variable defines the list of CPPFLAGS common to all target in this package.
+COMMON_CPPFLAGS= -I$(top_srcdir)/src/DSC/DSC_User
+
+# This local variable defines the list of dependant libraries common to all target in this package.
+COMMON_LIBS = $(top_builddir)/src/DSC/DSC_User/Datastream/Palm/libSalomePalm.la \
+ $(top_builddir)/src/DSC/DSC_User/Datastream/Calcium/libSalomeCalcium.la
+
+#
+# ===============================================================
+# Libraries targets
+# ===============================================================
+#
+lib_LTLIBRARIES = libSalomeDatastream.la
+
+libSalomeDatastream_la_SOURCES = fake.cc
+
+libSalomeDatastream_la_CXXFLAGS = $(COMMON_CPPFLAGS)
+
+libSalomeDatastream_la_LIBADD = $(COMMON_LIBS)
+
+libSalomeDatastream_la_LDFLAGS = -no-undefined -version-info=0:0:0
+
--- /dev/null
+# Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# 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.
+#
+# 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
+#
+#
+#
+# File : Makefile.am
+# Author : André RIBES (EDF), Eric Fayolle (EDF)
+# Module : KERNEL
+
+include $(top_srcdir)/salome_adm/unix/make_common_starter.am
+
+#
+# ===============================================================
+# Header to be installed
+# ===============================================================
+#
+# header files
+salomeinclude_HEADERS = palm_port_factory.hxx \
+ palm_data_short_port_provides.hxx \
+ palm_data_seq_short_port_provides.hxx \
+ PalmCouplingPolicy.hxx
+
+#
+# ===============================================================
+# Local definitions
+# ===============================================================
+#
+
+# This local variable defines the list of CPPFLAGS common to all target in this package.
+COMMON_CPPFLAGS= -I$(top_srcdir)/src/DSC/DSC_User \
+ -I$(top_srcdir)/src/DSC/DSC_User/Datastream \
+ -I$(top_srcdir)/src/DSC/DSC_Basic \
+ -I$(top_srcdir)/src/Utils \
+ -I$(top_builddir)/salome_adm/unix \
+ -I$(top_builddir)/idl \
+ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
+
+# This local variable defines the list of dependant libraries common to all target in this package.
+COMMON_LIBS = @CORBA_LIBS@
+
+#
+# ===============================================================
+# Libraries targets
+# ===============================================================
+#
+noinst_LTLIBRARIES = libSalomePalm.la
+
+libSalomePalm_la_SOURCES = palm_port_factory.cxx
+
+libSalomePalm_la_CXXFLAGS = $(COMMON_CPPFLAGS)
+
+libSalomePalm_la_LDFLAGS = -no-undefined -version-info=0:0:0
+
+#
+# ===============================================================
+# Executables targets
+# ===============================================================
+#
+noinst_PROGRAMS = test_DataIdContainer
+
+test_DataIdContainer_SOURCES = test_DataIdContainer.cxx
+
+test_DataIdContainer_CXXFLAGS = $(COMMON_CPPFLAGS)
+
+test_DataIdContainer_LDFLAGS = $(COMMON_LIBS)
+
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : PalmCouplingPolicy.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-01-29 16:12:41 +0100 (lun, 29 jan 2007) $
+// Id : $Id$
+
+#ifndef _PALM_COUPLING_POLICIES_HXX_
+#define _PALM_COUPLING_POLICIES_HXX_
+
+#include <CORBA.h>
+#include <vector>
+#include "DataIdFilter.hxx"
+#include "DisplayPair.hxx"
+#include "CouplingPolicy.hxx"
+
+class PalmCouplingPolicy: public CouplingPolicy {
+
+ // Objet de filtrage et conversion d'un TIME
+ filtre_conversion filtre_convert_TIME ;
+ // Objet de filtrage et conversion d'un TAG
+ filtre_conversion filtre_convert_TAG ;
+
+public:
+
+ template <typename T_TIME, typename T_TAG > class InternalDataIdContainer;
+ template <typename T_TIME, typename T_TAG > friend class InternalDataIdContainer;
+
+ filtre_conversion * get_filtre_convert_TIME() { return &filtre_convert_TIME; }
+ filtre_conversion * get_filtre_convert_TAG() { return &filtre_convert_TAG; }
+
+ // Classe DataId rassemblant les paramètres de la méthode PORT::put
+ // qui identifient l'instance d'une donnée pour Palm
+ // Rem : Le DataId doit pouvoir être une key dans une map stl
+ typedef CORBA::Long TimeType;
+ typedef CORBA::Long TagType;
+ typedef std::pair < TimeType , TagType > DataId;
+ typedef InternalDataIdContainer < TimeType , TagType > DataIdContainer;
+
+ TimeType getTime(const DataId &dataId) const { return dataId.first;}
+ TagType getTag (const DataId &dataId) const { return dataId.second;}
+
+ // Container qui permet d'itérer sur l'ensemble des DataId générés par les
+ // eventuelles conversions
+ template <typename T_TIME, typename T_TAG > class InternalDataIdContainer {
+
+ std::vector<T_TIME> _lTime;
+ std::vector<T_TAG> _lTag;
+
+ // Interdit la construction d'un container vide car
+ // aucune méthode d'ajout d'élément n'a été implémentée
+ InternalDataIdContainer() {}
+
+ public:
+ typedef DataId value_type;
+ template <typename TTIME, typename TTAG> class DataIdIterator;
+ typedef DataIdIterator<T_TIME, T_TAG> iterator;
+ typedef value_type & reference;
+ typedef value_type const & const_reference;
+
+ // Remplit le container d'identificateurs après avoir appliqué
+ // les filtres/convertions des paramètres "TIMEs" et des "TAGs"
+ InternalDataIdContainer(const DataId & dataId, const PalmCouplingPolicy & policy ) {
+ std::cout << "----Cst ---- InternalDataIdContainer(const DataId & dataId..) " << dataId <<std::endl;
+ policy.filtre_convert_TIME.applique_filtre_conversion(dataId.first, _lTime);
+ int c=0;
+ for(vector<CORBA::Long>::iterator i=_lTime.begin();i!=_lTime.end();++i)
+ std::cout << "_lTime["<< c++ << "] : " << *i << std::endl;
+ policy.filtre_convert_TAG.applique_filtre_conversion(dataId.second, _lTag);
+ c=0;
+ for(vector<CORBA::Long>::iterator i=_lTag.begin();i!=_lTag.end();++i)
+ std::cout << "_lTag["<< c++ << "] : " << *i << std::endl;
+ }
+
+ // Pas encore testé
+ InternalDataIdContainer(std::vector<T_TIME> const & lTime, std::vector<T_TAG> const & lTag):
+ _lTime(lTime),_lTag(lTag) {}
+
+
+ // Pas encore testé
+ InternalDataIdContainer( InternalDataIdContainer const & pc):
+ _lTime(pc._lTime), _lTag(pc._lTag) {}
+
+
+ // Pas encore testé
+ InternalDataIdContainer & operator=(const InternalDataIdContainer & pc) {
+ if (this != &pc) { _lTime=pc._lTime; _lTag=pc._lTag; }
+ return *this;
+ }
+
+ virtual ~InternalDataIdContainer() {}
+
+ iterator begin() { return iterator(*this); }
+ iterator end() { return iterator(*this,_lTime.end(),_lTag.end()); }
+ // En Palm les deux paramètres du couple (temps,tag) doivent
+ // exister (un seul paramètre n'est pas recevable)
+ bool empty() const { return _lTime.empty() || _lTag.empty(); }
+
+ // Définition de l'itérateur du container
+ template <typename TTIME, typename TTAG> class DataIdIterator {
+
+ public:
+
+ typedef typename std::vector<TTIME>::const_iterator ItTime;
+ typedef typename std::vector<TTAG >::const_iterator ItTag;
+
+ private:
+ ItTime _itTime;
+ ItTag _itTag;
+ const InternalDataIdContainer<TTIME,TTAG> & _pc;
+ DataIdIterator() {}
+
+ public:
+
+
+ // Pas encore testé
+ DataIdIterator(const InternalDataIdContainer<TTIME,TTAG> & pc):
+ _pc(pc),_itTime(pc._lTime.begin()),_itTag(pc._lTag.begin()) {}
+ DataIdIterator(const InternalDataIdContainer<TTIME,TTAG> & pc, ItTime itTime, ItTag itTag):
+ _pc(pc),_itTime(itTime),_itTag(itTag) {}
+ // Pas encore testé
+ DataIdIterator(const DataIdIterator & dIt):
+ _pc(dIt._pc),_itTime(dIt._itTime),_itTag(dIt._itTag) {}
+ ~DataIdIterator() {}
+
+
+ // Pas encore testé
+ DataIdIterator & operator=(const DataIdIterator & dIt) {
+ if (this != &dIt) {
+ _pc=dIt._pc;_itTime=dIt._itTime;_itTag=dIt._itTag;
+ }
+ return *this;
+ }
+
+ DataId operator*() const {
+ std::cout << "-------- operator*(), *_itTime : " << *_itTime << " *_itTag " << *_itTag <<std::endl;
+ return DataId(*_itTime,*_itTag); }
+
+ bool operator==( const DataIdIterator & dIt) const {
+ return (_itTime == dIt._itTime) && (_itTag == dIt._itTag) && (&_pc == &dIt._pc);
+ }
+
+ bool operator!=( const DataIdIterator & dIt) const {
+ return (_itTime != dIt._itTime) || (_itTag != dIt._itTag) || (&_pc != &dIt._pc);
+ }
+
+ // Notation préfixé
+ DataIdIterator & operator++() {
+ if ( _itTag != _pc._lTag.end() ) {
+ ++_itTag;
+ if (_itTag != _pc._lTag.end() ) return *this;
+ }
+ if ( _itTime != _pc._lTime.end() ) {
+ ++_itTime;
+ if (_itTime != _pc._lTime.end() ) _itTag=_pc._lTag.begin();
+ }
+ return *this;
+ }
+
+ // Notation postfixé
+ DataIdIterator operator++(int fake) {
+ DataIdIterator tmpIt=*this; ++*this; return tmpIt;
+ }
+
+ }; //Fin de la classe de l'itérateur
+ }; //Fin de la classe du container
+
+
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : palm_data_seq_short_port_provides.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $
+// Id : $Id$
+
+#ifndef _PALM_DATA_SEQ_SHORT_PORT_PROVIDES_HXX_
+#define _PALM_DATA_SEQ_SHORT_PORT_PROVIDES_HXX_
+
+#include "Palm_Ports.hh"
+#include "provides_port.hxx"
+#include "GenericPort.hxx"
+#include "PalmCouplingPolicy.hxx"
+
+class palm_data_seq_short_port_provides :
+ public virtual POA_Ports::Palm_Ports::Palm_Data_Seq_Short_Port,
+ public virtual provides_port,
+ public virtual GenericPort< seq_u_manipulation<Ports::Palm_Ports::seq_short, CORBA::Short>,
+ PalmCouplingPolicy >
+{
+ typedef Ports::Palm_Ports::seq_short CorbaDataType;
+ typedef seq_u_manipulation<CorbaDataType, CORBA::Short> DataManipulator;
+ typedef GenericPort< DataManipulator, PalmCouplingPolicy > Port;
+
+ public :
+ palm_data_seq_short_port_provides() {}
+ virtual ~palm_data_seq_short_port_provides() {}
+
+ void put(DataManipulator::CorbaInType data, CORBA::Long time, CORBA::Long tag) {
+ Port::put(data, time, tag);
+ }
+
+ Ports::Port_ptr get_port_ref() {
+ return _this();
+ }
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : palm_data_short_port_provides.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+
+#ifndef _PALM_DATA_SHORT_PORT_PROVIDES_HXX_
+#define _PALM_DATA_SHORT_PORT_PROVIDES_HXX_
+
+#include "Palm_Ports.hh"
+#include "provides_port.hxx"
+#include "GenericPort.hxx"
+#include "PalmCouplingPolicy.hxx"
+
+class palm_data_short_port_provides :
+ public virtual POA_Ports::Palm_Ports::Palm_Data_Short_Port,
+ public virtual provides_port,
+ public virtual GenericPort< atom_manipulation< CORBA::Short >, PalmCouplingPolicy >
+
+{
+ typedef CORBA::Short CorbaDataType;
+ typedef atom_manipulation < CorbaDataType > DataManipulator;
+ typedef GenericPort< DataManipulator, PalmCouplingPolicy > Port;
+
+ public :
+ palm_data_short_port_provides() {}
+ virtual ~palm_data_short_port_provides() {}
+
+ void put(DataManipulator::CorbaInType data, CORBA::Long time, CORBA::Long tag) {
+ Port::put(data, time, tag);
+ }
+
+ virtual Ports::Port_ptr get_port_ref() {
+ return _this();
+ }
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : palm_port_factory.cxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $
+// Id : $Id$
+
+
+#include "palm_port_factory.hxx"
+
+palm_port_factory::palm_port_factory() {
+}
+
+palm_port_factory::~palm_port_factory() {}
+
+provides_port *
+palm_port_factory::create_data_servant(string type) {
+ provides_port * rtn_port = NULL;
+ if (type == "short") {
+ rtn_port = new palm_data_short_port_provides();
+ }
+ if (type == "seq_short") {
+ rtn_port = new palm_data_seq_short_port_provides();
+ }
+ return rtn_port;
+}
+
+uses_port *
+palm_port_factory::create_data_proxy(string type) {
+ uses_port * rtn_port = NULL;
+ return rtn_port;
+}
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : palm_port_factory.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $
+// Id : $Id$
+
+
+#ifndef _PALM_PORT_FACTORY_HXX_
+#define _PALM_PORT_FACTORY_HXX_
+
+#include "uses_port.hxx"
+#include "provides_port.hxx"
+#include <string>
+
+#include "palm_data_short_port_provides.hxx"
+#include "palm_data_seq_short_port_provides.hxx"
+
+using namespace std;
+
+class palm_port_factory
+{
+ public:
+ palm_port_factory();
+ virtual ~palm_port_factory();
+
+ virtual provides_port * create_data_servant(string type);
+ virtual uses_port * create_data_proxy(string type);
+};
+
+#endif
+
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : test_DataIdContainer.cxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+
+#include "PalmCouplingPolicy.hxx"
+
+#include "palm_data_short_port_provides.hxx"
+
+//using namespace PalmCouplingPolicy;
+
+class TEST1 : public PalmCouplingPolicy {
+public:
+ TEST1() {
+
+ std::cout << "------------ TEST1 --------------" << std::endl;
+
+ int ret=0;
+
+ CORBA::Long time=1,tag=1;
+ typedef PalmCouplingPolicy::DataIdContainer DataIdContainer;
+ typedef PalmCouplingPolicy::DataId DataId;
+
+ DataId dataId(time,tag); //potentiellement avec un troisième paramètre
+ //std::vector<CORBA::Long> a(1,time);std::vector<CORBA::Long> b(1,tag);
+ //DataIdContainer dataIds(a,b);
+
+ std::cout << "-------- MARK 1 --"<< dataId <<"----------------" << std::endl;
+
+ filtre_conversion * f_time = get_filtre_convert_TIME();
+ filtre_conversion * f_tag = get_filtre_convert_TAG();
+
+ // On accepte les temps de 1 à 100 sans conversion
+ filtre_elementaire * f_time_el = new filtre_elementaire(1, 100);
+ f_time->config_elementaire(*f_time_el);
+
+ // On accepte que les tags 1 et ce sans conversion
+ filtre_elementaire * f_time_tag = new filtre_elementaire(1);
+ f_tag->config_elementaire(*f_time_tag);
+
+ DataIdContainer dataIds(dataId,*this);
+
+ DataIdContainer::iterator dataIdIt = dataIds.begin();
+
+ if (!dataIds.empty())
+ for (;dataIdIt != dataIds.end();++dataIdIt) {
+ std::cout << "-------- MARK 2 --"<< *dataIdIt <<"----------------" << std::endl;
+
+ }
+ }
+};
+
+class TEST2 : public PalmCouplingPolicy {
+public:
+ TEST2() {
+
+ std::cout << "------------ TEST2 --------------" << std::endl;
+
+ int ret=0;
+
+ CORBA::Long time=1,tag=1;
+ typedef PalmCouplingPolicy::DataIdContainer DataIdContainer;
+ typedef PalmCouplingPolicy::DataId DataId;
+
+ DataId dataId(time,tag); //potentiellement avec un troisième paramètre
+ //std::vector<CORBA::Long> a(1,time);std::vector<CORBA::Long> b(1,tag);
+ //DataIdContainer dataIds(a,b);
+
+ std::cout << "-------- MARK 1 --"<< dataId <<"----------------" << std::endl;
+
+ filtre_conversion * f_time = get_filtre_convert_TIME();
+ filtre_conversion * f_tag = get_filtre_convert_TAG();
+
+
+ filtre_elementaire * f_time_2 = new filtre_elementaire(1);
+ filtre_elementaire * g_time_2 = new filtre_elementaire(2);
+ f_time->config_elementaire(*f_time_2, *g_time_2);
+ filtre_elementaire * f_time_3 = new filtre_elementaire(1);
+ f_time->config_elementaire(*f_time_3);
+
+ // On accepte que les tags 1 et ce sans conversion
+ filtre_elementaire * f_time_tag = new filtre_elementaire(1);
+ f_time_tag = new filtre_elementaire(1);
+ f_tag->config_elementaire(*f_time_tag);
+
+
+ DataIdContainer dataIds(dataId,*this);
+
+ DataIdContainer::iterator dataIdIt = dataIds.begin();
+
+ if (!dataIds.empty())
+ for (;dataIdIt != dataIds.end();++dataIdIt) {
+ std::cout << "-------- MARK 2 --"<< *dataIdIt <<"----------------" << std::endl;
+
+ }
+ }
+};
+
+int main() {
+ TEST1 test1;
+ TEST2 test2;
+};
+
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : ProcessTimeIntervalTraits.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $
+// Id : $Id$
+
+#ifndef _PROCESS_TIME_INTERVAL_TRAIT_HXX_
+#define _PROCESS_TIME_INTERVAL_TRAIT_HXX_
+
+#include "IteratorTraits.hxx"
+
+// Par défaut les classes définissant un mode de couplage n'implémentent pas
+// de traitement particulier pour une de demande de données identifiées à partir
+// d'un dataId non reçu mais encadré par deux dataIds
+// Ce trait peut être spécialisé pour la classe de couplage pour effectuer
+// le traitement de son choix
+template <class WhatEver > struct ProcessTimeIntervalTraits {
+
+ template < typename Iterator >
+ std::pair<bool, typename iterator_t<Iterator>::value_type >
+ static inline apply(typename WhatEver::DataId dataId, Iterator it1) {
+ typedef typename iterator_t<Iterator>::value_type value_type;
+ return std::make_pair<bool,value_type> (0,0);
+ }
+};
+
+// class CalciumCoulpingPolicy;
+// template < typename Iterator >
+// typename iterator_t<Iterator>::value_type
+// CalciumCoulpingPolicy::processTimeInterval (DataId & dataId,
+// Iterator & it1, Iterator & it2);
+#include "CalciumCouplingPolicy.hxx"
+template <> struct ProcessTimeIntervalTraits<CalciumCouplingPolicy> {
+
+ template < class Iterator >
+ std::pair<bool,typename iterator_t<Iterator>::value_type>
+ static inline apply(CalciumCouplingPolicy::DataId dataId, Iterator it1) {
+
+ Iterator it2=it1; it2++;
+
+ typedef typename iterator_t<Iterator>::value_type value_type;
+ return std::make_pair<bool,value_type> (1,processTimeInterval(dataId,it1,it2));
+ }
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : fake.cc
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+void fake_method(void) {
+int fake_int;
+};
--- /dev/null
+// -- lambda.hpp -- Boost Lambda Library -----------------------------------
+// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// For more information, see http://lambda.cs.utu.fi
+
+#ifndef BOOST_LAMBDA_LAMBDA_HPP
+#define BOOST_LAMBDA_LAMBDA_HPP
+
+
+#include "boost/lambda/core.hpp"
+
+#ifdef BOOST_NO_FDECL_TEMPLATES_AS_TEMPLATE_TEMPLATE_PARAMS
+#include <istream>
+#include <ostream>
+#endif
+
+#include "boost/lambda/detail/operator_actions.hpp"
+#include "boost/lambda/detail/operator_lambda_func_base.hpp"
+#include "boost/lambda/detail/operator_return_type_traits.hpp"
+
+
+#include "boost/lambda/detail/operators.hpp"
+
+#ifndef BOOST_LAMBDA_FAILS_IN_TEMPLATE_KEYWORD_AFTER_SCOPE_OPER
+// sorry, member ptr does not work with gcc2.95
+#include "boost/lambda/detail/member_ptr.hpp"
+#endif
+
+
+#endif
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : testAdjacentFunctor.cxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $
+// Id : $Id$
+
+#include <iostream>
+#include <vector>
+#include <map>
+#include <algorithm>
+#include <iterator>
+#include <functional>
+#include <utility>
+
+#include "DisplayPair.hxx"
+#include "AdjacentFunctor.hxx"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+struct MyRand {
+ static const double MAXVALUE = 150.0;
+ MyRand() { srand(getpid()); }
+ int operator()() const {
+ return 1+(int) ( MAXVALUE *rand()/(RAND_MAX +1.0));
+ }
+};
+
+int main() {
+ typedef int Type;
+ const int N=20;
+ std::vector<Type> vect(N);
+ MyRand myRand;
+
+ //TEST1
+ std::generate(vect.begin(),vect.end(),myRand);
+ std::cout << "Vecteur généré aléatoirement :" << std::endl;
+ copy(vect.begin(),vect.end(),std::ostream_iterator<Type>(std::cout," "));
+ std::cout<< std::endl;
+
+ int valueToFind = myRand();
+ std::cout << "La valeur recherchée est : " << valueToFind << std::endl;
+
+ std::sort(vect.begin(),vect.end(),std::less< Type > ());
+ std::cout << "Vecteur trié par ordre croissant :" << std::endl;
+ copy(vect.begin(),vect.end(),std::ostream_iterator<Type>(std::cout," "));
+ std::cout<< std::endl;
+
+ std::vector<Type>::iterator it,it1,it2;
+ AdjacentFunctor<Type> ap(valueToFind);
+ AdjacentFunctor<Type> & vap(ap);
+ // Ne peut pas marcher à cause de la recopie du prédicat !!
+ it = std::find_if(vect.begin(),vect.end(),vap);
+ // On peut garder la valeur prédente de l'itérateur
+ // si l'itérateur n'est pas reverse
+// for (it = vect.begin(); it!=vect.end(); ++it)
+// if ( ap(*it) ) break;
+
+ if ( it == vect.end() ) {
+ std::cout << " Je n'ai pas trouvé la valeur " << valueToFind << std::endl;
+ } else {
+ if ( (*it) == valueToFind ) std::cout << " La valeur est trouvée *it :" << (*it) << std::endl;
+ else {
+ // Type min,max;
+ // if ( ap.getBounds(min,max) ) {
+ it2=it;it2--;
+ std::cout << "La valeur : " << valueToFind << " est encadrée par (*it) :" << (*it) << " et valeur de *(it-1) :" << (*it2) << std::endl;
+ }
+ }
+
+
+
+
+ // if ( it == vect.end() ) {
+// std::cout << " Je n'ai pas trouvé la valeur " << valueToFind << std::endl;
+// } else {
+// if ( (*it) == valueToFind ) std::cout << " La valeur est trouvée *it :" << (*it) << std::endl;
+// else {
+// Type min,max;
+// if ( ap.getBounds(min,max) ) {
+// it2=it;it2--;
+// std::cout << "La valeur : " << valueToFind << " est encadrée par (*it) :" << (*it) << " et valeur de *(it-1) :" << (*it2) << std::endl;
+// }
+// }
+// }
+
+ //TEST2
+// typedef std::map<Type,double> MapIntDouble;
+// MapIntDouble myMap;
+// MapIntDouble::const_iterator itM1,itM2;
+// for(it=vect.begin(); it!=vect.end(); ++it) myMap[*it] = myRand();
+
+// std::cout << "Clés de la Map :" << std::endl;
+// for(itM1=myMap.begin();itM1!=myMap.end();++itM1)
+// //std::cout << &((*itM1).first)
+// std::cout << (*itM1).first << " ";
+// std::cout<< std::endl;
+
+// AdjacentFunctor<MapIntDouble::value_type::first_type> apMap(valueToFind);
+// for (itM1 = myMap.begin(); itM1 != myMap.end(); ++itM1)
+// if ( apMap(itM1->first) ) break;
+
+// if ( itM1 == myMap.end() ) {
+// std::cout << " Je n'est pas trouvé la valeur " << valueToFind << std::endl;
+// } else {
+// if ( (itM1->first) == valueToFind ) std::cout << " La valeur est trouvée itM1->first :" << (itM1->first) << std::endl;
+// else {
+// Type min,max;
+// if ( apMap.getBounds(min,max) ) {
+// itM2=itM1;itM2--;
+// std::cout << "La valeur " << valueToFind << " est encadrée par (itM1->first) :" << (itM1->first) << " et valeur de (it-1)->first :" << (itM2->first) << std::endl;
+// }
+// }
+// }
+
+ // TEST3
+// typedef std::map<std::pair<int,double>, double> MapIntDouble_Double;
+// MapIntDouble_Double myMapP;
+// MapIntDouble_Double::const_iterator itMP1,itMP2;
+// for(it=vect.begin(); it!=vect.end(); ++it) myMapP[std::make_pair<int,double>(*it,myRand())] = myRand();
+// //myMapP[std::make_pair<int,double>(*(vect.begin()),myRand())] = myRand();
+
+// std::cout << "Clés de la MapP :" << std::endl;
+// for(itMP1=myMapP.begin();itMP1!=myMapP.end();++itMP1)
+// std::cout << (*itMP1).first << " " ;
+// std::cout<< std::endl;
+
+// //AdjacentPredicate<std::pair<int,double> > apMap(valueToFind);
+// std::pair<int,double> valuePToFind=std::make_pair<int,double>(valueToFind,myRand());
+// //std::pair<int,double> valuePToFind=myMapP.begin()->first;
+// AdjacentFunctor< MapIntDouble_Double::key_type > apMapP(valuePToFind);
+// for (itMP1 = myMapP.begin(); itMP1 != myMapP.end(); ++itMP1)
+// if ( apMapP(itMP1->first) ) break;
+
+// if ( itMP1 == myMapP.end() ) {
+// std::cout << " Je n'est pas trouvé la valeur " << valuePToFind << std::endl;
+// } else {
+// if ( (itMP1->first) == valuePToFind ) std::cout << " La valeur est trouvée itMP1->first :" << (itMP1->first) << std::endl;
+// else {
+// MapIntDouble_Double::key_type min,max;
+// if ( apMapP.getBounds(min,max) ) {
+// itMP2=itMP1;itMP2--;
+// std::cout << "La valeur " << valuePToFind << " est encadrée par (itMP1->first) :" << (itMP1->first) << " et valeur de (it-1)->first :" << (itMP2->first) << std::endl;
+// }
+// }
+// }
+
+
+ std::cout<< std::endl;
+
+};
+
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : testAdjacentPredicate.cxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $
+// Id : $Id$
+
+#include "AdjacentPredicate.hxx"
+#include "DisplayPair.hxx"
+
+#include <iostream>
+
+#include <vector>
+#include <map>
+#include <algorithm>
+#include <iterator>
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+struct MyRand {
+ static const double MAXVALUE = 150.0;
+ MyRand() { srand(getpid()); }
+ int operator()() const {
+ return 1+(int) ( MAXVALUE *rand()/(RAND_MAX +1.0));
+ }
+};
+
+typedef int TimeType;
+typedef double TagType;
+typedef std::pair< TimeType , TagType > DataId;
+
+template < typename DataType >
+ DataType processTimeInterval (DataId & dataId,
+ typename std::map<DataId, DataType>::const_iterator const & it1) {
+ return (*it1).second;
+};
+
+int main() {
+ typedef int Type;
+ const int N=20;
+ std::vector<Type> vect(N);
+ MyRand myRand;
+
+ //TEST1
+ std::generate(vect.begin(),vect.end(),myRand);
+ std::cout << "Vecteur généré aléatoirement :" << std::endl;
+ copy(vect.begin(),vect.end(),std::ostream_iterator<Type>(std::cout," "));
+ std::cout<< std::endl;
+
+ int valueToFind = myRand();
+
+ std::sort(vect.begin(),vect.end(),std::less< Type > ());
+ std::cout << "Vecteur trié par ordre croissant :" << std::endl;
+ copy(vect.begin(),vect.end(),std::ostream_iterator<Type>(std::cout," "));
+ std::cout<< std::endl;
+
+ std::vector<Type>::iterator it;
+ AdjacentPredicate<Type> ap(valueToFind);
+ it = std::adjacent_find(vect.begin(),vect.end(),ap);
+ if ( it == vect.end() )
+ std::cout << "Je n'est pas trouvé d'intervalle pour encadrer " << valueToFind << std::endl;
+ else
+ std::cout << "La valeur à trouver : " << valueToFind <<" est entre * it :" << *it << " et valeur de *(it+1) :" << *(it+1) << std::endl;
+ std::cout<< std::endl;
+
+ //TEST2
+ typedef std::map<int,double> MapIntDouble;
+ MapIntDouble myMap;
+ MapIntDouble::const_iterator itM1,itM2;
+ for(it=vect.begin(); it!=vect.end(); ++it) myMap[*it] = myRand();
+
+ std::cout << "Clés de la Map :" << std::endl;
+ for(itM1=myMap.begin();itM1!=myMap.end();++itM1)
+ //std::cout << &((*itM1).first)
+ std::cout << (*itM1).first << " ";
+ std::cout<< std::endl;
+
+ //AdjacentPredicate<std::pair<int,double> > apMap(valueToFind);
+ AdjacentPredicate< MapIntDouble::value_type > apMap(valueToFind);
+ itM1 = std::adjacent_find(myMap.begin(),myMap.end(),apMap);
+ itM2=itM1;itM2++;
+ if ( itM1 == myMap.end() )
+ std::cout << "Map : Je n'est pas trouvé d'intervalle pour encadrer " << valueToFind << std::endl;
+ else {
+ std::cout << "Map : La valeur à trouver : " << valueToFind <<" est entre (*itM1).first :" << (*itM1).first << " et valeur de *(itM1+1).first :" << (*(itM2)).first << std::endl;
+ }
+ std::cout<< std::endl;
+
+ // TEST3
+ typedef std::map<std::pair<int,double>, double> MapPIntDouble_Double;
+ MapPIntDouble_Double myMapP;
+ MapPIntDouble_Double::const_iterator itMP1,itMP2;
+ // for(it=vect.begin(); it!=vect.end(); ++it) myMapP[std::make_pair<int,double>(*it,myRand())] = myRand();
+ myMapP[std::make_pair<int,double>(*(vect.begin()),myRand())] = myRand();
+
+ std::cout << "Clés de la MapP :" << std::endl;
+ for(itMP1=myMapP.begin();itMP1!=myMapP.end();++itMP1)
+ std::cout << (*itMP1).first << " " ;
+ std::cout<< std::endl;
+
+ //AdjacentPredicate<std::pair<int,double> > apMap(valueToFind);
+ // std::pair<int,double> valuePToFind=std::make_pair<int,double>(valueToFind,myRand());
+ std::pair<int,double> valuePToFind=myMapP.begin()->first;
+ AdjacentPredicate< MapPIntDouble_Double::value_type > apMapP(valuePToFind);
+ itMP1 = std::adjacent_find(myMapP.begin(),myMapP.end(),apMapP);
+ itMP2=itMP1;itMP2++;
+ if ( itMP1 == myMapP.end() )
+ std::cout << "MapP : Je n'est pas trouvé d'intervalle pour encadrer " << valuePToFind << std::endl;
+ else {
+ std::cout << "MapP : La valeur à trouver : " << valuePToFind <<" est entre (*itMP1).first :" << (*itMP1).first << " et valeur de *(itMP1+1).first :" << (*(itMP2)).first << std::endl;
+ }
+
+ std::cout << processTimeInterval<double>(valuePToFind,itMP1);
+ std::cout<< std::endl;
+
+ std::cout<< std::endl;
+
+};
+
--- /dev/null
+# Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# 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.
+#
+# 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
+#
+#
+#
+# File : Makefile.am
+# Author : André RIBES (EDF)
+# Module : KERNEL
+
+SUBDIRS = Basic Datastream
+
+include $(top_srcdir)/salome_adm/unix/make_common_starter.am
+
+#
+# ===============================================================
+# Header to be installed
+# ===============================================================
+#
+# header files
+salomeinclude_HEADERS = base_port.hxx \
+ uses_port.hxx \
+ provides_port.hxx \
+ Superv_Component_i.hxx \
+ DSC_Exception.hxx
+
+#
+# ===============================================================
+# Local definitions
+# ===============================================================
+#
+
+# This local variable defines the list of CPPFLAGS common to all target in this package.
+COMMON_CPPFLAGS= -I$(srcdir)/Basic \
+ -I$(srcdir)/Datastream \
+ -I$(srcdir)/Datastream/Palm \
+ -I$(srcdir)/Datastream/Calcium \
+ -I$(top_srcdir)/src/Container \
+ -I$(top_srcdir)/src/Notification \
+ -I$(top_srcdir)/src/DSC/DSC_Basic \
+ -I$(top_srcdir)/src/SALOMELocalTrace \
+ -I$(top_srcdir)/src/Basics \
+ -I$(top_srcdir)/src/Utils \
+ -I$(top_builddir)/salome_adm/unix \
+ -I$(top_builddir)/idl \
+ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
+
+# This local variable defines the list of dependant libraries common to all target in this package.
+COMMON_LIBS =
+
+#
+# ===============================================================
+# Libraries targets
+# ===============================================================
+#
+lib_LTLIBRARIES = libSalomeDSCSuperv.la
+
+libSalomeDSCSuperv_la_SOURCES = base_port.cxx \
+ uses_port.cxx \
+ provides_port.cxx \
+ Superv_Component_i.cxx
+
+libSalomeDSCSuperv_la_CXXFLAGS = $(COMMON_CPPFLAGS)
+
+libSalomeDSCSuperv_la_LDFLAGS = -no-undefined -version-info=0:0:0
+
+#
+# ===============================================================
+# Executables targets
+# ===============================================================
+#
+noinst_PROGRAMS = test_DSC_Exception
+
+test_DSC_Exception_SOURCES = test_DSC_Exception.cxx
+
+test_DSC_Exception_CXXFLAGS = $(COMMON_CPPFLAGS)
+
+test_DSC_Exception_LDADD = $(top_builddir)/src/Utils/libOpUtil.la
+
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : Superv_Component_i.cxx
+// Author : André RIBES (EDF), Eric Fayolle (EDF)
+// Module : KERNEL
+
+#include "Superv_Component_i.hxx"
+
+DSC_EXCEPTION_CXX(Superv_Component_i,BadFabType);
+DSC_EXCEPTION_CXX(Superv_Component_i,BadType);
+DSC_EXCEPTION_CXX(Superv_Component_i,BadCast);
+DSC_EXCEPTION_CXX(Superv_Component_i,UnexpectedState);
+DSC_EXCEPTION_CXX(Superv_Component_i,PortAlreadyDefined);
+DSC_EXCEPTION_CXX(Superv_Component_i,PortNotDefined);
+DSC_EXCEPTION_CXX(Superv_Component_i,PortNotConnected);
+DSC_EXCEPTION_CXX(Superv_Component_i,NilPort);
+DSC_EXCEPTION_CXX(Superv_Component_i,BadProperty);
+
+Superv_Component_i::Superv_Component_i(CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName,
+ bool notif) :
+ Engines_DSC_i(orb, poa, contId, instanceName, interfaceName)
+{
+ std::cout << "--Superv_Component_i : MARK 1 ---- " << instanceName << "----" << std::endl;
+ _my_basic_factory = new basic_port_factory();
+ _my_palm_factory = new palm_port_factory();
+ _my_calcium_factory = new calcium_port_factory();
+}
+
+
+Superv_Component_i::~Superv_Component_i() {
+ delete _my_basic_factory;
+}
+
+provides_port *
+Superv_Component_i::create_provides_data_port(const char* port_fab_type)
+ throw (BadFabType)
+{
+ assert(port_fab_type);
+
+ provides_port * rtn_port = NULL;
+ string the_type(port_fab_type);
+ int search_result;
+
+ search_result = the_type.find("BASIC_");
+ if (search_result == 0) {
+ rtn_port = _my_basic_factory->create_data_servant(the_type.substr(search_result+6,
+ the_type.length()));
+ }
+ search_result = the_type.find("PALM_");
+ if (search_result == 0) {
+ rtn_port = _my_palm_factory->create_data_servant(the_type.substr(search_result+5,
+ the_type.length()));
+ }
+
+ search_result = the_type.find("CALCIUM_");
+ if (search_result == 0) {
+ rtn_port = _my_calcium_factory->create_data_servant(the_type.substr(search_result+8, the_type.length()));
+ }
+
+ if (rtn_port == NULL)
+ throw BadFabType( LOC(OSS()<< "Impossible d'accéder à la fabrique "
+ <<port_fab_type));
+
+ return rtn_port;
+}
+
+uses_port *
+Superv_Component_i::create_uses_data_port(const char* port_fab_type)
+throw (BadFabType)
+{
+ assert(port_fab_type);
+
+ uses_port * rtn_proxy = NULL;
+ string the_type(port_fab_type);
+ int search_result;
+
+ search_result = the_type.find("BASIC_");
+ if (search_result == 0) {
+ rtn_proxy = _my_basic_factory->create_data_proxy(the_type.substr(search_result+6,
+ the_type.length()));
+ }
+
+ search_result = the_type.find("CALCIUM_");
+ if (search_result == 0) {
+ std::cout << "---- Superv_Component_i::create_uses_data_port : MARK 1 ---- " << the_type.substr(search_result+8, the_type.length()) << "----" << std::endl;
+ rtn_proxy = _my_calcium_factory->create_data_proxy(the_type.substr(search_result+8, the_type.length()));
+ }
+
+ if (rtn_proxy == NULL)
+ throw BadFabType( LOC(OSS()<< "Impossible d'accéder à la fabrique "
+ <<port_fab_type));
+
+ return rtn_proxy;
+}
+
+void
+Superv_Component_i::add_port(const char * port_fab_type,
+ const char * port_type,
+ const char * port_name)
+ throw (PortAlreadyDefined, BadFabType, BadType, BadProperty)
+{
+ assert(port_fab_type);
+ assert(port_type);
+ assert(port_name);
+
+ std::string s_port_type(port_type);
+ if (s_port_type == "provides") {
+ provides_port * port = create_provides_data_port(port_fab_type);
+ add_port(port, port_name);
+ }
+ else if (s_port_type == "uses") {
+ std::cout << "---- Superv_Component_i::add_port : MARK 1 ---- " << std::endl;
+ uses_port * port = create_uses_data_port(port_fab_type);
+ std::cout << "---- Superv_Component_i::add_port : MARK 2 ---- " << std::endl;
+ add_port(port, port_name);
+ }
+ else
+ throw BadType( LOC(OSS()<< "Le port_type doit être soit 'provides' soit 'uses' not "
+ << port_type));
+
+}
+
+void
+Superv_Component_i::add_port(provides_port * port,
+ const char* provides_port_name)
+ throw (PortAlreadyDefined, NilPort, BadProperty)
+{
+ assert(port);
+ assert(provides_port_name);
+
+ try {
+
+ Engines_DSC_interface::add_provides_port(port->get_port_ref(),
+ provides_port_name,
+ port->get_port_properties());
+
+ superv_port_t * new_superv_port = new superv_port_t();
+ new_superv_port->p_ref = port;
+ my_superv_ports[provides_port_name] = new_superv_port;
+
+ }
+ catch (const Engines::DSC::PortAlreadyDefined&) {
+ throw PortAlreadyDefined( LOC(OSS()<< "Le port provides "
+ << provides_port_name <<" existe déjà."));
+ }
+ catch (const Engines::DSC::NilPort&) {
+ throw NilPort( LOC(OSS()<< "Le pointeur sur port provides est nul."));
+ }
+ catch (const Engines::DSC::BadProperty&) {
+ throw BadProperty( LOC(OSS()<< "La propriété est mal définie"));
+ }
+}
+
+void
+Superv_Component_i::add_port(uses_port * port,
+ const char* uses_port_name)
+ throw (PortAlreadyDefined, NilPort, BadProperty)
+{
+ assert(port);
+ assert(uses_port_name);
+
+ try {
+ Engines_DSC_interface::add_uses_port(port->get_repository_id(),
+ uses_port_name,
+ port->get_port_properties());
+ superv_port_t * new_superv_port = new superv_port_t();
+ new_superv_port->u_ref = port;
+ my_superv_ports[uses_port_name] = new_superv_port;
+ }
+ catch (const Engines::DSC::PortAlreadyDefined&) {
+ throw PortAlreadyDefined( LOC(OSS()<< "Le port uses "
+ << uses_port_name <<" existe déjà."));
+ }
+ catch (const Engines::DSC::NilPort&) {
+ throw NilPort( LOC(OSS()<< "Le pointeur sur port uses est nul."));
+ }
+ catch (const Engines::DSC::BadProperty&) {
+ throw BadProperty( LOC(OSS()<< "La propriété est mal définie"));
+ }
+}
+
+void
+Superv_Component_i::get_port(provides_port *& port,
+ const char * provides_port_name)
+ throw (PortNotDefined,PortNotConnected)
+{
+ assert(provides_port_name);
+
+ try {
+ Engines_DSC_interface::get_provides_port(provides_port_name, false);
+ port = my_superv_ports[provides_port_name]->p_ref;
+ } catch (const Engines::DSC::PortNotDefined&) {
+ throw PortNotDefined( LOC(OSS()<< "Le port provides "
+ << provides_port_name <<" n'existe pas."));
+ } catch (const Engines::DSC::PortNotConnected&) {
+ throw PortNotConnected( LOC(OSS()<< "Le port provides " << provides_port_name
+ << " n'est pas connecté."));
+ }
+}
+
+void
+Superv_Component_i::get_port(uses_port *& port,
+ const char * uses_port_name)
+ throw (PortNotDefined, PortNotConnected)
+{
+ assert(uses_port_name);
+
+ try {
+ Engines_DSC_i::get_uses_port(uses_port_name);
+ port = my_superv_ports[uses_port_name]->u_ref;
+ } catch (const Engines::DSC::PortNotDefined&) {
+ throw PortNotDefined( LOC(OSS()<< "Le port uses "
+ << uses_port_name <<" n'existe pas."));
+ } catch (const Engines::DSC::PortNotConnected&) {
+ throw PortNotConnected( LOC(OSS()<< "Le port uses " << uses_port_name
+ << " n'est pas connecté."));
+ }
+}
+
+
+
+void
+Superv_Component_i::provides_port_changed(const char* provides_port_name,
+ int connection_nbr,
+ const Engines::DSC::Message message)
+{
+ my_superv_ports_it = my_superv_ports.find(provides_port_name);
+ if (my_superv_ports_it != my_superv_ports.end())
+ my_superv_ports[provides_port_name]->p_ref->provides_port_changed(connection_nbr,
+ message);
+}
+
+void
+Superv_Component_i::uses_port_changed(const char* uses_port_name,
+ Engines::DSC::uses_port * new_uses_port,
+ const Engines::DSC::Message message)
+{
+ my_superv_ports_it = my_superv_ports.find(uses_port_name);
+ if (my_superv_ports_it != my_superv_ports.end())
+ my_superv_ports[uses_port_name]->u_ref->uses_port_changed(new_uses_port,
+ message);
+}
+
+
+
+void
+Superv_Component_i::get_uses_port_names(std::vector<std::string> & port_names,
+ const std::string servicename) const {
+
+ port_names.reserve(my_superv_ports.size());
+
+ superv_ports::const_iterator it;
+
+ for (it=my_superv_ports.begin(); it!=my_superv_ports.end();++it)
+ if( (*it).second->p_ref == NULL ) port_names.push_back((*it).first);
+}
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : Superv_Component_i.hxx
+// Author : André RIBES (EDF), Eric Fayolle (EDF)
+// Module : KERNEL
+
+#ifndef _SUPERV_COMPONENT_I_HXX_
+#define _SUPERV_COMPONENT_I_HXX_
+
+#include "DSC_i.hxx"
+#include "base_port.hxx"
+#include "uses_port.hxx"
+#include "provides_port.hxx"
+
+// Les différentes fabriques de ports
+#include "basic_port_factory.hxx"
+#include "palm_port_factory.hxx"
+#include "calcium_port_factory.hxx"
+
+#include "DSC_Exception.hxx"
+
+
+using namespace std;
+
+/*! \class Superv_Component_i
+ * \brief This class implements DSC_User component.
+ *
+ * This class allows a higher programming level than DSC_Basic. It enables
+ * a programming level for service's developpers who want to use DSC ports.
+ *
+ * This class has two level for using and declare ports. The higher level proposes
+ * operations to add ports that are provided by default by Salomé like Calcium ports.
+ * It provides too some methods to add their own DSC_User ports.
+ *
+ * \note This class doesn't implement the init_service CORBA operation.
+ */
+class Superv_Component_i :
+ public Engines_DSC_i,
+ virtual public POA_Engines::Superv_Component
+{
+public:
+ Superv_Component_i(CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName,
+ bool notif = false);
+ virtual ~Superv_Component_i();
+
+ // Exceptions declarations.
+ // There are defined on the Superv_Component_i.cxx to avoid problems
+ // from dlopen.
+ DSC_EXCEPTION(BadFabType);
+ DSC_EXCEPTION(BadType);
+ DSC_EXCEPTION(BadCast);
+ DSC_EXCEPTION(UnexpectedState);
+ DSC_EXCEPTION(PortAlreadyDefined);
+ DSC_EXCEPTION(PortNotDefined);
+ DSC_EXCEPTION(PortNotConnected);
+ DSC_EXCEPTION(NilPort);
+ DSC_EXCEPTION(BadProperty);
+
+ /*!
+ * \warning currently disabled.
+ */
+ virtual provides_port * create_provides_control_port()
+ {return NULL;}
+
+ /*!
+ * \warning currently disabled.
+ */
+ virtual provides_port * create_provides_data_and_control_port(const char* port_type)
+ {return NULL;}
+
+ /*!
+ * \warning currently disabled.
+ */
+ virtual uses_port * create_uses_control_port()
+ {return NULL;}
+
+ /*!
+ * \warning currently disabled.
+ */
+ virtual uses_port * create_uses_data_and_control_port(const char* port_type)
+ {return NULL;}
+
+ /*!
+ * This methode permits to create a provides port provided by the platform.
+ * (See documentation of DSC for knoing these ports).
+ *
+ *
+ * \param port_fab_type type provides port.
+ * \return the provides port.
+ *
+ * \note It's user repsonsability to destroy the provides port.
+ */
+ virtual provides_port * create_provides_data_port(const char* port_fab_type)
+ throw (BadFabType);
+
+
+ /*!
+ * This methode permits to create a uses port provided by the platform.
+ * (See documentation of DSC for knoing these ports).
+ *
+ *
+ * \param port_fab_type type uses port.
+ * \return the uses port.
+ *
+ * \note It's user repsonsability to destroy the uses port.
+ */
+ virtual uses_port * create_uses_data_port(const char* port_fab_type)
+ throw (BadFabType);
+
+ /*!
+ * Adds a port to the component. With this method only Salomé's provided DSC ports
+ * can be added.
+ *
+ * \param port_fab_type type of the port.
+ * \param port_type uses or provides.
+ * \param port_name the name of the port in the component.
+ */
+ virtual void add_port(const char * port_fab_type,
+ const char * port_type,
+ const char * port_name)
+ throw (PortAlreadyDefined, BadFabType, BadType, BadProperty);
+
+ /*!
+ * Adds a port to the component. With this method only Salomé's provided DSC ports
+ * can be added.
+ *
+ * \param port_fab_type type of the port.
+ * \param port_type uses or provides.
+ * \param port_name the name of the port in the component.
+ * \return the created port.
+ */
+ template < typename SpecificPortType >
+ SpecificPortType * add_port(const char * port_fab_type,
+ const char * port_type,
+ const char * port_name)
+ throw (PortAlreadyDefined, BadFabType, BadType, BadCast, BadProperty);
+
+ /*!
+ * Adds a created provides port to the component.
+ *
+ * \param port the provides port.
+ * \param provides_port_name the name of the port in the component.
+ */
+ virtual void add_port(provides_port * port,
+ const char* provides_port_name)
+ throw (PortAlreadyDefined, NilPort, BadProperty);
+
+ /*!
+ * Adds a created uses port to the component.
+ *
+ * \param port the uses port.
+ * \param uses_port_name the name of the port in the component.
+ */
+ virtual void add_port(uses_port * port,
+ const char* uses_port_name)
+ throw (PortAlreadyDefined, NilPort, BadProperty);
+
+ /*!
+ * Gets the provides port already added in the component.
+ *
+ * \param port the provides port pointer.
+ * \param provides_port_name the name of the port.
+ */
+ virtual void get_port(provides_port *& port,
+ const char* provides_port_name)
+ throw (PortNotDefined, PortNotConnected);
+
+ /*!
+ * Gets the uses port already added in the component.
+ *
+ * \param port the uses port pointer.
+ * \param uses_port_name the name of the port.
+ */
+ virtual void get_port(uses_port *& port,
+ const char* uses_port_name)
+ throw (PortNotDefined, PortNotConnected);
+
+ /*!
+ * Gets the list of the ports of a service.
+ * If servicename is not set, all the ports of the component are
+ * returned.
+ *
+ * \param port_names the ports's list.
+ * \param servicename service's name.
+ */
+ virtual void get_uses_port_names(std::vector<std::string> & port_names,
+ const std::string servicename="") const;
+
+ /*!
+ * Gets a port already added in the component.
+ *
+ * \param port_name the name of the port.
+ * \return a port's pointer.
+ */
+ template <typename SpecificPortType >
+ SpecificPortType * get_port( const char * port_name)
+ throw (PortNotDefined, PortNotConnected, BadCast, UnexpectedState);
+
+ /*!
+ * \see DSC_Callbacks::provides_port_changed
+ */
+ virtual void provides_port_changed(const char* provides_port_name,
+ int connection_nbr,
+ const Engines::DSC::Message message);
+
+ /*!
+ * \see DSC_Callbacks::uses_port_changed
+ */
+ virtual void uses_port_changed(const char* uses_port_name,
+ Engines::DSC::uses_port * new_uses_port,
+ const Engines::DSC::Message message);
+
+
+private:
+
+ // Fabrics
+ basic_port_factory * _my_basic_factory;
+ palm_port_factory * _my_palm_factory;
+ calcium_port_factory * _my_calcium_factory;
+
+ /*-------------------------------------------------*/
+ // A Superv_Component port.
+ struct superv_port_t {
+ superv_port_t():u_ref(NULL),p_ref(NULL){};
+ // For uses ports.
+ uses_port * u_ref;
+ // For provides ports.
+ provides_port * p_ref;
+ };
+
+ typedef std::map<std::string, superv_port_t *> superv_ports;
+
+ /*-------------------------------------------------*/
+ /*-------------------------------------------------*/
+
+ superv_ports my_superv_ports;
+ superv_ports::iterator my_superv_ports_it;
+};
+
+
+
+template < typename SpecificPortType > SpecificPortType *
+Superv_Component_i::add_port(const char * port_fab_type,
+ const char * port_type,
+ const char * port_name)
+ throw (PortAlreadyDefined, BadFabType, BadType, BadCast, BadProperty)
+{
+ assert(port_fab_type);
+ assert(port_type);
+ assert(port_name);
+ SpecificPortType * retPort;
+
+ std::cout << "---- Superv_Component_i::add_port : Mark 0 ---- " << port_name << "----" << std::endl;
+
+ std::string s_port_type(port_type);
+ if (s_port_type == "provides") {
+ provides_port * port = create_provides_data_port(port_fab_type);
+ add_port(port, port_name);
+ retPort = dynamic_cast<SpecificPortType *>(port);
+ if ( retPort == NULL ) { delete port;
+ throw BadCast( LOC("La conversion vers le type de port demandé n'est pas possible " ));
+ }
+ }
+ else if (s_port_type == "uses") {
+ uses_port * port = create_uses_data_port(port_fab_type);
+ add_port(port, port_name);
+ std::cout << "---- Superv_Component_i::add_port : Mark 1 ---- " << port << "----" << std::endl;
+ std::cout << "---- Superv_Component_i::add_port : Mark 1 ---- get_repository_id()" << port->get_repository_id() << std::endl;
+ retPort = dynamic_cast<SpecificPortType *>(port);
+ std::cout << "---- Superv_Component_i::add_port : Mark 2 ---- " << retPort << "----" << std::endl;
+ if ( retPort == NULL ) { delete port;
+ throw BadCast( LOC("La conversion vers le type de port demandé n'est pas possible " ));
+ }
+ }
+ else
+ throw BadType(LOC(OSS()<< "Le port_type doit être soit 'provides' soit 'uses' not "
+ << port_type));
+
+ return retPort;
+};
+
+
+template <typename SpecificPortType > SpecificPortType *
+Superv_Component_i::get_port( const char * port_name)
+ throw (PortNotDefined, PortNotConnected, BadCast, UnexpectedState)
+{
+ assert(port_name);
+
+ SpecificPortType * retPort;
+ base_port * port;
+
+ my_superv_ports_it = my_superv_ports.find(port_name);
+ if (my_superv_ports_it == my_superv_ports.end())
+ {
+ throw PortNotDefined( LOC(OSS()<< "Port " << port_name <<" does not exist"));
+ }
+
+ superv_port_t * superv_port = my_superv_ports[port_name];
+ try {
+ if ( superv_port->p_ref != NULL ) {
+ port = superv_port->p_ref;
+ Engines_DSC_interface::get_provides_port(port_name, false);
+ }
+ else if ( superv_port->u_ref != NULL ) {
+ port = superv_port->u_ref;
+ Engines_DSC_i::get_uses_port(port_name);
+ } else {
+ throw UnexpectedState( LOC(OSS()<< "Internal Error superv_port struct is inconsistent "));
+
+ }
+ } catch (const Engines::DSC::PortNotDefined&) {
+ throw PortNotDefined( LOC(OSS()<< "Le port "
+ << port_name <<" n'existe pas."));
+ } catch (const Engines::DSC::PortNotConnected&) {
+ throw PortNotConnected( LOC(OSS()<< "Le port " << port_name
+ << " n'est pas connecté."));
+ }
+
+ retPort = dynamic_cast<SpecificPortType *>(port);
+ if ( retPort == NULL ) {
+ delete port;
+ throw BadCast( LOC("La conversion vers le type de port demandé n'est pas possible " ));
+ }
+
+ return retPort;
+};
+
+
+#endif
--- /dev/null
+#include "base_port.hxx"
+
+
+base_port::base_port()
+{
+ default_properties = new PortProperties_i();
+}
+
+base_port::~base_port()
+{
+ delete default_properties;
+}
+
+Ports::PortProperties_ptr
+base_port::get_port_properties()
+{
+ return default_properties->_this();
+}
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : base_port.hxx
+// Author : Eric Fayolle (EDF), André RIBES (EDF)
+// Module : KERNEL
+
+#ifndef _PORT_HXX_
+#define _PORT_HXX_
+
+#include "PortProperties_i.hxx"
+/*
+ * This class is base class for all DSC_User provides and uses port.
+ * It provides a default property object for the port.
+ */
+class base_port
+{
+public :
+ base_port();
+ virtual ~base_port();
+
+ /*!
+ * This is used to get the property object of the port.
+ *
+ * \return property's CORBA reference.
+ */
+ virtual Ports::PortProperties_ptr get_port_properties();
+
+protected :
+ PortProperties_i * default_properties;
+};
+
+#endif
+
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : provides_port.cxx
+// Author : André RIBES (EDF)
+// Module : KERNEL
+
+#include "provides_port.hxx"
+
+provides_port::provides_port()
+{}
+
+provides_port::~provides_port()
+{}
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : provides_port.hxx
+// Author : André RIBES (EDF)
+// Module : KERNEL
+
+#ifndef _PROVIDES_PORT_HXX_
+#define _PROVIDES_PORT_HXX_
+
+#include "base_port.hxx"
+#include "SALOME_Ports.hh"
+#include "DSC_Engines.hh"
+
+/*! \class provides_port
+ * \brief This class implements a DSC_User provides C++ port.
+ *
+ * This class is base class for all DSC_User provides port.
+ * It's an abstract class.
+ */
+class provides_port : public base_port
+{
+ public :
+ provides_port();
+ virtual ~provides_port();
+
+ /*!
+ * This method permits to get the CORBA reference of the port.
+ *
+ * \return port's CORBA reference.
+ */
+ virtual Ports::Port_ptr get_port_ref() = 0;
+
+ /*!
+ * This method is the callback called by the component to inform
+ * the provides port of a new or a removed connection.
+ *
+ * \param connection_nbr current connection number.
+ * \param message message associated with this connection.
+ */
+ virtual void provides_port_changed(int connection_nbr,
+ const Engines::DSC::Message message) {}
+
+};
+
+#endif
+
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : test_DSC_Exception.cxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+//
+#include "DSC_Exception.hxx"
+
+//Compiler ce fichier en mode _DEBUG_ et sans _DEBUG_
+class A {
+
+public:
+ DSC_EXCEPTION(Exp1);
+ DSC_EXCEPTION(Exp2);
+
+ A() {};
+ virtual ~A() {};
+ // La salome exception ne permet pas de passer une chaine ""
+ void lanceException1_1() throw(Exp1) { throw Exp1("_");}
+ void lanceException1_2() throw(Exp1) { throw Exp1("Ceci est l'exception 1_2");}
+ void lanceException1_3() throw(Exp1) { throw Exp1(LOC("Ceci est l'exception 1_3"));}
+ void lanceException1_4() throw(Exp1) { throw Exp1(LOC(OSS() << "Ceci est l'exeption 1_4" )); }
+ void lanceException1_5() throw(Exp1) {
+ int a=1;
+ throw Exp1(LOC(OSS() << "Ceci est l'exeption 1_5 avec la valeur A : " << a )); }
+ void lanceException1_6() throw(Exp1) {
+ Exp1 exp1(LOC(OSS() << "Ceci est l'exeption 1_6"));
+ std::cout << "Affichage de exp1.what() dans lanceException1_6() " << exp1.what() << std::endl;
+ throw Exp1(exp1);
+ }
+ void lanceException1_7() throw(Exp1) {
+ throw Exp1(LOC(OSS() << "Ceci est l'exeption 1_7"));
+ }
+};
+
+DSC_EXCEPTION_CXX(A,Exp1);
+DSC_EXCEPTION_CXX(A,Exp2);
+
+
+int main() {
+
+ A a;
+
+
+ try {
+ a.lanceException1_1();
+ }
+ catch ( const A::Exp1 & ex ) {
+ std::cout << "Exception 1 bien reçue" << std::endl;
+ std::cout << ex.what() << std::endl;
+ } catch ( const DSC_Exception & dscE ) {
+ std::cout << "Exception DSC reçue mais aurait dû recevoir Exception 1" << std::endl;
+ } catch ( ...) {
+ std::cout << "Exception ... reçue mais aurait dû recevoir Exception 1" << std::endl;
+ }
+
+ try {
+ a.lanceException1_2();
+ }
+ // Essai par valeur (ne pas faire çà !)
+ catch ( A::Exp1 ex ) {
+ std::cout << "Exception 1 bien reçue" << std::endl;
+ std::cout << ex.what() << std::endl;
+ } catch ( const DSC_Exception & dscE ) {
+ std::cout << "Exception DSC reçue mais aurait dû recevoir Exception 1" << std::endl;
+ } catch ( ...) {
+ std::cout << "Exception ... reçue mais aurait dû recevoir Exception 1" << std::endl;
+ }
+
+ try {
+ a.lanceException1_3();
+ }
+ catch ( const A::Exp1 & ex ) {
+ std::cout << "Exception 1 bien reçue" << std::endl;
+ std::cout << ex.what() << std::endl;
+ } catch ( const DSC_Exception & dscE ) {
+ std::cout << "Exception DSC reçue mais aurait dû recevoir Exception 1" << std::endl;
+ } catch ( ...) {
+ std::cout << "Exception ... reçue mais aurait dû recevoir Exception 1" << std::endl;
+ }
+
+ try {
+ a.lanceException1_4();
+ }
+ catch ( const A::Exp1 & ex ) {
+ std::cout << "Exception 1 bien reçue" << std::endl;
+ std::cout << ex.what() << std::endl;
+ } catch ( const DSC_Exception & dscE ) {
+ std::cout << "Exception DSC reçue mais aurait dû recevoir Exception 1" << std::endl;
+ } catch ( ...) {
+ std::cout << "Exception ... reçue mais aurait dû recevoir Exception 1" << std::endl;
+ }
+
+ try {
+ a.lanceException1_5();
+ }
+ catch ( const A::Exp1 & ex ) {
+ std::cout << "Exception 1 bien reçue" << std::endl;
+ std::cout << ex.what() << std::endl;
+ } catch ( const DSC_Exception & dscE ) {
+ std::cout << "Exception DSC reçue mais aurait dû recevoir Exception 1" << std::endl;
+ } catch ( ...) {
+ std::cout << "Exception ... reçue mais aurait dû recevoir Exception 1" << std::endl;
+ }
+
+ try {
+ a.lanceException1_6();
+ }
+ catch ( SALOME_Exception ex ) {
+ std::cout << "Exception SALOME bien reçue" << std::endl;
+ std::cout << ex.what() << std::endl;
+ } catch ( ...) {
+ std::cout << "Exception ... reçue mais aurait dû recevoir Exception SALOME" << std::endl;
+ }
+
+ try {
+ a.lanceException1_6();
+ }
+ catch ( const SALOME_Exception & ex ) {
+ std::cout << "Exception SALOME bien reçue" << std::endl;
+ std::cout << ex.what() << std::endl;
+ } catch ( ...) {
+ std::cout << "Exception ... reçue mais aurait dû recevoir Exception SALOME" << std::endl;
+ }
+
+ try {
+ a.lanceException1_7();
+ } catch ( const DSC_Exception & ex ) {
+ std::cout << "Exception DSC bien reçue" << std::endl;
+ std::cout << ex.what() << std::endl;
+ } catch ( const SALOME_Exception & ex ) {
+ std::cout << "Exception SALOME reçue mais aurais dû recevoir une exception DSC" << std::endl;
+ std::cout << ex.what() << std::endl;
+ } catch ( ...) {
+ std::cout << "Exception ... reçue mais aurait dû recevoir Exception DSC" << std::endl;
+ }
+
+};
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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 "uses_port.hxx"
+
+uses_port::uses_port()
+{}
+
+uses_port::~uses_port()
+{}
+
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : uses_port.hxx
+// Author : André RIBES (EDF)
+// Module : KERNEL
+
+#ifndef _USES_PORT_HXX_
+#define _USES_PORT_HXX_
+
+#include "base_port.hxx"
+#include "SALOME_Ports.hh"
+#include "DSC_Engines.hh"
+
+/*! \class uses_port
+ * \brief This class implements a DSC_User uses C++ port.
+ *
+ * This class is base class for all DSC_User uses port.
+ * It's an abstract class.
+ *
+ * Contrary to DSC_Basic layer, a uses port as an implementation
+ * provided by this class which permits to manipulate the uses port.
+ */
+class uses_port : public base_port
+{
+ public :
+ uses_port();
+ virtual ~uses_port();
+
+ /*!
+ * This is used by the component to get the CORBA repository id
+ * of the uses port. It's an abstract method.
+ *
+ * \return port's CORBA repository id.
+ */
+ virtual const char * get_repository_id() = 0;
+
+ /*!
+ * DEPRECATED --- WILL BE REMOVED
+ * It was used when uses port where not multiple.
+ * It's an abstract method.
+ *
+ */
+ virtual bool set_port(Ports::Port_ptr port) = 0;
+
+ /*!
+ * This method is the uses port's callback to be aware of
+ * connections states.
+ * It's an abstract method. The uses port uses this method
+ * to manage the sequence of the DSC_Basic uses port.
+ *
+ * \param new_uses_port new uses port sequence.
+ * \param message message associated with this modification.
+ */
+ virtual void uses_port_changed(Engines::DSC::uses_port * new_uses_port,
+ const Engines::DSC::Message message) = 0;
+
+};
+
+#endif
+
--- /dev/null
+# Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# 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.
+#
+# 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
+#
+#
+#
+# File : Makefile.am
+# Author : André RIBES (EDF)
+# Module : KERNEL
+
+if WITH_PACO_PARALLEL
+SUBDIR_PAR = ParallelDSC
+endif
+
+SUBDIRS = DSC_Basic DSC_User $(SUBDIR_PAR)
--- /dev/null
+# Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# 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.
+#
+# 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
+#
+#
+#
+# File : Makefile.am
+# Author : André RIBES (EDF)
+# Module : KERNEL
+
+include $(top_srcdir)/salome_adm/unix/make_common_starter.am
+
+#
+# ===============================================================
+# Header to be installed
+# ===============================================================
+#
+# header files
+salomeinclude_HEADERS = ParallelDSC_i.hxx
+
+#
+# ===============================================================
+# Local definitions
+# ===============================================================
+#
+
+# This local variable defines the list of CPPFLAGS common to all target in this package.
+COMMON_CPPFLAGS= -I$(top_srcdir)/src/Container \
+ -I$(top_srcdir)/src/ParallelContainer \
+ -I$(top_srcdir)/src/Notification \
+ -I$(top_srcdir)/src/SALOMELocalTrace \
+ -I$(top_srcdir)/src/Basics \
+ -I$(top_srcdir)/src/NamingService \
+ -I$(top_srcdir)/src/Utils \
+ -I$(top_srcdir)/src/DSC/DSC_Basic \
+ -I$(top_builddir)/salome_adm/unix \
+ -I$(top_builddir)/idl \
+ -I$(top_srcdir)/src/Registry \
+ -I$(top_srcdir)/src/Utils \
+ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ \
+ @PACO_INCLUDES@
+
+# This local variable defines the list of dependant libraries common to all target in this package.
+COMMON_LIBS =
+
+#
+# ===============================================================
+# Libraries targets
+# ===============================================================
+#
+lib_LTLIBRARIES = libSalomeParallelDSCContainer.la
+
+libSalomeParallelDSCContainer_la_SOURCES = ParallelDSC_i.cxx
+
+libSalomeParallelDSCContainer_la_CXXFLAGS = $(COMMON_CPPFLAGS)
+
+libSalomeParallelDSCContainer_la_LIBADD = $(COMMON_LIBS)
+
+libSalomeParallelDSCContainer_la_LDFLAGS = -no-undefined -version-info=0:0:0
+
--- /dev/null
+// André Ribes EDF R&D - 2006
+//
+
+#include "ParallelDSC_i.hxx"
+
+Engines_ParallelDSC_i::Engines_ParallelDSC_i(CORBA::ORB_ptr orb, char * ior,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName,
+ bool notif) :
+ Engines_Parallel_Component_i(orb, ior, poa, contId, instanceName, interfaceName, notif),
+ Engines::Parallel_DSC_serv(orb, ior),
+ Engines::DSC_serv(orb, ior),
+// Engines::Superv_Component_serv(orb, ior),
+ Engines::Component_serv(orb, ior),
+ InterfaceParallel_impl(orb,ior)
+{
+}
+
+
+Engines_ParallelDSC_i::~Engines_ParallelDSC_i() {}
+
+// WARNING !!!
+// CURRENTLY ERRORS ARE NOT SUPPORTED !!!!!!!
+// WARNING !!
+
+void
+Engines_ParallelDSC_i::set_paco_proxy(const CORBA::Object_ptr ref,
+ const char* provides_port_name,
+ Ports::PortProperties_ptr port_prop) {
+ assert(provides_port_name);
+ Engines_DSC_interface::add_provides_port(Ports::Port::_narrow(ref),
+ provides_port_name,
+ port_prop);
+ PaCO_operation * global_ptr = getContext("global_paco_context");
+ cerr << " my_comm : " << global_ptr->my_com << endl;
+ // Waiting that all the nodes have the proxy
+ global_ptr->my_com->paco_barrier();
+ cerr << "set_paco_proxy node fin" << endl;
+}
+
+const char *
+Engines_ParallelDSC_i::get_proxy(const char* provides_port_name) {
+ char * rtn_char = NULL;
+ Ports::Port_ptr proxy = Engines_DSC_interface::get_provides_port(provides_port_name,
+ 0);
+ if (!CORBA::is_nil(proxy))
+ rtn_char = (char *) _orb->object_to_string(proxy);
+ return rtn_char;
+}
+
+CORBA::Boolean
+Engines_ParallelDSC_i::add_parallel_provides_proxy_port(const CORBA::Object_ptr ref,
+ const char * provides_port_name)
+{
+ assert(provides_port_name);
+ CORBA::Boolean rtn_bool = false;
+ CORBA::Object_ptr _comp_proxy = _orb->string_to_object(_ior.c_str());
+ Engines::Parallel_DSC_var real_comp_proxy = Engines::Parallel_DSC::_narrow(_comp_proxy);
+ real_comp_proxy->set_paco_proxy(ref, provides_port_name);
+ rtn_bool = true;
+ return rtn_bool;
+}
+
+CORBA::Boolean
+Engines_ParallelDSC_i::add_parallel_provides_proxy_wait(const char * provides_port_name)
+{
+ assert(provides_port_name);
+ char * proxy = NULL;
+ try {
+ proxy = (char *) get_proxy(provides_port_name);
+ }
+ catch(...) {
+ while(proxy == NULL)
+ {
+ sleep(1);
+ try {
+ proxy = (char *) get_proxy(provides_port_name);
+ }
+ catch(...) {}
+ }
+ }
+ return true;
+}
+
+CORBA::Boolean
+Engines_ParallelDSC_i::add_parallel_provides_node_port(Ports::Port_PaCO_ptr ref,
+ const char* provides_port_name)
+{
+ CORBA::Boolean rtn_bool = false;
+ PaCO::InterfaceParallel_var node = PaCO::InterfaceParallel::_narrow(ref);
+ node->deploy(getMyRank());
+ rtn_bool = true;
+ return rtn_bool;
+}
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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
+//
+//
+//
+// File : ParallelDSC_i.hxx
+// Author : André RIBES (EDF)
+// Module : KERNEL
+
+#ifndef _PARALLEL_DSC_COMPONENT_I_HXX_
+#define _PARALLEL_DSC_COMPONENT_I_HXX_
+
+#include <iostream>
+#include <map>
+
+#include "DSC_EnginesPaCO_Engines_Parallel_DSC_server.h"
+#include "DSC_interface.hxx"
+#include "SALOME_ParallelComponent_i.hxx"
+
+class Engines_ParallelDSC_i:
+ public virtual Engines_Parallel_Component_i,
+ public virtual Engines::Parallel_DSC_serv,
+ public virtual Engines_DSC_interface
+{
+public:
+ Engines_ParallelDSC_i(CORBA::ORB_ptr orb, char * ior,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName,
+ bool notif = false);
+
+ virtual ~Engines_ParallelDSC_i();
+
+
+ virtual CORBA::Boolean init_service(const char* service_name) {return true;};
+
+ /*!
+ * \see Engines::DSC::add_provides_port
+ */
+ virtual void add_provides_port(Ports::Port_ptr ref,
+ const char* provides_port_name,
+ Ports::PortProperties_ptr port_prop)
+ throw (Engines::DSC::PortAlreadyDefined,
+ Engines::DSC::NilPort,
+ Engines::DSC::BadProperty) {
+ Engines_DSC_interface::add_provides_port(ref,
+ provides_port_name,
+ port_prop);
+ }
+
+ /*!
+ * \see Engines::DSC::add_uses_port
+ */
+ virtual void add_uses_port(const char* repository_id,
+ const char* uses_port_name,
+ Ports::PortProperties_ptr port_prop)
+ throw (Engines::DSC::PortAlreadyDefined,
+ Engines::DSC::BadProperty) {
+ Engines_DSC_interface::add_uses_port(repository_id,
+ uses_port_name,
+ port_prop);
+ }
+
+ /*!
+ * \see Engines::DSC::get_provides_port
+ */
+ virtual Ports::Port_ptr get_provides_port(const char* provides_port_name,
+ const CORBA::Boolean connection_error)
+ throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::PortNotConnected) {
+ return Engines_DSC_interface::get_provides_port(provides_port_name,
+ connection_error);
+ }
+
+ /*!
+ * \see Engines::DSC::get_uses_port
+ */
+ virtual Engines::DSC::uses_port * get_uses_port(const char* uses_port_name)
+ throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::PortNotConnected) {
+ return Engines_DSC_interface::get_uses_port(uses_port_name);
+ }
+
+ /*!
+ * \see Engines::DSC::connect_provides_port
+ */
+ virtual void connect_provides_port(const char* provides_port_name)
+ throw (Engines::DSC::PortNotDefined) {
+ Engines_DSC_interface::connect_provides_port(provides_port_name);
+ }
+
+ /*!
+ * \see Engines::DSC::connect_uses_port
+ */
+ virtual void connect_uses_port(const char* uses_port_name,
+ Ports::Port_ptr provides_port_ref)
+ throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::BadPortType,
+ Engines::DSC::NilPort) {
+ Engines_DSC_interface::connect_uses_port(uses_port_name,
+ provides_port_ref);
+ }
+
+ /*!
+ * \see Engines::DSC::is_connected
+ */
+ virtual CORBA::Boolean is_connected(const char* port_name)
+ throw (Engines::DSC::PortNotDefined) {
+ return Engines_DSC_interface::is_connected(port_name);
+ }
+
+ /*!
+ * \see Engines::DSC::disconnect_provides_port
+ */
+ virtual void disconnect_provides_port(const char* provides_port_name,
+ const Engines::DSC::Message message)
+ throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::PortNotConnected) {
+ Engines_DSC_interface::disconnect_provides_port(provides_port_name,
+ message);
+ }
+
+ /*!
+ * \see Engines::DSC::disconnect_uses_port
+ */
+ virtual void disconnect_uses_port(const char* uses_port_name,
+ Ports::Port_ptr provides_port_ref,
+ const Engines::DSC::Message message)
+ throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::PortNotConnected,
+ Engines::DSC::BadPortReference) {
+ Engines_DSC_interface::disconnect_uses_port(uses_port_name,
+ provides_port_ref,
+ message);
+ }
+
+ virtual Ports::PortProperties_ptr get_port_properties(const char* port_name)
+ throw (Engines::DSC::PortNotDefined) {
+ return Engines_DSC_interface::get_port_properties(port_name);
+ }
+
+ /*!
+ * This method is used to register the proxy of the parallel port into
+ * all the nodes of the parallel component.
+ *
+ * \param ref CORBA proxy reference.
+ * \param provides_port_name provides port associated with the proxy.
+ * \param port_prop port properties.
+ */
+ virtual void set_paco_proxy(CORBA::Object_ptr ref,
+ const char* provides_port_name,
+ Ports::PortProperties_ptr port_prop);
+
+ /*!
+ * This method is used by the node that want to add the parallel proxy port.
+ *
+ * \param ref CORBA proxy reference.
+ * \param provides_port_name provides port associated with the proxy.
+ *
+ * \return true if the proxy is correctly added.
+ */
+ virtual CORBA::Boolean add_parallel_provides_proxy_port(const CORBA::Object_ptr ref,
+ const char * provides_port_name);
+
+ /*!
+ * This method by the nodes that do not add the proxy to wait is reference.
+ *
+ * \param provides_port_name provides port associated with the proxy.
+ *
+ * \return true if the proxy is correctly added.
+ */
+ virtual CORBA::Boolean add_parallel_provides_proxy_wait(const char * provides_port_name);
+
+ /*!
+ * Permits to add a parallel node of a parallel provides port.
+ *
+ * \param ref CORBA node reference.
+ * \param provides_port_name provides port associated with the node.
+ *
+ * \return true if the node is correctly added.
+ */
+ virtual CORBA::Boolean add_parallel_provides_node_port(Ports::Port_PaCO_ptr ref,
+ const char* provides_port_name);
+
+ /*!
+ * Used to get the proxy of the parallel port.
+ *
+ * \param provides_port_name name of the parallel provides port.
+ *
+ * \return IOR of the proxy.
+ */
+ virtual const char * get_proxy(const char* provides_port_name);
+
+};
+
+#endif
return myInstance._retn();
}
+Engines::Component_ptr
+SALOME_LifeCycleCORBA::Load_ParallelComponent(const Engines::MachineParameters& params,
+ const char *componentName,
+ int studyId)
+{
+ MESSAGE("Entering LoadParallelComponent");
+
+/*MESSAGE("Parameters : ");
+ MESSAGE("Container name : " << params.container_name);
+ MESSAGE("Number of component nodes : " << params.nb_component_nodes);
+ MESSAGE("Component Name : " << componentName);*/
+
+ MESSAGE("Building a list of machines");
+ Engines::MachineList_var listOfMachines = _ContManager->GetFittingResources(params, componentName);
+ if (listOfMachines->length() == 0)
+ {
+ INFOS("No matching machines founded !");
+ return Engines::Component::_nil();
+ }
+ MESSAGE("Starting Parallel Container");
+ Engines::Container_var cont = _ContManager->FindOrStartParallelContainer(params, listOfMachines);
+ if (CORBA::is_nil(cont)) {
+ INFOS("FindOrStartParallelContainer() returns a NULL container !");
+ return Engines::Component::_nil();
+ }
-
-
-
-
-
-
-
-
-
-
+ MESSAGE("Loading component library");
+ bool isLoadable = cont->load_component_Library(componentName);
+ if (!isLoadable) {
+ INFOS(componentName <<" library is not loadable !");
+ return Engines::Component::_nil();
+ }
+
+ MESSAGE("Creating component instance");
+ // @PARALLEL@ permits to identify that the component requested
+ // is a parallel component.
+ string name = string(componentName) + string("@PARALLEL@");
+ Engines::Component_var myInstance = cont->create_component_instance(name.c_str(), studyId);
+ if (CORBA::is_nil(myInstance))
+ INFOS("create_component_instance returns a NULL component !");
+ return myInstance._retn();
+}
#include <Utils_SALOME_Exception.hxx>
#include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
#include CORBA_CLIENT_HEADER(SALOME_Component)
-
+#include <iostream>
+using namespace std;
#ifdef WNT
# if defined LIFECYCLECORBA_EXPORTS
# define LIFECYCLECORBA_EXPORT __declspec( dllexport )
FindOrLoad_Component(const char *containerName,
const char *componentName); // for compatibility
+ // Parallel extension
+ Engines::Component_ptr
+ Load_ParallelComponent(const Engines::MachineParameters& params,
+ const char *componentName,
+ int studyId);
+
bool isKnownComponentClass(const char *componentName);
bool isMpiContainer(const Engines::MachineParameters& params)
param->nb_proc_per_node = 0;
param->nb_node = 0;
param->isMPI = false;
+ param->parallelLib = CORBA::string_dup("");
+ param->nb_component_nodes = 0;
PyObject *key, *value;
int pos = 0;
while (PyDict_Next($input, &pos, &key, &value))
{
param->isMPI = PyLong_AsLong(value);
}
+ else if (strcmp(keystr,"parallelLib")==0)
+ {
+ param->parallelLib = CORBA::string_dup(PyString_AsString(value));
+ }
+ else if (strcmp(keystr,"nb_component_nodes")==0)
+ {
+ param->nb_component_nodes = PyLong_AsLong(value);
+ }
}
$1 = param;
}
KERNEL_PY \
ModuleGenerator \
Communication \
- Communication_SWIG
+ Communication_SWIG \
+ DSC
SUBDIR_CPPUNIT_BASE= \
Basics/Test \
Batch \
Batch_SWIG
+SUBDIR_PARALLEL= ParallelContainer
+
+
DIST_SUBDIRS = \
$(SUBDIR_BASE) \
$(SUBDIR_CORBA) \
$(SUBDIR_MPI) \
+ $(SUBDIR_PARALLEL) \
$(SUBDIR_BATCH) \
$(SUBDIR_CPPUNIT_BASE) \
$(SUBDIR_CPPUNIT_CORBA) \
SUBDIRS += $(SUBDIR_CORBA)
endif
-if MPI_IS_OK
- SUBDIRS += $(SUBDIR_MPI)
-endif
+#if MPI_IS_OK
+# SUBDIRS += $(SUBDIR_MPI)
+#endif
if WITH_BATCH
SUBDIRS += $(SUBDIR_BATCH)
$(SUBDIR_CPPUNIT_GENERAL)
endif
endif
-
+if WITH_PACO_PARALLEL
+SUBDIRS += $(SUBDIR_PARALLEL)
+endif
#define MODULECATALOG_EXPORT
#endif
-#endif
\ No newline at end of file
+#endif
+
%module libNOTIFICATION
-#define _declspec(a)
%{
+#define __declspec(a)
#include "NOTIFICATION_Swig.hxx"
%}
// Author : Francis KLOSS
// Module : SALOME
+#ifndef _NOTIFICATION_SWIG_HXX_
+#define _NOTIFICATION_SWIG_HXX_
+
#include "NOTIFICATION.hxx"
#include "SALOME_NOTIFICATION_SWIG.hxx"
private:
NOTIFICATION_Consumer* _consumer;
};
+
+#endif
#define NOTIFICATION_SWIG_EXPORT
#endif
-#endif
\ No newline at end of file
+#endif
* number of processors.
* If the NamingService is out, the exception ServiceUnreachable is thrown.
* \param hostname name of the machine on which the component is searched.
- * \param containername name of the container in which the component is
+ * \param containerName name of the container in which the component is
instanciated.
- * \param componentname name of the component we are looking for an existing
+ * \param componentName name of the component we are looking for an existing
instance.
* \param nbproc in case of multi processor machine, container name is
* suffixed with _nbproc.
* Build a string representing the absolute pathname of a container in
* SALOME_NamingService. This form gives a suffixed containerName in case of
* multi processor machine.
- * \param params struct from which we get container name (may be
- * empty), number of nodes and number of processor
- * per node.
+ * \param containerName name of the container in which the component is
+ instanciated.
* \param hostname name of the host of the container, without domain names.
* \return the path under the form /Containers/hostname/containerName
* \sa ContainerName(const Engines::MachineParameters& params)
* \param splitPath
* \param lengthResult
* \param contextToFind
- * \param _notFound
+ * \param notFound
*/
// ============================================================================
#define NOTIFICATION_EXPORT
#endif
-#endif
\ No newline at end of file
+#endif
--- /dev/null
+# Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# 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.
+#
+# 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
+#
+#
+#
+# File : Makefile.am
+# Author : André RIBES (EDF)
+# Module : KERNEL
+#
+
+include $(top_srcdir)/salome_adm/unix/make_common_starter.am
+
+#
+# ===============================================================
+# Header to be installed
+# ===============================================================
+#
+# header files
+salomeinclude_HEADERS = SALOME_ParallelComponent_i.hxx \
+ SALOME_ParallelContainer_i.hxx
+
+#
+# ===============================================================
+# Local definitions
+# ===============================================================
+#
+
+# This local variable defines the list of CPPFLAGS common to all target in this package.
+COMMON_CPPFLAGS= -I$(top_srcdir)/src/Container \
+ -I$(top_srcdir)/src/Notification \
+ -I$(top_srcdir)/src/SALOMELocalTrace \
+ -I$(top_srcdir)/src/Basics \
+ -I$(top_srcdir)/src/NamingService \
+ -I$(top_srcdir)/src/Registry \
+ -I$(top_srcdir)/src/Utils \
+ -I$(top_builddir)/salome_adm/unix \
+ -I$(top_builddir)/idl \
+ -I$(top_srcdir)/src/SALOMETraceCollector \
+ @CORBA_CXXFLAGS@ \
+ @CORBA_INCLUDES@ \
+ @PACO_INCLUDES@
+
+# This local variable defines the list of dependant libraries common to all target in this package.
+COMMON_LIBS = $(top_builddir)/src/Container/libSalomeContainer.la \
+ $(top_builddir)/idl/libSalomeParallelIDLKernel.la \
+ @CORBA_LIBS@ \
+ @PACO_LIBS@
+
+#
+# ===============================================================
+# Libraries targets
+# ===============================================================
+#
+lib_LTLIBRARIES = libSalomeParallelContainer.la
+
+libSalomeParallelContainer_la_SOURCES = SALOME_ParallelComponent_i.cxx \
+ SALOME_ParallelContainer_i.cxx
+
+libSalomeParallelContainer_la_CXXFLAGS = $(COMMON_CPPFLAGS)
+
+libSalomeParallelContainer_la_LIBADD = $(COMMON_LIBS)
+
+libSalomeParallelContainer_la_LDFLAGS = -no-undefined -version-info=0:0:0
+
+#
+# ===============================================================
+# Executables targets
+# ===============================================================
+#
+
+if MPI_IS_OK
+bin_mpi_programs = SALOME_ParallelContainerProxyMpi \
+ SALOME_ParallelContainerNodeMpi
+endif
+
+bin_PROGRAMS = SALOME_ParallelContainerProxyDummy \
+ SALOME_ParallelContainerNodeDummy \
+ $(bin_mpi_programs)
+
+SALOME_ParallelContainerProxyDummy_SOURCES = SALOME_ParallelContainerProxyDummy.cxx
+SALOME_ParallelContainerProxyDummy_CXXFLAGS = $(COMMON_CPPFLAGS)
+SALOME_ParallelContainerProxyDummy_LDADD = libSalomeParallelContainer.la \
+ -L@PACOPATH@/lib -lPaCO_dummy -lPaCO_omnithread
+
+SALOME_ParallelContainerNodeDummy_SOURCES = SALOME_ParallelContainerNodeDummy.cxx
+SALOME_ParallelContainerNodeDummy_CXXFLAGS = $(COMMON_CPPFLAGS)
+SALOME_ParallelContainerNodeDummy_LDADD = libSalomeParallelContainer.la \
+ -L@PACOPATH@/lib -lPaCO_dummy -lPaCO_omnithread
+
+SALOME_ParallelContainerProxyMpi_SOURCES = SALOME_ParallelContainerProxyMpi.cxx
+SALOME_ParallelContainerProxyMpi_CXXFLAGS = $(COMMON_CPPFLAGS) @MPI_INCLUDES@
+SALOME_ParallelContainerProxyMpi_LDADD = libSalomeParallelContainer.la \
+ -L@PACOPATH@/lib -lPaCO_dummy -lPaCO_mpi -lPaCO_omnithread \
+ @MPI_LIBS@
+
+SALOME_ParallelContainerNodeMpi_SOURCES = SALOME_ParallelContainerNodeMpi.cxx
+SALOME_ParallelContainerNodeMpi_CXXFLAGS = $(COMMON_CPPFLAGS) @MPI_INCLUDES@
+SALOME_ParallelContainerNodeMpi_LDADD = libSalomeParallelContainer.la \
+ -L@PACOPATH@/lib -lPaCO_dummy -lPaCO_mpi -lPaCO_omnithread \
+ @MPI_LIBS@
+
--- /dev/null
+// SALOME_ParallelComponent : implementation of container and engine for Parallel Kernel
+//
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+// File : SALOME_ParallelComponent_i.cxx
+// Author : André RIBES, EDF
+// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
+
+#include "SALOME_ParallelComponent_i.hxx"
+#include "SALOME_ParallelContainer_i.hxx"
+
+#include "OpUtil.hxx"
+#include <stdio.h>
+#ifndef WNT
+#include <dlfcn.h>
+#endif
+#include <cstdlib>
+#include "utilities.h"
+
+#ifndef WNT
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <unistd.h>
+#else
+#include <sys/timeb.h>
+int SIGUSR11 = 1000;
+#endif
+
+
+using namespace std;
+
+extern bool _Sleeping ;
+static Engines_Parallel_Component_i * theEngines_Component ;
+
+bool Engines_Parallel_Component_i::_isMultiStudy = true;
+bool Engines_Parallel_Component_i::_isMultiInstance = false;
+
+//=============================================================================
+/*!
+ * Default constructor, not for use
+ */
+//=============================================================================
+
+Engines_Parallel_Component_i::Engines_Parallel_Component_i(CORBA::ORB_ptr orb, char * ior) :
+ InterfaceParallel_impl(orb,ior), Engines::Component_serv(orb,ior)
+{
+ //ASSERT(0);
+ INFOS("Default Constructor...");
+}
+
+//=============================================================================
+/*!
+ * Standard Constructor for generic Component, used in derived class
+ * Connection to Registry and Notification
+ * \param orb Object Request broker given by Container
+ * \parap poa Portable Object Adapter from Container (normally root_poa)
+ * \param contId container CORBA id inside the server
+ * \param instanceName unique instance name for this object (see Container_i)
+ * \param interfaceName component class name
+ * \param notif use of notification
+ */
+//=============================================================================
+
+Engines_Parallel_Component_i::Engines_Parallel_Component_i(CORBA::ORB_ptr orb, char * ior,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName,
+ bool notif) :
+ InterfaceParallel_impl(orb,ior), Engines::Component_serv(orb,ior),
+ _instanceName(instanceName),
+ _interfaceName(interfaceName),
+ _myConnexionToRegistry(0),
+ _ThreadId(0) ,
+ _ThreadCpuUsed(0) ,
+ _Executed(false) ,
+ _graphName("") ,
+ _nodeName(""),
+ _studyId(-1)
+{
+ MESSAGE("Component constructor with instanceName "<< _instanceName);
+ //SCRUTE(pd_refCount);
+ _orb = CORBA::ORB::_duplicate(orb);
+ _poa = PortableServer::POA::_duplicate(poa);
+ _contId = contId ;
+ CORBA::Object_var o = _poa->id_to_reference(*contId); // container ior...
+ const CORBA::String_var the_ior = _orb->object_to_string(o);
+ _myConnexionToRegistry = new RegistryConnexion(0, 0, the_ior,"theSession",
+ _instanceName.c_str());
+
+ _notifSupplier = new NOTIFICATION_Supplier(instanceName, notif);
+ //SCRUTE(pd_refCount);
+}
+
+//=============================================================================
+/*!
+ * Destructor: call Container for decrement of instances count.
+ * When instances count falls to 0, the container tries to remove the
+ * component library (dlclose)
+ */
+//=============================================================================
+
+Engines_Parallel_Component_i::~Engines_Parallel_Component_i()
+{
+ MESSAGE("Component destructor");
+ Engines_Parallel_Container_i::decInstanceCnt(_interfaceName);
+}
+
+//=============================================================================
+/*!
+ * CORBA method: return name of the instance, unique in this Container
+ */
+//=============================================================================
+
+char* Engines_Parallel_Component_i::instanceName()
+{
+ return CORBA::string_dup(_instanceName.c_str()) ;
+}
+
+//=============================================================================
+/*!
+ * CORBA method: return name of the component class
+ */
+//=============================================================================
+
+char* Engines_Parallel_Component_i::interfaceName()
+{
+ return CORBA::string_dup(_interfaceName.c_str()) ;
+}
+
+//=============================================================================
+/*!
+ * CORBA method: Get study Id
+ * \return -1: not initialised (Internal Error)
+ * 0: multistudy component instance
+ * >0: study id associated to this instance
+ */
+//=============================================================================
+
+CORBA::Long Engines_Parallel_Component_i::getStudyId()
+{
+ return _studyId;
+}
+
+//=============================================================================
+/*!
+ * CORBA method: Test if instance is alive and responds
+ */
+//=============================================================================
+
+void Engines_Parallel_Component_i::ping()
+{
+ // MESSAGE("Engines_Parallel_Component_i::ping_c() pid "<< getpid() << " threadid " << pthread_self());
+}
+
+//=============================================================================
+/*!
+ * CORBA method: Deactivate this instance. CORBA object is deactivated (do not
+ * respond any more to CORBA calls), the connection to Regsitry is removed
+ * (Registry informed of deactivation), internal server reference counter on
+ * the derived servant class is decremented, to allow destruction of the class
+ * (delete) by POA, when there are no more references.
+ * -- TO BE USED BY CONTAINER ONLY (Container housekeeping) --
+ */
+//=============================================================================
+
+void Engines_Parallel_Component_i::destroy()
+{
+ MESSAGE("Engines_Parallel_Component_i::destroy()");
+ //SCRUTE(pd_refCount);
+
+ delete _notifSupplier;
+ _notifSupplier = 0;
+
+ delete _myConnexionToRegistry;
+ _myConnexionToRegistry = 0 ;
+ _poa->deactivate_object(*_id) ;
+ CORBA::release(_poa) ;
+ delete(_id) ;
+ //SCRUTE(pd_refCount);
+ _thisObj->_remove_ref();
+ //SCRUTE(pd_refCount);
+ MESSAGE("Engines_Parallel_Component_i::destroyed") ;
+}
+
+//=============================================================================
+/*!
+ * CORBA method: return CORBA reference of the Container
+ *
+ */
+//=============================================================================
+
+Engines::Container_ptr Engines_Parallel_Component_i::GetContainerRef()
+{
+ MESSAGE("Engines_Parallel_Component_i::GetContainerRef");
+ CORBA::Object_ptr o = _poa->id_to_reference(*_contId) ;
+ return Engines::Container::_narrow(o);
+}
+
+//=============================================================================
+/*!
+ * CORBA method:
+ * Gives a sequence of (key=string,value=any) to the component.
+ * Base class component stores the sequence in a map.
+ * The map is cleared before.
+ * This map is for use by derived classes.
+ * \param dico sequence of (key=string,value=any)
+ */
+//=============================================================================
+
+void Engines_Parallel_Component_i::setProperties(const Engines::FieldsDict& dico)
+{
+ _fieldsDict.clear();
+ for (CORBA::ULong i=0; i<dico.length(); i++)
+ {
+ std::string cle(dico[i].key);
+ _fieldsDict[cle] = dico[i].value;
+ }
+}
+
+//=============================================================================
+/*!
+ * CORBA method:
+ * returns a previously stored map (key=string,value=any) as a sequence.
+ * (see setProperties)
+ */
+//=============================================================================
+
+Engines::FieldsDict* Engines_Parallel_Component_i::getProperties()
+{
+ Engines::FieldsDict_var copie = new Engines::FieldsDict;
+ copie->length(_fieldsDict.size());
+ map<std::string,CORBA::Any>::iterator it;
+ CORBA::ULong i = 0;
+ for (it = _fieldsDict.begin(); it != _fieldsDict.end(); it++, i++)
+ {
+ std::string cle((*it).first);
+ copie[i].key = CORBA::string_dup(cle.c_str());
+ copie[i].value = _fieldsDict[cle];
+ }
+ return copie._retn();
+}
+
+//=============================================================================
+/*!
+ * CORBA method: used by Supervision to give names to this instance
+ */
+//=============================================================================
+
+void Engines_Parallel_Component_i::Names( const char * graphName ,
+ const char * nodeName )
+{
+ _graphName = graphName ;
+ _nodeName = nodeName ;
+ INFOS("Engines_Parallel_Component_i::Names( '" << _graphName << "' , '"
+ << _nodeName << "' )");
+}
+
+//=============================================================================
+/*!
+ * CORBA method: used in Supervision
+ */
+//=============================================================================
+
+bool Engines_Parallel_Component_i::Kill_impl()
+{
+// MESSAGE("Engines_Parallel_Component_i::Kill_i() pthread_t "<< pthread_self()
+// << " pid " << getpid() << " instanceName "
+// << _instanceName.c_str() << " interface " << _interfaceName.c_str()
+// << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+// << dec << " _ThreadId " << _ThreadId << " this " << hex << this
+// << dec ) ;
+
+ bool RetVal = false ;
+#ifndef WNT
+ if ( _ThreadId > 0 && pthread_self() != _ThreadId )
+ {
+ RetVal = Killer( _ThreadId , 0 ) ;
+ _ThreadId = (pthread_t ) -1 ;
+ }
+
+#else
+ if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p )
+ {
+ RetVal = Killer( *_ThreadId , 0 ) ;
+ _ThreadId = (pthread_t* ) 0 ;
+ }
+
+#endif
+ return RetVal ;
+}
+
+//=============================================================================
+/*!
+ * CORBA method: used in Supervision
+ */
+//=============================================================================
+
+bool Engines_Parallel_Component_i::Stop_impl()
+{
+ MESSAGE("Engines_Parallel_Component_i::Stop_i() pthread_t "<< pthread_self()
+ << " pid " << getpid() << " instanceName "
+ << _instanceName.c_str() << " interface " << _interfaceName.c_str()
+ << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+ << dec << " _ThreadId " << _ThreadId );
+
+
+ bool RetVal = false ;
+#ifndef WNT
+ if ( _ThreadId > 0 && pthread_self() != _ThreadId )
+ {
+ RetVal = Killer( _ThreadId , 0 ) ;
+ _ThreadId = (pthread_t ) -1 ;
+ }
+#else
+ if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p )
+ {
+ RetVal = Killer( *_ThreadId , 0 ) ;
+ _ThreadId = (pthread_t* ) 0 ;
+ }
+#endif
+ return RetVal ;
+}
+
+//=============================================================================
+/*!
+ * CORBA method: used in Supervision
+ */
+//=============================================================================
+
+bool Engines_Parallel_Component_i::Suspend_impl()
+{
+ MESSAGE("Engines_Parallel_Component_i::Suspend_i() pthread_t "<< pthread_self()
+ << " pid " << getpid() << " instanceName "
+ << _instanceName.c_str() << " interface " << _interfaceName.c_str()
+ << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+ << dec << " _ThreadId " << _ThreadId );
+
+ bool RetVal = false ;
+#ifndef WNT
+ if ( _ThreadId > 0 && pthread_self() != _ThreadId )
+#else
+ if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p )
+#endif
+ {
+ if ( _Sleeping )
+ {
+ return false ;
+ }
+ else
+ {
+#ifndef WNT
+ RetVal = Killer( _ThreadId ,SIGINT ) ;
+#else
+ RetVal = Killer( *_ThreadId ,SIGINT ) ;
+#endif
+ //if ( RetVal ) _Sleeping = true;
+
+ }
+ }
+ return RetVal ;
+}
+
+//=============================================================================
+/*!
+ * CORBA method: used in Supervision
+ */
+//=============================================================================
+
+bool Engines_Parallel_Component_i::Resume_impl()
+{
+ MESSAGE("Engines_Parallel_Component_i::Resume_i() pthread_t "<< pthread_self()
+ << " pid " << getpid() << " instanceName "
+ << _instanceName.c_str() << " interface " << _interfaceName.c_str()
+ << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+ << dec << " _ThreadId " << _ThreadId );
+ bool RetVal = false ;
+#ifndef WNT
+ if ( _ThreadId > 0 && pthread_self() != _ThreadId )
+#else
+ if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p )
+#endif
+ {
+ if ( _Sleeping )
+ {
+ _Sleeping = false ;
+ RetVal = true ;
+ }
+ else
+ {
+ RetVal = false ;
+ }
+ }
+ return RetVal ;
+}
+
+//=============================================================================
+/*!
+ * CORBA method:
+ */
+//=============================================================================
+
+CORBA::Long Engines_Parallel_Component_i::CpuUsed_impl()
+{
+ long cpu = 0 ;
+ if ( _ThreadId || _Executed )
+ {
+ if ( _ThreadId > 0 )
+ {
+#ifndef WNT
+ if ( pthread_self() != _ThreadId )
+#else
+ if ( pthread_self().p != _ThreadId->p )
+#endif
+ {
+ if ( _Sleeping )
+ {
+ }
+ else
+ {
+ // Get Cpu in the appropriate thread with that object !...
+ theEngines_Component = this ;
+#ifndef WNT
+ Killer( _ThreadId ,SIGUSR1 ) ;
+#else
+ Killer( *_ThreadId ,SIGUSR11 ) ;
+#endif
+ }
+ cpu = _ThreadCpuUsed ;
+ }
+ else
+ {
+ _ThreadCpuUsed = CpuUsed() ;
+ cpu = _ThreadCpuUsed ;
+ // cout << pthread_self() << " Engines_Parallel_Component_i::CpuUsed_impl "
+ // << _serviceName << " " << cpu << endl ;
+ }
+ }
+ else
+ {
+ cpu = _ThreadCpuUsed ;
+ // cout << pthread_self() << " Engines_Parallel_Component_i::CpuUsed_impl "
+ // << _serviceName << " " << cpu<< endl ;
+ }
+ }
+ else
+ {
+ // cout<< pthread_self()<<"Engines_Parallel_Component_i::CpuUsed_impl _ThreadId "
+ // <<_ThreadId <<" "<<_serviceName<<" _StartUsed "<<_StartUsed<<endl;
+ }
+ return cpu ;
+}
+
+
+//=============================================================================
+/*!
+ * C++ method: return Container Servant
+ */
+//=============================================================================
+
+Engines_Parallel_Container_i *Engines_Parallel_Component_i::GetContainerPtr()
+{
+ return dynamic_cast<Engines_Parallel_Container_i*>(_poa->id_to_servant(*_contId)) ;
+}
+
+//=============================================================================
+/*!
+ * C++ method: set study Id
+ * \param studyId 0 if instance is not associated to a study,
+ * >0 otherwise (== study id)
+ * \return true if the set of study Id is OK
+ * must be set once by Container, at instance creation,
+ * and cannot be changed after.
+ */
+//=============================================================================
+
+CORBA::Boolean Engines_Parallel_Component_i::setStudyId(CORBA::Long studyId)
+{
+ ASSERT( studyId >= 0);
+ CORBA::Boolean ret = false;
+ if (_studyId < 0) // --- not yet initialized
+ {
+ _studyId = studyId;
+ ret = true;
+ }
+ else
+ if ( _studyId == studyId) ret = true;
+ return ret;
+}
+
+//=============================================================================
+/*!
+ * C++ method: return CORBA instance id, the id is set in derived class
+ * constructor, when instance is activated.
+ */
+//=============================================================================
+
+PortableServer::ObjectId * Engines_Parallel_Component_i::getId()
+{
+// MESSAGE("PortableServer::ObjectId * Engines_Parallel_Component_i::getId()");
+ return _id ;
+}
+
+//=============================================================================
+/*!
+ * C++ method: used by derived classes for supervision
+ */
+//=============================================================================
+
+void Engines_Parallel_Component_i::beginService(const char *serviceName)
+{
+ MESSAGE(pthread_self() << "Send BeginService notification for " <<serviceName
+ << endl << "Component instance : " << _instanceName << endl << endl);
+#ifndef WNT
+ _ThreadId = pthread_self() ;
+#else
+ _ThreadId = new pthread_t;
+ _ThreadId->p = pthread_self().p ;
+ _ThreadId->x = pthread_self().x ;
+#endif
+ _StartUsed = 0 ;
+ _StartUsed = CpuUsed_impl() ;
+ _ThreadCpuUsed = 0 ;
+ _Executed = true ;
+ _serviceName = serviceName ;
+ if ( pthread_setcanceltype( PTHREAD_CANCEL_ASYNCHRONOUS , NULL ) )
+ {
+ perror("pthread_setcanceltype ") ;
+ exit(0) ;
+ }
+ if ( pthread_setcancelstate( PTHREAD_CANCEL_ENABLE , NULL ) )
+ {
+ perror("pthread_setcancelstate ") ;
+ exit(0) ;
+ }
+// MESSAGE(pthread_self() << " Return from BeginService for " << serviceName
+// << " ThreadId " << _ThreadId << " StartUsed " << _StartUsed
+// << " _graphName " << _graphName << " _nodeName " << _nodeName );
+
+ // --- for supervisor : all strings given with setProperties
+ // are set in environment
+ bool overwrite = true;
+ map<std::string,CORBA::Any>::iterator it;
+ for (it = _fieldsDict.begin(); it != _fieldsDict.end(); it++)
+ {
+ std::string cle((*it).first);
+ if ((*it).second.type()->kind() == CORBA::tk_string)
+ {
+ const char* value;
+ (*it).second >>= value;
+ // ---todo: replace __GNUC__ test by an autoconf macro AC_CHECK_FUNC.
+#if defined __GNUC__
+ int ret = setenv(cle.c_str(), value, overwrite);
+#else
+ //CCRT porting : setenv not defined in stdlib.h
+ std::string s(cle);
+ s+='=';
+ s+=value;
+ // char* cast because 1st arg of linux putenv function
+ // is not a const char* !
+ int ret=putenv((char *)s.c_str());
+ //End of CCRT porting
+#endif
+ MESSAGE("--- setenv: "<<cle<<" = "<< value);
+ }
+ }
+}
+
+//=============================================================================
+/*!
+ * C++ method: used by derived classes for supervision
+ */
+//=============================================================================
+
+void Engines_Parallel_Component_i::endService(const char *serviceName)
+{
+ _ThreadCpuUsed = CpuUsed_impl() ;
+ MESSAGE(pthread_self() << " Send EndService notification for " << serviceName
+ << endl << " Component instance : " << _instanceName << " StartUsed "
+ << _StartUsed << " _ThreadCpuUsed "<< _ThreadCpuUsed << endl <<endl);
+ _ThreadId = 0 ;
+}
+
+//=============================================================================
+/*!
+ * C++ method: -- CHECK IF USED --
+ */
+//=============================================================================
+
+char* Engines_Parallel_Component_i::graphName()
+{
+ return CORBA::string_dup( _graphName.c_str() ) ;
+}
+
+//=============================================================================
+/*!
+ * C++ method: -- CHECK IF USED --
+ */
+//=============================================================================
+
+char* Engines_Parallel_Component_i::nodeName()
+{
+ return CORBA::string_dup( _nodeName.c_str() ) ;
+}
+
+//=============================================================================
+/*!
+ * C++ method: used in Supervision (see kill_impl)
+ */
+//=============================================================================
+
+bool Engines_Parallel_Component_i::Killer( pthread_t ThreadId , int signum )
+{
+#ifndef WNT
+ if ( ThreadId )
+#else
+ if ( ThreadId.p )
+#endif
+ {
+ if ( signum == 0 )
+ {
+ if ( pthread_cancel( ThreadId ) )
+ {
+ perror("Killer pthread_cancel error") ;
+ return false ;
+ }
+ else
+ {
+ MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId
+ << " pthread_canceled") ;
+ }
+ }
+ else
+ {
+ if ( pthread_kill( ThreadId , signum ) == -1 )
+ {
+ perror("Killer pthread_kill error") ;
+ return false ;
+ }
+ else
+ {
+ MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId
+ << " pthread_killed(" << signum << ")") ;
+ }
+ }
+ }
+ return true ;
+}
+
+//=============================================================================
+/*!
+ * C++ method:
+ */
+//=============================================================================
+
+void SetCpuUsed()
+{
+ theEngines_Component->SetCurCpu() ;
+}
+
+//=============================================================================
+/*!
+ * C++ method:
+ */
+//=============================================================================
+
+void Engines_Parallel_Component_i::SetCurCpu()
+{
+ _ThreadCpuUsed = CpuUsed() ;
+ // MESSAGE(pthread_self() <<
+ // " Engines_Parallel_Component_i::SetCurCpu() _ThreadCpuUsed " << _ThreadCpuUsed) ;
+}
+
+//=============================================================================
+/*!
+ * C++ method:
+ */
+//=============================================================================
+
+long Engines_Parallel_Component_i::CpuUsed()
+{
+ long cpu = 0 ;
+#ifndef WNT
+ struct rusage usage ;
+ if ( _ThreadId || _Executed )
+ {
+ if ( getrusage( RUSAGE_SELF , &usage ) == -1 )
+ {
+ perror("Engines_Parallel_Component_i::CpuUsed") ;
+ return 0 ;
+ }
+ cpu = usage.ru_utime.tv_sec - _StartUsed ;
+ // cout << pthread_self() << " Engines_Parallel_Component_i::CpuUsed " << " "
+ // << _serviceName << usage.ru_utime.tv_sec << " - " << _StartUsed
+ // << " = " << cpu << endl ;
+ }
+ else
+ {
+ // cout << pthread_self() << "Engines_Parallel_Component_i::CpuUsed _ThreadId "
+ // << _ThreadId << " " << _serviceName<< " _StartUsed "
+ // << _StartUsed << endl ;
+ }
+#else
+ // NOT implementet yet
+#endif
+
+
+ return cpu ;
+}
+
+//=============================================================================
+/*!
+ * C++ method: Send message to event channel
+ */
+//=============================================================================
+
+void Engines_Parallel_Component_i::sendMessage(const char *event_type,
+ const char *message)
+{
+ _notifSupplier->Send(graphName(), nodeName(), event_type, message);
+}
+
+//=============================================================================
+/*!
+ * C++ method: return standard library name built on component name
+ */
+//=============================================================================
+
+string Engines_Parallel_Component_i::GetDynLibraryName(const char *componentName)
+{
+ string ret="lib";
+ ret+=componentName;
+ ret+="Engine.so";
+ return ret;
+}
+
+//=============================================================================
+/*!
+ * C++ method: DumpPython default implementation
+ */
+//=============================================================================
+
+Engines::TMPFile* Engines_Parallel_Component_i::DumpPython(CORBA::Object_ptr theStudy,
+ CORBA::Boolean isPublished,
+ CORBA::Boolean& isValidScript)
+{
+ char* aScript = "def RebuildData(theStudy): pass";
+ char* aBuffer = new char[strlen(aScript)+1];
+ strcpy(aBuffer, aScript);
+ CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer;
+ int aBufferSize = strlen(aBuffer)+1;
+ Engines::TMPFile_var aStreamFile = new Engines::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1);
+ isValidScript = true;
+ return aStreamFile._retn();
+}
--- /dev/null
+// SALOME_ParallelComponent : implementation of container and engine for Parallel Kernel
+//
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+// File : SALOME_ParallelComponent_i.hxx
+// Author : André RIBES, EDF
+// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
+
+#ifndef _SALOME_PARALLEL_COMPONENT_I_HXX_
+#define _SALOME_PARALLEL_COMPONENT_I_HXX_
+
+#include <iostream>
+#include <signal.h>
+#include <stdlib.h>
+#ifndef WNT
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#include <string>
+#include <map>
+#include <SALOMEconfig.h>
+
+#include "SALOME_ComponentPaCO_Engines_Component_server.h"
+
+#include "NOTIFICATION.hxx"
+#include "RegistryConnexion.hxx"
+
+class Engines_Parallel_Container_i;
+
+#if defined CONTAINER_EXPORTS
+#if defined WIN32
+#define CONTAINER_EXPORT __declspec( dllexport )
+#else
+#define CONTAINER_EXPORT
+#endif
+#else
+#if defined WNT
+#define CONTAINER_EXPORT __declspec( dllimport )
+#else
+#define CONTAINER_EXPORT
+#endif
+#endif
+
+class CONTAINER_EXPORT Engines_Parallel_Component_i:
+ public virtual Engines::Component_serv,
+ public virtual PortableServer::RefCountServantBase
+{
+public:
+ Engines_Parallel_Component_i(CORBA::ORB_ptr orb, char * ior);
+ Engines_Parallel_Component_i(CORBA::ORB_ptr orb, char * ior,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName,
+ bool notif = false);
+
+ virtual ~Engines_Parallel_Component_i();
+
+ // --- CORBA methods
+
+ char* instanceName();
+ char* interfaceName();
+
+ void ping();
+ void destroy();
+
+ CORBA::Long getStudyId();
+ Engines::Container_ptr GetContainerRef();
+
+ void setProperties(const Engines::FieldsDict& dico);
+ Engines::FieldsDict* getProperties();
+
+ void Names( const char * graphName , const char * nodeName ) ;
+ bool Kill_impl();
+ bool Stop_impl();
+ bool Suspend_impl();
+ bool Resume_impl();
+ CORBA::Long CpuUsed_impl() ;
+
+ virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
+ CORBA::Boolean isPublished,
+ CORBA::Boolean& isValidScript);
+
+
+ // --- local C++ methods
+
+ PortableServer::ObjectId * getId();
+ Engines_Parallel_Container_i *GetContainerPtr();
+
+ bool setStudyId(CORBA::Long studyId);
+ static bool isMultiStudy();
+ static bool isMultiInstance();
+ static std::string GetDynLibraryName(const char *componentName);
+
+ void beginService(const char *serviceName);
+ void endService(const char *serviceName);
+ void sendMessage(const char *event_type, const char *message);
+ char * graphName() ;
+ char * nodeName() ;
+ bool Killer( pthread_t ThreadId , int signum );
+ void SetCurCpu() ;
+ long CpuUsed() ;
+
+protected:
+ int _studyId; // -1: not initialised; 0: multiStudy; >0: study
+ static bool _isMultiStudy;
+ static bool _isMultiInstance;
+
+ std::string _instanceName ;
+ std::string _interfaceName ;
+
+ CORBA::ORB_ptr _orb;
+ PortableServer::POA_ptr _poa;
+ PortableServer::ObjectId * _id;
+ PortableServer::ObjectId * _contId;
+ Engines_Parallel_Component_i * _thisObj ;
+ RegistryConnexion *_myConnexionToRegistry;
+ NOTIFICATION_Supplier* _notifSupplier;
+ std::map<std::string,CORBA::Any>_fieldsDict;
+
+ std::string _serviceName ;
+ std::string _graphName ;
+ std::string _nodeName ;
+
+private:
+#ifndef WNT
+ pthread_t _ThreadId ;
+#else
+ pthread_t* _ThreadId ;
+#endif
+ long _StartUsed ;
+ long _ThreadCpuUsed ;
+ bool _Executed ;
+};
+
+#endif
--- /dev/null
+// SALOME ParallelContainerNodeDummy : launcher of a PaCO++ object
+//
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SALOME_ParallelContainerNodeDummy.cxx
+// Author : André Ribes, EDF
+// Module : SALOME PARALLEL
+
+#include <iostream>
+#include <string>
+#include <stdio.h>
+
+#ifndef WNT
+#include <unistd.h>
+#else
+#include <process.h>
+#endif
+
+#include "SALOME_ParallelContainer_i.hxx"
+
+#include <paco_omni.h>
+#include <paco_dummy.h>
+
+#include "SALOME_NamingService.hxx"
+
+#include "utilities.h"
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
+#include "SALOMETraceCollector.hxx"
+#include "OpUtil.hxx"
+
+using namespace std;
+
+#ifdef DEBUG_PARALLEL
+#include <signal.h>
+
+void handler(int t) {
+ cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
+ cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
+ cerr << "SIGSEGV in :" << getpid() << endl;
+ cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
+ cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
+ while (1) {}
+}
+#endif
+
+int main(int argc, char* argv[])
+{
+ INFOS("Launching a parallel container node");
+
+#ifdef DEBUG_PARALLEL
+ signal(SIGSEGV, handler);
+#endif
+
+ // Initialise the ORB.
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
+ CORBA::ORB_var orb = init(0, 0);
+ //CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+
+ char * containerName = "";
+ if(argc > 1) {
+ containerName = argv[1];
+ }
+
+ char * hostname = "";
+ if(argc > 3) {
+ hostname = argv[3];
+ }
+
+ try {
+ CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
+ PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
+ PortableServer::POAManager_var pman = root_poa->the_POAManager();
+
+#ifndef WNT
+ // add this container to the kill list
+ char aCommand[100];
+ sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerNode", getpid());
+ system(aCommand);
+#endif
+
+ SALOME_NamingService * ns = new SALOME_NamingService(CORBA::ORB::_duplicate(orb));
+ // Get the proxy
+ string proxyNameInNS = ns->BuildContainerNameForNS(containerName, hostname);
+ obj = ns->Resolve(proxyNameInNS.c_str());
+ char * proxy_ior = orb->object_to_string(obj);
+
+ // Creating a node
+ string name(containerName);
+ string node_name = name + "Node";
+ Engines_Parallel_Container_i * servant = new Engines_Parallel_Container_i(CORBA::ORB::_duplicate(orb), proxy_ior,
+ root_poa,
+ (char*) node_name.c_str(),
+ argc, argv);
+ // PaCO++ init
+ paco_fabrique_manager * pfm = paco_getFabriqueManager();
+ pfm->register_com("dummy", new paco_dummy_fabrique());
+ pfm->register_thread("omni", new paco_omni_fabrique());
+
+ // Global context
+ PaCO_operation * global_ptr = servant->getContext("global_paco_context");
+ global_ptr->setLibCom("dummy",NULL);
+ global_ptr->setLibThread("omni");
+
+ // Activation
+ PortableServer::ObjectId * _id = root_poa->activate_object(servant);
+ servant->set_id(_id);
+ obj = root_poa->id_to_reference(*_id);
+
+ // In the NamingService
+ string hostname = GetHostname();
+ int myid = 0;
+ char buffer [5];
+ snprintf(buffer, 5, "%d", myid);
+ node_name = node_name + buffer;
+ string _containerName = ns->BuildContainerNameForNS((char*) node_name.c_str(),
+ hostname.c_str());
+ cerr << "---------" << _containerName << "----------" << endl;
+ ns->Register(obj, _containerName.c_str());
+ pman->activate();
+ orb->run();
+ }
+ catch(CORBA::SystemException&)
+ {
+ INFOS("Caught CORBA::SystemException.");
+ }
+ catch(PortableServer::POA::ServantAlreadyActive&)
+ {
+ INFOS("Caught CORBA::ServantAlreadyActiveException");
+ }
+ catch(CORBA::Exception&)
+ {
+ INFOS("Caught CORBA::Exception.");
+ }
+ catch(std::exception& exc)
+ {
+ INFOS("Caught std::exception - "<<exc.what());
+ }
+ catch(...)
+ {
+ INFOS("Caught unknown exception.");
+ }
+ return 0 ;
+}
+
--- /dev/null
+// SALOME ParallelContainerNodeMpi : Launch mpi PaCO++ object nodes
+//
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SALOME_ParallelContainerNodeMpi.cxx
+// Author : André Ribes, EDF
+// Module : SALOME PARALLEL
+
+#include <iostream>
+#include <string>
+#include <stdio.h>
+
+#ifndef WNT
+#include <unistd.h>
+#else
+#include <process.h>
+#endif
+
+#include "SALOME_ParallelContainer_i.hxx"
+
+// PaCO++ include
+#include <paco_omni.h>
+#include <paco_mpi.h>
+
+#include <mpi.h>
+
+#include "SALOME_NamingService.hxx"
+
+#include "utilities.h"
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
+#include "SALOMETraceCollector.hxx"
+#include "OpUtil.hxx"
+
+using namespace std;
+
+#ifdef DEBUG_PARALLEL
+#include <signal.h>
+
+void handler(int t) {
+ cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
+ cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
+ cerr << "SIGSEGV in :" << getpid() << endl;
+ cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
+ cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
+ while (1) {}
+}
+#endif
+
+int main(int argc, char* argv[])
+{
+ INFOS("Launching a parallel Mpi container node");
+
+#ifdef DEBUG_PARALLEL
+ signal(SIGSEGV, handler);
+#endif
+
+ // MPI Init
+ int provided;
+ MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE ,&provided);
+
+#ifdef DEBUG_PARALLEL
+ cerr << "Level MPI_THREAD_SINGLE : " << MPI_THREAD_SINGLE << endl;
+ cerr << "Level MPI_THREAD_SERIALIZED : " << MPI_THREAD_SERIALIZED << endl;
+ cerr << "Level MPI_THREAD_FUNNELED : " << MPI_THREAD_FUNNELED << endl;
+ cerr << "Level MPI_THREAD_MULTIPLE : " << MPI_THREAD_MULTIPLE << endl;
+ cerr << "Level provided : " << provided << endl;
+#endif
+ // Initialise the ORB.
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
+ CORBA::ORB_var orb = init(0, 0);
+ //CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+
+ // Code pour choisir le reseau infiniband .....
+/* string hostname_temp = GetHostname();
+ hostent * t = gethostbyname(hostname_temp.c_str());
+ cerr << " AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA " << t->h_addr << " " << hostname_temp << endl;
+ cerr << t->h_addr << endl;
+ in_addr * address=(in_addr * ) t->h_addr;
+ cerr << inet_ntoa(* address) << endl;
+ string ip = inet_ntoa(* address);
+ cerr << " AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA " << endl;
+ string com = "giop:tcp:" + ip + ":";
+ const char* options[][2] = { { "endPoint", com.c_str() }, { 0, 0 } };
+ CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB4", options);
+*/
+ char * containerName = "";
+ if(argc > 1) {
+ containerName = argv[1];
+ }
+
+ char * hostname = "";
+ if(argc > 3) {
+ hostname = argv[3];
+ }
+
+ try {
+ CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
+ PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
+ PortableServer::POAManager_var pman = root_poa->the_POAManager();
+
+#ifndef WNT
+ // add this container to the kill list
+ char aCommand[100];
+ sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerNodeMpi", getpid());
+ system(aCommand);
+#endif
+
+ SALOME_NamingService * ns = new SALOME_NamingService(CORBA::ORB::_duplicate(orb));
+ // On récupère le proxy
+ string proxyNameInNS = ns->BuildContainerNameForNS(containerName, hostname);
+ obj = ns->Resolve(proxyNameInNS.c_str());
+ char * proxy_ior = orb->object_to_string(obj);
+
+ // Node creation
+ string name(containerName);
+ string node_name = name + "Node";
+ Engines_Parallel_Container_i * servant = new Engines_Parallel_Container_i(CORBA::ORB::_duplicate(orb), proxy_ior,
+ root_poa,
+ (char*) node_name.c_str(),
+ argc, argv);
+ // PaCO++ init
+ paco_fabrique_manager * pfm = paco_getFabriqueManager();
+ pfm->register_com("mpi", new paco_mpi_fabrique());
+ pfm->register_thread("omni", new paco_omni_fabrique());
+
+ // Global context
+ PaCO_operation * global_ptr = servant->getContext("global_paco_context");
+ MPI_Comm group = MPI_COMM_WORLD;
+ global_ptr->setLibCom("mpi", &group);
+ global_ptr->setLibThread("omni");
+
+ // Activation
+ PortableServer::ObjectId * _id = root_poa->activate_object(servant);
+ servant->set_id(_id);
+ obj = root_poa->id_to_reference(*_id);
+
+ // In the NamingService
+ string hostname = GetHostname();
+
+ int myid;
+ MPI_Comm_rank(MPI_COMM_WORLD, &myid);
+ char buffer [5];
+ snprintf(buffer, 5, "%d", myid);
+ node_name = node_name + buffer;
+ string _containerName = ns->BuildContainerNameForNS((char*) node_name.c_str(),
+ hostname.c_str());
+ cerr << "---------" << _containerName << "----------" << endl;
+ ns->Register(obj, _containerName.c_str());
+ pman->activate();
+ orb->run();
+ }
+ catch(CORBA::SystemException&)
+ {
+ INFOS("Caught CORBA::SystemException.");
+ }
+ catch(PortableServer::POA::ServantAlreadyActive&)
+ {
+ INFOS("Caught CORBA::ServantAlreadyActiveException");
+ }
+ catch(CORBA::Exception&)
+ {
+ INFOS("Caught CORBA::Exception.");
+ }
+ catch(std::exception& exc)
+ {
+ INFOS("Caught std::exception - "<<exc.what());
+ }
+ catch(...)
+ {
+ INFOS("Caught unknown exception.");
+ }
+
+ MPI_Finalize();
+
+ return 0 ;
+}
+
--- /dev/null
+// SALOME ParallelContainerProxyDummy : Proxy of a PaCO++ object using Dummy
+//
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SALOME_ParallelContainerProxyDummy.cxx
+// Author : André Ribes, EDF
+// Module : SALOME PARALLEL
+
+#include <iostream>
+#include <string>
+#include <stdio.h>
+
+#ifndef WNT
+#include <unistd.h>
+#else
+#include <process.h>
+#endif
+
+// PaCO++ include
+#include "SALOME_ComponentPaCO_Engines_Container_server.h"
+#include <paco_omni.h>
+#include <paco_dummy.h>
+
+#include "SALOME_NamingService.hxx"
+
+#include "utilities.h"
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
+#include "SALOMETraceCollector.hxx"
+#include "OpUtil.hxx"
+
+#ifdef DEBUG_PARALLEL
+#include <signal.h>
+using namespace std;
+
+void handler(int t) {
+ cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
+ cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
+ cerr << "SIGSEGV in :" << getpid() << endl;
+ cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
+ cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
+ while (1) {}
+}
+#endif
+
+int main(int argc, char* argv[])
+{
+ INFOS("Launching a parallel proxy container");
+
+#ifdef DEBUG_PARALLEL
+ signal(SIGSEGV, handler);
+#endif
+
+ // Initialise the ORB.
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
+ CORBA::ORB_var orb = init(0, 0);
+ //CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+
+ char *containerName = "";
+ if(argc > 1) {
+ containerName = argv[1];
+ }
+
+ try {
+ CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
+ ASSERT(!CORBA::is_nil(obj));
+ PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
+ PortableServer::POAManager_var pman = root_poa->the_POAManager();
+
+#ifndef WNT
+ // add this container to the kill list
+ char aCommand[100];
+ sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerProxy", getpid());
+ system(aCommand);
+#endif
+
+ SALOME_NamingService * ns = new SALOME_NamingService(CORBA::ORB::_duplicate(orb));
+ Engines::Container_proxy_impl * proxy = new Engines::Container_proxy_impl(CORBA::ORB::_duplicate(orb));
+
+ // PaCO++ code
+ paco_fabrique_manager* pfm = paco_getFabriqueManager();
+ // Global context
+ PaCO_operation * global_ptr = proxy->getContext("global_paco_context");
+ pfm->register_com("dummy", new paco_dummy_fabrique());
+ global_ptr->setLibCom("dummy", NULL);
+ pfm->register_thread("omnithread", new paco_omni_fabrique());
+ global_ptr->setLibThread("omnithread");
+ global_ptr->setTypeClient(true);
+ // The proxy is a PaCO++ client
+ PaCO::PacoTopology_t client_topo;
+ client_topo.total = 1;
+ global_ptr->setClientTopo(client_topo);
+ // Topo of the parallel object
+ PaCO::PacoTopology_t serveur_topo;
+ serveur_topo.total = 1;
+ proxy->setTopo(serveur_topo);
+
+ PortableServer::ObjectId_var _id = root_poa->activate_object(proxy);
+ obj = root_poa->id_to_reference(_id);
+
+ // In the NamingService
+ string hostname = GetHostname();
+ Engines::Container_var pCont = Engines::Container::_narrow(obj);
+ string _containerName = ns->BuildContainerNameForNS(containerName,
+ hostname.c_str());
+ cerr << "---------" << _containerName << "----------" << endl;
+ ns->Register(pCont, _containerName.c_str());
+ pman->activate();
+ orb->run();
+ }
+ catch(CORBA::SystemException&)
+ {
+ INFOS("Caught CORBA::SystemException.");
+ }
+ catch(PortableServer::POA::ServantAlreadyActive&)
+ {
+ INFOS("Caught CORBA::ServantAlreadyActiveException");
+ }
+ catch(CORBA::Exception&)
+ {
+ INFOS("Caught CORBA::Exception.");
+ }
+ catch(std::exception& exc)
+ {
+ INFOS("Caught std::exception - "<<exc.what());
+ }
+ catch(...)
+ {
+ INFOS("Caught unknown exception.");
+ }
+ return 0 ;
+}
+
--- /dev/null
+// SALOME ParallelContainerProxyMpi : Launching the proxy of a MPI PaCO++ object
+//
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SALOME_ParallelContainerProxyMpi.cxx
+// Author : André Ribes, EDF
+// Module : SALOME PARALLEL
+
+#include <iostream>
+#include <string>
+#include <stdio.h>
+
+#ifndef WNT
+#include <unistd.h>
+#else
+#include <process.h>
+#endif
+
+#include "SALOME_ComponentPaCO_Engines_Container_server.h"
+#include <paco_omni.h>
+#include <paco_mpi.h>
+
+#include <mpi.h>
+
+#include "SALOME_NamingService.hxx"
+
+#include "utilities.h"
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
+#include "SALOMETraceCollector.hxx"
+#include "OpUtil.hxx"
+using namespace std;
+
+#ifdef DEBUG_PARALLEL
+#include <signal.h>
+
+void handler(int t) {
+ cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
+ cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
+ cerr << "SIGSEGV in :" << getpid() << endl;
+ cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
+ cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
+ while (1) {}
+}
+#endif
+
+int main(int argc, char* argv[])
+{
+ INFOS("Launching a parallel Mpi proxy container");
+
+#ifdef DEBUG_PARALLEL
+ signal(SIGSEGV, handler);
+#endif
+
+ // MPI Init
+ int provided;
+ MPI_Init_thread(&argc, &argv, MPI_THREAD_SERIALIZED ,&provided);
+
+ // Initialise the ORB.
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
+ CORBA::ORB_var orb = init(0, 0);
+ //CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+
+ char *containerName = "";
+ if(argc > 1) {
+ containerName = argv[1];
+ }
+
+ char * nb_nodes = "";
+ if(argc > 2) {
+ nb_nodes = argv[2];
+ }
+
+ try {
+ CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
+ ASSERT(!CORBA::is_nil(obj));
+ PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
+ PortableServer::POAManager_var pman = root_poa->the_POAManager();
+
+#ifndef WNT
+ // add this container to the kill list
+ char aCommand[100];
+ sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerProxyMpi", getpid());
+ system(aCommand);
+#endif
+
+ SALOME_NamingService * ns = new SALOME_NamingService(CORBA::ORB::_duplicate(orb));
+ Engines::Container_proxy_impl * proxy = new Engines::Container_proxy_impl(CORBA::ORB::_duplicate(orb));
+
+ // PaCO++ code
+ paco_fabrique_manager* pfm = paco_getFabriqueManager();
+ // Global context
+ PaCO_operation * global_ptr = proxy->getContext("global_paco_context");
+ pfm->register_com("mpi", new paco_mpi_fabrique());
+ MPI_Comm group = MPI_COMM_WORLD;
+ global_ptr->setLibCom("mpi", &group);
+ pfm->register_thread("omnithread", new paco_omni_fabrique());
+ global_ptr->setLibThread("omnithread");
+ global_ptr->setTypeClient(true);
+ PaCO::PacoTopology_t client_topo;
+ client_topo.total = 1;
+ global_ptr->setClientTopo(client_topo);
+ PaCO::PacoTopology_t serveur_topo;
+ serveur_topo.total = atoi(nb_nodes);
+ proxy->setTopo(serveur_topo);
+
+ // Activation
+ PortableServer::ObjectId_var _id = root_poa->activate_object(proxy);
+ obj = root_poa->id_to_reference(_id);
+
+ // in the NamingService
+ string hostname = GetHostname();
+ Engines::Container_var pCont = Engines::Container::_narrow(obj);
+ string _containerName = ns->BuildContainerNameForNS(containerName,
+ hostname.c_str());
+ cerr << "---------" << _containerName << "----------" << endl;
+ ns->Register(pCont, _containerName.c_str());
+ pman->activate();
+ orb->run();
+ }
+ catch(CORBA::SystemException&)
+ {
+ INFOS("Caught CORBA::SystemException.");
+ }
+ catch(PortableServer::POA::ServantAlreadyActive&)
+ {
+ INFOS("Caught CORBA::ServantAlreadyActiveException");
+ }
+ catch(CORBA::Exception&)
+ {
+ INFOS("Caught CORBA::Exception.");
+ }
+ catch(std::exception& exc)
+ {
+ INFOS("Caught std::exception - "<<exc.what());
+ }
+ catch(...)
+ {
+ INFOS("Caught unknown exception.");
+ }
+
+ MPI_Finalize();
+
+ return 0 ;
+}
+
--- /dev/null
+// SALOME_ParallelContainer : implementation of container and engine for ParallelKernel
+//
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+// File : SALOME_ParallelContainer_i.cxx
+// Author : André RIBES, EDF
+// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
+
+#include <SALOMEconfig.h>
+#ifndef WNT
+#else
+#include <SALOME_Component.hxx>
+#endif
+#include "SALOME_ParallelContainer_i.hxx"
+
+#include "SALOME_Component_i.hxx"
+
+#include "SALOME_FileRef_i.hxx"
+#include "SALOME_FileTransfer_i.hxx"
+#include "SALOME_NamingService.hxx"
+#include "OpUtil.hxx"
+
+#include "OpUtil.hxx"
+#include <string.h>
+#include <stdio.h>
+#ifndef WNT
+#include <dlfcn.h>
+#include <unistd.h>
+#else
+#include "../../adm/win32/SALOME_WNT.hxx"
+#include <signal.h>
+#include <process.h>
+int SIGUSR1 = 1000;
+#endif
+
+#include "utilities.h"
+using namespace std;
+
+bool _Sleeping = false ;
+
+// Containers with name FactoryServer are started via rsh in LifeCycleCORBA
+// Other Containers are started via start_impl of FactoryServer
+
+extern "C" {void ActSigIntHandler() ; }
+#ifndef WNT
+extern "C" {void SigIntHandler(int, siginfo_t *, void *) ; }
+#else
+extern "C" {void SigIntHandler( int ) ; }
+#endif
+
+
+map<std::string, int> Engines_Parallel_Container_i::_cntInstances_map;
+map<std::string, void *> Engines_Parallel_Container_i::_library_map;
+map<std::string, void *> Engines_Parallel_Container_i::_toRemove_map;
+omni_mutex Engines_Parallel_Container_i::_numInstanceMutex ;
+
+//=============================================================================
+/*!
+ * Default constructor, not for use
+ */
+//=============================================================================
+
+Engines_Parallel_Container_i::Engines_Parallel_Container_i (CORBA::ORB_ptr orb, char * ior) :
+ InterfaceParallel_impl(orb,ior), Engines::Container_serv(orb,ior),
+ _numInstance(0)
+{
+}
+
+//=============================================================================
+/*!
+ * Construtor to use
+ */
+//=============================================================================
+
+Engines_Parallel_Container_i::Engines_Parallel_Container_i (CORBA::ORB_ptr orb, char * ior,
+ PortableServer::POA_ptr poa,
+ char *containerName ,
+ int argc , char* argv[],
+ bool activAndRegist,
+ bool isServantAloneInProcess
+ ) :
+ InterfaceParallel_impl(orb,ior), Engines::Container_serv(orb,ior),
+ _numInstance(0),_isServantAloneInProcess(isServantAloneInProcess)
+{
+ _pid = (long)getpid();
+
+ if(activAndRegist)
+ ActSigIntHandler() ;
+
+ _argc = argc ;
+ _argv = argv ;
+
+ string hostname = GetHostname();
+
+ _orb = CORBA::ORB::_duplicate(orb) ;
+ _poa = PortableServer::POA::_duplicate(poa) ;
+ _NS = new SALOME_NamingService();
+ _NS->init_orb( CORBA::ORB::_duplicate(_orb) );
+ _containerName = _NS->BuildContainerNameForNS(containerName, hostname.c_str());
+
+ fileTransfer_i* aFileTransfer = new fileTransfer_i();
+ _fileTransfer = Engines::fileTransfer::_narrow(aFileTransfer->_this());
+}
+
+//=============================================================================
+/*!
+ * Destructor
+ */
+//=============================================================================
+
+Engines_Parallel_Container_i::~Engines_Parallel_Container_i()
+{
+ MESSAGE("Container_i::~Container_i()");
+ delete _id;
+}
+
+//=============================================================================
+/*!
+ * CORBA attribute: Container name (see constructor)
+ */
+//=============================================================================
+
+char* Engines_Parallel_Container_i::name()
+{
+ return CORBA::string_dup(_containerName.c_str()) ;
+}
+
+//=============================================================================
+/*!
+ * CORBA method: Get the hostName of the Container (without domain extensions)
+ */
+//=============================================================================
+
+char* Engines_Parallel_Container_i::getHostName()
+{
+ string s = GetHostname();
+ MESSAGE("Engines_Parallel_Container_i::getHostName " << s);
+ return CORBA::string_dup(s.c_str()) ;
+}
+
+//=============================================================================
+/*!
+ * CORBA method: Get the PID (process identification) of the Container
+ */
+//=============================================================================
+
+CORBA::Long Engines_Parallel_Container_i::getPID()
+{
+ return (CORBA::Long)getpid();
+}
+
+//=============================================================================
+/*!
+ * CORBA method: check if servant is still alive
+ */
+//=============================================================================
+
+void Engines_Parallel_Container_i::ping()
+{
+ MESSAGE("Engines_Parallel_Container_i::ping() pid "<< getpid());
+}
+
+//=============================================================================
+/*!
+ * CORBA method, oneway: Server shutdown.
+ * - Container name removed from naming service,
+ * - servant deactivation,
+ * - orb shutdown if no other servants in the process
+ */
+//=============================================================================
+
+void Engines_Parallel_Container_i::Shutdown()
+{
+ MESSAGE("Engines_Parallel_Container_i::Shutdown()");
+ _NS->Destroy_FullDirectory(_containerName.c_str());
+ //_remove_ref();
+ //_poa->deactivate_object(*_id);
+ if(_isServantAloneInProcess)
+ {
+ MESSAGE("Effective Shutdown of container Begins...");
+ LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
+ bp1->deleteInstance(bp1);
+ _orb->shutdown(0);
+ }
+}
+
+
+//=============================================================================
+/*!
+ * CORBA method: load a new component class (Python or C++ implementation)
+ * \param componentName like COMPONENT
+ * try to make a Python import of COMPONENT,
+ * then a lib open of libCOMPONENTEngine.so
+ * \return true if dlopen successfull or already done, false otherwise
+ */
+//=============================================================================
+
+bool
+Engines_Parallel_Container_i::load_component_Library(const char* componentName)
+{
+ bool ret = false;
+ string aCompName = componentName;
+ // --- try dlopen C++ component
+
+#ifndef WNT
+ string impl_name = string ("lib") + aCompName + string("Engine.so");
+#else
+ string impl_name = aCompName + string("Engine.dll");
+#endif
+
+ SCRUTE(impl_name);
+
+ _numInstanceMutex.lock(); // lock to be alone
+ if (_toRemove_map[impl_name]) _toRemove_map.erase(impl_name);
+ if (_library_map[impl_name])
+ {
+ MESSAGE("Library " << impl_name << " already loaded");
+ _numInstanceMutex.unlock();
+ ret = true;
+ }
+
+ void* handle;
+#ifndef WNT
+ handle = dlopen( impl_name.c_str() , RTLD_LAZY ) ;
+#else
+ handle = dlopen( impl_name.c_str() , 0 ) ;
+#endif
+ if ( handle )
+ {
+ _library_map[impl_name] = handle;
+ _numInstanceMutex.unlock();
+ ret = true;
+ }
+ else
+ {
+ cerr << "Can't load shared library : " << impl_name << endl;
+ cerr << "error dlopen: " << dlerror() << endl;
+ _numInstanceMutex.unlock();
+ ret = false;
+ }
+
+ // To be sure that all the nodes of the component as loaded the library
+ global_paco_context_ptr->my_com->paco_barrier();
+
+ return ret;
+}
+
+//=============================================================================
+/*!
+ * CORBA method: Creates a new servant instance of a component.
+ * The servant registers itself to naming service and Registry.
+ * \param genericRegisterName Name of the component instance to register
+ * in Registry & Name Service (without _inst_n suffix)
+ * \param studyId 0 for multiStudy instance,
+ * study Id (>0) otherwise
+ * \return a loaded component
+ */
+//=============================================================================
+
+Engines::Component_ptr
+Engines_Parallel_Container_i::create_component_instance(const char*genericRegisterName,
+ CORBA::Long studyId)
+{
+ cerr << "----------------- create_component_instance node : " << getMyRank() << endl;
+
+ if (studyId < 0)
+ {
+ INFOS("studyId must be > 0 for mono study instance, =0 for multiStudy");
+ return Engines::Component::_nil() ;
+ }
+
+ Engines::Component_var iobject = Engines::Component::_nil() ;
+
+ // is it a parallel component ?
+ bool parallel = false;
+ string aCompName = genericRegisterName;
+ int par = aCompName.find("@PARALLEL@");
+ if (par>0) {
+ parallel = true;
+ aCompName = aCompName.substr(0,par);
+ }
+
+ //--- try C++
+#ifndef WNT
+ string impl_name = string ("lib") + aCompName +string("Engine.so");
+#else
+ string impl_name = aCompName +string("Engine.dll");
+#endif
+ void* handle = _library_map[impl_name];
+
+ if ( !handle )
+ {
+ cerr << "shared library " << impl_name <<"must be loaded before instance" << endl;;
+ return Engines::Component::_nil() ;
+ }
+ else
+ {
+ if (parallel) {
+ // Sequential component case
+ // Component parallel proxy created on node 0
+ iobject = createParallelInstance(aCompName,
+ handle,
+ studyId);
+
+ }
+ else {
+ // Sequential component case
+ iobject = createInstance(aCompName,
+ handle,
+ studyId);
+ }
+
+ return iobject._retn();
+ }
+}
+
+//=============================================================================
+/*!
+ * CORBA method: Finds a servant instance of a component
+ * \param registeredName Name of the component in Registry or Name Service,
+ * without instance suffix number
+ * \param studyId 0 if instance is not associated to a study,
+ * >0 otherwise (== study id)
+ * \return the first instance found with same studyId
+ */
+//=============================================================================
+
+Engines::Component_ptr Engines_Parallel_Container_i::find_component_instance( const char* registeredName,
+ CORBA::Long studyId)
+{
+ Engines::Component_var anEngine = Engines::Component::_nil();
+ map<string,Engines::Component_var>::iterator itm =_listInstances_map.begin();
+ while (itm != _listInstances_map.end())
+ {
+ string instance = (*itm).first;
+ SCRUTE(instance);
+ if (instance.find(registeredName) == 0)
+ {
+ anEngine = (*itm).second;
+ if (studyId == anEngine->getStudyId())
+ {
+ return anEngine._retn();
+ }
+ }
+ itm++;
+ }
+ return anEngine._retn();
+}
+
+//=============================================================================
+/*!
+ * CORBA method: find or create an instance of the component (servant),
+ * load a new component class (dynamic library) if required,
+ * ---- FOR COMPATIBILITY WITH 2.2 ----
+ * ---- USE ONLY FOR MULTISTUDY INSTANCES ! --------
+ * The servant registers itself to naming service and Registry.
+ * \param genericRegisterName Name of the component to register
+ * in Registry & Name Service
+ * \param componentName Name of the constructed library of the component
+ * \return a loaded component
+ */
+//=============================================================================
+
+Engines::Component_ptr Engines_Parallel_Container_i::load_impl( const char* genericRegisterName,
+ const char* componentName )
+{
+ string impl_name = string ("lib") + genericRegisterName +string("Engine.so");
+ Engines::Component_var iobject = Engines::Component::_nil() ;
+ if (load_component_Library(genericRegisterName))
+ iobject = find_or_create_instance(genericRegisterName, impl_name);
+ return iobject._retn();
+}
+
+
+//=============================================================================
+/*!
+ * CORBA method: Stops the component servant, and deletes all related objects
+ * \param component_i Component to be removed
+ */
+//=============================================================================
+
+void Engines_Parallel_Container_i::remove_impl(Engines::Component_ptr component_i)
+{
+ ASSERT(! CORBA::is_nil(component_i));
+ string instanceName = component_i->instanceName() ;
+ MESSAGE("unload component " << instanceName);
+ _listInstances_map.erase(instanceName);
+ component_i->destroy() ;
+ _NS->Destroy_Name(instanceName.c_str());
+}
+
+//=============================================================================
+/*!
+ * CORBA method: Discharges unused libraries from the container.
+ */
+//=============================================================================
+
+void Engines_Parallel_Container_i::finalize_removal()
+{
+ MESSAGE("finalize unload : dlclose");
+ _numInstanceMutex.lock(); // lock to be alone
+ // (see decInstanceCnt, load_component_Library)
+ map<string, void *>::iterator ith;
+ for (ith = _toRemove_map.begin(); ith != _toRemove_map.end(); ith++)
+ {
+ void *handle = (*ith).second;
+ string impl_name= (*ith).first;
+ if (handle)
+ {
+ SCRUTE(handle);
+ SCRUTE(impl_name);
+ // dlclose(handle); // SALOME unstable after ...
+ // _library_map.erase(impl_name);
+ }
+ }
+ _toRemove_map.clear();
+ _numInstanceMutex.unlock();
+}
+
+//=============================================================================
+/*!
+ * CORBA method: Kill the container process with exit(0).
+ * To remove : never returns !
+ */
+//=============================================================================
+
+bool Engines_Parallel_Container_i::Kill_impl()
+{
+ MESSAGE("Engines_Parallel_Container_i::Kill() pid "<< getpid() << " containerName "
+ << _containerName.c_str() << " machineName "
+ << GetHostname().c_str());
+ INFOS("===============================================================");
+ INFOS("= REMOVE calls to Kill_impl in C++ container =");
+ INFOS("===============================================================");
+ //exit( 0 ) ;
+ ASSERT(0);
+ return false;
+}
+
+//=============================================================================
+/*!
+ * C++ method: Finds an already existing servant instance of a component, or
+ * create an instance.
+ * ---- USE ONLY FOR MULTISTUDY INSTANCES ! --------
+ * \param genericRegisterName Name of the component instance to register
+ * in Registry & Name Service,
+ * (without _inst_n suffix, like "COMPONENT")
+ * \param componentLibraryName like "libCOMPONENTEngine.so"
+ * \return a loaded component
+ *
+ * example with names:
+ * aGenRegisterName = COMPONENT (= first argument)
+ * impl_name = libCOMPONENTEngine.so (= second argument)
+ * _containerName = /Containers/cli76ce/FactoryServer
+ * factoryName = COMPONENTEngine_factory
+ * component_registerBase = /Containers/cli76ce/FactoryServer/COMPONENT
+ *
+ * instanceName = COMPONENT_inst_1
+ * component_registerName = /Containers/cli76ce/FactoryServer/COMPONENT_inst_1
+ */
+//=============================================================================
+
+Engines::Component_ptr
+Engines_Parallel_Container_i::find_or_create_instance(string genericRegisterName,
+ string componentLibraryName)
+{
+ string aGenRegisterName = genericRegisterName;
+ string impl_name = componentLibraryName;
+ void* handle = _library_map[impl_name];
+ if ( !handle )
+ {
+ INFOS("shared library " << impl_name <<"must be loaded before instance");
+ return Engines::Component::_nil() ;
+ }
+ else
+ {
+ // --- find a registered instance in naming service, or create
+
+ string component_registerBase =
+ _containerName + "/" + aGenRegisterName;
+ Engines::Component_var iobject = Engines::Component::_nil() ;
+ try
+ {
+ CORBA::Object_var obj =
+ _NS->ResolveFirst( component_registerBase.c_str());
+ if ( CORBA::is_nil( obj ) )
+ {
+ iobject = createInstance(genericRegisterName,
+ handle,
+ 0); // force multiStudy instance here !
+ }
+ else
+ {
+ iobject = Engines::Component::_narrow( obj ) ;
+ Engines_Component_i *servant =
+ dynamic_cast<Engines_Component_i*>
+ (_poa->reference_to_servant(iobject));
+ ASSERT(servant)
+ int studyId = servant->getStudyId();
+ ASSERT (studyId >= 0);
+ if (studyId == 0) // multiStudy instance, OK
+ {
+ // No ReBind !
+ MESSAGE(component_registerBase.c_str()<<" already bound");
+ }
+ else // monoStudy instance: NOK
+ {
+ iobject = Engines::Component::_nil();
+ INFOS("load_impl & find_component_instance methods "
+ << "NOT SUITABLE for mono study components");
+ }
+ }
+ }
+ catch (...)
+ {
+ INFOS( "Container_i::load_impl catched" ) ;
+ }
+ return iobject._retn();
+ }
+}
+
+//=============================================================================
+/*!
+ * C++ method: create a servant instance of a component.
+ * \param genericRegisterName Name of the component instance to register
+ * in Registry & Name Service,
+ * (without _inst_n suffix, like "COMPONENT")
+ * \param handle loaded library handle
+ * \param studyId 0 for multiStudy instance,
+ * study Id (>0) otherwise
+ * \return a loaded component
+ *
+ * example with names:
+ * aGenRegisterName = COMPONENT (= first argument)
+ * _containerName = /Containers/cli76ce/FactoryServer
+ * factoryName = COMPONENTEngine_factory
+ * component_registerBase = /Containers/cli76ce/FactoryServer/COMPONENT
+ * instanceName = COMPONENT_inst_1
+ * component_registerName = /Containers/cli76ce/FactoryServer/COMPONENT_inst_1
+ */
+//=============================================================================
+
+Engines::Component_ptr
+Engines_Parallel_Container_i::createInstance(string genericRegisterName,
+ void *handle,
+ int studyId)
+{
+ // --- find the factory
+
+ string aGenRegisterName = genericRegisterName;
+ string factory_name = aGenRegisterName + string("Engine_factory");
+
+ SCRUTE(factory_name) ;
+
+ typedef PortableServer::ObjectId * (*FACTORY_FUNCTION)
+ (CORBA::ORB_ptr,
+ PortableServer::POA_ptr,
+ PortableServer::ObjectId *,
+ const char *,
+ const char *) ;
+
+ FACTORY_FUNCTION Component_factory
+ = (FACTORY_FUNCTION) dlsym(handle, factory_name.c_str());
+
+ char *error ;
+ if ( (error = dlerror() ) != NULL)
+ {
+ INFOS("Can't resolve symbol: " + factory_name);
+ SCRUTE(error);
+ return Engines::Component::_nil() ;
+ }
+
+ // --- create instance
+ Engines::Component_var iobject = Engines::Component::_nil() ;
+ try
+ {
+ _numInstanceMutex.lock() ; // lock on the instance number
+ _numInstance++ ;
+ int numInstance = _numInstance ;
+ _numInstanceMutex.unlock() ;
+
+ char aNumI[12];
+ sprintf( aNumI , "%d" , numInstance ) ;
+ string instanceName = aGenRegisterName + "_inst_" + aNumI ;
+ string component_registerName =
+ _containerName + "/" + instanceName;
+
+ // --- Instanciate required CORBA object
+
+ PortableServer::ObjectId *id ; //not owner, do not delete (nore use var)
+ id = (Component_factory) ( _orb, _poa, _id, instanceName.c_str(),
+ aGenRegisterName.c_str() ) ;
+
+ // --- get reference & servant from id
+ CORBA::Object_var obj = _poa->id_to_reference(*id);
+ iobject = Engines::Component::_narrow(obj) ;
+
+ Engines_Component_i *servant =
+ dynamic_cast<Engines_Component_i*>(_poa->reference_to_servant(iobject));
+ ASSERT(servant);
+ servant->_remove_ref(); // compensate previous id_to_reference
+ _listInstances_map[instanceName] = iobject;
+ _cntInstances_map[aGenRegisterName] += 1;
+ bool ret_studyId = servant->setStudyId(studyId);
+ ASSERT(ret_studyId);
+
+ // --- register the engine under the name
+ // containerName(.dir)/instanceName(.object)
+ _NS->Register(iobject , component_registerName.c_str()) ;
+ MESSAGE( component_registerName.c_str() << " bound" ) ;
+ }
+ catch (...)
+ {
+ INFOS( "Container_i::createInstance exception catched" ) ;
+ }
+ return iobject._retn();
+}
+
+Engines::Component_ptr
+Engines_Parallel_Container_i::createParallelInstance(string genericRegisterName,
+ void *handle,
+ int studyId)
+{
+ cerr << "----------------- createParallelInstance node : " << getMyRank() << endl;
+ // --- create instance
+ Engines::Component_var iobject = Engines::Component::_nil();
+ string aGenRegisterName = genericRegisterName;
+
+ //////////////////////////////////////////////////////////////////////////
+ // 1: Proxy Step
+ // Node 0 create the proxy
+ if (getMyRank() == 0) {
+ // --- find the factory
+ string factory_name = aGenRegisterName + string("EngineProxy_factory");
+
+ typedef PortableServer::ObjectId * (*FACTORY_FUNCTION)
+ (CORBA::ORB_ptr,
+ PortableServer::POA_ptr,
+ PortableServer::ObjectId *,
+ const char *,
+ int) ;
+
+ FACTORY_FUNCTION Component_factory
+ = (FACTORY_FUNCTION) dlsym(handle, factory_name.c_str());
+
+ char *error ;
+ if ( (error = dlerror() ) != NULL) {
+ INFOS("Can't resolve symbol: " + factory_name);
+ SCRUTE(error);
+ return Engines::Component::_nil();
+ }
+ try {
+ _numInstanceMutex.lock() ; // lock on the instance number
+ _numInstance++ ;
+ int numInstance = _numInstance ;
+ _numInstanceMutex.unlock() ;
+
+ char aNumI[12];
+ sprintf( aNumI , "%d" , numInstance ) ;
+ string instanceName = aGenRegisterName + "_inst_" + aNumI ;
+ string component_registerName =
+ _containerName + "/" + instanceName;
+
+ // --- Instanciate required CORBA object
+ PortableServer::ObjectId *id ; //not owner, do not delete (nore use var)
+ id = (Component_factory) ( _orb, _poa, _id, instanceName.c_str(), getTotalNode()) ;
+
+ // --- get reference & servant from id
+ CORBA::Object_var obj = _poa->id_to_reference(*id);
+ iobject = Engines::Component::_narrow(obj) ;
+
+ _listInstances_map[instanceName] = iobject;
+ _cntInstances_map[aGenRegisterName] += 1;
+
+ // --- register the engine under the name
+ // containerName(.dir)/instanceName(.object)
+ _NS->Register(iobject , component_registerName.c_str()) ;
+ MESSAGE( component_registerName.c_str() << " bound" ) ;
+ }
+ catch (...)
+ {
+ INFOS( "Container_i::createParallelInstance exception catched in Proxy creation" ) ;
+ }
+ }
+ else {
+ // We have to have the same numIntance to be able to get the proxy reference
+ // in the nameing service.
+ _numInstanceMutex.lock() ; // lock on the instance number
+ _numInstance++ ;
+ int numInstance = _numInstance ;
+ _numInstanceMutex.unlock() ;
+ }
+ cerr << "Node " << getMyRank() << " entering in paco_barrier()" << endl;
+ global_paco_context_ptr->my_com->paco_barrier();
+ cerr << "Node " << getMyRank() << " quitting paco_barrier()" << endl;
+
+ //////////////////////////////////////////////////////////////////////////
+ // 2: Nodes Step
+
+ char * proxy_ior;
+ Engines::Component_PaCO_var iobject2;
+
+ char aNumI[12];
+ sprintf( aNumI , "%d" , _numInstance ) ;
+ string instanceName = aGenRegisterName + "_inst_" + aNumI ;
+
+ string component_registerName = _containerName + "/" + instanceName;
+ string hostname = GetHostname();
+
+ CORBA::Object_var temp = _NS->Resolve(component_registerName.c_str());
+ Engines::Component_var obj_proxy = Engines::Component::_narrow(temp);
+ proxy_ior = _orb->object_to_string(obj_proxy);
+
+ // --- find the factory
+ string factory_name = aGenRegisterName + string("Engine_factory");
+
+ typedef PortableServer::ObjectId * (*FACTORY_FUNCTION)
+ (CORBA::ORB_ptr, char * ior,
+ PortableServer::POA_ptr,
+ PortableServer::ObjectId *,
+ const char *,
+ const char *) ;
+
+ FACTORY_FUNCTION Component_factory
+ = (FACTORY_FUNCTION) dlsym(handle, factory_name.c_str());
+
+ char *error ;
+ if ( (error = dlerror() ) != NULL)
+ {
+ INFOS("Can't resolve symbol: " + factory_name);
+ SCRUTE(error);
+ return Engines::Component::_nil() ;
+ }
+ try
+ {
+ char aNumI2[12];
+ sprintf(aNumI2 , "%d" , getMyRank()) ;
+ string instanceName = aGenRegisterName + "_inst_node_" + aNumI2;
+ string component_registerName = _containerName + aNumI2 + "/" + instanceName;
+
+ // --- Instanciate required CORBA object
+
+ PortableServer::ObjectId *id ; //not owner, do not delete (nore use var)
+ id = (Component_factory) ( _orb, proxy_ior, _poa, _id, instanceName.c_str(),
+ aGenRegisterName.c_str() ) ;
+
+ // --- get reference & servant from id
+ CORBA::Object_var obj = _poa->id_to_reference(*id);
+ iobject2 = Engines::Component_PaCO::_narrow(obj) ;
+
+ // --- register the engine under the name
+ _NS->Register(iobject2 , component_registerName.c_str()) ;
+ MESSAGE( component_registerName.c_str() << " bound" ) ;
+ }
+ catch (...)
+ {
+ INFOS( "Container_i::createParallelInstance exception catched" ) ;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // 3: Deployment Step
+
+ iobject2->deploy(getMyRank());
+ global_paco_context_ptr->my_com->paco_barrier();
+ cerr << "--------- createParallelInstance : End Deploy step ----------" << endl;
+
+ // return obj_proxy._retn();
+ return iobject._retn();
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+void Engines_Parallel_Container_i::decInstanceCnt(string genericRegisterName)
+{
+ string aGenRegisterName =genericRegisterName;
+ MESSAGE("Engines_Parallel_Container_i::decInstanceCnt " << aGenRegisterName);
+ ASSERT(_cntInstances_map[aGenRegisterName] > 0);
+ _numInstanceMutex.lock(); // lock to be alone
+ // (see finalize_removal, load_component_Library)
+ _cntInstances_map[aGenRegisterName] -= 1;
+ SCRUTE(_cntInstances_map[aGenRegisterName]);
+ if (_cntInstances_map[aGenRegisterName] == 0)
+ {
+ string impl_name =
+ Engines_Component_i::GetDynLibraryName(aGenRegisterName.c_str());
+ SCRUTE(impl_name);
+ void* handle = _library_map[impl_name];
+ ASSERT(handle);
+ _toRemove_map[impl_name] = handle;
+ }
+ _numInstanceMutex.unlock();
+}
+
+//=============================================================================
+/*!
+ * Retrieves only with container naming convention if it is a python container
+ */
+//=============================================================================
+
+bool Engines_Parallel_Container_i::isPythonContainer(const char* ContainerName)
+{
+ bool ret=false;
+ int len=strlen(ContainerName);
+ if(len>=2)
+ if(strcmp(ContainerName+len-2,"Py")==0)
+ ret=true;
+ return ret;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+void ActSigIntHandler()
+{
+#ifndef WNT
+ struct sigaction SigIntAct ;
+ SigIntAct.sa_sigaction = &SigIntHandler ;
+ SigIntAct.sa_flags = SA_SIGINFO ;
+#endif
+
+ // DEBUG 03.02.2005 : the first parameter of sigaction is not a mask of signals
+ // (SIGINT | SIGUSR1) :
+ // it must be only one signal ===> one call for SIGINT
+ // and an other one for SIGUSR1
+#ifndef WNT
+ if ( sigaction( SIGINT , &SigIntAct, NULL ) ) {
+ perror("SALOME_Container main ") ;
+ exit(0) ;
+ }
+ if ( sigaction( SIGUSR1 , &SigIntAct, NULL ) ) {
+ perror("SALOME_Container main ") ;
+ exit(0) ;
+ }
+ //PAL9042 JR : during the execution of a Signal Handler (and of methods called through Signal Handlers)
+ // use of streams (and so on) should never be used because :
+ // streams of C++ are naturally thread-safe and use pthread_mutex_lock ===>
+ // A stream operation may be interrupted by a signal and if the Handler use stream we
+ // may have a "Dead-Lock" ===HangUp
+ //==INFOS is commented
+ // INFOS(pthread_self() << "SigIntHandler activated") ;
+#else
+ signal( SIGINT, SigIntHandler );
+ signal( SIGUSR1, SigIntHandler );
+#endif
+
+}
+
+void SetCpuUsed() ;
+
+#ifndef WNT
+void SigIntHandler(int what , siginfo_t * siginfo ,
+ void * toto ) {
+ //PAL9042 JR : during the execution of a Signal Handler (and of methods called through Signal Handlers)
+ // use of streams (and so on) should never be used because :
+ // streams of C++ are naturally thread-safe and use pthread_mutex_lock ===>
+ // A stream operation may be interrupted by a signal and if the Handler use stream we
+ // may have a "Dead-Lock" ===HangUp
+ //==MESSAGE is commented
+ // MESSAGE(pthread_self() << "SigIntHandler what " << what << endl
+ // << " si_signo " << siginfo->si_signo << endl
+ // << " si_code " << siginfo->si_code << endl
+ // << " si_pid " << siginfo->si_pid) ;
+ if ( _Sleeping ) {
+ _Sleeping = false ;
+ // MESSAGE("SigIntHandler END sleeping.") ;
+ return ;
+ }
+ else {
+ ActSigIntHandler() ;
+ if ( siginfo->si_signo == SIGUSR1 ) {
+ SetCpuUsed() ;
+ }
+ else {
+ _Sleeping = true ;
+ // MESSAGE("SigIntHandler BEGIN sleeping.") ;
+ int count = 0 ;
+ while( _Sleeping ) {
+ sleep( 1 ) ;
+ count += 1 ;
+ }
+ // MESSAGE("SigIntHandler LEAVE sleeping after " << count << " s.") ;
+ }
+ return ;
+ }
+}
+#else // Case WNT
+void SigIntHandler( int what ) {
+ MESSAGE( pthread_self() << "SigIntHandler what " << what << endl );
+ if ( _Sleeping ) {
+ _Sleeping = false ;
+ MESSAGE("SigIntHandler END sleeping.") ;
+ return ;
+ }
+ else {
+ ActSigIntHandler() ;
+ if ( what == SIGUSR1 ) {
+ SetCpuUsed() ;
+ }
+ else {
+ _Sleeping = true ;
+ MESSAGE("SigIntHandler BEGIN sleeping.") ;
+ int count = 0 ;
+ while( _Sleeping ) {
+ Sleep( 1000 ) ;
+ count += 1 ;
+ }
+ MESSAGE("SigIntHandler LEAVE sleeping after " << count << " s.") ;
+ }
+ return ;
+ }
+}
+#endif
+
+//=============================================================================
+/*!
+ * CORBA method: get or create a fileRef object associated to a local file
+ * (a file on the computer on which runs the container server), which stores
+ * a list of (machine, localFileName) corresponding to copies already done.
+ *
+ * \param origFileName absolute path for a local file to copy on other
+ * computers
+ * \return a fileRef object associated to the file.
+ */
+//=============================================================================
+
+Engines::fileRef_ptr
+Engines_Parallel_Container_i::createFileRef(const char* origFileName)
+{
+ string origName(origFileName);
+ Engines::fileRef_var theFileRef = Engines::fileRef::_nil();
+
+ if (origName[0] != '/')
+ {
+ INFOS("path of file to copy must be an absolute path begining with '/'");
+ return Engines::fileRef::_nil();
+ }
+
+ if (CORBA::is_nil(_fileRef_map[origName]))
+ {
+ CORBA::Object_var obj=_poa->id_to_reference(*_id);
+ Engines::Container_var pCont = Engines::Container::_narrow(obj);
+ fileRef_i* aFileRef = new fileRef_i(pCont, origFileName);
+ theFileRef = Engines::fileRef::_narrow(aFileRef->_this());
+ _numInstanceMutex.lock() ; // lock to be alone (stl container write)
+ _fileRef_map[origName] = theFileRef;
+ _numInstanceMutex.unlock() ;
+ }
+
+ theFileRef = Engines::fileRef::_duplicate(_fileRef_map[origName]);
+ ASSERT(! CORBA::is_nil(theFileRef));
+ return theFileRef._retn();
+}
+
+//=============================================================================
+/*!
+ * CORBA method:
+ * \return a reference to the fileTransfer object
+ */
+//=============================================================================
+
+Engines::fileTransfer_ptr
+Engines_Parallel_Container_i::getFileTransfer()
+{
+ Engines::fileTransfer_var aFileTransfer
+ = Engines::fileTransfer::_duplicate(_fileTransfer);
+ return aFileTransfer._retn();
+}
+
+
+
--- /dev/null
+// SALOME_ParallelContainer : implementation of container and engine for Parallel Kernel
+//
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+// File : SALOME_ParallelContainer_i.hxx
+// Author : André RIBES, EDF
+// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
+
+#ifndef _SALOME_PARALLEL_CONTAINER_I_HXX_
+#define _SALOME_PARALLEL_CONTAINER_I_HXX_
+
+#include <SALOMEconfig.h>
+
+#include "SALOME_ComponentPaCO_Engines_Container_server.h"
+
+#include <iostream>
+#include <signal.h>
+#include <stdlib.h>
+#ifndef WNT
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#include <omnithread.h>
+#include <map>
+#include <string>
+
+class SALOME_NamingService;
+
+
+#if defined CONTAINER_EXPORTS
+#if defined WIN32
+#define CONTAINER_EXPORT __declspec( dllexport )
+#else
+#define CONTAINER_EXPORT
+#endif
+#else
+#if defined WNT
+#define CONTAINER_EXPORT __declspec( dllimport )
+#else
+#define CONTAINER_EXPORT
+#endif
+#endif
+
+class CONTAINER_EXPORT Engines_Parallel_Container_i:
+ /* public virtual POA_Engines::Container, */
+ public Engines::Container_serv,
+ public virtual PortableServer::RefCountServantBase
+{
+public:
+ Engines_Parallel_Container_i(CORBA::ORB_ptr orb, char * ior);
+ Engines_Parallel_Container_i(CORBA::ORB_ptr orb, char * ior,
+ PortableServer::POA_ptr poa,
+ char * containerName ,
+ int argc, char* argv[],
+ bool activAndRegist = true,
+ bool isServantAloneInProcess = true);
+ virtual ~Engines_Parallel_Container_i();
+
+ // --- CORBA methods
+
+ virtual bool load_component_Library(const char* componentName);
+
+ virtual Engines::Component_ptr
+ create_component_instance( const char* componentName,
+ CORBA::Long studyId); // 0 for multiStudy
+
+ Engines::Component_ptr
+ find_component_instance( const char* registeredName,
+ CORBA::Long studyId); // 0 for multiStudy
+
+ Engines::Component_ptr
+ load_impl(const char* nameToRegister,
+ const char* componentName);
+
+
+ void remove_impl(Engines::Component_ptr component_i);
+ void finalize_removal();
+
+ virtual void ping();
+ char* name();
+ virtual void Shutdown();
+ char* getHostName();
+ CORBA::Long getPID();
+ //! Kill current container
+ bool Kill_impl() ;
+
+ // --- local C++ methods
+
+ Engines::Component_ptr
+ find_or_create_instance( std::string genericRegisterName,
+ std::string componentLibraryName);
+
+ Engines::Component_ptr
+ createInstance(std::string genericRegisterName,
+ void *handle,
+ int studyId);
+
+ Engines::Component_ptr
+ createParallelInstance(std::string genericRegisterName,
+ void *handle,
+ int studyId);
+
+ static bool isPythonContainer(const char* ContainerName);
+ static void decInstanceCnt(std::string genericRegisterName);
+
+ // --- needed for parallel components, Numerical Platon
+
+ int getArgc() { return _argc; }
+ char **getArgv() { return _argv; }
+
+ void set_id(PortableServer::ObjectId * id) { _id = id;}
+
+ Engines::fileRef_ptr createFileRef(const char* origFileName);
+ Engines::fileTransfer_ptr getFileTransfer();
+protected:
+
+ static std::map<std::string, int> _cntInstances_map;
+ static std::map<std::string, void *> _library_map; // library names, loaded
+ static std::map<std::string, void *> _toRemove_map;// library names to remove
+ static omni_mutex _numInstanceMutex ; // lib and instance protection
+
+ bool _isSupervContainer;
+
+ SALOME_NamingService *_NS ;
+ std::string _library_path;
+ std::string _containerName;
+ CORBA::ORB_var _orb;
+ PortableServer::POA_var _poa;
+ PortableServer::ObjectId * _id ;
+ int _numInstance ;
+ std::map<std::string,Engines::Component_var> _listInstances_map;
+ std::map<std::string,Engines::fileRef_var> _fileRef_map;
+ Engines::fileTransfer_var _fileTransfer;
+
+ int _argc ;
+ char** _argv ;
+ long _pid;
+ bool _isServantAloneInProcess;
+};
+
+#endif
+
_path_resources(xmlFilePath)
{
_NS = new SALOME_NamingService(orb);
+ _MpiStarted = false;
}
//=============================================================================
{
_NS = new SALOME_NamingService(orb);
_isAppliSalomeDefined = (getenv("APPLI") != 0);
+ _MpiStarted = false;
if (_isAppliSalomeDefined)
{
}
+//=============================================================================
+/*! Creates a command line that the container manager uses to launch
+ * a parallel container.
+ */
+//=============================================================================
+string
+SALOME_ResourcesManager::BuildCommandToLaunchLocalParallelContainer(const std::string& exe_name,
+ const Engines::MachineParameters& params,
+ const std::string& log)
+{
+ // This method knows the differences between the proxy and the nodes.
+ // nb_component_nodes is not used in the same way if it is a proxy or
+ // a node.
+ string command;
+ string parallelLib(CORBA::string_dup(params.parallelLib));
+ string hostname(CORBA::string_dup(params.hostname));
+ int par = exe_name.find("Proxy");
+ int nbproc = params.nb_component_nodes;
+ char buffer [33];
+ sprintf(buffer,"%d",nbproc);
+
+ Engines::MachineParameters_var rtn = new Engines::MachineParameters();
+ rtn->container_name = params.container_name;
+ rtn->hostname = params.hostname;
+ rtn->OS = params.OS;
+ rtn->mem_mb = params.mem_mb;
+ rtn->cpu_clock = params.cpu_clock;
+ rtn->nb_proc_per_node = params.nb_proc_per_node;
+ rtn->nb_node = params.nb_node;
+ rtn->isMPI = params.isMPI;
+
+ string real_exe_name = exe_name + parallelLib;
+
+ if (parallelLib == "Dummy")
+ {
+ //command = "gdb --args ";
+ //command += real_exe_name;
+ command = real_exe_name;
+ command += " " + _NS->ContainerName(rtn);
+ command += " " + parallelLib;
+ command += " " + hostname;
+ command += " -";
+ AddOmninamesParams(command);
+ }
+
+ if (parallelLib == "Mpi")
+ {
+ // Step 1 : check if MPI is started
+ if (_MpiStarted == false)
+ {
+ startMPI();
+ }
+
+ if (par < 0)
+ {
+ // Nodes case
+ command = "mpiexec -np " + string(buffer) + " ";
+ command += real_exe_name;
+ command += " " + _NS->ContainerName(rtn);
+ command += " " + parallelLib;
+ command += " " + hostname;
+ command += " -";
+ AddOmninamesParams(command);
+ }
+ else
+ {
+ // Proxy case
+ command = "mpiexec -np 1 ";
+ command += real_exe_name;
+ command += " " + _NS->ContainerName(rtn);
+ command += " " + string(buffer);
+ command += " " + parallelLib;
+ command += " " + hostname;
+ command += " -";
+ AddOmninamesParams(command);
+ }
+ }
+
+ // log choice
+ if (log == "default")
+ {
+ command += " > /tmp/";
+ command += _NS->ContainerName(rtn);
+ command += "_";
+ command += GetHostname();
+ command += "_";
+ command += getenv( "USER" ) ;
+ command += ".log 2>&1 &" ;
+ }
+ if (log == "xterm")
+ {
+ command = "/usr/X11R6/bin/xterm -e \"export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; export PATH=$PATH; "
+ + command + " \" &";
+ }
+ return command;
+
+/* if (log == "xterm")
+ {
+ command = "/usr/X11R6/bin/xterm -e \"export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; export PATH=$PATH; echo $LD_LIBRARY_PATH; echo $PATH; " + command + "; cat \" &";
+ }
+*/
+/* command = "cd ; rm " + fichier_commande + "; touch " + \
+ fichier_commande + "; echo \" export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; " + \
+ command + " >& /tmp/ribes_" + fichier_commande + " & \" > " + fichier_commande + ";";
+ command += "ssh cn01 sh " + fichier_commande + " &";
+ cerr << "La commande : " << command << endl;
+*/
+}
+
+void SALOME_ResourcesManager::startMPI()
+{
+ cerr << "----------------------------------------------" << endl;
+ cerr << "----------------------------------------------" << endl;
+ cerr << "----------------------------------------------" << endl;
+ cerr << "-Only Lam on Localhost is currently supported-" << endl;
+ cerr << "----------------------------------------------" << endl;
+ cerr << "----------------------------------------------" << endl;
+ cerr << "----------------------------------------------" << endl;
+
+ int status = system("lamboot");
+ if (status == -1)
+ {
+ INFOS("lamboot failed : system command status -1");
+ }
+ else if (status == 217)
+ {
+ INFOS("lamboot failed : system command status 217");
+ }
+ else
+ {
+ _MpiStarted = true;
+ }
+}
const MapOfParserResourcesType& GetList() const;
+ // Parallel extension
+ std::string BuildCommandToLaunchLocalParallelContainer(const std::string& exe_name,
+ const Engines::MachineParameters& params,
+ const std::string& log = "default");
protected:
+
+ // Parallel extension
+ void startMPI();
+ bool _MpiStarted;
+
SALOME_NamingService *_NS;
std::string BuildTempFileToLaunchRemoteContainer
virtual SALOMEDS::Study::ListOfSObject* FindDependances(SALOMEDS::SObject_ptr anObject);
- virtual SALOMEDS::AttributeStudyProperties_ptr SALOMEDS_Study_i::GetProperties();
+ virtual SALOMEDS::AttributeStudyProperties_ptr GetProperties();
virtual char* GetLastModificationDate();
_builder->SetOnAddSObject(NULL);
_builder->SetOnRemoveSObject(NULL);
}
-}
\ No newline at end of file
+}
Standard_EXPORT virtual Handle(TColStd_HSequenceOfTransient) FindDependances(const Handle(SALOMEDSImpl_SObject)& anObject);
- Standard_EXPORT virtual Handle(SALOMEDSImpl_AttributeStudyProperties) SALOMEDSImpl_Study::GetProperties();
+ Standard_EXPORT virtual Handle(SALOMEDSImpl_AttributeStudyProperties) GetProperties();
Standard_EXPORT virtual TCollection_AsciiString GetLastModificationDate();
#define SALOMELOCALTRACE_EXPORT
#endif
-#endif
\ No newline at end of file
+#endif
+
MESSAGE("activate object");
_thisObj = this ;
_id = _poa->activate_object(_thisObj);
- SCRUTE(_pd_refCount);
+ //does not work with 4.0.6 (too bad)
+ //SCRUTE(_pd_refCount);
+ //SCRUTE(_refcount_value());
}
Engines_TestComponent_i::Engines_TestComponent_i()
{
char s[100];
sprintf(s, "TestComponent_i : L = %ld", (long) L);
- SCRUTE(_pd_refCount);
+ //does not work with 4.0.6 (too bad)
+ //SCRUTE(_pd_refCount);
+ //SCRUTE(_refcount_value());
return CORBA::string_dup(s);
}