Go to the documentation of this file.00001 """autogenerated by genpy from test_roslisp/TwoInts.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007 import std_msgs.msg
00008
00009 class TwoInts(genpy.Message):
00010 _md5sum = "7f80fd04371aa5efefe6eae873a1958e"
00011 _type = "test_roslisp/TwoInts"
00012 _has_header = False
00013 _full_text = """std_msgs/Int16 a
00014 std_msgs/Int16 b
00015
00016 ================================================================================
00017 MSG: std_msgs/Int16
00018 int16 data
00019
00020 """
00021 __slots__ = ['a','b']
00022 _slot_types = ['std_msgs/Int16','std_msgs/Int16']
00023
00024 def __init__(self, *args, **kwds):
00025 """
00026 Constructor. Any message fields that are implicitly/explicitly
00027 set to None will be assigned a default value. The recommend
00028 use is keyword arguments as this is more robust to future message
00029 changes. You cannot mix in-order arguments and keyword arguments.
00030
00031 The available fields are:
00032 a,b
00033
00034 :param args: complete set of field values, in .msg order
00035 :param kwds: use keyword arguments corresponding to message field names
00036 to set specific fields.
00037 """
00038 if args or kwds:
00039 super(TwoInts, self).__init__(*args, **kwds)
00040
00041 if self.a is None:
00042 self.a = std_msgs.msg.Int16()
00043 if self.b is None:
00044 self.b = std_msgs.msg.Int16()
00045 else:
00046 self.a = std_msgs.msg.Int16()
00047 self.b = std_msgs.msg.Int16()
00048
00049 def _get_types(self):
00050 """
00051 internal API method
00052 """
00053 return self._slot_types
00054
00055 def serialize(self, buff):
00056 """
00057 serialize message into buffer
00058 :param buff: buffer, ``StringIO``
00059 """
00060 try:
00061 _x = self
00062 buff.write(_struct_2h.pack(_x.a.data, _x.b.data))
00063 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00064 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00065
00066 def deserialize(self, str):
00067 """
00068 unpack serialized message in str into this message instance
00069 :param str: byte array of serialized message, ``str``
00070 """
00071 try:
00072 if self.a is None:
00073 self.a = std_msgs.msg.Int16()
00074 if self.b is None:
00075 self.b = std_msgs.msg.Int16()
00076 end = 0
00077 _x = self
00078 start = end
00079 end += 4
00080 (_x.a.data, _x.b.data,) = _struct_2h.unpack(str[start:end])
00081 return self
00082 except struct.error as e:
00083 raise genpy.DeserializationError(e)
00084
00085
00086 def serialize_numpy(self, buff, numpy):
00087 """
00088 serialize message with numpy array types into buffer
00089 :param buff: buffer, ``StringIO``
00090 :param numpy: numpy python module
00091 """
00092 try:
00093 _x = self
00094 buff.write(_struct_2h.pack(_x.a.data, _x.b.data))
00095 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00096 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00097
00098 def deserialize_numpy(self, str, numpy):
00099 """
00100 unpack serialized message in str into this message instance using numpy for array types
00101 :param str: byte array of serialized message, ``str``
00102 :param numpy: numpy python module
00103 """
00104 try:
00105 if self.a is None:
00106 self.a = std_msgs.msg.Int16()
00107 if self.b is None:
00108 self.b = std_msgs.msg.Int16()
00109 end = 0
00110 _x = self
00111 start = end
00112 end += 4
00113 (_x.a.data, _x.b.data,) = _struct_2h.unpack(str[start:end])
00114 return self
00115 except struct.error as e:
00116 raise genpy.DeserializationError(e)
00117
00118 _struct_I = genpy.struct_I
00119 _struct_2h = struct.Struct("<2h")