def operator(g,n): name=n.getAttribute('name') opCode = opEnum(implName(n)) if (exec_(n) == 'MRF'): name=name+'_mrf' opCode=opEnum(name) iOpImpl="0" # # FTTB, some not implemented yet, hence if: if DomUtils.childInNameSet(n, self.supported) != None or \ exec_(n) in self.onExec: biName=implName(n) if exec_(n) == 'MRF': biName=biName+"_mrf" iOpImpl= '&builtIn_%s' % biName p=DomUtils.childInNameSet(n, self.pointCode) # mark by setting the domain arg to setPointOn setPointOn="" if p != None and p.hasAttribute("function") and name not in [ "sin", "cos", "tan" ]: setPointOn=self.domainIll(p) if implName(n) == "ifthenelse": setPointOn="noDomainIll" tail= int(inputTailRepeat(n)) if (tail > 0): assert tail <= len(DomUtils.childrenInNameSet(n,["Input"])) g.write('{IOpImpl *i= %s;' % iOpImpl) g.write(' Operator *c= new Operator(') g.write(''' "%s","%s",%s, SYNTAX_%s, EXEC_TYPE_%s, i,%s,%s);''' % (name,implName(n),opCode,syntax(n),exec_(n),commutative(n),tail)) if setPointOn != "": g.write(' c->setPointOn(%s);' % setPointOn) for f in DomUtils.childrenInNameSet(n,["Input"]): g.write(' c->pushBackInput(%s);' % pcrxml.DataType(f).arg()) for f in DomUtils.childrenInNameSet(n,["Result"]): g.write(' c->pushBackResult(%s);' % pcrxml.DataType(f).str()) g.write(' add(c);') g.write('}')
def operationImpl(self,n): if exec_(n) == "Direct": return # no need to generate the builtIn_%name% object name=implName(n) i = DomUtils.childInNameSet(n, self.automatic) ctorArgs=[] if i: type = i.nodeName if name in [ "sin", "cos", "tan" ]: type = "Trig" typeAndName="%s builtIn_%s" % (type,name) ctorArgs = self.pointOps(name,i,list(i.getAttribute("foTypes"))) elif exec_(n) in self.onExec: className = { 'GLOBAL':'Global', 'MRF':'MRF', 'DOUBLE':'OneOfMRF' } typeAndName="%s builtIn_%s" % (className[exec_(n)],name) if exec_(n) == 'MRF': typeAndName=typeAndName+"_mrf" if exec_(n) == 'DOUBLE': assert n.hasAttribute('mrf') ctorArgs= [ "&builtIn_%s_mrf" % n.getAttribute('mrf') ] else: # GLOBAL ctorArgs= [ 'Do_'+name ] if len(ctorArgs): self.biInc.write("static %s(%s);" % (typeAndName,string.join(ctorArgs,",")))
def operationImpl(self,n): if exec_(n) == "Direct": return # no need to generate the builtIn_%name% object name=implName(n) i = DomUtils.childInNameSet(n, self.automatic) ctorArgs=[] if i: type = i.nodeName if name in [ "sin", "cos", "tan" ]: type = "Trig" typeAndName="%s builtIn_%s" % (type,name) ctorArgs = self.pointOps(name,i,list(i.getAttribute("foTypes"))) elif exec_(n) in self.onExec: className = { 'GLOBAL':'Global', 'MRF':'MRF', 'DOUBLE':'OneOfMRF' } typeAndName="%s builtIn_%s" % (className[exec_(n)],name) if exec_(n) == 'MRF': typeAndName=typeAndName+"_mrf" if exec_(n) == 'DOUBLE': assert n.hasAttribute('mrf') ctorArgs= [ "&builtIn_%s_mrf" % n.getAttribute('mrf') ] else: # GLOBAL ctorArgs= [ 'Do_'+name ] if len(ctorArgs): self.biInc.write("static %s(%s);" % (typeAndName,",".join(ctorArgs)))