00001 """autogenerated by genmsg_py from Test4.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import test_roslisp.msg
00006
00007 class Test4(roslib.message.Message):
00008 _md5sum = "932cac2a43cc20b8fc71e75ff8f37423"
00009 _type = "test_roslisp/Test4"
00010 _has_header = False
00011 _full_text = """Test1[5] dummy
00012
00013 ================================================================================
00014 MSG: test_roslisp/Test1
00015 int32[] dummy1
00016
00017 """
00018 __slots__ = ['dummy']
00019 _slot_types = ['test_roslisp/Test1[5]']
00020
00021 def __init__(self, *args, **kwds):
00022 """
00023 Constructor. Any message fields that are implicitly/explicitly
00024 set to None will be assigned a default value. The recommend
00025 use is keyword arguments as this is more robust to future message
00026 changes. You cannot mix in-order arguments and keyword arguments.
00027
00028 The available fields are:
00029 dummy
00030
00031 @param args: complete set of field values, in .msg order
00032 @param kwds: use keyword arguments corresponding to message field names
00033 to set specific fields.
00034 """
00035 if args or kwds:
00036 super(Test4, self).__init__(*args, **kwds)
00037
00038 if self.dummy is None:
00039 self.dummy = [test_roslisp.msg.Test1(),test_roslisp.msg.Test1(),test_roslisp.msg.Test1(),test_roslisp.msg.Test1(),test_roslisp.msg.Test1()]
00040 else:
00041 self.dummy = [test_roslisp.msg.Test1(),test_roslisp.msg.Test1(),test_roslisp.msg.Test1(),test_roslisp.msg.Test1(),test_roslisp.msg.Test1()]
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
00053 @type buff: StringIO
00054 """
00055 try:
00056 for val1 in self.dummy:
00057 length = len(val1.dummy1)
00058 buff.write(_struct_I.pack(length))
00059 pattern = '<%si'%length
00060 buff.write(struct.pack(pattern, *val1.dummy1))
00061 except struct.error, se: self._check_types(se)
00062 except TypeError, te: self._check_types(te)
00063
00064 def deserialize(self, str):
00065 """
00066 unpack serialized message in str into this message instance
00067 @param str: byte array of serialized message
00068 @type str: str
00069 """
00070 try:
00071 end = 0
00072 self.dummy = []
00073 for i in xrange(0, 5):
00074 val1 = test_roslisp.msg.Test1()
00075 start = end
00076 end += 4
00077 (length,) = _struct_I.unpack(str[start:end])
00078 pattern = '<%si'%length
00079 start = end
00080 end += struct.calcsize(pattern)
00081 val1.dummy1 = struct.unpack(pattern, str[start:end])
00082 self.dummy.append(val1)
00083 return self
00084 except struct.error, e:
00085 raise roslib.message.DeserializationError(e)
00086
00087
00088 def serialize_numpy(self, buff, numpy):
00089 """
00090 serialize message with numpy array types into buffer
00091 @param buff: buffer
00092 @type buff: StringIO
00093 @param numpy: numpy python module
00094 @type numpy module
00095 """
00096 try:
00097 for val1 in self.dummy:
00098 length = len(val1.dummy1)
00099 buff.write(_struct_I.pack(length))
00100 pattern = '<%si'%length
00101 buff.write(val1.dummy1.tostring())
00102 except struct.error, se: self._check_types(se)
00103 except TypeError, te: self._check_types(te)
00104
00105 def deserialize_numpy(self, str, numpy):
00106 """
00107 unpack serialized message in str into this message instance using numpy for array types
00108 @param str: byte array of serialized message
00109 @type str: str
00110 @param numpy: numpy python module
00111 @type numpy: module
00112 """
00113 try:
00114 end = 0
00115 self.dummy = []
00116 for i in xrange(0, 5):
00117 val1 = test_roslisp.msg.Test1()
00118 start = end
00119 end += 4
00120 (length,) = _struct_I.unpack(str[start:end])
00121 pattern = '<%si'%length
00122 start = end
00123 end += struct.calcsize(pattern)
00124 val1.dummy1 = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
00125 self.dummy.append(val1)
00126 return self
00127 except struct.error, e:
00128 raise roslib.message.DeserializationError(e)
00129
00130 _struct_I = roslib.message.struct_I