1 // SALOME ModuleCatalog : implementation of ModuleCatalog server which parsers xml description of modules
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SALOME_ModuleCatalog_impl.cxx
25 // Author : Estelle Deville
29 #include "SALOME_ModuleCatalog_impl.hxx"
30 #include "SALOME_ModuleCatalog_Acomponent_impl.hxx"
34 #include <qstringlist.h>
35 #include <qfileinfo.h>
38 static const char* SEPARATOR = ":";
40 //----------------------------------------------------------------------
41 // Function : SALOME_ModuleCatalogImpl
42 // Purpose : Constructor
43 //----------------------------------------------------------------------
44 SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA::ORB_ptr orb) : _orb(orb)
46 MESSAGE("Catalog creation");
48 // Conversion rules for component types
49 ComponentTypeConvert[GEOM]
50 = SALOME_ModuleCatalog::GEOM;
51 ComponentTypeConvert[MESH]
52 = SALOME_ModuleCatalog::MESH;
53 ComponentTypeConvert[Med]
54 = SALOME_ModuleCatalog::Med;
55 ComponentTypeConvert[SOLVER]
56 = SALOME_ModuleCatalog::SOLVER;
57 ComponentTypeConvert[DATA]
58 = SALOME_ModuleCatalog::DATA;
59 ComponentTypeConvert[VISU]
60 = SALOME_ModuleCatalog::VISU;
61 ComponentTypeConvert[SUPERV]
62 = SALOME_ModuleCatalog::SUPERV;
63 ComponentTypeConvert[OTHER]
64 = SALOME_ModuleCatalog::OTHER;
66 // Conversion rules for datastream parameters type and dependency
67 DataStreamTypeConvert["UNKNOWN"]
68 = SALOME_ModuleCatalog::DATASTREAM_UNKNOWN;
69 DataStreamTypeConvert["INTEGER"]
70 = SALOME_ModuleCatalog::DATASTREAM_INTEGER;
71 DataStreamTypeConvert["FLOAT"]
72 = SALOME_ModuleCatalog::DATASTREAM_FLOAT;
73 DataStreamTypeConvert["DOUBLE"]
74 = SALOME_ModuleCatalog::DATASTREAM_DOUBLE;
75 DataStreamTypeConvert["STRING"]
76 = SALOME_ModuleCatalog::DATASTREAM_STRING;
77 DataStreamTypeConvert["BOOLEAN"]
78 = SALOME_ModuleCatalog::DATASTREAM_BOOLEAN;
80 DataStreamDepConvert["UNDEFINED"]
81 = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED;
82 DataStreamDepConvert["T"]
83 = SALOME_ModuleCatalog::DATASTREAM_TEMPORAL;
84 DataStreamDepConvert["I"]
85 = SALOME_ModuleCatalog::DATASTREAM_ITERATIVE;
87 // Empty used variables
88 _general_module_list.resize(0);
89 _general_path_list.resize(0);
91 _personal_module_list.resize(0);
92 _personal_path_list.resize(0);
94 // Parse the arguments given at server run
95 if (!_parseArguments(argc, argv,&_general_path,&_personal_path))
96 MESSAGE( "Error while argument parsing" );
98 // Test existency of files
99 if (_general_path == NULL)
100 MESSAGE( "Error the general catalog should be indicated" )
103 // Affect the _general_module_list and _general_path_list members
104 // with the common catalog
107 = QStringList::split( SEPARATOR, _general_path,
108 false ); // skip empty entries
110 for ( int i = 0; i < dirList.count(); i++ ) {
111 QFileInfo fileInfo( dirList[ i ] );
112 if ( fileInfo.isFile() && fileInfo.exists() ) {
113 _parse_xml_file(fileInfo.filePath(),
114 _general_module_list,
119 // Verification of _general_path_list content
120 if(!_verify_path_prefix(_general_path_list))
121 MESSAGE( "Error while parsing the general path list, "
122 "differents paths are associated to the same computer,"
123 "the first one will be choosen")
125 MESSAGE("General path list OK");
127 if(_personal_path != NULL)
129 // Initialize the _personal_module_list and
130 // _personal_path_list members with the personal catalog files
131 _parse_xml_file(_personal_path,
132 _personal_module_list,
133 _personal_path_list);
135 // Verification of _general_path_list content
136 if(!_verify_path_prefix(_personal_path_list))
137 MESSAGE("Error while parsing the personal path list, "
138 "differents paths are associated to the same computer, "
139 "the first one will be choosen" )
141 MESSAGE("Personal path list OK");
144 MESSAGE("No personal catalog indicated or error while "
145 "opening the personal catalog");
149 //----------------------------------------------------------------------
150 // Function : ~SALOME_ModuleCatalogImpl
151 // Purpose : Destructor
152 //----------------------------------------------------------------------
153 SALOME_ModuleCatalogImpl::~SALOME_ModuleCatalogImpl()
155 MESSAGE("Catalog Destruction");
159 //----------------------------------------------------------------------
160 // Function : GetComputerList
161 // Purpose : get a computer list
162 //----------------------------------------------------------------------
163 SALOME_ModuleCatalog::ListOfComputers*
164 SALOME_ModuleCatalogImpl::GetComputerList()
166 SALOME_ModuleCatalog::ListOfComputers_var _list_computers =
167 new SALOME_ModuleCatalog::ListOfComputers;
168 return _list_computers._retn();
171 //----------------------------------------------------------------------
172 // Function : GetPathPrefix
173 // Purpose : get the PathPrefix of a computer
174 //----------------------------------------------------------------------
176 SALOME_ModuleCatalogImpl::GetPathPrefix(const char* machinename) {
177 MESSAGE("Begin of GetPathPrefix")
178 // Variables initialisation
182 // Parse all the path prefixes
183 // looking for the wanted computer
184 for (unsigned int ind = 0 ; ind < _personal_path_list.size() ; ind++)
186 for (unsigned int ind1 = 0 ; ind1 < _personal_path_list[ind].listOfComputer.size() ; ind1++)
188 if (strcmp(machinename, _personal_path_list[ind].listOfComputer[ind1].c_str()) == 0)
192 // affect the path to be returned
193 const char* _temp = _personal_path_list[ind].path.c_str() ;
194 _path = new char[strlen(_temp)+1];
202 for (unsigned int ind = 0 ; ind < _general_path_list.size() ; ind++)
204 for (unsigned int ind1 = 0 ; ind1 < _general_path_list[ind].listOfComputer.size() ; ind1++)
206 if (strcmp(machinename, _general_path_list[ind].listOfComputer[ind1].c_str()) == 0)
210 // affect the path to be returned
211 const char* _temp = _general_path_list[ind].path.c_str() ;
212 _path = new char[strlen(_temp)+1];
222 //----------------------------------------------------------------------
223 // Function : GetComponentList
224 // Purpose : get a component list
225 // If a component is defined in the personal catalog and
226 // in the general catalog (same name), the component defined
227 // in the personal catalog is used
228 //----------------------------------------------------------------------
229 SALOME_ModuleCatalog::ListOfComponents*
230 SALOME_ModuleCatalogImpl::GetComponentList()
232 MESSAGE("Begin of GetComponentList");
233 SALOME_ModuleCatalog::ListOfComponents_var _list_components =
234 new SALOME_ModuleCatalog::ListOfComponents;
236 _list_components->length(_personal_module_list.size());
238 // All the components defined in the personal catalog are taken
239 for (unsigned int ind=0; ind < _personal_module_list.size();ind++)
241 _list_components[ind]=(_personal_module_list[ind].name).c_str();
242 SCRUTE(_list_components[ind]) ;
245 int indice = _personal_module_list.size() ;
248 // The components in the general catalog are taken only if they're
249 // not defined in the personal catalog
250 for (unsigned int ind=0; ind < _general_module_list.size();ind++)
253 for (unsigned int ind1=0; ind1 < _personal_module_list.size();ind1++)
255 // searching if the component is already defined in
256 // the personal catalog
257 if ((_general_module_list[ind].name.compare(_personal_module_list[ind1].name)) == 0)
262 MESSAGE("A new component " << _general_module_list[ind].name
263 << " has to be to added in the list");
264 _list_components->length(indice+1);
265 // The component is not already defined => has to be taken
266 _list_components[indice]=(_general_module_list[ind].name).c_str();
267 SCRUTE(_list_components[indice]) ;
272 MESSAGE("The component " <<_general_module_list[ind].name
273 << " was already defined in the personal catalog") ;
276 MESSAGE ( "End of GetComponentList" )
277 return _list_components._retn();
281 //----------------------------------------------------------------------
282 // Function : GetComponentIconeList
283 // Purpose : get a component list of component name and component icone
284 // If a component is defined in the personal catalog and
285 // in the general catalog (same name), the component defined
286 // in the personal catalog is used
287 //----------------------------------------------------------------------
288 SALOME_ModuleCatalog::ListOfIAPP_Affich*
289 SALOME_ModuleCatalogImpl::GetComponentIconeList()
291 MESSAGE("Begin of GetComponentIconeList");
293 SALOME_ModuleCatalog::ListOfIAPP_Affich_var _list_components_icone =
294 new SALOME_ModuleCatalog::ListOfIAPP_Affich;
296 _list_components_icone->length(_personal_module_list.size());
298 // All the components defined in the personal catalog are taken
299 for (unsigned int ind=0; ind < _personal_module_list.size();ind++)
301 _list_components_icone[ind].modulename=(_personal_module_list[ind].name).c_str();
302 _list_components_icone[ind].moduleusername=(_personal_module_list[ind].username).c_str();
303 _list_components_icone[ind].moduleicone=(_personal_module_list[ind].icon).c_str();
304 //SCRUTE(_list_components_icone[ind].modulename);
305 //SCRUTE(_list_components_icone[ind].moduleicone);
308 int indice = _personal_module_list.size() ;
311 // The components in the general catalog are taken only if they're
312 // not defined in the personal catalog
313 for (unsigned int ind=0; ind < _general_module_list.size();ind++)
316 for (unsigned int ind1=0; ind1 < _personal_module_list.size();ind1++)
318 // searching if the component is aleready defined in
319 // the personal catalog
320 if ((_general_module_list[ind].name.compare(_personal_module_list[ind1].name)) == 0)
325 // MESSAGE("A new component " << _general_module_list[ind].name << " has to be to added in the list");
326 _list_components_icone->length(indice+1);
327 // The component is not already defined => has to be taken
328 _list_components_icone[indice].modulename=_general_module_list[ind].name.c_str();
329 _list_components_icone[indice].moduleusername=_general_module_list[ind].username.c_str();
330 _list_components_icone[indice].moduleicone=_general_module_list[ind].icon.c_str();
331 //SCRUTE(_list_components_icone[indice].modulename) ;
332 //SCRUTE(_list_components_icone[indice].moduleicone);
337 //MESSAGE("The component " <<_general_module_list[ind].name << " was already defined in the personal catalog");
340 return _list_components_icone._retn() ;
343 //----------------------------------------------------------------------
344 // Function : GetTypedComponentList
345 // Purpose : get a component list of a wanted type
346 // If a component is defined in the personal catalog and
347 // in the general catalog (same name), the component defined
348 // in the personal catalog is used
349 //----------------------------------------------------------------------
350 SALOME_ModuleCatalog::ListOfComponents*
351 SALOME_ModuleCatalogImpl::GetTypedComponentList(SALOME_ModuleCatalog::ComponentType component_type)
353 MESSAGE("Begin of GetTypedComponentList");
354 SALOME_ModuleCatalog::ListOfComponents_var _list_typed_component =
355 new SALOME_ModuleCatalog::ListOfComponents;
358 _list_typed_component->length(0);
359 // Transform SALOME_ModuleCatalog::ComponentType in ParserComponentType
360 ParserComponentType _temp_component_type;
361 switch(component_type){
362 case SALOME_ModuleCatalog::GEOM:
363 _temp_component_type = GEOM ;
365 case SALOME_ModuleCatalog::MESH:
366 _temp_component_type = MESH;
368 case SALOME_ModuleCatalog::Med:
369 _temp_component_type = Med;
371 case SALOME_ModuleCatalog::SOLVER:
372 _temp_component_type = SOLVER;
374 case SALOME_ModuleCatalog::DATA:
375 _temp_component_type = DATA;
377 case SALOME_ModuleCatalog::VISU:
378 _temp_component_type = VISU;
380 case SALOME_ModuleCatalog::SUPERV:
381 _temp_component_type = SUPERV;
383 case SALOME_ModuleCatalog::OTHER:
384 _temp_component_type = OTHER;
388 // All the components in the personal catalog are taken
389 for (unsigned int ind=0; ind < _personal_module_list.size();ind++)
391 if (_personal_module_list[ind].type == _temp_component_type)
393 _list_typed_component->length(_j + 1);
394 _list_typed_component[_j] = (_moduleList[ind].name).c_str();
395 //SCRUTE(_list_typed_component[_j])
400 int indice = _list_typed_component->length() ;
403 // The components in the general catalog are taken only if they're
404 // not defined in the personal catalog
405 for (unsigned int ind=0; ind < _general_module_list.size();ind++)
409 if(_general_module_list[ind].type == _temp_component_type)
411 for (unsigned int ind1=0; ind1 < _personal_module_list.size();ind1++)
413 // searching if the component is aleready defined in
414 // the personal catalog
415 if ((_general_module_list[ind].name.compare(_personal_module_list[ind1].name)) == 0)
420 //MESSAGE("A new component " << _general_module_list[ind].name << " has to be to added in the list");
421 _list_typed_component->length(indice+1);
422 // The component is not already defined => has to be taken
423 _list_typed_component[indice]=(_general_module_list[ind].name).c_str();
424 //SCRUTE(_list_typed_component[indice]) ;
429 //MESSAGE("The component " <<_general_module_list[ind].name << " was already defined in the personal catalog") ;
434 return _list_typed_component._retn();
437 //----------------------------------------------------------------------
438 // Function : GetComponent
439 // Purpose : get a component
440 // If a component is defined in the personal catalog and
441 // in the general catalog (same name), the component defined
442 // in the personal catalog is used
443 //----------------------------------------------------------------------
444 SALOME_ModuleCatalog::Acomponent_ptr
445 SALOME_ModuleCatalogImpl::GetComponent(const char* name)
447 // Looking for component named "componentname" in the personal catalog
448 // If found, get name, interfaces and constraint
449 // If not found, looking for component named "componentname" in
450 // the general catalog
451 // If found, get name, interfaces and constraint
452 // If not found, NULL pointer is returned
455 ParserComponent *C_parser = NULL;
456 ParserPathPrefixes *pp = NULL;
458 SALOME_ModuleCatalog::Acomponent_ptr compo = NULL;
460 C_parser = findComponent(s);
463 // DebugParserComponent(*C_parser);
465 SALOME_ModuleCatalog::Component C_corba;
466 duplicate(C_corba, *C_parser);
469 SALOME_ModuleCatalog_AcomponentImpl * aComponentImpl =
470 new SALOME_ModuleCatalog_AcomponentImpl(C_corba);
472 compo = aComponentImpl->_this();
475 // Not found in the personal catalog and in the general catalog
476 // return NULL object
477 MESSAGE("Component with name " << name
478 << " not found in catalog");
485 SALOME_ModuleCatalog::Component *
486 SALOME_ModuleCatalogImpl::GetComponentInfo(const char *name)
490 ParserComponent * C_parser = findComponent(s);
494 SALOME_ModuleCatalog::Component * C_corba
495 = new SALOME_ModuleCatalog::Component;
496 duplicate(*C_corba, *C_parser);
504 SALOME_ModuleCatalogImpl::findComponent(const string & name)
506 ParserComponent * C_parser = NULL;
509 for (unsigned int ind=0; ind < _personal_module_list.size();ind++)
510 if (name.compare(_personal_module_list[ind].name) == 0)
512 MESSAGE("Component named " << name
513 << " found in the personal catalog");
514 C_parser = &(_personal_module_list[ind]);
519 for (unsigned int ind=0; ind < _general_module_list.size();ind++)
521 if (name.compare(_general_module_list[ind].name) == 0)
523 MESSAGE("Component named " << name
524 << " found in the general catalog");
525 C_parser = &(_general_module_list[ind]);
533 //----------------------------------------------------------------------
534 // Function : _parse_xml_file
535 // Purpose : parse one module catalog
536 //----------------------------------------------------------------------
538 SALOME_ModuleCatalogImpl::_parse_xml_file(const char* file,
539 ParserComponents& modulelist,
540 ParserPathPrefixes& pathList)
542 BEGIN_OF("_parse_xml_file");
545 SALOME_ModuleCatalog_Handler* handler = new SALOME_ModuleCatalog_Handler();
548 QXmlInputSource source(xmlFile);
550 QXmlSimpleReader reader;
551 reader.setContentHandler( handler );
552 reader.setErrorHandler( handler );
553 reader.parse( source );
558 for ( i = 0; i < _moduleList.size(); i++) {
559 for (j=0; j<modulelist.size(); j++) {
560 if (modulelist[j].name == _moduleList[i].name)
563 if (j < modulelist.size())
564 modulelist[j] = _moduleList[i];
566 modulelist.push_back(_moduleList[i]);
569 for ( i=0; i < _pathList.size(); i++)
570 pathList.push_back(_pathList[i]) ;
572 for (j=0; j<modulelist.size(); j++)
573 modulelist[j].prefixes = pathList;
577 SALOME_ModuleCatalogImpl::ImportXmlCatalogFile(const char* file)
579 _parse_xml_file(file, _personal_module_list, _personal_path_list);
584 // Duplicate functions create a Corba structure (component,
585 // interface, service, parameter) from the corresponding C++
589 //----------------------------------------------------------------------
590 // Function : duplicate
591 // Purpose : create a component from the catalog parsing
592 //----------------------------------------------------------------------
593 void SALOME_ModuleCatalogImpl::duplicate
594 (SALOME_ModuleCatalog::Component & C_corba,
595 const ParserComponent & C_parser)
597 C_corba.name = CORBA::string_dup(C_parser.name.c_str());
598 C_corba.username = CORBA::string_dup(C_parser.username.c_str());
599 C_corba.multistudy = C_parser.multistudy;
600 C_corba.icon = CORBA::string_dup(C_parser.icon.c_str());
601 C_corba.type = ComponentTypeConvert[C_parser.type];
602 C_corba.implementationType = C_parser.implementationType;
604 unsigned int _length = C_parser.interfaces.size();
605 C_corba.interfaces.length(_length);
607 for (unsigned int ind = 0; ind < _length; ind++)
608 duplicate(C_corba.interfaces[ind], C_parser.interfaces[ind]);
612 //----------------------------------------------------------------------
613 // Function : duplicate
614 // Purpose : create an interface from the catalog parsing
615 //----------------------------------------------------------------------
616 void SALOME_ModuleCatalogImpl::duplicate
617 (SALOME_ModuleCatalog::DefinitionInterface & I_corba,
618 const ParserInterface & I_parser)
620 //duplicate interface name
621 I_corba.interfacename = CORBA::string_dup(I_parser.name.c_str());
623 // duplicate service list
624 unsigned int _length = I_parser.services.size();
626 // I_corba.interfaceservicelist
627 // = new SALOME_ModuleCatalog::ListOfInterfaceService;
628 I_corba.interfaceservicelist.length(_length);
630 for (unsigned int ind1 = 0; ind1 < _length ; ind1 ++)
631 duplicate(I_corba.interfaceservicelist[ind1],
632 I_parser.services[ind1]);
635 //----------------------------------------------------------------------
636 // Function : duplicate
637 // Purpose : create a service from the catalog parsing
638 //----------------------------------------------------------------------
639 void SALOME_ModuleCatalogImpl::duplicate
640 (SALOME_ModuleCatalog::Service & S_corba,
641 const ParserService & S_parser)
643 // duplicate service name
644 S_corba.ServiceName = CORBA::string_dup(S_parser.name.c_str());
646 // duplicate service by default
647 S_corba.Servicebydefault = S_parser.byDefault;
649 S_corba.TypeOfNode = S_parser.typeOfNode;
651 unsigned int _length;
653 // duplicate in Parameters
654 _length = S_parser.inParameters.size();
655 S_corba.ServiceinParameter.length(_length);
657 for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
658 duplicate(S_corba.ServiceinParameter[ind2],
659 S_parser.inParameters[ind2]);
661 // duplicate out Parameters
662 _length = S_parser.outParameters.size();
663 S_corba.ServiceoutParameter.length(_length);
665 for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
666 duplicate(S_corba.ServiceoutParameter[ind2],
667 S_parser.outParameters[ind2]);
669 // duplicate in DataStreamParameters
670 _length = S_parser.inDataStreamParameters.size();
671 S_corba.ServiceinDataStreamParameter.length(_length);
673 for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
674 duplicate(S_corba.ServiceinDataStreamParameter[ind2],
675 S_parser.inDataStreamParameters[ind2]);
677 // duplicate out DataStreamParameters
678 _length = S_parser.outDataStreamParameters.size();
680 S_corba.ServiceoutDataStreamParameter.length(_length);
682 for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
683 duplicate(S_corba.ServiceoutDataStreamParameter[ind2],
684 S_parser.outDataStreamParameters[ind2]);
687 //----------------------------------------------------------------------
688 // Function : duplicate
689 // Purpose : create a service parameter from the catalog parsing
690 //----------------------------------------------------------------------
691 void SALOME_ModuleCatalogImpl::duplicate
692 (SALOME_ModuleCatalog::ServicesParameter & P_corba,
693 const ParserParameter & P_parser)
695 // duplicate parameter name
696 P_corba.Parametername = CORBA::string_dup(P_parser.name.c_str());
698 // duplicate parameter type
699 P_corba.Parametertype = CORBA::string_dup(P_parser.type.c_str());
703 //----------------------------------------------------------------------
704 // Function : duplicate
705 // Purpose : create a service datastream parameter from the catalog parsing
706 //----------------------------------------------------------------------
707 void SALOME_ModuleCatalogImpl::duplicate
708 (SALOME_ModuleCatalog::ServicesDataStreamParameter & P_corba,
709 const ParserDataStreamParameter & P_parser)
711 std::map < std::string,
712 SALOME_ModuleCatalog::DataStreamType >::const_iterator it_type;
714 std::map < std::string,
715 SALOME_ModuleCatalog::DataStreamDependency >::const_iterator it_dep;
717 // duplicate parameter name
718 P_corba.Parametername = CORBA::string_dup(P_parser.name.c_str());
721 // it_type = DataStreamTypeConvert.find(P_parser.type);
722 // P_corba.Parametertype
723 // = (it_type == DataStreamTypeConvert.end())
724 // ? it_type->second : SALOME_ModuleCatalog::DATASTREAM_UNKNOWN;
726 SCRUTE(P_parser.type);
727 P_corba.Parametertype = SALOME_ModuleCatalog::DATASTREAM_UNKNOWN;
728 for (it_type = DataStreamTypeConvert.begin();
729 it_type != DataStreamTypeConvert.end();
731 if (P_parser.type.compare(it_type->first) == 0) {
732 P_corba.Parametertype = it_type->second;
735 SCRUTE(P_corba.Parametertype);
737 // duplicate parameter type
740 // it_type = DataStreamTypeConvert.find(P_parser.type);
741 // P_corba.Parametertype
742 // = (it_type == DataStreamTypeConvert.end())
743 // ? it_type->second : SALOME_ModuleCatalog::DATASTREAM_UNKNOWN;
745 SCRUTE(P_parser.dependency);
746 P_corba.Parameterdependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED;
747 for (it_dep = DataStreamDepConvert.begin();
748 it_dep != DataStreamDepConvert.end();
750 if (P_parser.dependency.compare(it_dep->first) == 0) {
751 P_corba.Parameterdependency = it_dep->second;
755 SCRUTE(P_corba.Parameterdependency);
758 //----------------------------------------------------------------------
759 // Function : duplicate
760 // Purpose : create the path prefix structures from the catalog parsing
761 //----------------------------------------------------------------------
763 SALOME_ModuleCatalogImpl::duplicate(ParserPathPrefixes &L_out,
764 const ParserPathPrefixes &L_in)
770 //----------------------------------------------------------------------
771 // Function : _verify_path_prefix
772 // Purpose : verify the path prefix structures from the catalog parsing
773 // Verify that there only one path prefix associated to a
774 // particular computer
775 //----------------------------------------------------------------------
777 SALOME_ModuleCatalogImpl::_verify_path_prefix(ParserPathPrefixes & pathList)
779 bool _return_value = true;
780 vector<string> _machine_list;
782 // Fill a list of all computers indicated in the path list
783 for (unsigned int ind = 0; ind < pathList.size(); ind++)
785 for (unsigned int ind1 = 0 ; ind1 < pathList[ind].listOfComputer.size(); ind1++)
787 _machine_list.push_back(pathList[ind].listOfComputer[ind1]);
791 // Parse if a computer name is twice in the list of computers
792 for (unsigned int ind = 0; ind < _machine_list.size(); ind++)
794 for (unsigned int ind1 = ind+1 ; ind1 < _machine_list.size(); ind1++)
796 if(_machine_list[ind].compare(_machine_list[ind1]) == 0)
798 MESSAGE( "The computer " << _machine_list[ind] << " is indicated more than once in the path list")
799 _return_value = false;
803 return _return_value;
807 //----------------------------------------------------------------------
808 // Function : _parseArguments
809 // Purpose : parse arguments to get general and personal catalog files
810 //----------------------------------------------------------------------
812 SALOME_ModuleCatalogImpl::_parseArguments(int argc, char **argv,
816 bool _return_value = true;
819 for (int ind = 0; ind < argc ; ind++)
822 if (strcmp(argv[ind],"-help") == 0)
824 INFOS( "Usage: " << argv[0]
825 << " -common 'path to general catalog' "
826 " -personal 'path to personal catalog' "
827 " -ORBInitRef NameService=corbaname::localhost");
828 _return_value = false ;
831 if (strcmp(argv[ind],"-common") == 0)
835 // General catalog file
836 *_general = argv[ind + 1] ;
839 else if (strcmp(argv[ind],"-personal") == 0)
843 // Personal catalog file
844 *_personal = argv[ind + 1] ;
848 return _return_value;