SALOME_MPIObject.idl \
SALOME_MPIContainer.idl \
SALOME_TestMPIComponent.idl \
+ SALOME_TestModuleCatalog.idl \
Logger.idl \
SALOME_GenericObj.idl
List of names of interfaces.
*/
typedef sequence<string> ListOfInterfaces ;
+
+/*!
+Description of a component
+*/
+ struct Component
+ {
+ ComponentType type;
+ string name;
+ string username;
+ boolean multistudy;
+ string icon;
+ string constraint;
+ ListOfDefInterface interfaces;
+ };
+
/*!
List of names of components.
*/
string GetPathPrefix(in string machinename) raises(NotFound);
/*!
- Sets/gets the constraint affected to the component
+ Get the constraint affected to the component
(to be resolved by LifeCycle for the computer choice)
*/
readonly attribute string constraint ;
/*!
-Sets/gets the name of the component
+Get the name of the component
*/
readonly attribute string componentname;
/*!
-Sets/gets the user name of the component
+G the user name of the component
*/
readonly attribute string componentusername;
/*!
-Defines whether the component is multistudy or not
+Ask whether the component is multistudy or not
*/
readonly attribute boolean multistudy;
/*!
-Defines the type of the component
+Ask the type of the component
*/
readonly attribute ComponentType component_type ;
*/
Acomponent GetComponent(in string componentname) raises(NotFound);
+/*!
+Gets the description of a component of the catalog.
+*/
+ Component GetComponentInfo(in string componentName) raises(NotFound);
+
/*!
Reads a xml file and imports new components from this file.
New components replace existing components with the same name.
--- /dev/null
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SALOME_TestModuleCatalog.idl
+// Author :
+
+#ifndef _TestModuleCatalog_IDL
+#define _TestModuleCatalog_IDL
+
+#include "SALOME_Component.idl"
+
+module SuperVisionTest {
+
+ interface Adder ;
+
+ interface AddComponent : Engines::Component {
+
+// DataStreamPorts Addition istream(INTEGER, in, T), ostream(STRING, out, I)
+// DataStreamPorts Addition Ostream(FLOAT, out, T)
+ Adder Addition() ;
+ double Add( in double x , in double y , out double z ) ;
+ long Sigma( in long n ) ;
+ double LastResult() ;
+ };
+
+ interface Adder : Engines::Component {
+ double Add( in double x , in double y , out double z ) ;
+ double AddAndCompare( in double x , in double y , in Adder anOtherAdder,
+ out double z ) ;
+ void SetLastResult( in double z ) ;
+ void LastResult( out double z ) ;
+ };
+
+} ;
+
+#endif
@COMMENCE@
+EXPORT_PYSCRIPTS = SALOME_TestModuleCatalog.py
EXPORT_HEADERS = \
SALOME_ModuleCatalog_impl.hxx \
SALOME_ModuleCatalog_Acomponent_impl.hxx \
// Affect too the constraint and the interfaces of the component
// and the pathes 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::Component &C) : _Component(C)
{
BEGIN_OF("SALOME_ModuleCatalog_AcomponentImpl");
- SCRUTE(name);
- SCRUTE(username);
- SCRUTE(constraint);
- SCRUTE(componenttype);
- SCRUTE(componentmultistudy);
- SCRUTE(icone);
-
- // 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 = list_interfaces;
-
- // affect path prefixes
- // _pathes.resize(pathes.size());
- _pathes = pathes ;
END_OF("SALOME_ModuleCatalog_AcomponentImpl");
}
{
BEGIN_OF("~SALOME_ModuleCatalog_AcomponentImpl");
- // empty memory
- delete [] _component_name;
- delete [] _component_user_name;
- delete [] _constraint;
END_OF("~SALOME_ModuleCatalog_AcomponentImpl");
}
{
BEGIN_OF("GetInterfaceList");
- SALOME_ModuleCatalog::ListOfInterfaces_var _list = new SALOME_ModuleCatalog::ListOfInterfaces;
+ 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);
+ MESSAGE("The component " << _Component.name
+ << " contains " << _list[ind] << " as interface");
}
END_OF("GetInterfaceList");
BEGIN_OF("GetInterface");
SCRUTE(interfacename);
- 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;
+ 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)
+ SALOME_ModuleCatalog::DefinitionInterface &I
+ = _Component.interfaces[ind];
+
+ if (strcmp(interfacename, I.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++;
- }
-
+ duplicate(*_interface, I);
}
}
-
+
+ SCRUTE(_find);
if (!_find)
{
// The interface was not found, the exception should be thrown
string message = "The interface";
message += interfacename;
message += " of the component ";
- message += _component_name;
+ message += _Component.name;
message += " was not found";
MESSAGE(message)
throw SALOME_ModuleCatalog::NotFound(message.c_str());
}
- END_OF("GetInterfaceList");
- return _interface._retn();
+ END_OF("GetInterface");
+
+ return _interface;
}
BEGIN_OF("GetServiceList");
SCRUTE(interfacename);
- SALOME_ModuleCatalog::ListOfServices_var _list = new SALOME_ModuleCatalog::ListOfServices;
+ 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)
+ 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 = _list_interfaces[ind].interfaceservicelist.length();
+ 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(_list_interfaces[ind].interfaceservicelist[ind1].ServiceName);
- MESSAGE("The interface " << interfacename << " of the component " << _component_name << " contains " << _list[ind1] << " as a service")
+ _list[ind1] = CORBA::string_dup(I.interfaceservicelist[ind1].ServiceName);
+ MESSAGE("The interface " << interfacename << " of the component "
+ << _Component.name << " contains " << _list[ind1] << " as a service")
}
}
}
string message = "The interface";
message += interfacename;
message += " of the component ";
- message += _component_name;
+ message += _Component.name;
message += " was not found";
MESSAGE(message)
throw SALOME_ModuleCatalog::NotFound(message.c_str());
SCRUTE(interfacename);
SCRUTE(servicename);
- SALOME_ModuleCatalog::Service_var _service = new SALOME_ModuleCatalog::Service;
+ SALOME_ModuleCatalog::Service *service = new SALOME_ModuleCatalog::Service;
+
// Varaibles initialisation
bool _find = false ;
MESSAGE("");
// 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++)
{
SCRUTE(ind);
- SCRUTE(_list_interfaces[ind].interfacename);
+ SCRUTE(_Component.interfaces[ind].interfacename);
- if (strcmp(interfacename, _list_interfaces[ind].interfacename) == 0)
+ 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 < _list_interfaces[ind].interfaceservicelist.length() ; ind1++)
+ for (unsigned int ind1 = 0; ind1 < I.interfaceservicelist.length() ; ind1++)
{
+ SALOME_ModuleCatalog::Service &S = I.interfaceservicelist[ind1];
SCRUTE(ind1);
- SCRUTE(_list_interfaces[ind].interfaceservicelist[ind1].ServiceName);
+ SCRUTE(S.ServiceName);
- if (strcmp(servicename, _list_interfaces[ind].interfaceservicelist[ind1].ServiceName) == 0)
+ if (strcmp(servicename, S.ServiceName) == 0)
{
// Wanted Service
// Affect the service to be returned
_find = true ;
- _service = _duplicate_service(_list_interfaces[ind].interfaceservicelist[ind1]);
+ duplicate(*service, S);
}
}
message += " of the interface ";
message += interfacename;
message += " of the component ";
- message += _component_name;
+ message += _Component.name;
message += " was not found";
MESSAGE(message)
throw SALOME_ModuleCatalog::NotFound(message.c_str());
}
END_OF("GetService");
- return _service._retn();
+ return service;
}
//----------------------------------------------------------------------
BEGIN_OF("GetDefaultService");
SCRUTE(interfacename);
- SALOME_ModuleCatalog::Service_var _service = new SALOME_ModuleCatalog::Service;
+ 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)
+ 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 < _list_interfaces[ind].interfaceservicelist.length() ; ind1++)
+ for (unsigned int ind1 = 0; ind1 < _Component.interfaces[ind].interfaceservicelist.length() ; ind1++)
{
- if (_list_interfaces[ind].interfaceservicelist[ind1].Servicebydefault)
+ if (_Component.interfaces[ind].interfaceservicelist[ind1].Servicebydefault)
{
// Default Service
// affect the service to be returned
_find = true ;
- _service = _duplicate_service(_list_interfaces[ind].interfaceservicelist[ind1]);
+ duplicate(*_service, _Component.interfaces[ind].interfaceservicelist[ind1]);
}
}
string message = "The default service of the interface ";
message += interfacename;
message += " of the component ";
- message += _component_name;
+ message += _Component.name;
message += " was not found";
MESSAGE(message)
throw SALOME_ModuleCatalog::NotFound(message.c_str());
}
END_OF("GetDefaultService");
- return _service._retn();
+ return _service;
}
//----------------------------------------------------------------------
BEGIN_OF("GetPathPrefix");
SCRUTE(machinename);
- // 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 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
- string message = "The computer ";
- message += machinename;
- message += " was not found in the catalog associated to the component ";
- message += _component_name;
- MESSAGE(message)
- throw SALOME_ModuleCatalog::NotFound(message.c_str());
- }
+// // Variables initialisation
+// char* _path = NULL;
+// bool _find = false ;
+
+// // Parse all the path prefixes
+// // looking for the wanted computer
+// for (unsigned int ind = 0 ; ind < _Component.PathPrefixes.size() ; 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
+// string message = "The computer ";
+// message += machinename;
+// message += " was not found in the catalog associated to the component ";
+// message += _Component.name;
+// MESSAGE(message)
+// throw SALOME_ModuleCatalog::NotFound(message.c_str());
+// }
END_OF("GetPathPrefix");
- return _path;
+ return NULL;
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
char* SALOME_ModuleCatalog_AcomponentImpl::constraint()
{
- return CORBA::string_dup(_constraint);
+ return CORBA::string_dup(_Component.constraint);
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
char* SALOME_ModuleCatalog_AcomponentImpl::componentname()
{
- return CORBA::string_dup(_component_name);
+ return CORBA::string_dup(_Component.name);
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
char* SALOME_ModuleCatalog_AcomponentImpl::componentusername()
{
- return CORBA::string_dup(_component_user_name);
+ return CORBA::string_dup(_Component.username);
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
CORBA::Boolean SALOME_ModuleCatalog_AcomponentImpl::multistudy()
{
- return _componentmultistudy ;
+ return _Component.multistudy ;
}
//----------------------------------------------------------------------
SALOME_ModuleCatalog::ComponentType
SALOME_ModuleCatalog_AcomponentImpl::component_type()
{
- return _componenttype;
+ return _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)
+/// /----------------------------------------------------------------------
+// // Function : _duplicate_service
+// // Purpose : duplicate a service
+// //----------------------------------------------------------------------
+// void
+// SALOME_ModuleCatalog_AcomponentImpl::_duplicate_service
+// (SALOME_ModuleCatalog::Service & S_out,
+// const SALOME_ModuleCatalog::Service & S_in)
+// {
+// BEGIN_OF("_duplicate_service");
+
+// unsigned int _length;
+
+// MESSAGE("service name : " << S_in.ServiceName);
+
+// // service name
+// S_out.ServiceName = CORBA::string_dup(S_in.ServiceName);
+// // service by default
+// _service->Servicebydefault = S_in.Servicebydefault;
+
+// // in Parameters service
+// _length = S_in.ServiceinParameter.length();
+
+// if (_length>0) {
+// _service->ServiceinParameter.length(_length);
+// SCRUTE(_length);
+
+// for(unsigned int ind = 0; ind < _length; ind++)
+// {
+// SALOME_ModuleCatalog::ServicesParameter & P_in
+// = service.ServiceinParameter[ind];
+// SALOME_ModuleCatalog::ServicesParameter & P_out
+// = _service->ServiceinParameter[ind];
+
+// SCRUTE(P_in.Parametername);
+// // in Parameter type
+// P_out.Parametertype = CORBA::string_dup(P_in.Parametertype);
+// // in Parameter name
+// P_out.Parametername = CORBA::string_dup(P_in.Parametername);
+// }
+// }
+
+// // out Parameters service
+// _length = service.ServiceoutParameter.length();
+
+// if (_length>0) {
+// _service->ServiceoutParameter.length(_length);
+// SCRUTE(_length);
+
+// for(unsigned int ind = 0; ind < _length; ind++)
+// {
+// SALOME_ModuleCatalog::ServicesParameter & P_in
+// = service.ServiceoutParameter[ind];
+// SALOME_ModuleCatalog::ServicesParameter & P_out
+// = _service->ServiceoutParameter[ind];
+
+// // out Parameter type
+// P_out.Parametertype = CORBA::string_dup(P_in.Parametertype);
+// // out Parameter name
+// P_out.Parametername = CORBA::string_dup(P_in.Parametername);
+// }
+// }
+
+// // in DataStreamParameters service
+// _length = service.ServiceinDataStreamParameter.length();
+// SCRUTE(_length);
+
+// if (_length > 0) {
+
+// _service->ServiceinDataStreamParameter.length(_length);
+
+// for(unsigned int ind = 0; ind < _length; ind++)
+// {
+// SALOME_ModuleCatalog::ServicesDataStreamParameter & P_in
+// = service.ServiceinDataStreamParameter[ind];
+// SALOME_ModuleCatalog::ServicesDataStreamParameter & P_out
+// = _service->ServiceinDataStreamParameter[ind];
+
+// SCRUTE(P_in.Parametername);
+// // in Parameter type
+// P_out.Parametertype = P_in.Parametertype;
+// // in Parameter name
+// P_out.Parametername = CORBA::string_dup(P_in.Parametername);
+// // out Parameter dependency
+// P_out.Parameterdependency = P_in.Parameterdependency;
+// }
+// }
+
+// // out Parameters service
+// _length = service.ServiceoutDataStreamParameter.length();
+// SCRUTE(_length);
+// return _service;
+
+// if (_length > 0) {
+// _service->ServiceoutDataStreamParameter.length(_length);
+// SCRUTE(_length);
+
+// for(unsigned int ind = 0; ind < _length; ind++)
+// {
+// SALOME_ModuleCatalog::ServicesDataStreamParameter & P_in
+// = service.ServiceoutDataStreamParameter[ind];
+// SALOME_ModuleCatalog::ServicesDataStreamParameter & P_out
+// = _service->ServiceoutDataStreamParameter[ind];
+
+// // out Parameter type
+// P_out.Parametertype = P_in.Parametertype;
+// // out Parameter name
+// P_out.Parametername = CORBA::string_dup(P_in.Parametername);
+// // out Parameter dependency
+// P_out.Parameterdependency = P_in.Parameterdependency;
+// }
+// }
+
+// MESSAGE("OK");
+// END_OF("_duplicate_service");
+// return _service;
+// }
+
+
+// //----------------------------------------------------------------------
+// // Function : _duplicate_interface
+// // Purpose : duplicate an interface
+// //----------------------------------------------------------------------
+// SALOME_ModuleCatalog::DefinitionInterface_var
+// SALOME_ModuleCatalog_AcomponentImpl::_duplicate_interface
+// (SALOME_ModuleCatalog::DefinitionInterface & interface)
+// {
+// BEGIN_OF("_duplicate_interface");
+
+// unsigned int _length;
+// SALOME_ModuleCatalog::DefinitionInterface_var _interface
+// = new SALOME_ModuleCatalog::DefinitionInterface;
+
+// // Affect the name of the interface
+// _interface->interfacename = interface.interfacename;
+
+// // Affect each service of the wanted interface
+
+// _length = interface.interfaceservicelist.length();
+// _interface->interfaceservicelist.length(_length);
+
+// for (unsigned int ind1 = 0; ind1 < _length; ind1++)
+// {
+// _interface->interfaceservicelist[ind1]
+// = _duplicate_service(interface.interfaceservicelist[ind1]);
+// }
+
+// END_OF("_duplicate_interface");
+// return _interface;
+// }
+
+void SALOME_ModuleCatalog_AcomponentImpl::duplicate
+(SALOME_ModuleCatalog::ServicesParameter & P_out,
+ const SALOME_ModuleCatalog::ServicesParameter &P_in)
+{
+ // duplicate parameter name
+ P_out.Parametername = CORBA::string_dup(P_in.Parametername);
+
+ // duplicate parameter type
+ P_out.Parametertype = CORBA::string_dup(P_in.Parametertype);
+}
+
+
+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;
+
+ // duplicate parameter dependency
+ P_out.Parameterdependency = P_in.Parameterdependency;
+
+}
+
+void SALOME_ModuleCatalog_AcomponentImpl::duplicate
+(SALOME_ModuleCatalog::Service & S_out,
+ const SALOME_ModuleCatalog::Service &S_in)
{
- BEGIN_OF("_duplicate_service");
+ // 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;
- SALOME_ModuleCatalog::Service_var _service = new SALOME_ModuleCatalog::Service;
- // service name
- MESSAGE("service name : " << service.ServiceName);
- _service->ServiceName = CORBA::string_dup(service.ServiceName);
- // service by default
- _service->Servicebydefault = service.Servicebydefault;
+ // duplicate in Parameters
+ _length = S_in.ServiceinParameter.length();
+ S_out.ServiceinParameter.length(_length);
- MESSAGE("");
- // in Parameters service
- _length = service.ServiceinParameter.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();
SCRUTE(_length);
- for(unsigned int ind = 0; ind < _length; ind++)
- {
- SCRUTE(service.ServiceinParameter[ind].Parametername);
- _service->ServiceinParameter.length(_length);
- // 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);
- }
+ S_out.ServiceoutDataStreamParameter.length(_length);
+
+ for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
+ duplicate(S_out.ServiceoutDataStreamParameter[ind2],
+ S_in.ServiceoutDataStreamParameter[ind2]);
+}
- // out Parameters service
- _length = service.ServiceoutParameter.length();
- SCRUTE(_length);
- for(unsigned int ind = 0; ind < _length; ind++)
- {
- SCRUTE(service.ServiceoutParameter[ind].Parametername);
- _service->ServiceoutParameter.length(_length);
- // 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);
- }
-
- // in DataStreamParameters service
- _length = service.ServiceinDataStreamParameter.length();
- SCRUTE(_length);
- for(unsigned int ind = 0; ind < _length; ind++)
- {
- SCRUTE(service.ServiceinDataStreamParameter[ind].Parametername);
- _service->ServiceinDataStreamParameter.length(_length);
- // in DataStreamParameter type
- _service->ServiceinDataStreamParameter[ind].Parametertype
- = service.ServiceinDataStreamParameter[ind].Parametertype;
- // in DataStreamParameter dependency
- _service->ServiceinDataStreamParameter[ind].Parameterdependency
- = service.ServiceinDataStreamParameter[ind].Parameterdependency;
- // in DataStreamParameter name
- _service->ServiceinDataStreamParameter[ind].Parametername
- = CORBA::string_dup(service.ServiceinDataStreamParameter[ind].Parametername);
- }
- // out DataStreamParameters service
- _length = service.ServiceoutDataStreamParameter.length();
+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();
SCRUTE(_length);
- for(unsigned int ind = 0; ind < _length; ind++)
- {
- SCRUTE(service.ServiceoutDataStreamParameter[ind].Parametername);
- _service->ServiceoutDataStreamParameter.length(_length);
- // out DataStreamParameter type
- _service->ServiceoutDataStreamParameter[ind].Parametertype
- = service.ServiceoutDataStreamParameter[ind].Parametertype;
- // in DataStreamParameter dependency
- _service->ServiceoutDataStreamParameter[ind].Parameterdependency
- = service.ServiceoutDataStreamParameter[ind].Parameterdependency;
- // out DataStreamParameter name
- _service->ServiceoutDataStreamParameter[ind].Parametername
- = CORBA::string_dup(service.ServiceoutDataStreamParameter[ind].Parametername);
- }
-
- END_OF("_duplicate_service");
- return _service;
+ I_out.interfaceservicelist.length(_length);
+
+ for (unsigned int ind1 = 0; ind1 < _length ; ind1 ++)
+ duplicate(I_out.interfaceservicelist[ind1],
+ I_in.interfaceservicelist[ind1]);
}
#define ACOMPONENT_IMPL_H
#include "utilities.h"
-#include "PathPrefix.hxx"
+#include "SALOME_ModuleCatalog_Parser.hxx"
#include <SALOMEconfig.h>
+
#include CORBA_SERVER_HEADER(SALOME_ModuleCatalog)
class SALOME_ModuleCatalog_AcomponentImpl: public POA_SALOME_ModuleCatalog::Acomponent,
{
public:
//! standard constructor
- 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::Component &C);
//! standard destructor
virtual ~SALOME_ModuleCatalog_AcomponentImpl();
virtual char* component_icone();
private :
- char* _component_name ;
- char* _component_user_name ;
- char* _constraint;
- char* _icone;
- SALOME_ModuleCatalog::ComponentType _componenttype;
- CORBA::Boolean _componentmultistudy;
- SALOME_ModuleCatalog::ListOfDefInterface _list_interfaces;
- ListOfPathPrefix _pathes ;
-
+
+ SALOME_ModuleCatalog::Component _Component;
+
+ //! method to duplicate an interface
+ /*!
+ \param service SALOME_ModuleCatalog::DefinitionInterface arguments
+ \return the interface
+ */
+ void duplicate(SALOME_ModuleCatalog::DefinitionInterface &I_out,
+ const SALOME_ModuleCatalog::DefinitionInterface &I_in);
//! method to duplicate a service
/*!
\param service SALOME_ModuleCatalog::Service arguments
\return the service
*/
- virtual SALOME_ModuleCatalog::Service_var _duplicate_service(SALOME_ModuleCatalog::Service & service);
+ void duplicate(SALOME_ModuleCatalog::Service & S_out,
+ const SALOME_ModuleCatalog::Service &S_in);
+
+ //! method to duplicate a parameter
+ /*!
+ \param parameter SALOME_ModuleCatalog::ServicesParameter arguments
+ \return the parameter
+ */
+ void duplicate(SALOME_ModuleCatalog::ServicesParameter & P_out,
+ const SALOME_ModuleCatalog::ServicesParameter & P_in);
+
+ //! method to duplicate a parameter
+ /*!
+ \param parameter SALOME_ModuleCatalog::ServicesDataStreamParameter arguments
+ \return the parameter
+ */
+ void duplicate(SALOME_ModuleCatalog::ServicesDataStreamParameter & P_out,
+ const SALOME_ModuleCatalog::ServicesDataStreamParameter &P_in);
+
};
+
#endif // ACOMPONENT_IMPL_H
// tag test_component_name
if((qName.compare(test_component_name)==0)) {
- _aModule.parserComponentName = content ;
+ _aModule.name = content ;
return true;
}
// tag test_component_username
if((qName.compare(test_component_username)==0)) {
- _aModule.parserComponentUsername = content ;
+ _aModule.username = content ;
return true;
}
if ((content.compare("MESH") == 0) ||
(content.compare("Mesh") == 0) ||
(content.compare("mesh") == 0))
- _aModule.parserComponentType = MESH ;
+ _aModule.type = MESH ;
else if((content.compare("MED") == 0) ||
(content.compare("Med") == 0) ||
(content.compare("med") == 0))
- _aModule.parserComponentType = Med ;
+ _aModule.type = Med ;
else if((content.compare("GEOM") == 0) ||
(content.compare("Geom") == 0) ||
(content.compare("geom") == 0))
- _aModule.parserComponentType = GEOM ;
+ _aModule.type = GEOM ;
else if((content.compare("SOLVER") == 0) ||
(content.compare("Solver") == 0) ||
(content.compare("solver") == 0))
- _aModule.parserComponentType = SOLVER ;
+ _aModule.type = SOLVER ;
else if((content.compare("SUPERV") == 0) ||
(content.compare("Superv") == 0) ||
(content.compare("Supervision") == 0) ||
(content.compare("superv") == 0))
- _aModule.parserComponentType = SUPERV ;
+ _aModule.type = SUPERV ;
else if((content.compare("DATA") == 0) ||
(content.compare("Data") == 0) ||
(content.compare("data") == 0))
- _aModule.parserComponentType = DATA ;
+ _aModule.type = DATA ;
else if((content.compare("VISU") == 0) ||
(content.compare("Visu") == 0) ||
(content.compare("visu") == 0))
- _aModule.parserComponentType = VISU ;
+ _aModule.type = VISU ;
else if((content.compare("OTHER") == 0) ||
(content.compare("Other") == 0) ||
(content.compare("other") == 0))
- _aModule.parserComponentType = OTHER ;
+ _aModule.type = OTHER ;
else
// If it'not in all theses cases, the type is affected to OTHER
- _aModule.parserComponentType = OTHER ;
+ _aModule.type = OTHER ;
return true;
}
// tag test_component_multistudy
if((qName.compare(test_component_multistudy)==0)) {
- _aModule.parserComponentMultistudy = atoi(content.c_str()) ;
+ _aModule.multistudy = atoi(content.c_str()) ;
return true;
}
// tag test_component_icon
if((qName.compare(test_component_icon)==0)) {
- _aModule.parserComponentIcon = content ;
+ _aModule.icon = content ;
return true;
}
// tag test_interface_name
if ((qName.compare(test_interface_name)==0)) {
- _aInterface.parserInterfaceName = content ;
+ _aInterface.name = content ;
return true;
}
// tag test_service_name
if ((qName.compare(test_service_name)==0)) {
- _aService.parserServiceName = content ;
+ _aService.name = content ;
return true;
}
//tag test_defaultservice
if ((qName.compare(test_defaultservice)==0)) {
- _aService.parserServiceByDefault = atoi(content.c_str()) ;
+ _aService.byDefault = atoi(content.c_str()) ;
return true;
}
// tag test_inDataStreamParameter_type
if ((qName.compare(test_inDataStreamParameter_type)==0)) {
if (grandparent.compare(test_inDataStreamParameter_list) == 0)
- _inDataStreamParam.parserParamType = content ;
+ _inDataStreamParam.type = content ;
else
- _inParam.parserParamType = content ;
+ _inParam.type = content ;
return true;
}
// tag test_inParameter_type
if ((qName.compare(test_inParameter_type)==0)) {
if (grandparent.compare(test_inDataStreamParameter_list) == 0)
- _inDataStreamParam.parserParamType = content ;
+ _inDataStreamParam.type = content ;
else
- _inParam.parserParamType = content ;
+ _inParam.type = content ;
return true;
}
//tag test_inDataStreamParameter_name
if ((qName.compare(test_inDataStreamParameter_name)==0)) {
if (grandparent.compare(test_inDataStreamParameter_list) == 0)
- _inDataStreamParam.parserParamName = content ;
+ _inDataStreamParam.name = content ;
else
- _inParam.parserParamName = content ;
+ _inParam.name = content ;
return true;
}
SCRUTE(parent);
SCRUTE(grandparent);
if (grandparent.compare(test_inDataStreamParameter_list) == 0)
- _inDataStreamParam.parserParamName = content ;
+ _inDataStreamParam.name = content ;
else
- _inParam.parserParamName = content ;
+ _inParam.name = content ;
return true;
}
//tag test_inDataStreamParameter_dependency
if ((qName.compare(test_inDataStreamParameter_dependency)==0)) {
- _inDataStreamParam.parserParamDependency = content ;
+ _inDataStreamParam.dependency = content ;
return true;
}
{
if (parent.compare(test_inParameter_list)==0) {
- MESSAGE("add inParameter : " << _inParam.parserParamName);
+ MESSAGE("add inParameter : " << _inParam.name);
_inParamList.push_back(_inParam) ;
// Empty temporary structures
- _inParam.parserParamType = "";
- _inParam.parserParamName = "";
+ _inParam.type = "";
+ _inParam.name = "";
}
else if ((qName.compare(test_inDataStreamParameter)==0)) {
- MESSAGE("add inDataStreamParameter : " << _inDataStreamParam.parserParamName);
+ MESSAGE("add inDataStreamParameter : " << _inDataStreamParam.name);
_inDataStreamParamList.push_back(_inDataStreamParam) ;
// Empty temporary structures
- _inDataStreamParam.parserParamType = "";
- _inDataStreamParam.parserParamName = "";
- _inDataStreamParam.parserParamDependency = "";
+ _inDataStreamParam.type = "";
+ _inDataStreamParam.name = "";
+ _inDataStreamParam.dependency = "";
}
return true;
}
if((qName.compare(test_inParameter_list)==0))
{
SCRUTE(_inParamList.size());
- _aService.parserServiceInParameter = _inParamList;
+ _aService.inParameters = _inParamList;
_inParamList.resize(0);
return true;
}
if((qName.compare(test_inDataStreamParameter_list)==0))
{
SCRUTE(_inDataStreamParamList.size());
- _aService.parserServiceInDataStreamParameter = _inDataStreamParamList;
+ _aService.inDataStreamParameters = _inDataStreamParamList;
_inDataStreamParamList.resize(0);
}
//tag test_outDataStreamParameter_list
if((qName.compare(test_outDataStreamParameter_list)==0))
{
SCRUTE(_outDataStreamParamList.size());
- _aService.parserServiceOutDataStreamParameter = _outDataStreamParamList;
+ _aService.outDataStreamParameters = _outDataStreamParamList;
_outDataStreamParamList.resize(0);
return true;
}
// tag test_outParameter_type
if ((qName.compare(test_outParameter_type)==0)) {
if (grandparent.compare(test_outDataStreamParameter_list) == 0)
- _outDataStreamParam.parserParamType = content ;
+ _outDataStreamParam.type = content ;
else
- _outParam.parserParamType = content ;
+ _outParam.type = content ;
return true;
}
// tag test_outDataStreamParameter_type
if ((qName.compare(test_outDataStreamParameter_type)==0)) {
if (grandparent.compare(test_outDataStreamParameter_list) == 0)
- _outDataStreamParam.parserParamType = content ;
+ _outDataStreamParam.type = content ;
else
- _outParam.parserParamType = content ;
+ _outParam.type = content ;
return true;
}
//tag test_outParameter_name
if ((qName.compare(test_outParameter_name)==0)) {
if (grandparent.compare(test_outDataStreamParameter_list) == 0)
- _outDataStreamParam.parserParamName = content ;
+ _outDataStreamParam.name = content ;
else
- _outParam.parserParamName = content ;
+ _outParam.name = content ;
return true;
}
SCRUTE(grandparent);
SCRUTE(test_outDataStreamParameter_list);
if (grandparent.compare(test_outDataStreamParameter_list) == 0)
- _outDataStreamParam.parserParamName = content ;
+ _outDataStreamParam.name = content ;
else
- _outParam.parserParamName = content ;
+ _outParam.name = content ;
return true;
}
//tag test_outParameter_dependency
if ((qName.compare(test_outDataStreamParameter_dependency)==0)) {
- _outDataStreamParam.parserParamDependency = content ;
+ _outDataStreamParam.dependency = content ;
return true;
}
{
if (parent.compare(test_outParameter_list)==0) {
- MESSAGE("add outParameter : " << _outParam.parserParamName);
+ MESSAGE("add outParameter : " << _outParam.name);
_outParamList.push_back(_outParam) ;
// Empty temporary structures
- _outParam.parserParamType = "";
- _outParam.parserParamName = "";
+ _outParam.type = "";
+ _outParam.name = "";
}
else if ((qName.compare(test_outDataStreamParameter)==0)) {
- MESSAGE("add outDataStreamParameter : " << _outDataStreamParam.parserParamName);
+ MESSAGE("add outDataStreamParameter : " << _outDataStreamParam.name);
_outDataStreamParamList.push_back(_outDataStreamParam) ;
// Empty temporary structures
- _outDataStreamParam.parserParamType = "";
- _outDataStreamParam.parserParamName = "";
- _outDataStreamParam.parserParamDependency = "";
+ _outDataStreamParam.type = "";
+ _outDataStreamParam.name = "";
+ _outDataStreamParam.dependency = "";
}
return true;
}
if((qName.compare(test_outParameter_list)==0))
{
SCRUTE(_outParamList.size());
- _aService.parserServiceOutParameter = _outParamList;
+ _aService.outParameters = _outParamList;
_outParamList.resize(0);
return true;
}
_serviceList.push_back(_aService);
// Empty temporary structures
- _aService.parserServiceName = "";
- _aService.parserServiceInParameter.resize(0);
- _aService.parserServiceOutParameter.resize(0);
- _aService.parserServiceInDataStreamParameter.resize(0);
- _aService.parserServiceOutDataStreamParameter.resize(0);
+ _aService.name = "";
+ _aService.inParameters.resize(0);
+ _aService.outParameters.resize(0);
+ _aService.inDataStreamParameters.resize(0);
+ _aService.outDataStreamParameters.resize(0);
}
// tag test_service_list
if((qName.compare(test_service_list)==0))
{
- _aInterface.parserInterfaceServiceList = _serviceList ;
+ _aInterface.services = _serviceList ;
// Empty temporary structures
_serviceList.resize(0);
_interfaceList.push_back(_aInterface);
- _aInterface.parserInterfaceName ="";
- _aInterface.parserInterfaceServiceList.resize(0);
+ _aInterface.name ="";
+ _aInterface.services.resize(0);
}
//tag test_interface_list
if((qName.compare(test_interface_list)==0))
{
- _aModule.parserListInterface = _interfaceList ;
+ _aModule.interfaces = _interfaceList ;
_interfaceList.resize(0);
}
//tag test_constraint
if((qName.compare(test_constraint)==0))
- _aModule.parserConstraint = content ;
+ _aModule.constraint = content ;
// tag test_component
if((qName.compare(test_component)==0))
_moduleList.push_back(_aModule) ;
// Empty temporary structures
- _aModule.parserComponentName = "";
- _aModule.parserConstraint = "";
- _aModule.parserComponentIcon="";
- _aModule.parserListInterface.resize(0);
+ _aModule.name = "";
+ _aModule.constraint = "";
+ _aModule.icon="";
+ _aModule.interfaces.resize(0);
}
return true;
#include <fstream>
bool SALOME_ModuleCatalog_Handler::endDocument()
{
- ofstream f("/tmp/logs/tajchman/xxx.log", std::ofstream::app);
+ ofstream f("/tmp/logs/xxx.log", std::ofstream::app);
f << "---------------------------------------------------------" << std::endl;
BEGIN_OF("endDocument");
//_pathlist
#include <qxml.h>
#include <string>
#include <stack>
+#include <map>
class SALOME_ModuleCatalog_Handler : public QXmlDefaultHandler
{
ParserComponent _aModule;
- ListOfDefinitionInterface _interfaceList;
- ParserDefInterface _aInterface;
- ListOfParserServices _serviceList;
- ParserService _aService;
- ParserServParam _inParam;
- ParserServParam _outParam;
- ParserServDataStreamParam _inDataStreamParam;
- ParserServDataStreamParam _outDataStreamParam;
- ListOfParserServicesParameter _inParamList;
- ListOfParserServicesParameter _outParamList;
- ListOfParserServicesDataStreamParameter _inDataStreamParamList;
- ListOfParserServicesDataStreamParameter _outDataStreamParamList;
+ ParserInterfaces _interfaceList;
+ ParserInterface _aInterface;
+
+ ParserServices _serviceList;
+ ParserService _aService;
+
+ ParserParameters _inParamList;
+ ParserParameter _inParam;
+
+ ParserParameters _outParamList;
+ ParserParameter _outParam;
+
+ ParserDataStreamParameters _inDataStreamParamList;
+ ParserDataStreamParameter _inDataStreamParam;
+
+ ParserDataStreamParameters _outDataStreamParamList;
+ ParserDataStreamParameter _outDataStreamParam;
std::stack<QString> _xml_pile;
};
std::vector<std::string> listOfComputer ;
};
-typedef std::vector<ParserPathPrefix> ListOfParserPathPrefix ;
+typedef std::vector<ParserPathPrefix> ParserPathPrefixes ;
enum ParserComponentType {GEOM, MESH, Med, SOLVER, DATA, VISU, SUPERV, OTHER} ;
-struct ParserServParam
+struct ParserParameter
{
- std::string parserParamType;
- std::string parserParamName;
+ std::string type;
+ std::string name;
} ;
-struct ParserServDataStreamParam
+struct ParserDataStreamParameter
{
- std::string parserParamType;
- std::string parserParamName;
- std::string parserParamDependency;
+ std::string type;
+ std::string name;
+ std::string dependency;
} ;
-typedef std::vector<ParserServParam> ListOfParserServicesParameter;
-typedef std::vector<ParserServDataStreamParam> ListOfParserServicesDataStreamParameter;
+typedef std::vector<ParserParameter> ParserParameters;
+typedef std::vector<ParserDataStreamParameter> ParserDataStreamParameters;
struct ParserService
{
- std::string parserServiceName;
- ListOfParserServicesParameter parserServiceInParameter;
- ListOfParserServicesParameter parserServiceOutParameter;
- ListOfParserServicesDataStreamParameter parserServiceInDataStreamParameter;
- ListOfParserServicesDataStreamParameter parserServiceOutDataStreamParameter;
- bool parserServiceByDefault;
+ std::string name;
+ ParserParameters inParameters;
+ ParserParameters outParameters;
+ ParserDataStreamParameters inDataStreamParameters;
+ ParserDataStreamParameters outDataStreamParameters;
+ bool byDefault;
} ;
-typedef std::vector<ParserService> ListOfParserServices ;
+typedef std::vector<ParserService> ParserServices ;
-struct ParserDefInterface
+struct ParserInterface
{
- std::string parserInterfaceName ;
- ListOfParserServices parserInterfaceServiceList ;
+ std::string name ;
+ ParserServices services ;
} ;
-typedef std::vector<ParserDefInterface> ListOfDefinitionInterface;
+typedef std::vector<ParserInterface> ParserInterfaces;
struct ParserComponent
{
- std::string parserComponentName;
- std::string parserComponentUsername;
- ParserComponentType parserComponentType;
- bool parserComponentMultistudy ;
- std::string parserComponentIcon;
- ListOfDefinitionInterface parserListInterface;
- std::string parserConstraint ;
+ std::string name;
+ std::string username;
+ ParserComponentType type;
+ bool multistudy;
+ std::string icon;
+ std::string constraint;
+ ParserInterfaces interfaces;
+ ParserPathPrefixes prefixes;
};
-typedef std::vector<ParserComponent> ListOfParserComponent ;
+typedef std::vector<ParserComponent> ParserComponents ;
#ifdef WRITE_CATA_COMPONENT
-// contains all the paths and the computers defined in the catalog
-ListOfParserPathPrefix _pathList;
+// contains all the paths and the computers defined in the catalog
+ ParserPathPrefixes _pathList;
// contains all the modules defined in the catalog
-ListOfParserComponent _moduleList;
+ ParserComponents _moduleList;
#else
-extern ListOfParserPathPrefix _pathList;
-extern ListOfParserComponent _moduleList;
+extern ParserPathPrefixes _pathList;
+extern ParserComponents _moduleList;
#endif
#include "SALOME_ModuleCatalog_Parser_IO.hxx"
#include <string>
-std::ostream & operator<< (std::ostream & f, const ParserServParam & P)
+std::ostream & operator<< (std::ostream & f, const ParserParameter & P)
{
- f << " name : " << P.parserParamName << std::endl;
- f << " type : " << P.parserParamType << std::endl;
+ f << " name : " << P.name << std::endl;
+ f << " type : " << P.type << std::endl;
return f;
}
std::ostream & operator<< (std::ostream & f,
- const ParserServDataStreamParam & P)
+ const ParserDataStreamParameter & P)
{
- f << " name : " << P.parserParamName << std::endl;
- f << " type : " << P.parserParamType << std::endl;
- f << " dependency : " << P.parserParamDependency << std::endl;
+ f << " name : " << P.name << std::endl;
+ f << " type : " << P.type << std::endl;
+ f << " dependency : " << P.dependency << std::endl;
return f;
}
const ParserService & S)
{
int i, n;
- f << " name : " << S.parserServiceName << std::endl;
- f << " default : " << (S.parserServiceByDefault ? "yes" : "no")
+ f << " name : " << S.name << std::endl;
+ f << " default : " << (S.byDefault ? "yes" : "no")
<< std::endl;
- n = S.parserServiceInParameter.size();
+ n = S.inParameters.size();
f << " in parameters : " << n << std::endl;
for (i=0; i<n; i++)
- f << S.parserServiceInParameter[i] << std::endl;
+ f << S.inParameters[i] << std::endl;
if (n == 0) f << std::endl;
- n = S.parserServiceInDataStreamParameter.size();
+ n = S.inDataStreamParameters.size();
f << " in DataStream parameters : " << n << std::endl;
for (i=0; i<n; i++)
- f << S.parserServiceInDataStreamParameter[i] << std::endl;
+ f << S.inDataStreamParameters[i] << std::endl;
if (n == 0) f << std::endl;
- n = S.parserServiceOutParameter.size();
+ n = S.outParameters.size();
f << " out parameters : " << n << std::endl;
for (i=0; i<n; i++)
- f << S.parserServiceOutParameter[i] << std::endl;
+ f << S.outParameters[i] << std::endl;
if (n == 0) f << std::endl;
- n = S.parserServiceOutDataStreamParameter.size();
+ n = S.outDataStreamParameters.size();
f << " out DataStream parameters : " << n << std::endl;
for (i=0; i<n; i++)
- f << S.parserServiceOutDataStreamParameter[i] << std::endl;
+ f << S.outDataStreamParameters[i] << std::endl;
if (n == 0) f << std::endl;
return f;
}
std::ostream & operator<< (std::ostream & f,
- const ParserDefInterface & I)
+ const ParserInterface & I)
{
int j, n;
- f << " name : " << I.parserInterfaceName << std::endl;
+ f << " name : " << I.name << std::endl;
- n = I.parserInterfaceServiceList.size();
+ n = I.services.size();
f << " services : " << n << std::endl;
for (j=0; j<n; j++) {
- std::cerr << I.parserInterfaceServiceList[j].parserServiceName << std::endl;
- f << I.parserInterfaceServiceList[j] << std::endl;
+ std::cerr << I.services[j].name << std::endl;
+ f << I.services[j] << std::endl;
}
return f;
{
int j, n;
f << std::endl
- << " name : " << C.parserComponentName << std::endl;
- f << " user name : " << C.parserComponentUsername << std::endl;
- f << " type : " << C.parserComponentType << std::endl;
- f << " multistudy : " << (C.parserComponentMultistudy ? "yes" : "no")
+ << " name : " << C.name << std::endl;
+ f << " user name : " << C.username << std::endl;
+ f << " type : " << C.type << std::endl;
+ f << " multistudy : " << (C.multistudy ? "yes" : "no")
<< std::endl;
- f << " icon : " << C.parserComponentIcon << std::endl;
- f << " constraint : " << C.parserConstraint << std::endl;
+ f << " icon : " << C.icon << std::endl;
+ f << " constraint : " << C.constraint << std::endl;
- n = C.parserListInterface.size();
+ n = C.interfaces.size();
f << " interfaces : " << n << std::endl;
for (j=0; j<n; j++)
- f << C.parserListInterface[j] << std::endl;
+ f << C.interfaces[j] << std::endl;
if (n == 0) f << std::endl;
return f;
#include <iostream>
std::ostream & operator<< (std::ostream & f,
- const ParserServParam & P);
+ const ParserParameter & P);
std::ostream & operator<< (std::ostream & f,
- const ParserServDataStreamParam & P);
+ const ParserDataStreamParameter & P);
std::ostream & operator<< (std::ostream & f,
const ParserService & S);
std::ostream & operator<< (std::ostream & f,
- const ParserDefInterface & I);
+ const ParserInterface & I);
std::ostream & operator<< (std::ostream & f,
const ParserComponent & C);
std::ostream & operator<< (std::ostream & f,
- const ParserComponentType & T);
+ const ParserComponentType & T);
#endif
{
MESSAGE("Catalog creation");
+ // Conversion rules for component types
+ ComponentTypeConvert[GEOM]
+ = SALOME_ModuleCatalog::GEOM;
+ ComponentTypeConvert[MESH]
+ = SALOME_ModuleCatalog::MESH;
+ ComponentTypeConvert[Med]
+ = SALOME_ModuleCatalog::Med;
+ ComponentTypeConvert[SOLVER]
+ = SALOME_ModuleCatalog::SOLVER;
+ ComponentTypeConvert[DATA]
+ = SALOME_ModuleCatalog::DATA;
+ ComponentTypeConvert[VISU]
+ = SALOME_ModuleCatalog::VISU;
+ ComponentTypeConvert[SUPERV]
+ = SALOME_ModuleCatalog::SUPERV;
+ ComponentTypeConvert[OTHER]
+ = SALOME_ModuleCatalog::OTHER;
+
+ // Conversion rules for datastream parameters type and dependency
+ DataStreamTypeConvert["UNKNOWN"]
+ = SALOME_ModuleCatalog::DATASTREAM_UNKNOWN;
+ DataStreamTypeConvert["INTEGER"]
+ = SALOME_ModuleCatalog::DATASTREAM_INTEGER;
+ DataStreamTypeConvert["FLOAT"]
+ = SALOME_ModuleCatalog::DATASTREAM_FLOAT;
+ DataStreamTypeConvert["DOUBLE"]
+ = SALOME_ModuleCatalog::DATASTREAM_DOUBLE;
+ DataStreamTypeConvert["STRING"]
+ = SALOME_ModuleCatalog::DATASTREAM_STRING;
+ DataStreamTypeConvert["BOOLEAN"]
+ = SALOME_ModuleCatalog::DATASTREAM_BOOLEAN;
+
+ DataStreamDepConvert["UNDEFINED"]
+ = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED;
+ DataStreamDepConvert["T"]
+ = SALOME_ModuleCatalog::DATASTREAM_TEMPORAL;
+ DataStreamDepConvert["I"]
+ = SALOME_ModuleCatalog::DATASTREAM_ITERATIVE;
+
// Empty used variables
_general_module_list.resize(0);
_general_path_list.resize(0);
// Parse the arguments given at server run
if (!_parseArguments(argc, argv,&_general_path,&_personal_path))
- MESSAGE( "Error while argument parsing" )
+ MESSAGE( "Error while argument parsing" );
// Test existency of files
if (_general_path == NULL)
MESSAGE( "Error the general catalog should be indicated" )
else
{
- //MESSAGE("Parse general catalog");
- // Affect the variables _general_module_list and _general_path_list
+ // Affect the _general_module_list and _general_path_list members
// with the common catalog
- QStringList dirList = QStringList::split( SEPARATOR, _general_path, false ); // skip empty entries
+ QStringList dirList
+ = QStringList::split( SEPARATOR, _general_path,
+ false ); // skip empty entries
+
for ( int i = 0; i < dirList.count(); i++ ) {
QFileInfo fileInfo( dirList[ i ] );
if ( fileInfo.isFile() && fileInfo.exists() ) {
- _parse_xml_file(fileInfo.filePath(),_general_module_list, _general_path_list);
+ _parse_xml_file(fileInfo.filePath(),
+ _general_module_list,
+ _general_path_list);
}
}
// Verification of _general_path_list content
if(!_verify_path_prefix(_general_path_list))
- MESSAGE( "Error while parsing the general path list, differents pathes are associated to one computer, the first will be choosen" )
- else MESSAGE("General path list OK");
+ MESSAGE( "Error while parsing the general path list, "
+ "differents paths are associated to the same computer,"
+ "the first one will be choosen")
+ else
+ MESSAGE("General path list OK");
if(_personal_path != NULL)
{
- //MESSAGE("Parse personal catalog");
- // Affect the variables _personal_module_list and _personal_path_list
- // with the personal catalog
- _parse_xml_file(_personal_path,_personal_module_list, _personal_path_list);
+ // Initialize the _personal_module_list and
+ // _personal_path_list members with the personal catalog files
+ _parse_xml_file(_personal_path,
+ _personal_module_list,
+ _personal_path_list);
// Verification of _general_path_list content
if(!_verify_path_prefix(_personal_path_list))
- MESSAGE("Error while parsing the personal path list, differents pathes are associated to one computer, the first will be choosen" )
- else MESSAGE("Personal path list OK");
+ MESSAGE("Error while parsing the personal path list, "
+ "differents paths are associated to the same computer, "
+ "the first one will be choosen" )
+ else
+ MESSAGE("Personal path list OK");
}
- else MESSAGE("No personal catalog indicated or error while opening the personal catalog");
+ else
+ MESSAGE("No personal catalog indicated or error while "
+ "opening the personal catalog");
}
}
// Function : GetPathPrefix
// Purpose : get the PathPrefix of a computer
//----------------------------------------------------------------------
-char*
+char *
SALOME_ModuleCatalogImpl::GetPathPrefix(const char* machinename) {
MESSAGE("Begin of GetPathPrefix")
// Variables initialisation
// All the components defined in the personal catalog are taken
for (unsigned int ind=0; ind < _personal_module_list.size();ind++)
{
- _list_components[ind]=(_personal_module_list[ind].parserComponentName).c_str();
+ _list_components[ind]=(_personal_module_list[ind].name).c_str();
SCRUTE(_list_components[ind]) ;
}
{
// searching if the component is already defined in
// the personal catalog
- if ((_general_module_list[ind].parserComponentName.compare(_personal_module_list[ind1].parserComponentName)) == 0)
+ if ((_general_module_list[ind].name.compare(_personal_module_list[ind1].name)) == 0)
_find = true;
}
if (!_find)
{
- MESSAGE("A new component " << _general_module_list[ind].parserComponentName << " has to be to added in the list");
+ MESSAGE("A new component " << _general_module_list[ind].name
+ << " has to be to added in the list");
_list_components->length(indice+1);
// The component is not already defined => has to be taken
- _list_components[indice]=(_general_module_list[ind].parserComponentName).c_str();
+ _list_components[indice]=(_general_module_list[ind].name).c_str();
SCRUTE(_list_components[indice]) ;
indice++;
}
else
- MESSAGE("The component " <<_general_module_list[ind].parserComponentName << " was already defined in the personal catalog") ;
+ MESSAGE("The component " <<_general_module_list[ind].name
+ << " was already defined in the personal catalog") ;
}
MESSAGE ( "End of GetComponentList" )
// All the components defined in the personal catalog are taken
for (unsigned int ind=0; ind < _personal_module_list.size();ind++)
{
- _list_components_icone[ind].modulename=(_personal_module_list[ind].parserComponentName).c_str();
- _list_components_icone[ind].moduleusername=(_personal_module_list[ind].parserComponentUsername).c_str();
- _list_components_icone[ind].moduleicone=(_personal_module_list[ind].parserComponentIcon).c_str();
+ _list_components_icone[ind].modulename=(_personal_module_list[ind].name).c_str();
+ _list_components_icone[ind].moduleusername=(_personal_module_list[ind].username).c_str();
+ _list_components_icone[ind].moduleicone=(_personal_module_list[ind].icon).c_str();
//SCRUTE(_list_components_icone[ind].modulename);
//SCRUTE(_list_components_icone[ind].moduleicone);
}
{
// searching if the component is aleready defined in
// the personal catalog
- if ((_general_module_list[ind].parserComponentName.compare(_personal_module_list[ind1].parserComponentName)) == 0)
+ if ((_general_module_list[ind].name.compare(_personal_module_list[ind1].name)) == 0)
_find = true;
}
if (!_find)
{
- // MESSAGE("A new component " << _general_module_list[ind].parserComponentName << " has to be to added in the list");
+ // MESSAGE("A new component " << _general_module_list[ind].name << " has to be to added in the list");
_list_components_icone->length(indice+1);
// The component is not already defined => has to be taken
- _list_components_icone[indice].modulename=(_general_module_list[ind].parserComponentName).c_str();
- _list_components_icone[indice].moduleusername=(_general_module_list[ind].parserComponentUsername).c_str();
- _list_components_icone[indice].moduleicone=(_general_module_list[ind].parserComponentIcon).c_str();
+ _list_components_icone[indice].modulename=_general_module_list[ind].name.c_str();
+ _list_components_icone[indice].moduleusername=_general_module_list[ind].username.c_str();
+ _list_components_icone[indice].moduleicone=_general_module_list[ind].icon.c_str();
//SCRUTE(_list_components_icone[indice].modulename) ;
//SCRUTE(_list_components_icone[indice].moduleicone);
indice++;
}
// else
- //MESSAGE("The component " <<_general_module_list[ind].parserComponentName << " was already defined in the personal catalog");
+ //MESSAGE("The component " <<_general_module_list[ind].name << " was already defined in the personal catalog");
}
return _list_components_icone._retn() ;
// All the components in the personal catalog are taken
for (unsigned int ind=0; ind < _personal_module_list.size();ind++)
{
- if (_personal_module_list[ind].parserComponentType == _temp_component_type)
+ if (_personal_module_list[ind].type == _temp_component_type)
{
_list_typed_component->length(_j + 1);
- _list_typed_component[_j] = (_moduleList[ind].parserComponentName).c_str();
+ _list_typed_component[_j] = (_moduleList[ind].name).c_str();
//SCRUTE(_list_typed_component[_j])
_j++;
}
{
_find = false;
- if(_general_module_list[ind].parserComponentType == _temp_component_type)
+ if(_general_module_list[ind].type == _temp_component_type)
{
for (unsigned int ind1=0; ind1 < _personal_module_list.size();ind1++)
{
// searching if the component is aleready defined in
// the personal catalog
- if ((_general_module_list[ind].parserComponentName.compare(_personal_module_list[ind1].parserComponentName)) == 0)
+ if ((_general_module_list[ind].name.compare(_personal_module_list[ind1].name)) == 0)
_find = true;
}
if (!_find)
{
- //MESSAGE("A new component " << _general_module_list[ind].parserComponentName << " has to be to added in the list");
+ //MESSAGE("A new component " << _general_module_list[ind].name << " has to be to added in the list");
_list_typed_component->length(indice+1);
// The component is not already defined => has to be taken
- _list_typed_component[indice]=(_general_module_list[ind].parserComponentName).c_str();
+ _list_typed_component[indice]=(_general_module_list[ind].name).c_str();
//SCRUTE(_list_typed_component[indice]) ;
indice++;
}
//else
- //MESSAGE("The component " <<_general_module_list[ind].parserComponentName << " was already defined in the personal catalog") ;
+ //MESSAGE("The component " <<_general_module_list[ind].name << " was already defined in the personal catalog") ;
}
}
// in the personal catalog is used
//----------------------------------------------------------------------
SALOME_ModuleCatalog::Acomponent_ptr
-SALOME_ModuleCatalogImpl::GetComponent(const char* componentname)
+SALOME_ModuleCatalogImpl::GetComponent(const char* name)
{
- SALOME_ModuleCatalog::Acomponent_ptr compo;
- SALOME_ModuleCatalog::ListOfDefInterface _list_interfaces;
- _list_interfaces.length(0);
- char* _constraint = NULL;
- char* _icone = NULL;
- char* _componentusername = NULL;
- SALOME_ModuleCatalog::ComponentType _componentType = SALOME_ModuleCatalog::OTHER; // default initialisation
- CORBA::Boolean _componentmultistudy = false ; // default initialisation
- ListOfPathPrefix _pathes ;
- _pathes.resize(0);
-
// Looking for component named "componentname" in the personal catalog
// If found, get name, interfaces and constraint
// If not found, looking for component named "componentname" in
// If found, get name, interfaces and constraint
// If not found, NULL pointer is returned
- ParserComponent *p = NULL;
- ListOfParserPathPrefix *pp = NULL;
-
- for (unsigned int ind=0; ind < _personal_module_list.size();ind++)
- {
- if (strcmp((_personal_module_list[ind].parserComponentName).c_str(),componentname) == 0)
- {
- MESSAGE("Component named " << componentname << " found in the personal catalog");
- p = &(_personal_module_list[ind]);
- pp = &_personal_path_list;
- }
- }
-
- if (!p)
- for (unsigned int ind=0; ind < _general_module_list.size();ind++)
- {
- if (strcmp((_general_module_list[ind].parserComponentName).c_str(),componentname) == 0)
- {
- MESSAGE("Component named " << componentname << " found in the general catalog");
- p = &(_general_module_list[ind]);
- pp = &_general_path_list;
- }
- }
+ std::string s(name);
+ ParserComponent *C_parser = NULL;
+ ParserPathPrefixes *pp = NULL;
- if (p) {
+ SALOME_ModuleCatalog::Acomponent_ptr compo = NULL;
+
+ C_parser = findComponent(s);
+ if (C_parser) {
-// DebugParserComponent(*p);
+// DebugParserComponent(*C_parser);
+
+ SALOME_ModuleCatalog::Component C_corba;
+ duplicate(C_corba, *C_parser);
- // get constraint
- _constraint = CORBA::string_dup(p->parserConstraint.c_str());
-
- // get component type
- switch(p->parserComponentType) {
- case GEOM:
- _componentType = SALOME_ModuleCatalog::GEOM;
- break;
- case MESH:
- _componentType = SALOME_ModuleCatalog::MESH;
- break;
- case Med:
- _componentType = SALOME_ModuleCatalog::Med;
- break;
- case SOLVER:
- _componentType = SALOME_ModuleCatalog::SOLVER;
- break;
- case DATA:
- _componentType = SALOME_ModuleCatalog::DATA;
- break;
- case VISU:
- _componentType = SALOME_ModuleCatalog::VISU;
- break;
- case SUPERV:
- _componentType = SALOME_ModuleCatalog::SUPERV;
- break;
- case OTHER:
- _componentType = SALOME_ModuleCatalog::OTHER;
- break;
- }
-
- // get component multistudy
- _componentmultistudy = p->parserComponentMultistudy ;
-
- // get component icone
- _icone = CORBA::string_dup(p->parserComponentIcon.c_str());
-
- // get component user name
- _componentusername = CORBA::string_dup(p->parserComponentUsername.c_str());
-
- // get component interfaces
- _list_interfaces = duplicate_interfaces(p->parserListInterface);
-
- // get pathes prefix
- _pathes = duplicate_pathes(*pp);
- SALOME_ModuleCatalog_AcomponentImpl* aComponentImpl =
- new SALOME_ModuleCatalog_AcomponentImpl(componentname,
- _componentusername,
- _constraint,
- _componentType,
- _componentmultistudy,
- _icone,
- _list_interfaces,
- _pathes);
+ SALOME_ModuleCatalog_AcomponentImpl * aComponentImpl =
+ new SALOME_ModuleCatalog_AcomponentImpl(C_corba);
compo = aComponentImpl->_this();
}
- else
+ else {
// Not found in the personal catalog and in the general catalog
// return NULL object
- {
- MESSAGE("Component with name " << componentname << " not found in catalog");
- compo = NULL;
- }
-
+ MESSAGE("Component with name " << name
+ << " not found in catalog");
+ compo = NULL;
+ }
+
return compo;
}
-
+SALOME_ModuleCatalog::Component *
+SALOME_ModuleCatalogImpl::GetComponentInfo(const char *name)
+{
+ std::string s(name);
+
+ ParserComponent * C_parser = findComponent(s);
+
+ if (C_parser) {
+
+ SALOME_ModuleCatalog::Component * C_corba
+ = new SALOME_ModuleCatalog::Component;
+ duplicate(*C_corba, *C_parser);
+ return C_corba;
+ }
+
+ return NULL;
+}
+
+ParserComponent *
+SALOME_ModuleCatalogImpl::findComponent(const string & name)
+{
+ ParserComponent * C_parser = NULL;
+
+ if (!C_parser)
+ for (unsigned int ind=0; ind < _personal_module_list.size();ind++)
+ if (name.compare(_personal_module_list[ind].name) == 0)
+ {
+ MESSAGE("Component named " << name
+ << " found in the personal catalog");
+ C_parser = &(_personal_module_list[ind]);
+ break;
+ }
+
+ if (!C_parser)
+ for (unsigned int ind=0; ind < _general_module_list.size();ind++)
+ {
+ if (name.compare(_general_module_list[ind].name) == 0)
+ {
+ MESSAGE("Component named " << name
+ << " found in the general catalog");
+ C_parser = &(_general_module_list[ind]);
+ break;
+ }
+ }
+
+ return C_parser;
+}
+
//----------------------------------------------------------------------
// Function : _parse_xml_file
// Purpose : parse one module catalog
//----------------------------------------------------------------------
void
SALOME_ModuleCatalogImpl::_parse_xml_file(const char* file,
- ListOfParserComponent& modulelist,
- ListOfParserPathPrefix& pathList)
+ ParserComponents& modulelist,
+ ParserPathPrefixes& pathList)
{
BEGIN_OF("_parse_xml_file");
SCRUTE(file);
reader.parse( source );
xmlFile.close();
- unsigned int ind, j;
- for ( ind = 0; ind < _moduleList.size(); ind++) {
- for (j=0; j<modulelist.size(); j++)
- if (modulelist[j].parserComponentName ==
- _moduleList[ind].parserComponentName) {
- modulelist[ind] = _moduleList[ind];
- }
- if (j == modulelist.size())
- modulelist.push_back(_moduleList[ind]) ;
+ unsigned int i, j;
+
+ for ( i = 0; i < _moduleList.size(); i++) {
+ for (j=0; j<modulelist.size(); j++) {
+ if (modulelist[j].name == _moduleList[i].name)
+ break;
+ }
+ if (j < modulelist.size())
+ modulelist[j] = _moduleList[i];
+ else
+ modulelist.push_back(_moduleList[i]);
}
- for ( ind = 0; ind < _pathList.size(); ind++)
- pathList.push_back(_pathList[ind]) ;
+ for ( i=0; i < _pathList.size(); i++)
+ pathList.push_back(_pathList[i]) ;
+
+ for (j=0; j<modulelist.size(); j++)
+ modulelist[j].prefixes = pathList;
}
void
_parse_xml_file(file, _personal_module_list, _personal_path_list);
}
+
+//
+// Duplicate functions create a Corba structure (component,
+// interface, service, parameter) from the corresponding C++
+// parser structure
+//
+
//----------------------------------------------------------------------
-// Function : duplicate_interfaces
-// Purpose : create a list of interfaces from the parsing of the catalog
+// Function : duplicate
+// Purpose : create a component from the catalog parsing
//----------------------------------------------------------------------
-SALOME_ModuleCatalog::ListOfDefInterface
-SALOME_ModuleCatalogImpl::duplicate_interfaces(ListOfDefinitionInterface list_interface)
+void SALOME_ModuleCatalogImpl::duplicate
+(SALOME_ModuleCatalog::Component & C_corba,
+ const ParserComponent & C_parser)
{
+ C_corba.name = CORBA::string_dup(C_parser.name.c_str());
+ C_corba.username = CORBA::string_dup(C_parser.username.c_str());
+ C_corba.multistudy = C_parser.multistudy;
+ C_corba.icon = CORBA::string_dup(C_parser.icon.c_str());
+ C_corba.type = ComponentTypeConvert[C_parser.type];
+
+ unsigned int _length = C_parser.interfaces.size();
+ C_corba.interfaces.length(_length);
+
+ for (unsigned int ind = 0; ind < _length; ind++)
+ duplicate(C_corba.interfaces[ind], C_parser.interfaces[ind]);
+}
- // Choices for DataStream port types (en dur ... pas terrible) (MT)
- std::map < string, SALOME_ModuleCatalog::DataStreamType > DataStreamTypeConvert;
- DataStreamTypeConvert["UNKNOWN"] = SALOME_ModuleCatalog::DATASTREAM_UNKNOWN;
- DataStreamTypeConvert["INTEGER"] = SALOME_ModuleCatalog::DATASTREAM_INTEGER;
- DataStreamTypeConvert["FLOAT"] = SALOME_ModuleCatalog::DATASTREAM_FLOAT;
- DataStreamTypeConvert["DOUBLE"] = SALOME_ModuleCatalog::DATASTREAM_DOUBLE;
- DataStreamTypeConvert["STRING"] = SALOME_ModuleCatalog::DATASTREAM_STRING;
- DataStreamTypeConvert["BOOLEAN"] = SALOME_ModuleCatalog::DATASTREAM_BOOLEAN;
- std::map < string, SALOME_ModuleCatalog::DataStreamType >::iterator it_type;
-
- // Choices for DataStream ports dependencies (en dur ... pas terrible) (MT)
- std::map<string,SALOME_ModuleCatalog::DataStreamDependency> DataStreamDepConvert;
- DataStreamDepConvert["UNDEFINED"] = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED;
- DataStreamDepConvert["T"] = SALOME_ModuleCatalog::DATASTREAM_TEMPORAL;
- DataStreamDepConvert["I"] = SALOME_ModuleCatalog::DATASTREAM_ITERATIVE;
- std::map < string, SALOME_ModuleCatalog::DataStreamDependency >::iterator it_dep;
-
-
- SALOME_ModuleCatalog::ListOfDefInterface _list_interfaces;
- unsigned int _length_interfaces = list_interface.size();
- _list_interfaces.length(_length_interfaces);
+
+//----------------------------------------------------------------------
+// Function : duplicate
+// Purpose : create an interface from the catalog parsing
+//----------------------------------------------------------------------
+void SALOME_ModuleCatalogImpl::duplicate
+(SALOME_ModuleCatalog::DefinitionInterface & I_corba,
+ const ParserInterface & I_parser)
+{
+ //duplicate interface name
+ I_corba.interfacename = CORBA::string_dup(I_parser.name.c_str());
- for (unsigned int ind = 0; ind < _length_interfaces; ind++)
- {
- SALOME_ModuleCatalog::DefinitionInterface & I_corba = _list_interfaces[ind];
- ParserDefInterface & I_parser = list_interface[ind];
+ // duplicate service list
+ unsigned int _length = I_parser.services.size();
+ SCRUTE(_length);
+ // I_corba.interfaceservicelist
+ // = new SALOME_ModuleCatalog::ListOfInterfaceService;
+ I_corba.interfaceservicelist.length(_length);
+
+ for (unsigned int ind1 = 0; ind1 < _length ; ind1 ++)
+ duplicate(I_corba.interfaceservicelist[ind1],
+ I_parser.services[ind1]);
+}
- //duplicate interface name
- I_corba.interfacename = CORBA::string_dup(I_parser.parserInterfaceName.c_str());
+//----------------------------------------------------------------------
+// Function : duplicate
+// Purpose : create a service from the catalog parsing
+//----------------------------------------------------------------------
+void SALOME_ModuleCatalogImpl::duplicate
+(SALOME_ModuleCatalog::Service & S_corba,
+ const ParserService & S_parser)
+{
+ // duplicate service name
+ S_corba.ServiceName = CORBA::string_dup(S_parser.name.c_str());
+
+ // duplicate service by default
+ S_corba.Servicebydefault = S_parser.byDefault;
- // duplicate service list
- unsigned int _length_services = I_parser.parserInterfaceServiceList.size();
- SCRUTE(_length_services);
- I_corba.interfaceservicelist.length(_length_services);
+ unsigned int _length;
- for (unsigned int ind1 = 0; ind1 < _length_services ; ind1 ++)
- {
- // input structure form XML parser
- const ParserService & S_parser = I_parser.parserInterfaceServiceList[ind1];
- // output structure to CORBA
- SALOME_ModuleCatalog::Service & S_corba = I_corba.interfaceservicelist[ind1];
-
- // duplicate service name
- S_corba.ServiceName
- = CORBA::string_dup(S_parser.parserServiceName.c_str());
-
- // duplicate service by default
- S_corba.Servicebydefault
- = S_parser.parserServiceByDefault;
-
- // duplicate in Parameters
- unsigned int _length_in_param = S_parser.parserServiceInParameter.size();
- S_corba.ServiceinParameter.length(_length_in_param);
- for (unsigned int ind2 = 0; ind2 < _length_in_param ; ind2 ++)
- {
- SALOME_ModuleCatalog::ServicesParameter & P_corba = S_corba.ServiceinParameter[ind2];
- const ParserServParam & P_parser = S_parser.parserServiceInParameter[ind2];
- // duplicate parameter type
- P_corba.Parametertype = CORBA::string_dup(P_parser.parserParamType.c_str());
-
- // duplicate parameter name
- P_corba.Parametername = CORBA::string_dup(P_parser.parserParamName.c_str());
- }
+ // duplicate in Parameters
+ _length = S_parser.inParameters.size();
+ S_corba.ServiceinParameter.length(_length);
- // duplicate out Parameters
- unsigned int _length_out_param = S_parser.parserServiceOutParameter.size();
- S_corba.ServiceoutParameter.length(_length_out_param);
- for (unsigned int ind2 = 0; ind2 < _length_out_param ; ind2 ++)
- {
- SALOME_ModuleCatalog::ServicesParameter & P_corba
- = S_corba.ServiceoutParameter[ind2];
- const ParserServParam & P_parser
- = S_parser.parserServiceOutParameter[ind2];
-
- // duplicate parameter type
- P_corba.Parametertype = CORBA::string_dup(P_parser.parserParamType.c_str());
-
- // duplicate parameter name
- P_corba.Parametername = CORBA::string_dup(P_parser.parserParamName.c_str());
- }
-
- // duplicate in DataStreamParameters
- unsigned int _length_in_datastream_param
- = S_parser.parserServiceInDataStreamParameter.size();
- S_corba.ServiceinDataStreamParameter.length(_length_in_datastream_param);
- for (unsigned int ind2 = 0; ind2 < _length_in_datastream_param ; ind2 ++)
- {
- SALOME_ModuleCatalog::ServicesDataStreamParameter & P_corba
- = S_corba.ServiceinDataStreamParameter[ind2];
- const ParserServDataStreamParam & P_parser
- = S_parser.parserServiceInDataStreamParameter[ind2];
-
- // duplicate parameter type
- it_type = DataStreamTypeConvert.find(P_parser.parserParamType);
- S_corba.ServiceinDataStreamParameter[ind2].Parametertype
- = (it_type == DataStreamTypeConvert.end())
- ? it_type->second : SALOME_ModuleCatalog::DATASTREAM_UNKNOWN;
-
- // duplicate parameter name
- S_corba.ServiceinDataStreamParameter[ind2].Parametername
- = CORBA::string_dup(P_parser.parserParamName.c_str());
- }
+ for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
+ duplicate(S_corba.ServiceinParameter[ind2],
+ S_parser.inParameters[ind2]);
+
+ // duplicate out Parameters
+ _length = S_parser.outParameters.size();
+ S_corba.ServiceoutParameter.length(_length);
+
+ for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
+ duplicate(S_corba.ServiceoutParameter[ind2],
+ S_parser.outParameters[ind2]);
+
+ // duplicate in DataStreamParameters
+ _length = S_parser.inDataStreamParameters.size();
+ S_corba.ServiceinDataStreamParameter.length(_length);
+
+ for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
+ duplicate(S_corba.ServiceinDataStreamParameter[ind2],
+ S_parser.inDataStreamParameters[ind2]);
+
+ // duplicate out DataStreamParameters
+ _length = S_parser.outDataStreamParameters.size();
+ SCRUTE(_length);
+ S_corba.ServiceoutDataStreamParameter.length(_length);
+
+ for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
+ duplicate(S_corba.ServiceoutDataStreamParameter[ind2],
+ S_parser.outDataStreamParameters[ind2]);
+}
- // duplicate out DataStreamParameters
- unsigned int _length_out_datastream_param
- = S_parser.parserServiceOutDataStreamParameter.size();
- S_corba.ServiceoutDataStreamParameter.length(_length_out_datastream_param);
+//----------------------------------------------------------------------
+// Function : duplicate
+// Purpose : create a service parameter from the catalog parsing
+//----------------------------------------------------------------------
+void SALOME_ModuleCatalogImpl::duplicate
+(SALOME_ModuleCatalog::ServicesParameter & P_corba,
+ const ParserParameter & P_parser)
+{
+ // duplicate parameter name
+ P_corba.Parametername = CORBA::string_dup(P_parser.name.c_str());
+
+ // duplicate parameter type
+ P_corba.Parametertype = CORBA::string_dup(P_parser.type.c_str());
+}
- for (unsigned int ind2 = 0; ind2 < _length_out_datastream_param ; ind2 ++)
- {
- SALOME_ModuleCatalog::ServicesDataStreamParameter & P_corba
- = S_corba.ServiceoutDataStreamParameter[ind2];
- const ParserServDataStreamParam & P_parser
- = S_parser.parserServiceOutDataStreamParameter[ind2];
-
- // duplicate parameter type
- it_type = DataStreamTypeConvert.find(P_parser.parserParamType);
- S_corba.ServiceoutDataStreamParameter[ind2].Parametertype
- = (it_type == DataStreamTypeConvert.end())
- ? it_type->second : SALOME_ModuleCatalog::DATASTREAM_UNKNOWN;
-
- // duplicate parameter name
- P_corba.Parametername = CORBA::string_dup(P_parser.parserParamName.c_str());
- }
-
- }
+
+//----------------------------------------------------------------------
+// Function : duplicate
+// Purpose : create a service datastream parameter from the catalog parsing
+//----------------------------------------------------------------------
+void SALOME_ModuleCatalogImpl::duplicate
+(SALOME_ModuleCatalog::ServicesDataStreamParameter & P_corba,
+ const ParserDataStreamParameter & P_parser)
+{
+ std::map < std::string,
+ SALOME_ModuleCatalog::DataStreamType >::const_iterator it_type;
+
+ std::map < std::string,
+ SALOME_ModuleCatalog::DataStreamDependency >::const_iterator it_dep;
+
+ // duplicate parameter name
+ P_corba.Parametername = CORBA::string_dup(P_parser.name.c_str());
+
+ // doesn't work ???
+ // it_type = DataStreamTypeConvert.find(P_parser.type);
+ // P_corba.Parametertype
+ // = (it_type == DataStreamTypeConvert.end())
+ // ? it_type->second : SALOME_ModuleCatalog::DATASTREAM_UNKNOWN;
+
+ SCRUTE(P_parser.type);
+ P_corba.Parametertype = SALOME_ModuleCatalog::DATASTREAM_UNKNOWN;
+ for (it_type = DataStreamTypeConvert.begin();
+ it_type != DataStreamTypeConvert.end();
+ it_type++)
+ if (P_parser.type.compare(it_type->first) == 0) {
+ P_corba.Parametertype = it_type->second;
+ break;
}
- return _list_interfaces;
-}
+ SCRUTE(P_corba.Parametertype);
+ // duplicate parameter type
+
+ // doesn't work ???
+ // it_type = DataStreamTypeConvert.find(P_parser.type);
+ // P_corba.Parametertype
+ // = (it_type == DataStreamTypeConvert.end())
+ // ? it_type->second : SALOME_ModuleCatalog::DATASTREAM_UNKNOWN;
+
+ SCRUTE(P_parser.dependency);
+ P_corba.Parameterdependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED;
+ for (it_dep = DataStreamDepConvert.begin();
+ it_dep != DataStreamDepConvert.end();
+ it_dep++)
+ if (P_parser.dependency.compare(it_dep->first) == 0) {
+ P_corba.Parameterdependency = it_dep->second;
+ break;
+ }
+
+ SCRUTE(P_corba.Parameterdependency);
+}
//----------------------------------------------------------------------
-// Function : duplicate_pathes
+// Function : duplicate
// Purpose : create the path prefix structures from the catalog parsing
//----------------------------------------------------------------------
-ListOfPathPrefix
-SALOME_ModuleCatalogImpl::duplicate_pathes(ListOfParserPathPrefix pathes)
+void
+SALOME_ModuleCatalogImpl::duplicate(ParserPathPrefixes &L_out,
+ const ParserPathPrefixes &L_in)
{
- ListOfPathPrefix _pathes ;
+ L_out = L_in;
- unsigned int _length = pathes.size() ;
- _pathes.resize(_length);
- unsigned int _length_comput = 0;
+// unsigned int _length = L_in.size() ;
+// L_out.resize(_length);
+// unsigned int _length_comput = 0;
- for (unsigned int ind = 0; ind < _length ; ind++)
- {
- // duplicate path
- _pathes[ind].path = CORBA::string_dup(pathes[ind].path.c_str()) ;
- //MESSAGE("Prefix : " << _pathes[ind].path);
-
- _length_comput = pathes[ind].listOfComputer.size() ;
- _pathes[ind].listOfComputer.resize(_length_comput);
- for (unsigned int ind1 = 0; ind1 <_length_comput ; ind1++)
- {
- // duplicate computer name
- _pathes[ind].listOfComputer[ind1] = CORBA::string_dup(pathes[ind].listOfComputer[ind1].c_str());
- //MESSAGE("Computer associated to the prefix : " <<_pathes[ind].listOfComputer[ind1]);
- }
- }
- return _pathes ;
+// for (unsigned int ind = 0; ind < _length ; ind++)
+// {
+// ParserPathPrefix & P_out = L_out[ind];
+// ParserPathPrefix & P_in = L_in[ind];
+// // duplicate path
+// P_out.path = CORBA::string_dup(P_in[ind].path.c_str()) ;
+
+// _length_comput = P_in[ind].listOfComputer.size() ;
+
+// P_out.listOfComputer.resize(_length_comput);
+// for (unsigned int ind1 = 0; ind1 <_length_comput ; ind1++)
+// {
+// // duplicate computer name
+// P_out.listOfComputer[ind1]
+// = CORBA::string_dup(P_in[ind].listOfComputer[ind1].c_str());
+// //MESSAGE("Computer associated to the prefix : " <<P_out[ind].listOfComputer[ind1]);
+// }
+// }
}
// particular computer
//----------------------------------------------------------------------
bool
-SALOME_ModuleCatalogImpl::_verify_path_prefix(ListOfParserPathPrefix pathList)
+SALOME_ModuleCatalogImpl::_verify_path_prefix(ParserPathPrefixes & pathList)
{
bool _return_value = true;
vector<string> _machine_list;
- _machine_list.resize(0);
// Fill a list of all computers indicated in the path list
for (unsigned int ind = 0; ind < pathList.size(); ind++)
if (strcmp(argv[ind],"-help") == 0)
{
- INFOS( "Usage: " << argv[0] << " -common 'path to general catalog' -personal 'path to personal catalog' -ORBInitRef NameService=corbaname::localhost");
+ INFOS( "Usage: " << argv[0]
+ << " -common 'path to general catalog' "
+ " -personal 'path to personal catalog' "
+ " -ORBInitRef NameService=corbaname::localhost");
_return_value = false ;
}
+
if (strcmp(argv[ind],"-common") == 0)
{
if (ind + 1 < argc)
{
// General catalog file
*_general = argv[ind + 1] ;
-/* ifstream _general_file(*_general);
- if (!_general_file)
- {
- MESSAGE( "Sorry the file " << *_general << " can't be open" )
- *_general = NULL;
- _return_value = false;
- }
-*/
}
}
else if (strcmp(argv[ind],"-personal") == 0)
{
// Personal catalog file
*_personal = argv[ind + 1] ;
-/* ifstream _personal_file(*_personal);
- if (!_personal_file)
- {
- MESSAGE("Sorry the file " << *_personal << " can't be open" )
- *_personal = NULL;
- _return_value = false;
- }
-*/
}
}
}
#define MODULECATALOG_IMPL_H
#include "utilities.h"
+#include <string>
+#include <map>
+
#include "SALOME_ModuleCatalog_Handler.hxx"
-#include "PathPrefix.hxx"
+
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOME_ModuleCatalog)
*/
virtual SALOME_ModuleCatalog::Acomponent_ptr
GetComponent(const char* componentname);
+
+ //! method to get a component description
+ /*!
+ \param componentname const char* arguments
+ \return the wanted component description
+ */
+ virtual SALOME_ModuleCatalog::Component *
+ GetComponentInfo(const char *name);
void ping(){};
//! method to parse one module catalog
/*!
\param file const char* arguments
- \param modulelist ListOfParserComponent arguments
- \param pathlist ListOfParserPathPrefix arguments
+ \param modulelist ParserComponents arguments
+ \param pathlist ParserPathPrefixes arguments
*/
virtual void _parse_xml_file(const char* file,
- ListOfParserComponent& modulelist,
- ListOfParserPathPrefix& pathlist);
+ ParserComponents & modulelist,
+ ParserPathPrefixes & pathlist);
+
+ //! method to find component in the parser list
+ /*!
+ \param name string argument
+ \return pointer on a component, NULL if not found
+ */
+ ParserComponent *findComponent(const string & name);
- //! method to create a list of interfaces from the parsing of the catalog
+ //! method to create a CORBA component description from parser
+ /*!
+ \param C_corba Component argument
+ \param C_parser const ParserComponent argument
+ */
+ void duplicate(SALOME_ModuleCatalog::Component & C_corba,
+ const ParserComponent & C_parser);
+
+ //! method to create a CORBA interface description from parser
/*!
- \param list_interface ListOfDefinitionInterface arguments
- \return the interfaces list
+ \param I_corba DefinitionInterface argument
+ \param I_parser const ParserInterface argument
*/
- virtual SALOME_ModuleCatalog::ListOfDefInterface
- duplicate_interfaces(ListOfDefinitionInterface list_interface);
+ void duplicate(SALOME_ModuleCatalog::DefinitionInterface & I_corba,
+ const ParserInterface & I_parser);
- //! method to create the path prefix structures from the catalog parsing
+ //! method to create a CORBA service description from parser
/*!
- \param pathes ListOfParserPathPrefix arguments
+ \param S_corba Service argument
+ \param S_parser const ParserService argument
+ */
+ void duplicate(SALOME_ModuleCatalog::Service & S_corba,
+ const ParserService & service);
+
+ //! method to create a CORBA parameter description from parser
+ /*!
+ \param P_corba ServicesParameter argument
+ \param P_parser const ParserParameter argument
+ */
+ void duplicate(SALOME_ModuleCatalog::ServicesParameter & P_corba,
+ const ParserParameter & P_parser);
+
+ //! method to create a CORBA datastream parameter description from parser
+ /*!
+ \param P_corba ServicesDataStreamParameter argument
+ \param P_parser const ParserDataStreamParameter argument
+ */
+ void duplicate(SALOME_ModuleCatalog::ServicesDataStreamParameter & P_corba,
+ const ParserDataStreamParameter & P_parser);
+
+ //! method to create the path prefix structures from the catalog parsing
+ /*!
+ \param pathes ParserPathPrefixes arguments
\return the pathes
*/
- virtual ListOfPathPrefix duplicate_pathes(ListOfParserPathPrefix pathes);
+ void duplicate(ParserPathPrefixes & p_out, const ParserPathPrefixes & P_in);
//! method to verify path prefix content
/*!
\param pathlist ListOfParserPathPrefix arguments
\return true if verfication is OK
*/
- virtual bool _verify_path_prefix(ListOfParserPathPrefix pathlist);
+ virtual bool _verify_path_prefix(ParserPathPrefixes & pathlist);
//! method to parse arguments to get general and personal catalog files
// These variables will contain the informations on the general common catalog
- ListOfParserComponent _general_module_list ;
- ListOfParserPathPrefix _general_path_list ;
+ ParserComponents _general_module_list ;
+ ParserPathPrefixes _general_path_list ;
// These variables will contain the informations on the personal catalog
- ListOfParserComponent _personal_module_list ;
- ListOfParserPathPrefix _personal_path_list ;
+ ParserComponents _personal_module_list ;
+ ParserPathPrefixes _personal_path_list ;
+
+ std::map <std::string, SALOME_ModuleCatalog::DataStreamType>
+ DataStreamTypeConvert;
+
+ std::map <std::string, SALOME_ModuleCatalog::DataStreamDependency>
+ DataStreamDepConvert;
+ std::map <ParserComponentType, SALOME_ModuleCatalog::ComponentType>
+ ComponentTypeConvert;
};
#endif // MODULECATALOG_IMPL_H
import batchmode_salome
import SALOME_ModuleCatalog
+print
+print "======================================================================"
+print " XML Catalog file generation from idl file"
+print "======================================================================"
+
+import os
+os.system('runIDLparser -Wbcatalog=x \
+ ${KERNEL_ROOT_DIR}/idl/salome/SALOME_TestModuleCatalog.idl')
+
print "======================================================================"
print " Get Catalog "
print "======================================================================"
catalog = obj._narrow(SALOME_ModuleCatalog.ModuleCatalog)
catalog.GetComponentList()
-C = catalog.GetComponent("AddComponent")
-print C
+print
+print "======================================================================"
+print " Import xml file "
+print "======================================================================"
+catalog.ImportXmlCatalogFile("x.xml")
+
+name = "AddComponent"
+print
+print "======================================================================"
+print " Dump component <", name, "> "
+print "======================================================================"
+C = catalog.GetComponent(name)
-print C.GetInterfaceList()
+print "name : ", C._get_componentname()
+print "username : ", C._get_componentusername()
+print "type : ", C._get_component_type()
+print "constraint : ", C._get_constraint()
+print "icon : ", C._get_component_icone()
-#I = C.GetInterface("Adder")
-#print I
+for iL in C.GetInterfaceList():
+ I = C.GetInterface(iL)
+ print "interface : ", I.interfacename
+ for S in I.interfaceservicelist:
+ print " service : ", S.ServiceName
+ print " ", len(S.ServiceinParameter), "in params : "
+ for iP in S.ServiceinParameter:
+ print ' ' + iP.Parametername + '(' + iP.Parametertype + ')'
+ pass
+ print " ", len(S.ServiceoutParameter), "out params : "
+ for iP in S.ServiceoutParameter:
+ print ' ' + iP.Parametername + '(' + iP.Parametertype + ')'
+ pass
+ print " ", len(S.ServiceinDataStreamParameter), "in datastream params : "
+ for iP in S.ServiceinDataStreamParameter:
+ print ' ' + iP.Parametername + '(' + str(iP.Parametertype) + ', ' + \
+ str(iP.Parameterdependency) + ')'
+ pass
+ print " ", len(S.ServiceoutDataStreamParameter), "out datastream params : "
+ for iP in S.ServiceoutDataStreamParameter:
+ print ' ' + iP.Parametername + '(' + str(iP.Parametertype) + ', ' + \
+ str(iP.Parameterdependency) + ')'
+ pass
+ pass
+ pass
-#I = C.GetInterface("AddComponent")
-#print I