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


srs_msgs
Author(s): renxi
autogenerated on Mon Oct 6 2014 08:20:53