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