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