Back to index

salome-kernel  6.5.0
Public Member Functions | Public Attributes | Private Attributes
IDLparser.ModuleCatalogVisitor Class Reference

List of all members.

Public Member Functions

def __init__
def visitAST
def visitModule
def visitInterface
def visitOperation
def visitDeclaredType
def visitBaseType
def visitStringType
def visitParameter
def visitSequenceType
def visitTypedef
def visitStruct
def visitDeclarator

Public Attributes

 catalog
 EngineType
 currentScope
 currentInterface
 currentService
 currentType
 contentType

Private Attributes

 __result_declarator

Detailed Description

Definition at line 666 of file IDLparser.py.


Constructor & Destructor Documentation

def IDLparser.ModuleCatalogVisitor.__init__ (   self,
  catalog 
)

Definition at line 668 of file IDLparser.py.

00668 
00669     def __init__(self, catalog):
00670         self.catalog = catalog
00671         self.EngineType = 0
00672         self.currentScope=None


Member Function Documentation

def IDLparser.ModuleCatalogVisitor.visitAST (   self,
  node 
)

Definition at line 673 of file IDLparser.py.

00673 
00674     def visitAST(self, node):
00675         for n in node.declarations():
00676             if n.mainFile():
00677               n.accept(self)

Definition at line 752 of file IDLparser.py.

00752 
00753     def visitBaseType(self, type):
00754         self.currentType = ttsMap[type.kind()]

Definition at line 813 of file IDLparser.py.

00813 
00814     def visitDeclarator(self, node):
00815         if node.sizes():
00816           self.__result_declarator =None
00817         else:
00818           self.__result_declarator =node.identifier()
00819 
00820 #--------------------------------------------------
00821 # parse idl and store xml file
#--------------------------------------------------

Definition at line 747 of file IDLparser.py.

00747 
00748     def visitDeclaredType(self, type):
00749         name=type.name()
00750         scoped_name="/".join(type.scopedName())
00751         self.currentType = scoped_name

Definition at line 683 of file IDLparser.py.

00683 
00684     def visitInterface(self, node):
00685         if node.mainFile():
00686 
00687             self.EngineType = 0
00688 
00689             for i in node.inherits():
00690                 s = i.scopedName();
00691                 if s[0] == "Engines":
00692                   if s[1] == "EngineComponent":
00693                     self.EngineType = 1; break
00694                   if s[1] == "Superv_Component":
00695                     self.EngineType = 2; break
00696 
00697             if self.EngineType:
00698               #This interface is a SALOME component
00699               Comp = Component(node.identifier())
00700 
00701               self.currentInterface = Comp.createInterface(node.identifier())
00702 
00703               for c in node.callables():
00704                 if isinstance(c, idlast.Operation):
00705                     c.accept(self)
00706 
00707               for c in node.declarations():
00708                 if isinstance(c, idlast.Struct):
00709                     c.accept(self)
00710 
00711               for i in node.comments():
00712                 self.currentInterface.comments.append(str(i))
00713 
00714               if self.EngineType == 2:
00715                 self.currentInterface.processDataStreams()
00716 
00717               global nb_components
00718               nb_components = nb_components + 1
00719               self.catalog.mergeComponent(Comp)
00720 
00721             else:
00722               #This interface is not a component : use it as a DataType
00723               t=ObjType("/".join(node.scopedName()))
00724               for i in node.inherits():
00725                 t.addNamedChild("base","/".join(i.scopedName()))
00726               self.catalog.mergeType(t)
00727 
00728             self.EngineType = 0
00729 

def IDLparser.ModuleCatalogVisitor.visitModule (   self,
  node 
)

Definition at line 678 of file IDLparser.py.

00678 
00679     def visitModule(self, node):
00680         self.currentScope=node
00681         for n in node.definitions():
00682             n.accept(self)

Definition at line 730 of file IDLparser.py.

00730 
00731     def visitOperation(self, node):
00732 
00733         self.currentService = self.currentInterface.createService \
00734                                        (node.identifier())
00735 
00736         node.returnType().accept(self)
00737         if (self.currentType != "void"):
00738             self.currentService.createOutParameter \
00739                 ("return", self.currentType)
00740 
00741         for c in node.parameters():
00742             c.accept(self)
00743 
00744         for i in node.comments():
00745             self.currentInterface.comments.append(str(i))
00746 

Definition at line 758 of file IDLparser.py.

00758 
00759     def visitParameter(self, node):
00760         node.paramType().accept(self)
00761         if node.is_in():
00762             self.currentService.createInParameter \
00763                      (node.identifier(), self.currentType)
00764         if node.is_out():
00765             self.currentService.createOutParameter \
00766                      (node.identifier(), self.currentType)

Definition at line 767 of file IDLparser.py.

00767 
00768     def visitSequenceType(self,type):
00769       type.seqType().accept(self)
00770       if type.bound() == 0:
00771           self.contentType=self.currentType
00772           self.currentType = "sequence"
00773       else:
00774           self.currentType = None

Definition at line 755 of file IDLparser.py.

00755 
00756     def visitStringType(self, type):
00757         self.currentType = "string"

def IDLparser.ModuleCatalogVisitor.visitStruct (   self,
  node 
)

Definition at line 799 of file IDLparser.py.

00799 
00800     def visitStruct(self, node):
00801       t=StructType("/".join(node.scopedName()))
00802       for m in node.members():
00803             if m.constrType():
00804                 m.memberType().decl().accept(self)
00805 
00806             m.memberType().accept(self)
00807             type = self.currentType
00808             for d in m.declarators():
00809                 d.accept(self)
00810                 t.addChild(Member(self.__result_declarator,type))
00811 
00812       self.catalog.mergeType(t)

def IDLparser.ModuleCatalogVisitor.visitTypedef (   self,
  node 
)

Definition at line 775 of file IDLparser.py.

00775 
00776     def visitTypedef(self, node):
00777       if node.constrType():
00778             node.aliasType().decl().accept(self)
00779 
00780       node.aliasType().accept(self)
00781       type  = self.currentType
00782       if not type:
00783         return
00784       decll = []
00785       for d in node.declarators():
00786             d.accept(self)
00787             if self.__result_declarator:
00788               decll.append(self.__result_declarator)
00789       if type == "sequence":
00790         #it's a sequence type
00791         for name in decll:
00792           scoped_name="/".join(self.currentScope.scopedName()+[name])
00793           self.catalog.mergeType(SeqType(scoped_name,self.contentType))
00794       #else:
00795         #it's an alias
00796       #  for name in decll:
00797       #    scoped_name="/".join(self.currentScope.scopedName()+[name])
00798       #    self.catalog.mergeType(Type(scoped_name,type))


Member Data Documentation

Definition at line 815 of file IDLparser.py.

Definition at line 669 of file IDLparser.py.

Definition at line 770 of file IDLparser.py.

Definition at line 700 of file IDLparser.py.

Definition at line 671 of file IDLparser.py.

Definition at line 732 of file IDLparser.py.

Definition at line 750 of file IDLparser.py.

Definition at line 670 of file IDLparser.py.


The documentation for this class was generated from the following file: