Go to the documentation of this file.00001 """autogenerated by genpy from iri_perception_msgs/ImageSize.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 ImageSize(genpy.Message):
00009 _md5sum = "d00b1659f7d843bad3388af53e042f94"
00010 _type = "iri_perception_msgs/ImageSize"
00011 _has_header = False
00012 _full_text = """uint32 width
00013 uint32 height
00014 """
00015 __slots__ = ['width','height']
00016 _slot_types = ['uint32','uint32']
00017
00018 def __init__(self, *args, **kwds):
00019 """
00020 Constructor. Any message fields that are implicitly/explicitly
00021 set to None will be assigned a default value. The recommend
00022 use is keyword arguments as this is more robust to future message
00023 changes. You cannot mix in-order arguments and keyword arguments.
00024
00025 The available fields are:
00026 width,height
00027
00028 :param args: complete set of field values, in .msg order
00029 :param kwds: use keyword arguments corresponding to message field names
00030 to set specific fields.
00031 """
00032 if args or kwds:
00033 super(ImageSize, self).__init__(*args, **kwds)
00034
00035 if self.width is None:
00036 self.width = 0
00037 if self.height is None:
00038 self.height = 0
00039 else:
00040 self.width = 0
00041 self.height = 0
00042
00043 def _get_types(self):
00044 """
00045 internal API method
00046 """
00047 return self._slot_types
00048
00049 def serialize(self, buff):
00050 """
00051 serialize message into buffer
00052 :param buff: buffer, ``StringIO``
00053 """
00054 try:
00055 _x = self
00056 buff.write(_struct_2I.pack(_x.width, _x.height))
00057 except struct.error as se: self._check_types(se)
00058 except TypeError as te: self._check_types(te)
00059
00060 def deserialize(self, str):
00061 """
00062 unpack serialized message in str into this message instance
00063 :param str: byte array of serialized message, ``str``
00064 """
00065 try:
00066 end = 0
00067 _x = self
00068 start = end
00069 end += 8
00070 (_x.width, _x.height,) = _struct_2I.unpack(str[start:end])
00071 return self
00072 except struct.error as e:
00073 raise genpy.DeserializationError(e)
00074
00075
00076 def serialize_numpy(self, buff, numpy):
00077 """
00078 serialize message with numpy array types into buffer
00079 :param buff: buffer, ``StringIO``
00080 :param numpy: numpy python module
00081 """
00082 try:
00083 _x = self
00084 buff.write(_struct_2I.pack(_x.width, _x.height))
00085 except struct.error as se: self._check_types(se)
00086 except TypeError as te: self._check_types(te)
00087
00088 def deserialize_numpy(self, str, numpy):
00089 """
00090 unpack serialized message in str into this message instance using numpy for array types
00091 :param str: byte array of serialized message, ``str``
00092 :param numpy: numpy python module
00093 """
00094 try:
00095 end = 0
00096 _x = self
00097 start = end
00098 end += 8
00099 (_x.width, _x.height,) = _struct_2I.unpack(str[start:end])
00100 return self
00101 except struct.error as e:
00102 raise genpy.DeserializationError(e)
00103
00104 _struct_I = genpy.struct_I
00105 _struct_2I = struct.Struct("<2I")