X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleCatalog%2FSALOME_ModuleCatalog_Acomponent_impl.cxx;h=fecc12beeac9453682d31dacf47fcdf3bf8b4f98;hb=a98a09635ad776cf8eb98664e0933760eb9edbe4;hp=65476af917500b215415ae8f3eb3174a94c33a4a;hpb=611c96f1b845f602ce9dbdc154c6fe4425937b9b;p=modules%2Fkernel.git diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx index 65476af91..fecc12bee 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx @@ -1,62 +1,57 @@ -using namespace std; -// File: SALOME_ModuleCatalog_Acomponent_impl.cxx -// Created: Tue June 28 2001 -// Author: Estelle Deville -// Project: SALOME -// Copyright : CEA/DEN/DMSS/LGLS -// $Header$ +// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-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, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// SALOME ModuleCatalog : implementation of ModuleCatalog server which parsers xml description of modules +// File : SALOME_ModuleCatalog_Acomponent_impl.cxx +// Author : Estelle Deville +// Module : SALOME +// $Header$ +// +#include "SALOME_ModuleCatalog_Acomponent_impl.hxx" +#include "Utils_ExceptHandlers.hxx" +UNEXPECT_CATCH(MC_NotFound, SALOME_ModuleCatalog::NotFound) -#include "SALOME_ModuleCatalog_Acomponent_impl.hxx" +#include "utilities.h" + +#ifdef _DEBUG_ +static int MYDEBUG = 0; +#else +static int MYDEBUG = 0; +#endif //---------------------------------------------------------------------- // Function : SALOME_ModuleCatalog_AcomponentImpl // Purpose : Constructor -// Affect the component name, type,icone, a bool to define -// if it's multistudy or not. +// Affect the component name, type,icon // Affect too the constraint and the interfaces of the component -// and the pathes prefixes for all computers +// and the path prefixes for all computers //---------------------------------------------------------------------- -SALOME_ModuleCatalog_AcomponentImpl::SALOME_ModuleCatalog_AcomponentImpl( - const char* name, - const char* username, - const char* constraint, - SALOME_ModuleCatalog::ComponentType componenttype, - CORBA::Boolean componentmultistudy, - const char* icone, - SALOME_ModuleCatalog::ListOfDefInterface list_interfaces, - ListOfPathPrefix pathes) +SALOME_ModuleCatalog_AcomponentImpl::SALOME_ModuleCatalog_AcomponentImpl +(SALOME_ModuleCatalog::ComponentDef &C) : _Component(C) { - MESSAGE("Component creation") - // Affect component name - _component_name = new char[strlen(name)+1]; - strcpy(_component_name, name); - - // Affect component user name - _component_user_name = new char[strlen(username)+1]; - strcpy(_component_user_name, username); - - // Affect constraint - _constraint =new char[strlen(constraint)+1]; - strcpy(_constraint, constraint); - - // Affect component type - _componenttype = componenttype; - - // Affect component multistudy - _componentmultistudy = componentmultistudy; - - // Affect icone - _icone =new char[strlen(icone)+1]; - strcpy(_icone, icone); - - //Affect interfaces - _list_interfaces.length(list_interfaces.length()); - _list_interfaces = list_interfaces; - - // affect path prefixes - _pathes.resize(pathes.size()); - _pathes = pathes ; + if(MYDEBUG) BEGIN_OF("SALOME_ModuleCatalog_AcomponentImpl"); + + if(MYDEBUG) END_OF("SALOME_ModuleCatalog_AcomponentImpl"); } //---------------------------------------------------------------------- @@ -65,11 +60,10 @@ SALOME_ModuleCatalog_AcomponentImpl::SALOME_ModuleCatalog_AcomponentImpl( //---------------------------------------------------------------------- SALOME_ModuleCatalog_AcomponentImpl::~SALOME_ModuleCatalog_AcomponentImpl() { - MESSAGE("Component destruction") - // empty memory - delete [] _component_name; - delete [] _component_user_name; - delete [] _constraint; + if(MYDEBUG) BEGIN_OF("~SALOME_ModuleCatalog_AcomponentImpl"); + + + if(MYDEBUG) END_OF("~SALOME_ModuleCatalog_AcomponentImpl"); } //---------------------------------------------------------------------- @@ -79,21 +73,26 @@ SALOME_ModuleCatalog_AcomponentImpl::~SALOME_ModuleCatalog_AcomponentImpl() SALOME_ModuleCatalog::ListOfInterfaces* SALOME_ModuleCatalog_AcomponentImpl::GetInterfaceList() { - SALOME_ModuleCatalog::ListOfInterfaces_var _list = new SALOME_ModuleCatalog::ListOfInterfaces; + if(MYDEBUG) BEGIN_OF("GetInterfaceList"); + + SALOME_ModuleCatalog::ListOfInterfaces_var _list + = new SALOME_ModuleCatalog::ListOfInterfaces; // All the interfaces are defined in _list_interfaces affected at the // component creation - unsigned int _length_interfaces =_list_interfaces.length(); + unsigned int _length_interfaces = _Component.interfaces.length(); _list->length(_length_interfaces); // Parse all the interfaces to get their name for (unsigned int ind = 0; ind < _length_interfaces; ind++) { - _list[ind] = CORBA::string_dup(_list_interfaces[ind].interfacename); - MESSAGE("The component " << _component_name << " contains " << _list[ind] << " as interface") + _list[ind] = CORBA::string_dup(_Component.interfaces[ind].interfacename); + if(MYDEBUG) MESSAGE("The component " << _Component.name + << " contains " << _list[ind] << " as interface"); } + if(MYDEBUG) END_OF("GetInterfaceList"); return _list._retn(); } @@ -103,54 +102,45 @@ SALOME_ModuleCatalog_AcomponentImpl::GetInterfaceList() //---------------------------------------------------------------------- SALOME_ModuleCatalog::DefinitionInterface* SALOME_ModuleCatalog_AcomponentImpl::GetInterface(const char* interfacename) - throw(SALOME_ModuleCatalog::NotFound) { - SALOME_ModuleCatalog::DefinitionInterface_var _interface = new SALOME_ModuleCatalog::DefinitionInterface; - SALOME_ModuleCatalog::Service_var _service = new SALOME_ModuleCatalog::Service; - // Variables initialisation - _interface->interfaceservicelist.length(0); - int _length = 0; + if(MYDEBUG) BEGIN_OF("GetInterface"); + if(MYDEBUG) SCRUTE(interfacename); + + SALOME_ModuleCatalog::DefinitionInterface *_interface = + new SALOME_ModuleCatalog::DefinitionInterface; + bool _find = false ; // looking for the specified interface - for (unsigned int ind = 0; ind < _list_interfaces.length(); ind++) + for (unsigned int ind = 0; ind < _Component.interfaces.length(); ind++) { - if (strcmp(interfacename, _list_interfaces[ind].interfacename) == 0) - { - // wanted interface - _find = true ; - - // Affect the name of the interface - _interface->interfacename = interfacename; - - // Affect each service of the wanted interface - for (unsigned int ind1 = 0; ind1 < _list_interfaces[ind].interfaceservicelist.length() ; ind1++) - { - _interface->interfaceservicelist.length(_length+1); - _service = _duplicate_service(_list_interfaces[ind].interfaceservicelist[ind1]); - _interface->interfaceservicelist[_length] = _service; - - _length++; - } - - } + SALOME_ModuleCatalog::DefinitionInterface &I + = _Component.interfaces[ind]; + + if (strcmp(interfacename, I.interfacename) == 0) + { + // wanted interface + _find = true ; + duplicate(*_interface, I); + } } - + + if(MYDEBUG) SCRUTE(_find); if (!_find) { // The interface was not found, the exception should be thrown - char * message = new char[100]; - strcpy(message, "The interface "); - strcat(message,interfacename); - strcat(message, " of the component "); - strcat(message,_component_name); - strcat(message, " was not found") ; - MESSAGE("The interface " << interfacename << " of the component " << _component_name << " was not found") - throw SALOME_ModuleCatalog::NotFound(message); - delete [] message; + std::string message = "The interface"; + message += interfacename; + message += " of the component "; + message += _Component.name; + message += " was not found"; + if(MYDEBUG) MESSAGE(message); + throw SALOME_ModuleCatalog::NotFound(message.c_str()); } - return _interface._retn(); + if(MYDEBUG) END_OF("GetInterface"); + + return _interface; } @@ -162,46 +152,50 @@ SALOME_ModuleCatalog_AcomponentImpl::GetInterface(const char* interfacename) //---------------------------------------------------------------------- SALOME_ModuleCatalog::ListOfServices* SALOME_ModuleCatalog_AcomponentImpl::GetServiceList(const char* interfacename) - throw(SALOME_ModuleCatalog::NotFound) { - SALOME_ModuleCatalog::ListOfServices_var _list = new SALOME_ModuleCatalog::ListOfServices; + if(MYDEBUG) BEGIN_OF("GetServiceList"); + if(MYDEBUG) SCRUTE(interfacename); + + SALOME_ModuleCatalog::ListOfServices_var _list + = new SALOME_ModuleCatalog::ListOfServices; // Variables initialisation - _list->length(0); bool _find = false ; // looking for the specified interface - for (unsigned int ind = 0; ind < _list_interfaces.length(); ind++) + for (unsigned int ind = 0; ind < _Component.interfaces.length(); ind++) { - if (strcmp(interfacename, _list_interfaces[ind].interfacename) == 0) - { - _find = true ; - // wanted interface - // Get the list of services name for this interface - unsigned int _length_services = _list_interfaces[ind].interfaceservicelist.length(); - _list->length(_length_services); - for (unsigned int ind1 = 0; ind1 < _length_services ; ind1++) - { - _list[ind1] = CORBA::string_dup(_list_interfaces[ind].interfaceservicelist[ind1].ServiceName); - MESSAGE("The interface " << interfacename << " of the component " << _component_name << " contains " << _list[ind1] << " as a service") - } - } + SALOME_ModuleCatalog::DefinitionInterface & I = _Component.interfaces[ind]; + + if (strcmp(interfacename, I.interfacename) == 0) + { + _find = true ; + // wanted interface + // Get the list of services name for this interface + unsigned int _length_services = I.interfaceservicelist.length(); + _list->length(_length_services); + for (unsigned int ind1 = 0; ind1 < _length_services ; ind1++) + { + _list[ind1] = CORBA::string_dup(I.interfaceservicelist[ind1].ServiceName); + if(MYDEBUG) MESSAGE("The interface " << interfacename << " of the component " + << _Component.name << " contains " << _list[ind1] << " as a service") + } + } } if (!_find) { // The interface was not found, the exception should be thrown - char * message = new char[100]; - strcpy(message, "The interface "); - strcat(message,interfacename); - strcat(message, " of the component "); - strcat(message,_component_name); - strcat(message, " was not found") ; - MESSAGE("The interface " << interfacename << " of the component " << _component_name << " was not found") - throw SALOME_ModuleCatalog::NotFound(message); - delete [] message; + std::string message = "The interface"; + message += interfacename; + message += " of the component "; + message += _Component.name; + message += " was not found"; + if(MYDEBUG) MESSAGE(message); + throw SALOME_ModuleCatalog::NotFound(message.c_str()); } + if(MYDEBUG) END_OF("GetServiceList"); return _list._retn(); } @@ -212,51 +206,65 @@ SALOME_ModuleCatalog_AcomponentImpl::GetServiceList(const char* interfacename) //---------------------------------------------------------------------- SALOME_ModuleCatalog::Service* SALOME_ModuleCatalog_AcomponentImpl::GetService(const char* interfacename, - const char* servicename) - throw(SALOME_ModuleCatalog::NotFound) + const char* servicename) { - SALOME_ModuleCatalog::Service_var _service = new SALOME_ModuleCatalog::Service; - // Varaibles initialisation + if(MYDEBUG) BEGIN_OF("GetService"); + if(MYDEBUG) SCRUTE(interfacename); + if(MYDEBUG) SCRUTE(servicename); + + Unexpect aCatch( MC_NotFound ); + SALOME_ModuleCatalog::Service *service = new SALOME_ModuleCatalog::Service; + + // Variables initialization bool _find = false ; + // looking for the specified interface - for (unsigned int ind = 0; ind < _list_interfaces.length(); ind++) + for (unsigned int ind = 0; ind < _Component.interfaces.length(); ind++) { - if (strcmp(interfacename, _list_interfaces[ind].interfacename) == 0) - { - // wanted interface - // looking for the specified service - for (unsigned int ind1 = 0; ind1 < _list_interfaces[ind].interfaceservicelist.length() ; ind1++) - { - if (strcmp(servicename, _list_interfaces[ind].interfaceservicelist[ind1].ServiceName) == 0) - { - // Wanted Service - // Affect the service to be returned - _find = true ; - _service = _duplicate_service(_list_interfaces[ind].interfaceservicelist[ind1]); - } - } - - } + if(MYDEBUG) SCRUTE(ind); + if(MYDEBUG) SCRUTE(_Component.interfaces[ind].interfacename); + + SALOME_ModuleCatalog::DefinitionInterface &I = _Component.interfaces[ind]; + if (strcmp(interfacename, I.interfacename) == 0) + { + // wanted interface + // looking for the specified service + for (unsigned int ind1 = 0; ind1 < I.interfaceservicelist.length() ; ind1++) + { + SALOME_ModuleCatalog::Service &S = I.interfaceservicelist[ind1]; + if(MYDEBUG) SCRUTE(ind1); + if(MYDEBUG) SCRUTE(S.ServiceName); + + if (strcmp(servicename, S.ServiceName) == 0) + { + // Wanted Service + // Affect the service to be returned + _find = true ; + duplicate(*service, S); + } + } + + } } + if(MYDEBUG) SCRUTE(_find); if (!_find) { - // The service was not found, the exception should be thrown - char * message = new char[100]; - strcpy(message, "The service "); - strcat(message, servicename); - strcat(message," of the interface "); - strcat(message,interfacename); - strcat(message, " of the component "); - strcat(message,_component_name); - strcat(message, " was not found") ; - MESSAGE("The service " << servicename << " of the interface " << interfacename << " of the component " << _component_name << " was not found") - throw SALOME_ModuleCatalog::NotFound(message); - delete [] message; + // The interface was not found, the exception should be thrown + std::string message = "The service"; + message += servicename; + message += " of the interface "; + message += interfacename; + message += " of the component "; + message += _Component.name; + message += " was not found"; + if(MYDEBUG) MESSAGE(message); + throw SALOME_ModuleCatalog::NotFound(message.c_str()); } - return _service._retn(); + if(MYDEBUG) END_OF("GetService"); + return service; } //---------------------------------------------------------------------- @@ -265,49 +273,51 @@ SALOME_ModuleCatalog_AcomponentImpl::GetService(const char* interfacename, //---------------------------------------------------------------------- SALOME_ModuleCatalog::Service* SALOME_ModuleCatalog_AcomponentImpl::GetDefaultService(const char* interfacename) - throw(SALOME_ModuleCatalog::NotFound) { - SALOME_ModuleCatalog::Service_var _service = new SALOME_ModuleCatalog::Service; + if(MYDEBUG) BEGIN_OF("GetDefaultService"); + if(MYDEBUG) SCRUTE(interfacename); + + Unexpect aCatch( MC_NotFound ); + SALOME_ModuleCatalog::Service *_service = new SALOME_ModuleCatalog::Service; // Variables initialisation bool _find = false ; // looking for the specified interface - for (unsigned int ind = 0; ind < _list_interfaces.length(); ind++) + for (unsigned int ind = 0; ind < _Component.interfaces.length(); ind++) { - if (strcmp(interfacename, _list_interfaces[ind].interfacename) == 0) - { - // wanted interface - // looking for the defautl service of the wanted interface - for (unsigned int ind1 = 0; ind1 < _list_interfaces[ind].interfaceservicelist.length() ; ind1++) - { - if (_list_interfaces[ind].interfaceservicelist[ind1].Servicebydefault) - { - // Default Service - // affect the service to be returned - _find = true ; - _service = _duplicate_service(_list_interfaces[ind].interfaceservicelist[ind1]); - } - } - - } + if (strcmp(interfacename, _Component.interfaces[ind].interfacename) == 0) + { + // wanted interface + // looking for the default service of the wanted interface + for (unsigned int ind1 = 0; ind1 < _Component.interfaces[ind].interfaceservicelist.length() ; ind1++) + { + if (_Component.interfaces[ind].interfaceservicelist[ind1].Servicebydefault) + { + // Default Service + // affect the service to be returned + _find = true ; + duplicate(*_service, _Component.interfaces[ind].interfaceservicelist[ind1]); + } + } + + } } if (!_find) { // The service was not found, the exception should be thrown - char * message = new char[100]; - strcpy(message, "The default service of the interface "); - strcat(message,interfacename); - strcat(message, " of the component "); - strcat(message,_component_name); - strcat(message, " was not found") ; - MESSAGE("The default service of the interface " << interfacename << " of the component " << _component_name << " was not found") - throw SALOME_ModuleCatalog::NotFound(message); - delete [] message; + std::string message = "The default service of the interface "; + message += interfacename; + message += " of the component "; + message += _Component.name; + message += " was not found"; + if(MYDEBUG) MESSAGE(message); + throw SALOME_ModuleCatalog::NotFound(message.c_str()); } - return _service._retn(); + if(MYDEBUG) END_OF("GetDefaultService"); + return _service; } //---------------------------------------------------------------------- @@ -316,44 +326,43 @@ SALOME_ModuleCatalog_AcomponentImpl::GetDefaultService(const char* interfacename //---------------------------------------------------------------------- char* SALOME_ModuleCatalog_AcomponentImpl::GetPathPrefix(const char* machinename) - throw(SALOME_ModuleCatalog::NotFound) { - MESSAGE("Begin of GetPathPrefix") - // Variables initialisation + if(MYDEBUG) BEGIN_OF("GetPathPrefix"); + if(MYDEBUG) SCRUTE(machinename); + Unexpect aCatch( MC_NotFound ); + + // Variables initialisation char* _path = NULL; bool _find = false ; // Parse all the path prefixes // looking for the wanted computer - for (unsigned int ind = 0 ; ind < _pathes.size() ; ind++) + for (unsigned int ind = 0 ; ind < _Component.paths.length() ; ind++) { - for (unsigned int ind1 = 0 ; ind1 < _pathes[ind].ListOfComputer.size() ; ind1++) - { - if (strcmp(machinename, _pathes[ind].ListOfComputer[ind1].c_str()) == 0) - { - _find = true ; - // Wanted computer - // affect the path to be returned - const char* _temp = _pathes[ind].path.c_str() ; - _path = new char[strlen(_temp)+1]; - strcpy(_path,_temp); - } - } - } - - if (!_find) - { - // The computer was not found, the exception should be thrown - char * message = new char[100]; - strcpy(message, "The computer "); - strcat(message,machinename); - strcat(message, " was not found in the catalog associated to the component ") ; - strcat(message,_component_name); - MESSAGE("The computer " << machinename << " was not found in the catalog associated to the component " << _component_name) - throw SALOME_ModuleCatalog::NotFound(message); - delete [] message; - } - + if (strcmp(machinename, _Component.paths[ind].machine) == 0) + { + _find = true ; + // Wanted computer + // affect the path to be returned + const char* _temp = _Component.paths[ind].path ; + _path = new char[strlen(_temp)+1]; + strcpy(_path,_temp); + } + } + + if(MYDEBUG) SCRUTE(_find); + if (!_find) + { + // The computer was not found, the exception should be thrown + std::string message = "The computer "; + message += machinename; + message += " was not found in the catalog associated to the component "; + message += _Component.name; + if(MYDEBUG) MESSAGE(message); + throw SALOME_ModuleCatalog::NotFound(message.c_str()); + } + + if(MYDEBUG) END_OF("GetPathPrefix"); return _path; } @@ -363,7 +372,7 @@ SALOME_ModuleCatalog_AcomponentImpl::GetPathPrefix(const char* machinename) //---------------------------------------------------------------------- char* SALOME_ModuleCatalog_AcomponentImpl::constraint() { - return CORBA::string_dup(_constraint); + return CORBA::string_dup(_Component.constraint); } //---------------------------------------------------------------------- @@ -372,7 +381,7 @@ char* SALOME_ModuleCatalog_AcomponentImpl::constraint() //---------------------------------------------------------------------- char* SALOME_ModuleCatalog_AcomponentImpl::componentname() { - return CORBA::string_dup(_component_name); + return CORBA::string_dup(_Component.name); } //---------------------------------------------------------------------- @@ -381,16 +390,25 @@ char* SALOME_ModuleCatalog_AcomponentImpl::componentname() //---------------------------------------------------------------------- char* SALOME_ModuleCatalog_AcomponentImpl::componentusername() { - return CORBA::string_dup(_component_user_name); + return CORBA::string_dup(_Component.username); +} + +//---------------------------------------------------------------------- +// Function : implementation type +// Purpose : return the implementation type : C++ (dyn lib), Python (module) or executable +//---------------------------------------------------------------------- +SALOME_ModuleCatalog::ImplType SALOME_ModuleCatalog_AcomponentImpl::implementation_type() +{ + return _Component.implementationType ; } //---------------------------------------------------------------------- -// Function : multistudy -// Purpose : define if a component can be multistudy or not +// Function : implementation name +// Purpose : return the implementation name to exec if the default one is not convenient //---------------------------------------------------------------------- -CORBA::Boolean SALOME_ModuleCatalog_AcomponentImpl::multistudy() +char* SALOME_ModuleCatalog_AcomponentImpl::implementation_name() { - return _componentmultistudy ; + return _Component.implname ; } //---------------------------------------------------------------------- @@ -400,7 +418,7 @@ CORBA::Boolean SALOME_ModuleCatalog_AcomponentImpl::multistudy() SALOME_ModuleCatalog::ComponentType SALOME_ModuleCatalog_AcomponentImpl::component_type() { - return _componenttype; + return _Component.type; } //---------------------------------------------------------------------- @@ -409,44 +427,102 @@ SALOME_ModuleCatalog_AcomponentImpl::component_type() //---------------------------------------------------------------------- char* SALOME_ModuleCatalog_AcomponentImpl::component_icone() { - return CORBA::string_dup(_icone); + return CORBA::string_dup(_Component.icon); } -//---------------------------------------------------------------------- -// Function : _duplicate_service -// Purpose : duplicate a service -//---------------------------------------------------------------------- -SALOME_ModuleCatalog::Service_var -SALOME_ModuleCatalog_AcomponentImpl::_duplicate_service(SALOME_ModuleCatalog::Service service) + +void SALOME_ModuleCatalog_AcomponentImpl::duplicate +(SALOME_ModuleCatalog::ServicesParameter & P_out, + const SALOME_ModuleCatalog::ServicesParameter &P_in) { - SALOME_ModuleCatalog::Service_var _service = new SALOME_ModuleCatalog::Service; + // duplicate parameter name + P_out.Parametername = CORBA::string_dup(P_in.Parametername); + + // duplicate parameter type + P_out.Parametertype = CORBA::string_dup(P_in.Parametertype); +} - // service name - _service->ServiceName = CORBA::string_dup(service.ServiceName); - // service by default - _service->Servicebydefault = service.Servicebydefault; - // in Parameters service - unsigned int _length_in_param = service.ServiceinParameter.length(); - for(unsigned int ind = 0; ind < _length_in_param; ind++) - { - _service->ServiceinParameter.length(_length_in_param); - // in Parameter type - _service->ServiceinParameter[ind].Parametertype = CORBA::string_dup(service.ServiceinParameter[ind].Parametertype); - // in Parameter name - _service->ServiceinParameter[ind].Parametername = CORBA::string_dup(service.ServiceinParameter[ind].Parametername); - } +void SALOME_ModuleCatalog_AcomponentImpl::duplicate +(SALOME_ModuleCatalog::ServicesDataStreamParameter & P_out, + const SALOME_ModuleCatalog::ServicesDataStreamParameter &P_in) +{ + // duplicate parameter name + P_out.Parametername = CORBA::string_dup(P_in.Parametername); + + // duplicate parameter type + P_out.Parametertype = P_in.Parametertype; - // out Parameters service - unsigned int _length_out_param = service.ServiceoutParameter.length(); - for(unsigned int ind = 0; ind < _length_out_param; ind++) - { - _service->ServiceoutParameter.length(_length_out_param); - // out Parameter type - _service->ServiceoutParameter[ind].Parametertype = CORBA::string_dup(service.ServiceoutParameter[ind].Parametertype); - // out Parameter name - _service->ServiceoutParameter[ind].Parametername = CORBA::string_dup(service.ServiceoutParameter[ind].Parametername); - } + // duplicate parameter dependency + P_out.Parameterdependency = P_in.Parameterdependency; - return _service; } + +void SALOME_ModuleCatalog_AcomponentImpl::duplicate +(SALOME_ModuleCatalog::Service & S_out, + const SALOME_ModuleCatalog::Service &S_in) +{ + // type of node + S_out.TypeOfNode = S_in.TypeOfNode; + + // duplicate service name + S_out.ServiceName = CORBA::string_dup(S_in.ServiceName); + + // duplicate service by default + S_out.Servicebydefault = S_in.Servicebydefault; + + unsigned int _length; + + // duplicate in Parameters + _length = S_in.ServiceinParameter.length(); + S_out.ServiceinParameter.length(_length); + + for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++) + duplicate(S_out.ServiceinParameter[ind2], + S_in.ServiceinParameter[ind2]); + + // duplicate out Parameters + _length = S_in.ServiceoutParameter.length(); + S_out.ServiceoutParameter.length(_length); + + for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++) + duplicate(S_out.ServiceoutParameter[ind2], + S_in.ServiceoutParameter[ind2]); + + // duplicate in DataStreamParameters + _length = S_in.ServiceinDataStreamParameter.length(); + S_out.ServiceinDataStreamParameter.length(_length); + + for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++) + duplicate(S_out.ServiceinDataStreamParameter[ind2], + S_in.ServiceinDataStreamParameter[ind2]); + + // duplicate out DataStreamParameters + _length = S_in.ServiceoutDataStreamParameter.length(); + if(MYDEBUG) SCRUTE(_length); + S_out.ServiceoutDataStreamParameter.length(_length); + + for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++) + duplicate(S_out.ServiceoutDataStreamParameter[ind2], + S_in.ServiceoutDataStreamParameter[ind2]); +} + + +void SALOME_ModuleCatalog_AcomponentImpl::duplicate +(SALOME_ModuleCatalog::DefinitionInterface & I_out, + const SALOME_ModuleCatalog::DefinitionInterface & I_in) +{ + //duplicate interface name + I_out.interfacename = CORBA::string_dup(I_in.interfacename); + + // duplicate service list + unsigned int _length = I_in.interfaceservicelist.length(); + if(MYDEBUG) SCRUTE(_length); + I_out.interfaceservicelist.length(_length); + + for (unsigned int ind1 = 0; ind1 < _length ; ind1 ++) + duplicate(I_out.interfaceservicelist[ind1], + I_in.interfaceservicelist[ind1]); +} + +