Salome HOME
CCAR:
[modules/kernel.git] / src / ModuleCatalog / TestModuleCatalog.py
1 #  Copyright (C) 2007-2008  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.
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 import batchmode_salome
23 import SALOME_ModuleCatalog
24
25 print
26 print "======================================================================"
27 print "           XML Catalog file generation from idl file"
28 print "======================================================================"
29
30 import os
31 os.system('runIDLparser -Wbcatalog=x \
32                  ${KERNEL_ROOT_DIR}/idl/salome/SALOME_TestModuleCatalog.idl')
33
34 print "======================================================================"
35 print "           Get Catalog "
36 print "======================================================================"
37 obj = batchmode_salome.naming_service.Resolve('Kernel/ModulCatalog')
38 catalog = obj._narrow(SALOME_ModuleCatalog.ModuleCatalog)
39 catalog.GetComponentList()
40
41 print 
42 print "======================================================================"
43 print "           Import xml file "
44 print "======================================================================"
45 catalog.ImportXmlCatalogFile("x.xml")
46
47 name = "AddComponent"
48 print 
49 print "======================================================================"
50 print "           Dump component <", name, "> "
51 print "======================================================================"
52 C = catalog.GetComponent(name)
53
54 print "name       : ", C._get_componentname()
55 print "username   : ", C._get_componentusername()
56 print "type       : ", C._get_component_type()
57 print "constraint : ", C._get_constraint()
58 print "icon       : ", C._get_component_icone()
59
60 for iL in C.GetInterfaceList():
61     I = C.GetInterface(iL)
62     print "interface  : ", I.interfacename
63     for S in I.interfaceservicelist:
64         print "  service : ", S.ServiceName
65         print "    ", len(S.ServiceinParameter), "in params : "
66         for iP in S.ServiceinParameter:
67             print '      ' + iP.Parametername + '(' + iP.Parametertype + ')'
68             pass
69         print "    ", len(S.ServiceoutParameter), "out params : "
70         for iP in S.ServiceoutParameter:
71             print '      ' + iP.Parametername + '(' + iP.Parametertype + ')'
72             pass
73         print "    ", len(S.ServiceinDataStreamParameter), "in datastream params : "
74         for iP in S.ServiceinDataStreamParameter:
75             print '      ' + iP.Parametername + '(' + str(iP.Parametertype) + ', ' + \
76                   str(iP.Parameterdependency) + ')'
77             pass
78         print "    ", len(S.ServiceoutDataStreamParameter), "out datastream params : "
79         for iP in S.ServiceoutDataStreamParameter:
80             print '      ' + iP.Parametername + '(' + str(iP.Parametertype) + ', ' + \
81                   str(iP.Parameterdependency) + ')'
82             pass
83         pass
84     pass
85