00001 """autogenerated by genmsg_py from Icon.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005
00006 class Icon(roslib.message.Message):
00007 _md5sum = "e378a502c24c5aa2af7065d57c580d12"
00008 _type = "app_manager/Icon"
00009 _has_header = False
00010 _full_text = """# Image data format. "jpeg" or "png"
00011 string format
00012
00013 # Image data.
00014 uint8[] data
00015
00016 """
00017 __slots__ = ['format','data']
00018 _slot_types = ['string','uint8[]']
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 format,data
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(Icon, self).__init__(*args, **kwds)
00036
00037 if self.format is None:
00038 self.format = ''
00039 if self.data is None:
00040 self.data = ''
00041 else:
00042 self.format = ''
00043 self.data = ''
00044
00045 def _get_types(self):
00046 """
00047 internal API method
00048 """
00049 return self._slot_types
00050
00051 def serialize(self, buff):
00052 """
00053 serialize message into buffer
00054 @param buff: buffer
00055 @type buff: StringIO
00056 """
00057 try:
00058 _x = self.format
00059 length = len(_x)
00060 buff.write(struct.pack('<I%ss'%length, length, _x))
00061 _x = self.data
00062 length = len(_x)
00063
00064 if type(_x) in [list, tuple]:
00065 buff.write(struct.pack('<I%sB'%length, length, *_x))
00066 else:
00067 buff.write(struct.pack('<I%ss'%length, length, _x))
00068 except struct.error, se: self._check_types(se)
00069 except TypeError, te: self._check_types(te)
00070
00071 def deserialize(self, str):
00072 """
00073 unpack serialized message in str into this message instance
00074 @param str: byte array of serialized message
00075 @type str: str
00076 """
00077 try:
00078 end = 0
00079 start = end
00080 end += 4
00081 (length,) = _struct_I.unpack(str[start:end])
00082 start = end
00083 end += length
00084 self.format = str[start:end]
00085 start = end
00086 end += 4
00087 (length,) = _struct_I.unpack(str[start:end])
00088 start = end
00089 end += length
00090 self.data = str[start:end]
00091 return self
00092 except struct.error, e:
00093 raise roslib.message.DeserializationError(e)
00094
00095
00096 def serialize_numpy(self, buff, numpy):
00097 """
00098 serialize message with numpy array types into buffer
00099 @param buff: buffer
00100 @type buff: StringIO
00101 @param numpy: numpy python module
00102 @type numpy module
00103 """
00104 try:
00105 _x = self.format
00106 length = len(_x)
00107 buff.write(struct.pack('<I%ss'%length, length, _x))
00108 _x = self.data
00109 length = len(_x)
00110
00111 if type(_x) in [list, tuple]:
00112 buff.write(struct.pack('<I%sB'%length, length, *_x))
00113 else:
00114 buff.write(struct.pack('<I%ss'%length, length, _x))
00115 except struct.error, se: self._check_types(se)
00116 except TypeError, te: self._check_types(te)
00117
00118 def deserialize_numpy(self, str, numpy):
00119 """
00120 unpack serialized message in str into this message instance using numpy for array types
00121 @param str: byte array of serialized message
00122 @type str: str
00123 @param numpy: numpy python module
00124 @type numpy: module
00125 """
00126 try:
00127 end = 0
00128 start = end
00129 end += 4
00130 (length,) = _struct_I.unpack(str[start:end])
00131 start = end
00132 end += length
00133 self.format = str[start:end]
00134 start = end
00135 end += 4
00136 (length,) = _struct_I.unpack(str[start:end])
00137 start = end
00138 end += length
00139 self.data = str[start:end]
00140 return self
00141 except struct.error, e:
00142 raise roslib.message.DeserializationError(e)
00143
00144 _struct_I = roslib.message.struct_I