Salome HOME
4864f32a451ca8acf5cc713840ae91c1e9e022c8
[modules/kernel.git] / src / ModuleCatalog / SALOME_ModuleCatalog_Parser_IO.cxx
1
2 //  SALOME ModuleCatalog : implementation of ModuleCatalog server which parsers xml description of modules
3 //
4 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
5 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
6 // 
7 //  This library is free software; you can redistribute it and/or 
8 //  modify it under the terms of the GNU Lesser General Public 
9 //  License as published by the Free Software Foundation; either 
10 //  version 2.1 of the License. 
11 // 
12 //  This library is distributed in the hope that it will be useful, 
13 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
14 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
15 //  Lesser General Public License for more details. 
16 // 
17 //  You should have received a copy of the GNU Lesser General Public 
18 //  License along with this library; if not, write to the Free Software 
19 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
20 // 
21 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
22 //
23 //
24 //
25 //  File   : SALOME_ModuleCatalog_Parser_IO.cxx
26 //  Author : Estelle Deville
27 //  Module : SALOME
28 //  $Header$
29
30 #include "SALOME_ModuleCatalog_Parser_IO.hxx"
31 #include <string>
32 #include "utilities.h"
33
34 std::ostream & operator<< (std::ostream & f, const ParserParameter & P)
35 {
36   f << "          name :       " << P.name << std::endl;
37   f << "          type :       " << P.type << std::endl;
38   return f;
39 }
40
41 std::ostream & operator<< (std::ostream & f, 
42                            const ParserDataStreamParameter & P)
43 {
44   f << "          name :       " << P.name << std::endl;
45   f << "          type :       " << P.type << std::endl;
46   f << "          dependency : " << P.dependency << std::endl;
47   return f;
48 }
49
50 std::ostream & operator<< (std::ostream & f, 
51                            const ParserService & S)
52 {
53   int i, n;
54   f << "      name :       " << S.name << std::endl;
55   f << "      default :    " << (S.byDefault ? "yes" : "no") 
56     << std::endl;
57
58   n = S.inParameters.size();
59   f << "      in parameters : " << n << std::endl;
60   for (i=0; i<n; i++)
61     f << S.inParameters[i] << std::endl;
62   if (n == 0) f << std::endl;
63
64   n = S.inDataStreamParameters.size();
65   f << "      in DataStream parameters : " << n << std::endl;
66   for (i=0; i<n; i++)
67     f << S.inDataStreamParameters[i] << std::endl;
68   if (n == 0) f << std::endl;
69
70   n = S.outParameters.size();
71   f << "      out parameters : " << n << std::endl;
72   for (i=0; i<n; i++)
73     f << S.outParameters[i] << std::endl;
74   if (n == 0) f << std::endl;
75
76   n = S.outDataStreamParameters.size();
77   f << "      out DataStream parameters : " << n << std::endl;
78   for (i=0; i<n; i++)
79     f << S.outDataStreamParameters[i] << std::endl;
80   if (n == 0) f << std::endl;
81
82   return f;
83 }
84
85 std::ostream & operator<< (std::ostream & f, 
86                            const ParserInterface & I)
87 {
88   int j, n;
89   f << "    name :       " << I.name << std::endl;
90
91   n = I.services.size();
92   f << "    services : " << n << std::endl;
93   for (j=0; j<n; j++) {
94     MESSAGE(I.services[j].name);
95     f << I.services[j] << std::endl;
96   }
97
98   return f;
99 }
100
101 std::ostream & operator<< (std::ostream & f, 
102                            const  ParserComponentType & T)
103 {
104   std::string s;
105   switch (T) {
106   case GEOM :   s = "GEOM"; break;
107   case MESH :   s = "MESH"; break;
108   case Med  :   s = "Med"; break;
109   case SOLVER : s = "SOLVER"; break;
110   case DATA :   s = "DATA"; break;
111   case VISU :   s = "VISU"; break;
112   case SUPERV : s = "SUPERV"; break;
113   default :     s = "OTHER"; break;
114   }
115   f << s << std::endl;
116   return f;
117 }
118
119 std::ostream & operator<< (std::ostream & f, 
120                            const ParserComponent & C)
121 {
122   int j, n;
123   f << std::endl
124     << "    name :       " << C.name << std::endl;
125   f << "    user name :  " << C.username << std::endl;
126   f << "    type :       " << C.type << std::endl;
127   f << "    multistudy : " << (C.multistudy ? "yes" : "no")
128     << std::endl;
129   f << "    icon :       " << C.icon << std::endl;
130   f << "    constraint : " << C.constraint << std::endl;
131
132   n = C.interfaces.size();
133   f << "    interfaces : " << n << std::endl;
134   for (j=0; j<n; j++)
135     f << C.interfaces[j] << std::endl;
136   if (n == 0) f << std::endl;
137
138   return f;
139 }
140
141