From 94010690a84094191e2ded0f286192922ab47087 Mon Sep 17 00:00:00 2001 From: ageay Date: Wed, 14 Sep 2005 05:55:03 +0000 Subject: [PATCH] MED Corba servants inherit from GenericObj in KERNEL to manage memory in heap. --- idl/MED.idl | 7 ++++--- src/MEDMEM_I/MEDMEM_Field_i.cxx | 12 ------------ src/MEDMEM_I/MEDMEM_Field_i.hxx | 5 +---- src/MEDMEM_I/MEDMEM_Mesh_i.cxx | 12 ------------ src/MEDMEM_I/MEDMEM_Mesh_i.hxx | 6 +++--- src/MEDMEM_I/MEDMEM_Support_i.cxx | 11 ----------- src/MEDMEM_I/MEDMEM_Support_i.hxx | 7 ++++--- src/MEDMEM_I/Makefile.in | 2 +- 8 files changed, 13 insertions(+), 49 deletions(-) diff --git a/idl/MED.idl b/idl/MED.idl index 7b499d87b..e67960245 100644 --- a/idl/MED.idl +++ b/idl/MED.idl @@ -18,6 +18,7 @@ This file contains the main IDL definitions of the %MED component in %SALOME app study and/or give a direct access to those objects. */ +#include "SALOME_GenericObj.idl" #include "SALOME_Exception.idl" #include "SALOME_Component.idl" #include "SALOMEDS.idl" @@ -134,7 +135,7 @@ This enumeration contains a set of elements defining the type of connectivity. // mesh interface // ---------------------- - interface MESH : SALOME::MultiCommClass, SALOME::ServantLifeCycle { + interface MESH : SALOME::MultiCommClass, SALOME::GenericObj { // Index range begins from 1 // General Informations @@ -520,7 +521,7 @@ Internal Corba method. // Support interface // ---------------------- - interface SUPPORT : SALOME::MultiCommClass, SALOME::ServantLifeCycle { + interface SUPPORT : SALOME::MultiCommClass, SALOME::GenericObj { /*! Returns the name of the support. @@ -777,7 +778,7 @@ Internal Corba method. // Field interface //---------------- - interface FIELD : SALOME::ServantLifeCycle + interface FIELD : SALOME::GenericObj { /*! diff --git a/src/MEDMEM_I/MEDMEM_Field_i.cxx b/src/MEDMEM_I/MEDMEM_Field_i.cxx index 3014d67f8..556e72bd1 100644 --- a/src/MEDMEM_I/MEDMEM_Field_i.cxx +++ b/src/MEDMEM_I/MEDMEM_Field_i.cxx @@ -639,15 +639,3 @@ CORBA::Long FIELD_i::addDriver (SALOME_MED::medDriverTypes driverType, } } -//============================================================================= -/*! - * CORBA: Destructor -*/ -//============================================================================= -void FIELD_i::release() -{ - PortableServer::ObjectId_var oid=_default_POA()->servant_to_id(this); - _default_POA()->deactivate_object(oid); - _remove_ref(); -} - diff --git a/src/MEDMEM_I/MEDMEM_Field_i.hxx b/src/MEDMEM_I/MEDMEM_Field_i.hxx index 327170904..f1981ce47 100644 --- a/src/MEDMEM_I/MEDMEM_Field_i.hxx +++ b/src/MEDMEM_I/MEDMEM_Field_i.hxx @@ -25,15 +25,13 @@ #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) #include "MEDMEM_Support_i.hxx" - #include "MEDMEM_convert.hxx" - #include "MEDMEM_Support.hxx" #include "MEDMEM_Field.hxx" namespace MEDMEM { class FIELD_i: public virtual POA_SALOME_MED::FIELD, - public PortableServer::RefCountServantBase + public SALOME::GenericObj_i { public : static map < int, ::MEDMEM::FIELD_ * > fieldMap ; @@ -87,7 +85,6 @@ public : void read (CORBA::Long i) throw (SALOME::SALOME_Exception); void write (CORBA::Long i, const char* driverFieldName) throw (SALOME::SALOME_Exception); - void release(); // Cuisine Interne MEDMEM::FIELD_ * constructConstField() const; diff --git a/src/MEDMEM_I/MEDMEM_Mesh_i.cxx b/src/MEDMEM_I/MEDMEM_Mesh_i.cxx index 41ca4ba11..bd1115b23 100644 --- a/src/MEDMEM_I/MEDMEM_Mesh_i.cxx +++ b/src/MEDMEM_I/MEDMEM_Mesh_i.cxx @@ -1534,15 +1534,3 @@ CORBA::Boolean MESH_i::areEquals(SALOME_MED::MESH_ptr other) } return false; } - -//============================================================================= -/*! - * CORBA : Servant destruction - */ -//============================================================================= -void MESH_i::release() -{ - PortableServer::ObjectId_var oid=_default_POA()->servant_to_id(this); - _default_POA()->deactivate_object(oid); - _remove_ref(); -} diff --git a/src/MEDMEM_I/MEDMEM_Mesh_i.hxx b/src/MEDMEM_I/MEDMEM_Mesh_i.hxx index 8f1befb86..1cc92b551 100644 --- a/src/MEDMEM_I/MEDMEM_Mesh_i.hxx +++ b/src/MEDMEM_I/MEDMEM_Mesh_i.hxx @@ -14,6 +14,7 @@ #include #include "SALOMEMultiComm.hxx" +#include "SALOME_GenericObj_i.hh" #include CORBA_SERVER_HEADER(MED) #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) #include CORBA_SERVER_HEADER(SALOME_Comm) @@ -21,8 +22,8 @@ namespace MEDMEM { class MESH; class MESH_i: public POA_SALOME_MED::MESH, - public PortableServer::RefCountServantBase, - public SALOMEMultiComm + public SALOMEMultiComm, + public SALOME::GenericObj_i { public : static std::map < int,::MEDMEM::MESH *> meshMap; @@ -190,7 +191,6 @@ public: throw (SALOME::SALOME_Exception); CORBA::Boolean areEquals(SALOME_MED::MESH_ptr other); - void release(); }; } diff --git a/src/MEDMEM_I/MEDMEM_Support_i.cxx b/src/MEDMEM_I/MEDMEM_Support_i.cxx index e3b90c61a..a8e302c29 100644 --- a/src/MEDMEM_I/MEDMEM_Support_i.cxx +++ b/src/MEDMEM_I/MEDMEM_Support_i.cxx @@ -712,14 +712,3 @@ void SUPPORT_i::addInStudy (SALOMEDS::Study_ptr myStudy, SALOME_MED::SUPPORT_ptr END_OF(LOC); } -//============================================================================= -/*! - * CORBA: release <=> remote delete this - */ -//============================================================================= -void SUPPORT_i::release() -{ - PortableServer::ObjectId_var oid=_default_POA()->servant_to_id(this); - _default_POA()->deactivate_object(oid); - _remove_ref(); -} diff --git a/src/MEDMEM_I/MEDMEM_Support_i.hxx b/src/MEDMEM_I/MEDMEM_Support_i.hxx index e7eb33963..5e19805af 100644 --- a/src/MEDMEM_I/MEDMEM_Support_i.hxx +++ b/src/MEDMEM_I/MEDMEM_Support_i.hxx @@ -15,15 +15,16 @@ #include #include "SALOMEMultiComm.hxx" +#include "SALOME_GenericObj_i.hh" #include CORBA_SERVER_HEADER(MED) #include CORBA_SERVER_HEADER(SALOME_Comm) namespace MEDMEM { class SUPPORT; -class SUPPORT_i: public POA_SALOME_MED::SUPPORT, - public PortableServer::RefCountServantBase, - public SALOMEMultiComm + class SUPPORT_i: public POA_SALOME_MED::SUPPORT, + public SALOMEMultiComm, + public SALOME::GenericObj_i { public : static std::map < int,::MEDMEM::SUPPORT *> supportMap; diff --git a/src/MEDMEM_I/Makefile.in b/src/MEDMEM_I/Makefile.in index b3350e4a3..d29750e49 100644 --- a/src/MEDMEM_I/Makefile.in +++ b/src/MEDMEM_I/Makefile.in @@ -66,7 +66,7 @@ LDFLAGSFORBIN= -L$(top_builddir)/lib/salome CPPFLAGS+= $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS+= -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -lmedmem -L${KERNEL_ROOT_DIR}/lib/salome -lSALOMELocalTrace -L${KERNEL_ROOT_DIR}/lib/salome -lSALOMELocalTrace -lSalomeCommunication +LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -lmedmem -L${KERNEL_ROOT_DIR}/lib/salome -lSALOMELocalTrace -L${KERNEL_ROOT_DIR}/lib/salome -lSALOMELocalTrace -lSalomeCommunication -lSalomeGenericObj #LDFLAGS+=-lmedmem -L. -lSalomeContainer -lSalomeNS -lRegistry -lOpUtil -lSalomeNotification # does we put only -lSalomeContainer and compiler retrieves -lSalomeNS -lRegistry -lOpUtil ???? -- 2.39.2