00001 """autogenerated by genmsg_py from Test3.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import test_roslisp.msg
00006
00007 class Test3(roslib.message.Message):
00008 _md5sum = "932cac2a43cc20b8fc71e75ff8f37423"
00009 _type = "test_roslisp/Test3"
00010 _has_header = False
00011 _full_text = """Test1[] dummy
00012
00013 ================================================================================
00014 MSG: test_roslisp/Test1
00015 int32[] dummy1
00016
00017 """
00018 __slots__ = ['dummy']
00019 _slot_types = ['test_roslisp/Test1[]']
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(Test3, self).__init__(*args, **kwds)
00037
00038 if self.dummy is None:
00039 self.dummy = []
00040 else:
00041 self.dummy = []
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 length = len(self.dummy)
00057 buff.write(_struct_I.pack(length))
00058 for val1 in self.dummy:
00059 length = len(val1.dummy1)
00060 buff.write(_struct_I.pack(length))
00061 pattern = '<%si'%length
00062 buff.write(struct.pack(pattern, *val1.dummy1))
00063 except struct.error, se: self._check_types(se)
00064 except TypeError, te: self._check_types(te)
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
00070 @type str: str
00071 """
00072 try:
00073 end = 0
00074 start = end
00075 end += 4
00076 (length,) = _struct_I.unpack(str[start:end])
00077 self.dummy = []
00078 for i in xrange(0, length):
00079 val1 = test_roslisp.msg.Test1()
00080 start = end
00081 end += 4
00082 (length,) = _struct_I.unpack(str[start:end])
00083 pattern = '<%si'%length
00084 start = end
00085 end += struct.calcsize(pattern)
00086 val1.dummy1 = struct.unpack(pattern, str[start:end])
00087 self.dummy.append(val1)
00088 return self
00089 except struct.error, e:
00090 raise roslib.message.DeserializationError(e)
00091
00092
00093 def serialize_numpy(self, buff, numpy):
00094 """
00095 serialize message with numpy array types into buffer
00096 @param buff: buffer
00097 @type buff: StringIO
00098 @param numpy: numpy python module
00099 @type numpy module
00100 """
00101 try:
00102 length = len(self.dummy)
00103 buff.write(_struct_I.pack(length))
00104 for val1 in self.dummy:
00105 length = len(val1.dummy1)
00106 buff.write(_struct_I.pack(length))
00107 pattern = '<%si'%length
00108 buff.write(val1.dummy1.tostring())
00109 except struct.error, se: self._check_types(se)
00110 except TypeError, te: self._check_types(te)
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
00116 @type str: str
00117 @param numpy: numpy python module
00118 @type numpy: module
00119 """
00120 try:
00121 end = 0
00122 start = end
00123 end += 4
00124 (length,) = _struct_I.unpack(str[start:end])
00125 self.dummy = []
00126 for i in xrange(0, length):
00127 val1 = test_roslisp.msg.Test1()
00128 start = end
00129 end += 4
00130 (length,) = _struct_I.unpack(str[start:end])
00131 pattern = '<%si'%length
00132 start = end
00133 end += struct.calcsize(pattern)
00134 val1.dummy1 = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
00135 self.dummy.append(val1)
00136 return self
00137 except struct.error, e:
00138 raise roslib.message.DeserializationError(e)
00139
00140 _struct_I = roslib.message.struct_I