Go to the documentation of this file.00001 """autogenerated by genpy from test_roslisp/Foo.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 test_roslisp.msg
00008
00009 class Foo(genpy.Message):
00010 _md5sum = "7cdb6f5fcd1a055355fcf8728e010dae"
00011 _type = "test_roslisp/Foo"
00012 _has_header = False
00013 _full_text = """Bar y
00014 Bar[] z
00015 ================================================================================
00016 MSG: test_roslisp/Bar
00017 int32 x=10
00018 int32 y
00019 """
00020 __slots__ = ['y','z']
00021 _slot_types = ['test_roslisp/Bar','test_roslisp/Bar[]']
00022
00023 def __init__(self, *args, **kwds):
00024 """
00025 Constructor. Any message fields that are implicitly/explicitly
00026 set to None will be assigned a default value. The recommend
00027 use is keyword arguments as this is more robust to future message
00028 changes. You cannot mix in-order arguments and keyword arguments.
00029
00030 The available fields are:
00031 y,z
00032
00033 :param args: complete set of field values, in .msg order
00034 :param kwds: use keyword arguments corresponding to message field names
00035 to set specific fields.
00036 """
00037 if args or kwds:
00038 super(Foo, self).__init__(*args, **kwds)
00039
00040 if self.y is None:
00041 self.y = test_roslisp.msg.Bar()
00042 if self.z is None:
00043 self.z = []
00044 else:
00045 self.y = test_roslisp.msg.Bar()
00046 self.z = []
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 buff.write(_struct_i.pack(self.y.y))
00061 length = len(self.z)
00062 buff.write(_struct_I.pack(length))
00063 for val1 in self.z:
00064 buff.write(_struct_i.pack(val1.y))
00065 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00066 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00067
00068 def deserialize(self, str):
00069 """
00070 unpack serialized message in str into this message instance
00071 :param str: byte array of serialized message, ``str``
00072 """
00073 try:
00074 if self.y is None:
00075 self.y = test_roslisp.msg.Bar()
00076 if self.z is None:
00077 self.z = None
00078 end = 0
00079 start = end
00080 end += 4
00081 (self.y.y,) = _struct_i.unpack(str[start:end])
00082 start = end
00083 end += 4
00084 (length,) = _struct_I.unpack(str[start:end])
00085 self.z = []
00086 for i in range(0, length):
00087 val1 = test_roslisp.msg.Bar()
00088 start = end
00089 end += 4
00090 (val1.y,) = _struct_i.unpack(str[start:end])
00091 self.z.append(val1)
00092 return self
00093 except struct.error as e:
00094 raise genpy.DeserializationError(e)
00095
00096
00097 def serialize_numpy(self, buff, numpy):
00098 """
00099 serialize message with numpy array types into buffer
00100 :param buff: buffer, ``StringIO``
00101 :param numpy: numpy python module
00102 """
00103 try:
00104 buff.write(_struct_i.pack(self.y.y))
00105 length = len(self.z)
00106 buff.write(_struct_I.pack(length))
00107 for val1 in self.z:
00108 buff.write(_struct_i.pack(val1.y))
00109 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00110 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00111
00112 def deserialize_numpy(self, str, numpy):
00113 """
00114 unpack serialized message in str into this message instance using numpy for array types
00115 :param str: byte array of serialized message, ``str``
00116 :param numpy: numpy python module
00117 """
00118 try:
00119 if self.y is None:
00120 self.y = test_roslisp.msg.Bar()
00121 if self.z is None:
00122 self.z = None
00123 end = 0
00124 start = end
00125 end += 4
00126 (self.y.y,) = _struct_i.unpack(str[start:end])
00127 start = end
00128 end += 4
00129 (length,) = _struct_I.unpack(str[start:end])
00130 self.z = []
00131 for i in range(0, length):
00132 val1 = test_roslisp.msg.Bar()
00133 start = end
00134 end += 4
00135 (val1.y,) = _struct_i.unpack(str[start:end])
00136 self.z.append(val1)
00137 return self
00138 except struct.error as e:
00139 raise genpy.DeserializationError(e)
00140
00141 _struct_I = genpy.struct_I
00142 _struct_i = struct.Struct("<i")