Back to index

salome-kernel  6.5.0
TestModuleCatalog.py
Go to the documentation of this file.
00001 #  -*- coding: iso-8859-1 -*-
00002 # Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00003 #
00004 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00005 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00006 #
00007 # This library is free software; you can redistribute it and/or
00008 # modify it under the terms of the GNU Lesser General Public
00009 # License as published by the Free Software Foundation; either
00010 # version 2.1 of the License.
00011 #
00012 # This library is distributed in the hope that it will be useful,
00013 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 # Lesser General Public License for more details.
00016 #
00017 # You should have received a copy of the GNU Lesser General Public
00018 # License along with this library; if not, write to the Free Software
00019 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00020 #
00021 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00022 #
00023 
00024 import batchmode_salome
00025 import SALOME_ModuleCatalog
00026 
00027 print
00028 print "======================================================================"
00029 print "           XML Catalog file generation from idl file"
00030 print "======================================================================"
00031 
00032 import os
00033 os.system('runIDLparser -Wbcatalog=x \
00034                  ${KERNEL_ROOT_DIR}/idl/salome/SALOME_TestModuleCatalog.idl')
00035 
00036 print "======================================================================"
00037 print "           Get Catalog "
00038 print "======================================================================"
00039 obj = batchmode_salome.naming_service.Resolve('Kernel/ModulCatalog')
00040 catalog = obj._narrow(SALOME_ModuleCatalog.ModuleCatalog)
00041 catalog.GetComponentList()
00042 
00043 print 
00044 print "======================================================================"
00045 print "           Import xml file "
00046 print "======================================================================"
00047 catalog.ImportXmlCatalogFile("x.xml")
00048 
00049 name = "AddComponent"
00050 print 
00051 print "======================================================================"
00052 print "           Dump component <", name, "> "
00053 print "======================================================================"
00054 C = catalog.GetComponent(name)
00055 
00056 print "name       : ", C._get_componentname()
00057 print "username   : ", C._get_componentusername()
00058 print "type       : ", C._get_component_type()
00059 print "constraint : ", C._get_constraint()
00060 print "icon       : ", C._get_component_icone()
00061 
00062 for iL in C.GetInterfaceList():
00063     I = C.GetInterface(iL)
00064     print "interface  : ", I.interfacename
00065     for S in I.interfaceservicelist:
00066         print "  service : ", S.ServiceName
00067         print "    ", len(S.ServiceinParameter), "in params : "
00068         for iP in S.ServiceinParameter:
00069             print '      ' + iP.Parametername + '(' + iP.Parametertype + ')'
00070             pass
00071         print "    ", len(S.ServiceoutParameter), "out params : "
00072         for iP in S.ServiceoutParameter:
00073             print '      ' + iP.Parametername + '(' + iP.Parametertype + ')'
00074             pass
00075         print "    ", len(S.ServiceinDataStreamParameter), "in datastream params : "
00076         for iP in S.ServiceinDataStreamParameter:
00077             print '      ' + iP.Parametername + '(' + str(iP.Parametertype) + ', ' + \
00078                   str(iP.Parameterdependency) + ')'
00079             pass
00080         print "    ", len(S.ServiceoutDataStreamParameter), "out datastream params : "
00081         for iP in S.ServiceoutDataStreamParameter:
00082             print '      ' + iP.Parametername + '(' + str(iP.Parametertype) + ', ' + \
00083                   str(iP.Parameterdependency) + ')'
00084             pass
00085         pass
00086     pass
00087