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


iri_perception_msgs
Author(s):
autogenerated on Fri Dec 6 2013 20:02:15