Salome HOME
Merge branch 'omu/Launcher9'
[modules/kernel.git] / src / ModuleCatalog / SALOME_ModuleCatalog_Handler.cxx
1 // Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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, or (at your option) any later version.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  SALOME ModuleCatalog : implementation of ModuleCatalog server which parsers xml description of modules
24 //  File   : SALOME_ModuleCatalog_Handler.cxx
25 //  Author : Estelle Deville
26 //  Module : SALOME
27 //  $Header$ 
28 //
29 #define WRITE_CATA_COMPONENT
30
31 #include "SALOME_ModuleCatalog_Handler.hxx"
32 #include "SALOME_ModuleCatalog_Parser_IO.hxx"
33 #include "utilities.h"
34
35 #include <sstream>
36
37 #ifdef _DEBUG_
38 static int MYDEBUG = 0;
39 #else
40 static int MYDEBUG = 0;
41 #endif
42
43 //----------------------------------------------------------------------
44 // Function : SALOME_ModuleCatalog_Handler
45 // Purpose  : Constructor
46 //----------------------------------------------------------------------
47 SALOME_ModuleCatalog_Handler::SALOME_ModuleCatalog_Handler(ParserPathPrefixes& pathList,
48                                                            ParserComponents& moduleList,
49                                                            ParserTypes& typeMap,
50                                                            TypeList& typeList):_typeMap(typeMap),_typeList(typeList),
51                                                                                _pathList(pathList),_moduleList(moduleList)
52
53 {
54   if(MYDEBUG) BEGIN_OF("SALOME_ModuleCatalog_Handler");
55
56   // XML Tags initialisation
57   // Used in the function endElement
58   test_path_prefix_name     = "path-prefix-name";
59   test_computer_name        = "computer-name" ;
60   test_computer_list        = "computer-list" ;
61   test_path_prefix          = "path-prefix" ;
62   test_path_prefix_list     = "path-prefix-list" ;
63
64   test_component_name       = "component-name";
65   test_component_username   = "component-username";
66   test_component_type       = "component-type" ;
67   test_component_icon       = "component-icone" ;
68   test_component_impltype   = "component-impltype";
69   test_component_implname   = "component-implname";
70   test_component_version    = "component-version";
71   test_component_comment    = "component-comment";
72
73   test_interface_name       = "component-interface-name" ;
74   
75   test_service_name         = "service-name";
76   test_defaultservice       = "service-by-default";
77
78   test_typeofnode           = "type-of-node";
79
80   test_inParameter_type     = "inParameter-type";
81   test_inParameter_name     = "inParameter-name";
82   test_inParameter          = "inParameter";
83   test_inParameter_list     = "inParameter-list";
84
85   test_outParameter_type    = "outParameter-type";
86   test_outParameter_name    = "outParameter-name";
87   test_outParameter         = "outParameter";
88   test_outParameter_list    = "outParameter-list";
89
90   test_inDataStreamParameter_type = "inParameter-type";
91   test_inDataStreamParameter_name = "inParameter-name";
92   test_inDataStreamParameter_dependency = "inParameter-dependency";
93   test_inDataStreamParameter = "inParameter";
94   test_inDataStreamParameter_list = "DataStream-list";
95
96   test_outDataStreamParameter_type = "outParameter-type";
97   test_outDataStreamParameter_name = "outParameter-name";
98   test_outDataStreamParameter_dependency = "outParameter-dependency";
99   test_outDataStreamParameter = "outParameter";
100   test_outDataStreamParameter_list = "DataStream-list";
101
102   test_service =  "component-service";
103   test_service_list = "component-service-list";
104   test_interface_list = "component-interface-list";
105
106   test_constraint = "constraint";
107
108   test_component_list = "component-list";
109   test_component="component";
110
111   if(MYDEBUG) END_OF("SALOME_ModuleCatalog_Handler");
112 }
113
114 //----------------------------------------------------------------------
115 // Function : ~SALOME_ModuleCatalog_Handler
116 // Purpose  : Destructor
117 //----------------------------------------------------------------------
118 SALOME_ModuleCatalog_Handler::~SALOME_ModuleCatalog_Handler()
119 {
120   if(MYDEBUG) BEGIN_OF("~SALOME_ModuleCatalog_Handler()")
121   if(MYDEBUG) END_OF("~SALOME_ModuleCatalog_Handler()")
122 }
123
124
125 //=============================================================================
126 /*!
127  *  Processes XML document and fills the list of modules
128  */ 
129 //=============================================================================
130
131 void SALOME_ModuleCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc)
132 {
133   if(MYDEBUG) MESSAGE("Begin parse document");
134   // Empty the private elements
135   _pathList.resize(0);
136   _pathPrefix.listOfComputer.resize(0);
137   _serviceList.resize(0);
138   _interfaceList.resize(0);
139   _moduleList.resize(0);
140   _inDataStreamParamList.resize(0);
141   _outDataStreamParamList.resize(0);
142   _inParamList.resize(0);
143   _outParamList.resize(0);
144
145   // Get the document root node
146   xmlNodePtr aCurNode = xmlDocGetRootElement(theDoc);
147   aCurNode = aCurNode->xmlChildrenNode;
148   
149   // Processing the document nodes
150   while(aCurNode != NULL)
151   {
152     // Part 1: Process path prefix list (tag test_path_prefix_list)
153     if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_path_prefix_list) )
154     {
155       xmlNodePtr aCurSubNode = aCurNode->xmlChildrenNode;
156       while(aCurSubNode != NULL)
157       {
158         // Forming a PathPrefix structure (tag test_path_prefix)
159         if ( xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_path_prefix) ) {
160           aCurSubNode = aCurSubNode->next;
161           continue;
162         }
163
164         xmlNodePtr aCurSubSubNode = aCurSubNode->xmlChildrenNode;
165         while(aCurSubSubNode != NULL)
166         {
167           // Tag test_path_prefix_name
168           if ( !xmlStrcmp(aCurSubSubNode->name, (const xmlChar*)test_path_prefix_name) ) {
169             xmlChar* aPath = xmlNodeGetContent(aCurSubSubNode);
170             if (aPath != NULL) {
171               _pathPrefix.path = (const char*)aPath;
172               xmlFree(aPath);
173             }
174           }
175
176           // Tag test_computer_list
177           if ( !xmlStrcmp(aCurSubSubNode->name, (const xmlChar*)test_computer_list) ) {
178             xmlNodePtr aComputerNode = aCurSubSubNode->xmlChildrenNode;
179             while (aComputerNode != NULL) {
180               // Tag test_computer_name
181               if ( !xmlStrcmp(aComputerNode->name, (const xmlChar*) test_computer_name) ) {
182                 xmlChar* aCompName = xmlNodeGetContent(aComputerNode);
183                 if (aCompName != NULL) {
184                   _pathPrefix.listOfComputer.push_back((const char*)aCompName);
185                   xmlFree(aCompName);
186                 }
187               }
188
189               aComputerNode = aComputerNode->next;
190             }
191           }
192
193           aCurSubSubNode = aCurSubSubNode->next;
194         }
195
196         _pathList.push_back(_pathPrefix);
197         _pathPrefix.listOfComputer.resize(0);
198
199         aCurSubNode = aCurSubNode->next;
200       }
201     }
202
203     //Part 2: Process list of types
204     if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)"type-list") )
205       {
206         xmlNodePtr aTypeNode = aCurNode->xmlChildrenNode;
207         while (aTypeNode != NULL)
208           {
209             //  match "type"
210             if ( !xmlStrcmp(aTypeNode->name, (const xmlChar*)"type" )) 
211               {
212                 // Here is a basic type description
213                 ParserType aType;
214                 xmlChar * name=xmlGetProp(aTypeNode,(const xmlChar*)"name");
215                 if(name)
216                   {
217                     aType.name = (const char*)name;
218                     xmlFree(name);
219                   }
220                 xmlChar *kind=xmlGetProp(aTypeNode,(const xmlChar*)"kind");
221                 if(kind)
222                   {
223                     aType.kind = (const char*)kind;
224                     xmlFree(kind);
225                   }
226                 if(aType.kind == "double" ||
227                    aType.kind == "int"    ||
228                    aType.kind == "bool"    ||
229                    aType.kind == "string")
230                   {
231                     if ( _typeMap.find(aType.name) == _typeMap.end() )
232                       {
233                         MESSAGE("Registered basic type: " << aType.name << " " << aType.kind );
234                         _typeMap[aType.name]=aType;
235                         _typeList.push_back(aType);
236                       }
237                     else
238                       std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored."  << std::endl;
239                   }
240                 else
241                   std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") has incorrect kind, it will be ignored." << std::endl;
242               }
243             else if ( !xmlStrcmp(aTypeNode->name, (const xmlChar*)"sequence" )) 
244               {
245                 // Here is a sequence type description
246                 ParserSequence aType;
247                 xmlChar * name=xmlGetProp(aTypeNode,(const xmlChar*)"name");
248                 if(name)
249                   {
250                     aType.name = (const char*)name;
251                     xmlFree(name);
252                   }
253                 xmlChar *content=xmlGetProp(aTypeNode,(const xmlChar*)"content");
254                 if(content)
255                   {
256                     aType.content = (const char*)content;
257                     xmlFree(content);
258                   }
259                 if ( _typeMap.find(aType.content) != _typeMap.end() )
260                   {
261                     if ( _typeMap.find(aType.name) == _typeMap.end() )
262                       {
263                         MESSAGE("Registered sequence type: " << aType.name << " " << aType.content );
264                         _typeMap[aType.name]=aType;
265                         _typeList.push_back(aType);
266                       }
267                     else
268                       std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored."  << std::endl;
269                   }
270                 else
271                   {
272                     std::cerr << "Warning: this sequence type (" << aType.name << "," << aType.content << ") has unknown content type, it will be ignored." << std::endl;
273                   }
274               }
275             else if ( !xmlStrcmp(aTypeNode->name, (const xmlChar*)"objref" )) 
276               {
277                 // Here is an objref type description
278                 ParserObjref aType;
279                 int error=0;
280                 xmlChar * name=xmlGetProp(aTypeNode,(const xmlChar*)"name");
281                 if(name)
282                   {
283                     aType.name = (const char*)name;
284                     xmlFree(name);
285                   }
286                 xmlChar *id=xmlGetProp(aTypeNode,(const xmlChar*)"id");
287                 if(id)
288                   {
289                     aType.id = (const char*)id;
290                     xmlFree(id);
291                   }
292
293                 xmlNodePtr aTypeSubNode = aTypeNode->xmlChildrenNode;
294                 while (aTypeSubNode != NULL)
295                   {
296                     if ( !xmlStrcmp(aTypeSubNode->name, (const xmlChar*)"base" )) 
297                       {
298                         //a base type
299                         xmlChar* content = xmlNodeGetContent(aTypeSubNode);
300                         if(content)
301                           {
302                             std::string base=(const char*)content;
303                             xmlFree(content);
304                             if ( _typeMap.find(base) != _typeMap.end() && _typeMap[base].kind == "objref")
305                               {
306                                 aType.bases.push_back(base);
307                               }
308                             else
309                               {
310                                 std::cerr << "Warning: this objref type (" << aType.name << ") has unknown base type (" << base << "), it will be ignored." << std::endl;
311                                 error=1;
312                                 break;
313                               }
314                           }
315                       }
316                     aTypeSubNode = aTypeSubNode->next;
317                   }
318                 if(!error)
319                   {
320                     if ( _typeMap.find(aType.name) == _typeMap.end() )
321                       {
322                         //MESSAGE("Registered objref type: " << aType.name << " " << aType.id );
323                         _typeMap[aType.name]=aType;
324                         _typeList.push_back(aType);
325                       }
326                     else
327                       std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored."  << std::endl;
328                   }
329               }
330             else if ( !xmlStrcmp(aTypeNode->name, (const xmlChar*)"struct" )) 
331               {
332                 // Here is a struct type description
333                 ParserStruct aType;
334                 int error=0;
335                 xmlChar * name=xmlGetProp(aTypeNode,(const xmlChar*)"name");
336                 if(name)
337                   {
338                     aType.name = (const char*)name;
339                     xmlFree(name);
340                   }
341                 xmlChar *id=xmlGetProp(aTypeNode,(const xmlChar*)"id");
342                 if(id)
343                   {
344                     aType.id = (const char*)id;
345                     xmlFree(id);
346                   }
347
348                 xmlNodePtr aTypeSubNode = aTypeNode->xmlChildrenNode;
349                 while (aTypeSubNode != NULL)
350                   {
351                     if ( !xmlStrcmp(aTypeSubNode->name, (const xmlChar*)"member" )) 
352                       {
353                         std::pair<std::string,std::string> member;
354                         xmlChar * m_name=xmlGetProp(aTypeSubNode,(const xmlChar*)"name");
355                         if(m_name)
356                           {
357                             member.first=(const char*)m_name;
358                             xmlFree(m_name);
359                           }
360                         xmlChar * m_type=xmlGetProp(aTypeSubNode,(const xmlChar*)"type");
361                         if(m_type)
362                           {
363                             member.second=(const char*)m_type;
364                             xmlFree(m_type);
365                           }
366                         if ( _typeMap.find(member.second) != _typeMap.end() )
367                           {
368                             aType.members.push_back(member);
369                           }
370                         else
371                           {
372                             std::cerr << "Warning: this struct type (" << aType.name << ") has unknown member type (" << member.first << "," << member.second << "), it will be ignored." << std::endl;
373                             error=1;
374                             break;
375                           }
376                       }
377                     aTypeSubNode = aTypeSubNode->next;
378                   }
379                 if(!error)
380                   {
381                     if ( _typeMap.find(aType.name) == _typeMap.end() )
382                       {
383                         MESSAGE("Registered struct type: " << aType.name << " " << aType.id );
384                         _typeMap[aType.name]=aType;
385                         _typeList.push_back(aType);
386                       }
387                     else
388                       std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored."  << std::endl;
389                   }
390               } // end of struct
391             aTypeNode = aTypeNode->next;
392           }
393       }
394
395     //Part 3: Process list of components (tag test_component_list)
396     if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_component_list) )
397     {
398       xmlNodePtr aComponentNode = aCurNode->xmlChildrenNode;
399       while (aComponentNode != NULL)
400       {
401         // Do not process tags differ from test_component here
402         if ( xmlStrcmp(aComponentNode->name, (const xmlChar*)test_component) ) {
403           aComponentNode = aComponentNode->next;
404           continue;
405         }
406
407         // Component identification
408
409         // Empty temporary structures
410         _aModule.name = "";
411         _aModule.constraint = "";
412         _aModule.icon="";       
413         _aModule.interfaces.resize(0);
414         _aModule.implementationType ="";
415         _aModule.implementationName ="";
416
417         xmlNodePtr aComponentSubNode = aComponentNode->xmlChildrenNode;
418         while(aComponentSubNode != NULL)
419         {
420           xmlChar* aNodeContent = xmlNodeGetContent(aComponentSubNode);
421
422           if (aNodeContent == NULL) {
423             aComponentSubNode = aComponentSubNode->next;
424             continue;
425           }
426
427           std::string aContent = (const char*)aNodeContent;
428
429           // Tag test_component_name
430           if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_name) )
431             _aModule.name = aContent;
432
433           // Tag test_component_username
434           if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_username) )
435             _aModule.username = aContent;
436
437           // Tag test_component_type
438           if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_type) ) {
439             std::string aType = aContent;
440
441             if ((aType.compare("MESH") == 0) ||
442                 (aType.compare("Mesh") == 0) ||
443                 (aType.compare("mesh") == 0))
444               _aModule.type = MESH ;
445             else if((aType.compare("MED") == 0) ||
446                     (aType.compare("Med") == 0) ||
447                     (aType.compare("med") == 0))
448               _aModule.type = Med ;
449             else if((aType.compare("GEOM") == 0) ||
450                     (aType.compare("Geom") == 0) ||
451                     (aType.compare("geom") == 0))
452               _aModule.type = GEOM ;
453             else if((aType.compare("SOLVER") == 0) ||
454                     (aType.compare("Solver") == 0) ||
455                     (aType.compare("solver") == 0))
456               _aModule.type = SOLVER ;
457             else if((aType.compare("SUPERV") == 0) ||
458                     (aType.compare("Superv") == 0) ||
459                     (aType.compare("Supervision") == 0) ||
460                     (aType.compare("superv") == 0))
461               _aModule.type = SUPERV ;
462             else if((aType.compare("DATA") == 0) ||
463                     (aType.compare("Data") == 0) ||
464                     (aType.compare("data") == 0))
465               _aModule.type = DATA ; 
466             else if((aType.compare("VISU") == 0) ||
467                     (aType.compare("Visu") == 0) ||
468                     (aType.compare("visu") == 0))
469               _aModule.type = VISU ; 
470             else if((aType.compare("OTHER") == 0) ||
471                     (aType.compare("Other") == 0) ||
472                     (aType.compare("other") == 0))                
473               _aModule.type = OTHER ;
474             else
475               // If it'not in all theses cases, the type is affected to OTHER
476               _aModule.type = OTHER ;
477           }
478
479           // Tag test_component_impltype
480           if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_impltype) )
481             _aModule.implementationType = aContent;
482
483           // Tag test_component_implname
484           if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_implname) )
485             _aModule.implementationName = aContent;
486
487           // Tag test_component_icon
488           if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_icon) )
489             _aModule.icon = aContent;
490
491           // Tag test_component_version
492           if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_version) )
493             _aModule.version = aContent;
494
495           // Tag test_component_comment
496           if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_comment) )
497             _aModule.comment = aContent;
498
499           // Tag test_constraint
500           if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_constraint) )
501             _aModule.constraint = aContent;
502
503           xmlFree(aNodeContent);
504
505           // Process tag test_interface_list:
506           if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_interface_list) ) {
507
508             // Form an interface list for the component
509             xmlNodePtr aSubNode = aComponentSubNode->xmlChildrenNode;
510             while(aSubNode != NULL) {
511               // Tag test_interface_name
512               if ( !xmlStrcmp(aSubNode->name, (const xmlChar*)test_interface_name) ) {
513                 xmlChar* anInterfaceName = xmlNodeGetContent(aSubNode);
514                 if (anInterfaceName != NULL) {
515                   _aInterface.name = (const char*)anInterfaceName;
516                   xmlFree(anInterfaceName);
517                 }
518               }
519
520               // Tag test_service_list
521               if ( !xmlStrcmp(aSubNode->name, (const xmlChar*)test_service_list) ) {
522                 // Form a service list for the interface
523                 xmlNodePtr aCompServiceNode = aSubNode->xmlChildrenNode;
524                 while(aCompServiceNode != NULL) {
525                   // Tag test_service
526                   if ( !xmlStrcmp(aCompServiceNode->name, (const xmlChar*)"component-service") ) {
527                     xmlNodePtr aCompServiceSubNode = aCompServiceNode->xmlChildrenNode;
528                     while(aCompServiceSubNode != NULL)
529                     {
530                       xmlChar* aCompServiceData = xmlNodeGetContent(aCompServiceSubNode);
531
532                       if ( aCompServiceData != NULL)
533                       {
534                         // Tag test_service_name
535                         if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_service_name) )
536                           _aService.name = (const char*)aCompServiceData;
537
538                         // Tag test_defaultservice
539                         if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_defaultservice) )
540                           _aService.byDefault = atoi((const char*)aCompServiceData) !=0 ;
541
542                         // Tag test_typeofnode
543                         if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_typeofnode) )
544                           _aService.typeOfNode = atoi((const char*)aCompServiceData) !=0 ;
545
546                         xmlFree(aCompServiceData);
547                       }
548
549                       // Tag test_inParameter_list
550                       if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_inParameter_list) ) {
551                         xmlNodePtr aParamNode = aCompServiceSubNode->xmlChildrenNode;
552                         while (aParamNode != NULL)
553                         {
554                           // Tag test_inParameter
555                           if (xmlStrcmp(aParamNode->name, (const xmlChar*)test_inParameter)) {
556                             aParamNode = aParamNode->next;
557                             continue;
558                           }
559
560                           xmlNodePtr aParamItemNode = aParamNode->xmlChildrenNode;
561                           while (aParamItemNode != NULL)
562                           {
563                             xmlChar* aParamData = xmlNodeGetContent(aParamItemNode);
564
565                             if (aParamData != NULL)
566                             {
567                               // Tag test_inParameter_name
568                               if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inParameter_name) )
569                                 _inParam.name = (const char*)aParamData;
570
571                               // Tag test_inParameter_type
572                               if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inParameter_type) )
573                                 _inParam.type = (const char*)aParamData;
574
575                               xmlFree(aParamData);
576                             }
577
578                             aParamItemNode = aParamItemNode->next;
579                           }
580
581                           _inParamList.push_back(_inParam) ; 
582
583                           // Empty temporary structures
584                           _inParam.type = "";
585                           _inParam.name = "";
586
587                           aParamNode = aParamNode->next;
588                         }
589
590                         _aService.inParameters = _inParamList;
591                         _inParamList.resize(0);
592                       }
593
594                       // Tag test_outParameter_list
595                       if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_outParameter_list) ) {
596                         xmlNodePtr aParamNode = aCompServiceSubNode->xmlChildrenNode;
597                         while (aParamNode != NULL)
598                         {
599                           // Tag test_outParameter
600                           if (xmlStrcmp(aParamNode->name, (const xmlChar*)test_outParameter)) {
601                             aParamNode = aParamNode->next;
602                             continue;
603                           }
604
605                           xmlNodePtr aParamItemNode = aParamNode->xmlChildrenNode;
606                           while (aParamItemNode != NULL)
607                           {
608                             xmlChar* anOutParamData = xmlNodeGetContent(aParamItemNode);
609
610                             if (anOutParamData != NULL)
611                             {
612                               // Tag test_outParameter_name
613                               if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outParameter_name) )
614                                 _outParam.name = (const char*)anOutParamData;
615
616                               // Tag test_outParameter_type
617                               if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outParameter_type) )
618                                 _outParam.type = (const char*)anOutParamData;
619
620                               xmlFree(anOutParamData);
621                             }
622
623                             aParamItemNode = aParamItemNode->next;
624                           }
625
626                           _outParamList.push_back(_outParam) ; 
627
628                           // Empty temporary structures
629                           _outParam.type = "";
630                           _outParam.name = "";
631
632                           aParamNode = aParamNode->next;
633                         }
634
635                         _aService.outParameters = _outParamList;
636                         _outParamList.resize(0);
637                       }
638
639                       //@ Tag test_inDataStreamParameter_list
640                       if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_inDataStreamParameter_list) )
641                       {
642                         xmlNodePtr aParamNode = aCompServiceSubNode->xmlChildrenNode;
643                         while (aParamNode != NULL)
644                         {
645                           // Tag test_inDataStreamParameter
646                           if (xmlStrcmp(aParamNode->name, (const xmlChar*)test_inDataStreamParameter)) {
647                             aParamNode = aParamNode->next;
648                             continue;
649                           }
650
651                           xmlNodePtr aParamItemNode = aParamNode->xmlChildrenNode;
652                           while (aParamItemNode != NULL)
653                           {
654                             xmlChar* inDataStreamParamData = xmlNodeGetContent(aParamItemNode);
655
656                             if (inDataStreamParamData != NULL)
657                             {
658                               // Tag test_inDataStreamParameter_name
659                               if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inDataStreamParameter_name) )
660                                 _inDataStreamParam.name = (const char*)inDataStreamParamData;
661
662                               // Tag test_inDataStreamParameter_type
663                               if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inDataStreamParameter_type) )
664                                 _inDataStreamParam.type = (const char*)inDataStreamParamData;
665
666                               // Tag test_inDataStreamParameter_dependency
667                               if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inDataStreamParameter_dependency) )
668                                 _inDataStreamParam.dependency = (const char*)inDataStreamParamData;
669
670                               xmlFree(inDataStreamParamData);
671                             }
672
673                             aParamItemNode = aParamItemNode->next;
674                           }
675
676                           _inDataStreamParamList.push_back(_inDataStreamParam) ; 
677
678                           // Empty temporary structures
679                           _inDataStreamParam.type = "";
680                           _inDataStreamParam.name = "";
681                           _inDataStreamParam.dependency = "";
682
683                           aParamNode = aParamNode->next;
684                         }
685
686                         _aService.inDataStreamParameters = _inDataStreamParamList;
687                         _inDataStreamParamList.resize(0);
688                       }
689
690                       // Tag test_outDataStreamParameter_list
691                       if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_outDataStreamParameter_list) )
692                       {
693                         xmlNodePtr aParamNode = aCompServiceSubNode->xmlChildrenNode;
694                         while (aParamNode != NULL)
695                         {
696                           // Tag test_outDataStreamParameter
697                           if (xmlStrcmp(aParamNode->name, (const xmlChar*)test_outDataStreamParameter)) {
698                             aParamNode = aParamNode->next;
699                             continue;
700                           }
701
702                           xmlNodePtr aParamItemNode = aParamNode->xmlChildrenNode;
703                           while (aParamItemNode != NULL)
704                           {
705                             xmlChar* outDataStreamParamData = xmlNodeGetContent(aParamItemNode);
706
707                             if (outDataStreamParamData != NULL)
708                             {
709                               // Tag test_outDataStreamParameter_name
710                               if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outDataStreamParameter_name) )
711                                 _outDataStreamParam.name = (const char*)outDataStreamParamData;
712                               
713                               // Tag test_outDataStreamParameter_type
714                               if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outDataStreamParameter_type) )
715                                 _outDataStreamParam.type = (const char*)outDataStreamParamData;
716                               
717                               // Tag test_outDataStreamParameter_dependency
718                               if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outDataStreamParameter_dependency) )
719                                 _outDataStreamParam.dependency = (const char*)outDataStreamParamData;
720                               
721                               xmlFree(outDataStreamParamData);
722                             }
723
724                             aParamItemNode = aParamItemNode->next;
725                           }
726                           
727                           _outDataStreamParamList.push_back(_outDataStreamParam) ; 
728                           
729                           // Empty temporary structures
730                           _outDataStreamParam.type = "";
731                           _outDataStreamParam.name = "";
732                           _outDataStreamParam.dependency = "";
733
734                           aParamNode = aParamNode->next;
735                         }
736                         
737                         _aService.outDataStreamParameters = _outDataStreamParamList;
738                         _outDataStreamParamList.resize(0);
739                       }
740                       
741                       aCompServiceSubNode = aCompServiceSubNode->next;
742                     }
743
744                     // Put formed service into the list
745                     _serviceList.push_back(_aService);
746
747                     // Empty temporary structures
748                     _aService.name = "";
749                     _aService.typeOfNode = 1;
750                     _aService.inParameters.resize(0);
751                     _aService.outParameters.resize(0);
752                     _aService.inDataStreamParameters.resize(0);
753                     _aService.outDataStreamParameters.resize(0);
754                   }
755                   
756                   aCompServiceNode = aCompServiceNode->next;
757                 }
758                 
759                 _aInterface.services = _serviceList ;
760                 
761                 // Empty temporary structures
762                 _serviceList.resize(0);
763                 _interfaceList.push_back(_aInterface);  
764                 _aInterface.name ="";    
765                 _aInterface.services.resize(0);
766               }
767               
768               aSubNode = aSubNode->next;
769             }
770             
771             _aModule.interfaces = _interfaceList ;
772             _interfaceList.resize(0);
773           }
774
775           aComponentSubNode = aComponentSubNode->next;
776         }
777
778         _moduleList.push_back(_aModule);
779
780         aComponentNode = aComponentNode->next;
781       }
782     }
783
784     aCurNode = aCurNode->next;
785   }
786 }