parameters: (msg_context, spec, start, end, serialize)
docstring: Generator (de)serialization code for multiple fields from spec
  
      :param spec: :class:`genmsg.MsgSpec`
      :param start: first field to serialize, ``int``
      :param end: last field to serialize, ``int``
docstring_summary: Generator (de)serialization code for multiple fields from spec
docstring_tokens: Generator ( de ) serialization code for multiple fields from spec
function: def simple_serializer_generator(msg_context, spec, start, end, serialize): #primitives that can be handled with struct
      """
      Generator (de)serialization code for multiple fields from spec
  
      :param spec: :class:`genmsg.MsgSpec`
      :param start: first field to serialize, ``int``
      :param end: last field to serialize, ``int``
      """
      # optimize member var access
      if end - start > 1 and _serial_context.endswith('.'):
          yield '_x = '+_serial_context[:-1]
          vars_ = '_x.' + (', _x.').join(spec.names[start:end])
      else:
          vars_ = _serial_context + (', '+_serial_context).join(spec.names[start:end])
  
      pattern = compute_struct_pattern(spec.types[start:end])
      if serialize:
          yield pack(pattern, vars_)
      else:
          yield "start = end"
          yield "end += %s"%struct.calcsize('<%s'%reduce_pattern(pattern))
          yield unpack('(%s,)'%vars_, pattern, 'str[start:end]')
  
          # convert uint8 to bool. this doesn't add much value as Python
          # equality test on a field will return that True == 1, but I
          # want to be consistent with bool
          bool_vars = [(f, t) for f, t in zip(spec.names[start:end], spec.types[start:end]) if t == 'bool']
          for f, t in bool_vars:
              #TODO: could optimize this as well
              var = _serial_context+f
              yield "%s = bool(%s)"%(var, var)
function_tokens: def simple_serializer_generator ( msg_context , spec , start , end , serialize ) : #primitives that can be handled with struct # optimize member var access if end - start > 1 and _serial_context . endswith ( '.' ) : yield '_x = ' + _serial_context [ : - 1 ] vars_ = '_x.' + ( ', _x.' ) . join ( spec . names [ start : end ] ) else : vars_ = _serial_context + ( ', ' + _serial_context ) . join ( spec . names [ start : end ] ) pattern = compute_struct_pattern ( spec . types [ start : end ] ) if serialize : yield pack ( pattern , vars_ ) else : yield "start = end" yield "end += %s" % struct . calcsize ( '<%s' % reduce_pattern ( pattern ) ) yield unpack ( '(%s,)' % vars_ , pattern , 'str[start:end]' ) # convert uint8 to bool. this doesn't add much value as Python # equality test on a field will return that True == 1, but I # want to be consistent with bool bool_vars = [ ( f , t ) for f , t in zip ( spec . names [ start : end ] , spec . types [ start : end ] ) if t == 'bool' ] for f , t in bool_vars : #TODO: could optimize this as well var = _serial_context + f yield "%s = bool(%s)" % ( var , var )