Go to the documentation of this file.00001 """autogenerated by genpy from jsk_gui_msgs/VoiceMessage.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007
00008 class VoiceMessage(genpy.Message):
00009 _md5sum = "8d7dcfb3b46640ccf02177a3f0cf9530"
00010 _type = "jsk_gui_msgs/VoiceMessage"
00011 _has_header = False
00012 _full_text = """string[] texts
00013 """
00014 __slots__ = ['texts']
00015 _slot_types = ['string[]']
00016
00017 def __init__(self, *args, **kwds):
00018 """
00019 Constructor. Any message fields that are implicitly/explicitly
00020 set to None will be assigned a default value. The recommend
00021 use is keyword arguments as this is more robust to future message
00022 changes. You cannot mix in-order arguments and keyword arguments.
00023
00024 The available fields are:
00025 texts
00026
00027 :param args: complete set of field values, in .msg order
00028 :param kwds: use keyword arguments corresponding to message field names
00029 to set specific fields.
00030 """
00031 if args or kwds:
00032 super(VoiceMessage, self).__init__(*args, **kwds)
00033
00034 if self.texts is None:
00035 self.texts = []
00036 else:
00037 self.texts = []
00038
00039 def _get_types(self):
00040 """
00041 internal API method
00042 """
00043 return self._slot_types
00044
00045 def serialize(self, buff):
00046 """
00047 serialize message into buffer
00048 :param buff: buffer, ``StringIO``
00049 """
00050 try:
00051 length = len(self.texts)
00052 buff.write(_struct_I.pack(length))
00053 for val1 in self.texts:
00054 length = len(val1)
00055 if python3 or type(val1) == unicode:
00056 val1 = val1.encode('utf-8')
00057 length = len(val1)
00058 buff.write(struct.pack('<I%ss'%length, length, val1))
00059 except struct.error as se: self._check_types(se)
00060 except TypeError as te: self._check_types(te)
00061
00062 def deserialize(self, str):
00063 """
00064 unpack serialized message in str into this message instance
00065 :param str: byte array of serialized message, ``str``
00066 """
00067 try:
00068 end = 0
00069 start = end
00070 end += 4
00071 (length,) = _struct_I.unpack(str[start:end])
00072 self.texts = []
00073 for i in range(0, length):
00074 start = end
00075 end += 4
00076 (length,) = _struct_I.unpack(str[start:end])
00077 start = end
00078 end += length
00079 if python3:
00080 val1 = str[start:end].decode('utf-8')
00081 else:
00082 val1 = str[start:end]
00083 self.texts.append(val1)
00084 return self
00085 except struct.error as e:
00086 raise genpy.DeserializationError(e)
00087
00088
00089 def serialize_numpy(self, buff, numpy):
00090 """
00091 serialize message with numpy array types into buffer
00092 :param buff: buffer, ``StringIO``
00093 :param numpy: numpy python module
00094 """
00095 try:
00096 length = len(self.texts)
00097 buff.write(_struct_I.pack(length))
00098 for val1 in self.texts:
00099 length = len(val1)
00100 if python3 or type(val1) == unicode:
00101 val1 = val1.encode('utf-8')
00102 length = len(val1)
00103 buff.write(struct.pack('<I%ss'%length, length, val1))
00104 except struct.error as se: self._check_types(se)
00105 except TypeError as te: self._check_types(te)
00106
00107 def deserialize_numpy(self, str, numpy):
00108 """
00109 unpack serialized message in str into this message instance using numpy for array types
00110 :param str: byte array of serialized message, ``str``
00111 :param numpy: numpy python module
00112 """
00113 try:
00114 end = 0
00115 start = end
00116 end += 4
00117 (length,) = _struct_I.unpack(str[start:end])
00118 self.texts = []
00119 for i in range(0, length):
00120 start = end
00121 end += 4
00122 (length,) = _struct_I.unpack(str[start:end])
00123 start = end
00124 end += length
00125 if python3:
00126 val1 = str[start:end].decode('utf-8')
00127 else:
00128 val1 = str[start:end]
00129 self.texts.append(val1)
00130 return self
00131 except struct.error as e:
00132 raise genpy.DeserializationError(e)
00133
00134 _struct_I = genpy.struct_I