From f5b54d94659de8117d7f46d574ed3dfb2d42547f Mon Sep 17 00:00:00 2001 From: caremoli Date: Fri, 26 Sep 2008 15:16:48 +0000 Subject: [PATCH] CCAR : INTERFACE CHANGE : add a boolean parameter regist with default value true to one Component constructor It was needed to avoid calling registry two times for a python superv_component Registry was called in the python constructor and in the corba proxy (class PySupervCompo) that is used to implement DSC ports for python component. As regist value is true by default there is no impact on other parts of KERNEL or of modules. --- src/Container/Component_i.cxx | 14 ++++++++------ src/Container/SALOME_Component_i.hxx | 5 +++-- src/DSC/DSC_Basic/DSC_i.cxx | 4 +++- src/DSC/DSC_Basic/DSC_i.hxx | 3 ++- src/DSC/DSC_User/Datastream/Calcium/Calcium.cxx | 2 +- src/DSC/DSC_User/Superv_Component_i.cxx | 4 +++- src/DSC/DSC_User/Superv_Component_i.hxx | 3 ++- 7 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/Container/Component_i.cxx b/src/Container/Component_i.cxx index 885750da9..b92cf0708 100644 --- a/src/Container/Component_i.cxx +++ b/src/Container/Component_i.cxx @@ -125,6 +125,7 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, * \param instanceName unique instance name for this object (see Container_i) * \param interfaceName component class name * \param notif use of notification + * \param regist (true or false) use of registry (default true) */ //============================================================================= @@ -133,7 +134,8 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, Engines::Container_ptr container, const char *instanceName, const char *interfaceName, - bool notif) : + bool notif, + bool regist) : _instanceName(instanceName), _interfaceName(interfaceName), _myConnexionToRegistry(0), @@ -160,7 +162,8 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, _contId = 0; } const CORBA::String_var ior = _orb->object_to_string(_container); - _myConnexionToRegistry = new RegistryConnexion(0, 0, ior,"theSession", _instanceName.c_str()); + if(regist) + _myConnexionToRegistry = new RegistryConnexion(0, 0, ior,"theSession", _instanceName.c_str()); _notifSupplier = new NOTIFICATION_Supplier(instanceName, notif); } @@ -290,11 +293,10 @@ void Engines_Component_i::destroy() MESSAGE("Engines_Component_i::destroy()"); //SCRUTE(pd_refCount); - delete _notifSupplier; - _notifSupplier = 0; - - delete _myConnexionToRegistry; + if(_myConnexionToRegistry)delete _myConnexionToRegistry; _myConnexionToRegistry = 0 ; + if(_notifSupplier)delete _notifSupplier; + _notifSupplier = 0; if(_id) delete(_id) ; //SCRUTE(pd_refCount); diff --git a/src/Container/SALOME_Component_i.hxx b/src/Container/SALOME_Component_i.hxx index 3d49b89c5..154211695 100644 --- a/src/Container/SALOME_Component_i.hxx +++ b/src/Container/SALOME_Component_i.hxx @@ -67,8 +67,9 @@ public: Engines::Container_ptr container, const char *instanceName, const char *interfaceName, - bool notif = false); - // Consructeur pour composant parallele: ne pas faire appel au registry + bool notif = false, + bool regist=true); + // Constructor for parallel component : don't call registry Engines_Component_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId, diff --git a/src/DSC/DSC_Basic/DSC_i.cxx b/src/DSC/DSC_Basic/DSC_i.cxx index 2daa87423..7ae1e157b 100644 --- a/src/DSC/DSC_Basic/DSC_i.cxx +++ b/src/DSC/DSC_Basic/DSC_i.cxx @@ -48,7 +48,9 @@ Engines_DSC_i(CORBA::ORB_ptr orb, Engines::Container_ptr container, const char *instanceName, const char *interfaceName, - bool notif) : Engines_Component_i(orb, poa, container, instanceName, interfaceName) + bool notif, + bool regist) : + Engines_Component_i(orb, poa, container, instanceName, interfaceName,notif,regist) { #ifdef _DEBUG_ std::cerr << "--Engines_DSC_i: MARK 1 --" << instanceName << "----" << std::endl; diff --git a/src/DSC/DSC_Basic/DSC_i.hxx b/src/DSC/DSC_Basic/DSC_i.hxx index a66be1d56..98fc8a6ad 100644 --- a/src/DSC/DSC_Basic/DSC_i.hxx +++ b/src/DSC/DSC_Basic/DSC_i.hxx @@ -61,7 +61,8 @@ public: Engines::Container_ptr container, const char *instanceName, const char *interfaceName, - bool notif = false); + bool notif = false, + bool regist = true ); virtual ~Engines_DSC_i(); diff --git a/src/DSC/DSC_User/Datastream/Calcium/Calcium.cxx b/src/DSC/DSC_User/Datastream/Calcium/Calcium.cxx index fde8203a8..4c245e621 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/Calcium.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/Calcium.cxx @@ -13,7 +13,7 @@ PySupervCompo::PySupervCompo( CORBA::ORB_ptr orb, const char *instanceName, const char *interfaceName, bool notif) : - Superv_Component_i(orb, poa,contain, instanceName, interfaceName) + Superv_Component_i(orb, poa,contain, instanceName, interfaceName,false,false) { } diff --git a/src/DSC/DSC_User/Superv_Component_i.cxx b/src/DSC/DSC_User/Superv_Component_i.cxx index 4a6449990..b4335d38f 100644 --- a/src/DSC/DSC_User/Superv_Component_i.cxx +++ b/src/DSC/DSC_User/Superv_Component_i.cxx @@ -55,7 +55,9 @@ Superv_Component_i::Superv_Component_i(CORBA::ORB_ptr orb, Engines::Container_ptr container, const char *instanceName, const char *interfaceName, - bool notif) : Engines_DSC_i(orb, poa, container, instanceName, interfaceName) + bool notif, + bool regist) : + Engines_DSC_i(orb, poa, container, instanceName, interfaceName,notif,regist) { #ifdef _DEBUG_ std::cerr << "--Superv_Component_i : MARK 1 ---- " << instanceName << "----" << std::endl; diff --git a/src/DSC/DSC_User/Superv_Component_i.hxx b/src/DSC/DSC_User/Superv_Component_i.hxx index 2c8467e05..35ccc8922 100644 --- a/src/DSC/DSC_User/Superv_Component_i.hxx +++ b/src/DSC/DSC_User/Superv_Component_i.hxx @@ -70,7 +70,8 @@ public: Engines::Container_ptr container, const char *instanceName, const char *interfaceName, - bool notif = false); + bool notif = false, + bool regist = true ); virtual ~Superv_Component_i(); // Exceptions declarations. -- 2.39.2