コード例 #1
0
 def mapStructValue(self, structdef, value):
     newval = {}
     for field in structdef['fields']:
         identifier = field['identifier']
         if identifier in value:
             if type(value[identifier]) == list:
                 newval[identifier] = []
                 for val in value[identifier]:
                     newval[identifier].append(cpp.literal(val, field['type']))
             else:
                 newval[identifier] = cpp.literal(value[identifier], field['type'])
     return newval
コード例 #2
0
 def mapStructValue(self, structdef, value):
     newval = {}
     for field in structdef['fields']:
         identifier = field['identifier']
         if identifier in value:
             if type(value[identifier]) == list:
                 newval[identifier] = []
                 for val in value[identifier]:
                     newval[identifier].append(cpp.literal(val, field['type'], field['iscomplex']))
             else:
                 newval[identifier] = cpp.literal(value[identifier], field['type'], field['iscomplex'])
     return newval
コード例 #3
0
 def mapStructValue(self, structdef, value):
     newval = {}
     for field in structdef['fields']:
         identifier = field['identifier']
         if identifier in value:
             newval[identifier] = cpp.literal(value[identifier], field['type'])
     return newval
コード例 #4
0
 def mapSimpleSequenceProperty(self, prop):
     cppprop = self.mapProperty(prop)
     cppprop['cpptype'] = cpp.sequenceType(prop.type(), prop.isComplex())
     if prop.hasValue():
         cppprop['cppvalues'] = [cpp.literal(v, 
                                             prop.type(), 
                                             prop.isComplex()) 
                                 for v in prop.value()]
     return cppprop
コード例 #5
0
 def mapSimpleProperty(self, prop):
     cppprop = self.mapProperty(prop)
     cppprop['iscomplex'] = prop.isComplex()
     cppprop['cpptype'] = cpp.cppType(prop.type(), prop.isComplex())
     if prop.hasValue():
         cppprop['cppvalue'] = cpp.literal(prop.value(), 
                                           prop.type(),
                                           prop.isComplex())
     return cppprop
コード例 #6
0
 def mapSimpleProperty(self, prop):
     cppprop = self.mapProperty(prop)
     cppprop['iscomplex'] = prop.isComplex()
     cppprop['isOptional'] = prop.isOptional()
     cppprop['cpptype'] = cpp.cppType(prop.type(), prop.isComplex())
     if prop.hasValue():
         cppprop['cppvalue'] = cpp.literal(prop.value(), prop.type(),
                                           prop.isComplex())
     return cppprop
コード例 #7
0
 def mapSimpleSequenceProperty(self, prop):
     cppprop = self.mapProperty(prop)
     cppprop['cpptype'] = cpp.sequenceType(prop.type(), prop.isComplex())
     cppprop['isOptional'] = prop.isOptional()
     if prop.hasValue():
         cppprop['cppvalues'] = [
             cpp.literal(v, prop.type(), prop.isComplex())
             for v in prop.value()
         ]
     return cppprop
コード例 #8
0
 def mapSimpleProperty(self, prop):
     cppprop = self.mapProperty(prop)
     cppprop['iscomplex'] = prop.isComplex()
     cppprop['isOptional'] = prop.isOptional()
     cppprop['cpptype'] = cpp.cppType(prop.type(), prop.isComplex())
     if prop.hasValue():
         _prepend = ''
         _append = ''
         if prop.type() == 'utctime':
             _prepend = '"'
             _append = '"'
         cppprop['cppvalue'] = _prepend+cpp.literal(prop.value(), 
                                           prop.type(),
                                           prop.isComplex())+_append
     cppprop['format'] = self._getSimpleFormat(prop, False)
     return cppprop
コード例 #9
0
 def mapSimpleSequenceProperty(self, prop):
     cppprop = self.mapProperty(prop)
     cppprop['cpptype'] = cpp.sequenceType(prop.type(), prop.isComplex())
     cppprop['iscomplex'] = prop.isComplex()
     cppprop['isOptional'] = prop.isOptional()
     if prop.hasValue():
         _prepend = ''
         _append = ''
         if prop.type() == 'utctime':
             _prepend = 'redhawk::time::utils::convert("'
             _append = '")'
         cppprop['cppvalues'] = [_prepend+cpp.literal(v, 
                                             prop.type(), 
                                             prop.isComplex())+_append
                                 for v in prop.value()]
     cppprop['format'] = self._getSimpleFormat(prop, True)
     return cppprop
コード例 #10
0
 def mapEnumeration(self, prop, label, value):
     cppenum = {}
     cppenum['cpplabel'] = cpp.identifier(label)
     cppenum['cppvalue'] = cpp.literal(value, prop.type(), prop.isComplex())
     return cppenum