-// SALOME ModuleCatalog : implementation of ModuleCatalog server which parsers xml description of modules
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003 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
+// 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.
//
+// 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"
#include "utilities.h"
-using namespace std;
-
#ifdef _DEBUG_
static int MYDEBUG = 0;
#else
// and the pathes prefixes for all computers
//----------------------------------------------------------------------
SALOME_ModuleCatalog_AcomponentImpl::SALOME_ModuleCatalog_AcomponentImpl
-(SALOME_ModuleCatalog::Component &C) : _Component(C)
+(SALOME_ModuleCatalog::ComponentDef &C) : _Component(C)
{
if(MYDEBUG) BEGIN_OF("SALOME_ModuleCatalog_AcomponentImpl");
{
_list[ind] = CORBA::string_dup(_Component.interfaces[ind].interfacename);
if(MYDEBUG) MESSAGE("The component " << _Component.name
- << " contains " << _list[ind] << " as interface");
+ << " contains " << _list[ind] << " as interface");
}
if(MYDEBUG) END_OF("GetInterfaceList");
if(MYDEBUG) SCRUTE(interfacename);
SALOME_ModuleCatalog::DefinitionInterface *_interface =
- new SALOME_ModuleCatalog::DefinitionInterface;
+ new SALOME_ModuleCatalog::DefinitionInterface;
bool _find = false ;
for (unsigned int ind = 0; ind < _Component.interfaces.length(); ind++)
{
SALOME_ModuleCatalog::DefinitionInterface &I
- = _Component.interfaces[ind];
+ = _Component.interfaces[ind];
if (strcmp(interfacename, I.interfacename) == 0)
- {
- // wanted interface
- _find = true ;
- duplicate(*_interface, I);
- }
+ {
+ // wanted interface
+ _find = true ;
+ duplicate(*_interface, I);
+ }
}
if(MYDEBUG) SCRUTE(_find);
if (!_find)
{
// The interface was not found, the exception should be thrown
- string message = "The interface";
+ std::string message = "The interface";
message += interfacename;
message += " of the component ";
message += _Component.name;
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")
- }
- }
+ {
+ _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
- string message = "The interface";
+ std::string message = "The interface";
message += interfacename;
message += " of the component ";
message += _Component.name;
//----------------------------------------------------------------------
SALOME_ModuleCatalog::Service*
SALOME_ModuleCatalog_AcomponentImpl::GetService(const char* interfacename,
- const char* servicename)
+ const char* servicename)
throw(SALOME_ModuleCatalog::NotFound)
{
if(MYDEBUG) BEGIN_OF("GetService");
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);
- }
- }
-
- }
+ {
+ // 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 interface was not found, the exception should be thrown
- string message = "The service";
+ std::string message = "The service";
message += servicename;
message += " of the interface ";
message += interfacename;
for (unsigned int ind = 0; ind < _Component.interfaces.length(); ind++)
{
if (strcmp(interfacename, _Component.interfaces[ind].interfacename) == 0)
- {
- // wanted interface
- // looking for the defautl 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]);
- }
- }
-
- }
+ {
+ // wanted interface
+ // looking for the defautl 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
- string message = "The default service of the interface ";
+ std::string message = "The default service of the interface ";
message += interfacename;
message += " of the component ";
message += _Component.name;
for (unsigned int ind = 0 ; ind < _Component.paths.length() ; ind++)
{
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);
- }
+ {
+ _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
- string message = "The computer ";
+ std::string message = "The computer ";
message += machinename;
message += " was not found in the catalog associated to the component ";
message += _Component.name;
//----------------------------------------------------------------------
// Function : implementation type
-// Purpose : define if a component is implemented in C++ or Python
+// Purpose : return the implementation type : C++ (dyn lib), Python (module) or executable
//----------------------------------------------------------------------
-CORBA::Boolean SALOME_ModuleCatalog_AcomponentImpl::implementation_type()
+SALOME_ModuleCatalog::ImplType SALOME_ModuleCatalog_AcomponentImpl::implementation_type()
{
return _Component.implementationType ;
}
+//----------------------------------------------------------------------
+// Function : implementation name
+// Purpose : return the implementation name to exec if the default one is not convenient
+//----------------------------------------------------------------------
+char* SALOME_ModuleCatalog_AcomponentImpl::implementation_name()
+{
+ return _Component.implname ;
+}
+
//----------------------------------------------------------------------
// Function : component_type
// Purpose : define the type of the component
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
duplicate(S_out.ServiceinParameter[ind2],
- S_in.ServiceinParameter[ind2]);
+ S_in.ServiceinParameter[ind2]);
// duplicate out Parameters
_length = S_in.ServiceoutParameter.length();
S_out.ServiceoutParameter.length(_length);
-#ifndef WNT
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
-#else
- for (ind2 = 0; ind2 < _length ; ind2 ++)
-#endif
duplicate(S_out.ServiceoutParameter[ind2],
- S_in.ServiceoutParameter[ind2]);
+ S_in.ServiceoutParameter[ind2]);
// duplicate in DataStreamParameters
_length = S_in.ServiceinDataStreamParameter.length();
S_out.ServiceinDataStreamParameter.length(_length);
-#ifndef WNT
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
-#else
- for (ind2 = 0; ind2 < _length ; ind2 ++)
-#endif
duplicate(S_out.ServiceinDataStreamParameter[ind2],
- S_in.ServiceinDataStreamParameter[ind2]);
+ S_in.ServiceinDataStreamParameter[ind2]);
// duplicate out DataStreamParameters
_length = S_in.ServiceoutDataStreamParameter.length();
if(MYDEBUG) SCRUTE(_length);
S_out.ServiceoutDataStreamParameter.length(_length);
-#ifndef WNT
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
-#else
- for (ind2 = 0; ind2 < _length ; ind2 ++)
-#endif
duplicate(S_out.ServiceoutDataStreamParameter[ind2],
- S_in.ServiceoutDataStreamParameter[ind2]);
+ S_in.ServiceoutDataStreamParameter[ind2]);
}
for (unsigned int ind1 = 0; ind1 < _length ; ind1 ++)
duplicate(I_out.interfaceservicelist[ind1],
- I_in.interfaceservicelist[ind1]);
+ I_in.interfaceservicelist[ind1]);
}