00001 """autogenerated by genmsg_py from ComplexMessage.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import test_roslisp.msg
00006 import std_msgs.msg
00007
00008 class ComplexMessage(roslib.message.Message):
00009 _md5sum = "8bc73630573f57076b9939fd6536169a"
00010 _type = "test_roslisp/ComplexMessage"
00011 _has_header = False
00012 _full_text = """float32[4] x
00013 Foo[] y
00014 Foo[] z
00015 std_msgs/String[] w
00016 bool qux
00017 uint8 ind
00018 ================================================================================
00019 MSG: test_roslisp/Foo
00020 Bar y
00021 Bar[] z
00022 ================================================================================
00023 MSG: test_roslisp/Bar
00024 int32 x=10
00025 int32 y
00026 ================================================================================
00027 MSG: std_msgs/String
00028 string data
00029
00030 """
00031 __slots__ = ['x','y','z','w','qux','ind']
00032 _slot_types = ['float32[4]','test_roslisp/Foo[]','test_roslisp/Foo[]','std_msgs/String[]','bool','uint8']
00033
00034 def __init__(self, *args, **kwds):
00035 """
00036 Constructor. Any message fields that are implicitly/explicitly
00037 set to None will be assigned a default value. The recommend
00038 use is keyword arguments as this is more robust to future message
00039 changes. You cannot mix in-order arguments and keyword arguments.
00040
00041 The available fields are:
00042 x,y,z,w,qux,ind
00043
00044 @param args: complete set of field values, in .msg order
00045 @param kwds: use keyword arguments corresponding to message field names
00046 to set specific fields.
00047 """
00048 if args or kwds:
00049 super(ComplexMessage, self).__init__(*args, **kwds)
00050
00051 if self.x is None:
00052 self.x = [0.,0.,0.,0.]
00053 if self.y is None:
00054 self.y = []
00055 if self.z is None:
00056 self.z = []
00057 if self.w is None:
00058 self.w = []
00059 if self.qux is None:
00060 self.qux = False
00061 if self.ind is None:
00062 self.ind = 0
00063 else:
00064 self.x = [0.,0.,0.,0.]
00065 self.y = []
00066 self.z = []
00067 self.w = []
00068 self.qux = False
00069 self.ind = 0
00070
00071 def _get_types(self):
00072 """
00073 internal API method
00074 """
00075 return self._slot_types
00076
00077 def serialize(self, buff):
00078 """
00079 serialize message into buffer
00080 @param buff: buffer
00081 @type buff: StringIO
00082 """
00083 try:
00084 buff.write(_struct_4f.pack(*self.x))
00085 length = len(self.y)
00086 buff.write(_struct_I.pack(length))
00087 for val1 in self.y:
00088 _v1 = val1.y
00089 buff.write(_struct_i.pack(_v1.y))
00090 length = len(val1.z)
00091 buff.write(_struct_I.pack(length))
00092 for val2 in val1.z:
00093 buff.write(_struct_i.pack(val2.y))
00094 length = len(self.z)
00095 buff.write(_struct_I.pack(length))
00096 for val1 in self.z:
00097 _v2 = val1.y
00098 buff.write(_struct_i.pack(_v2.y))
00099 length = len(val1.z)
00100 buff.write(_struct_I.pack(length))
00101 for val2 in val1.z:
00102 buff.write(_struct_i.pack(val2.y))
00103 length = len(self.w)
00104 buff.write(_struct_I.pack(length))
00105 for val1 in self.w:
00106 _x = val1.data
00107 length = len(_x)
00108 buff.write(struct.pack('<I%ss'%length, length, _x))
00109 _x = self
00110 buff.write(_struct_2B.pack(_x.qux, _x.ind))
00111 except struct.error, se: self._check_types(se)
00112 except TypeError, te: self._check_types(te)
00113
00114 def deserialize(self, str):
00115 """
00116 unpack serialized message in str into this message instance
00117 @param str: byte array of serialized message
00118 @type str: str
00119 """
00120 try:
00121 end = 0
00122 start = end
00123 end += 16
00124 self.x = _struct_4f.unpack(str[start:end])
00125 start = end
00126 end += 4
00127 (length,) = _struct_I.unpack(str[start:end])
00128 self.y = []
00129 for i in xrange(0, length):
00130 val1 = test_roslisp.msg.Foo()
00131 _v3 = val1.y
00132 start = end
00133 end += 4
00134 (_v3.y,) = _struct_i.unpack(str[start:end])
00135 start = end
00136 end += 4
00137 (length,) = _struct_I.unpack(str[start:end])
00138 val1.z = []
00139 for i in xrange(0, length):
00140 val2 = test_roslisp.msg.Bar()
00141 start = end
00142 end += 4
00143 (val2.y,) = _struct_i.unpack(str[start:end])
00144 val1.z.append(val2)
00145 self.y.append(val1)
00146 start = end
00147 end += 4
00148 (length,) = _struct_I.unpack(str[start:end])
00149 self.z = []
00150 for i in xrange(0, length):
00151 val1 = test_roslisp.msg.Foo()
00152 _v4 = val1.y
00153 start = end
00154 end += 4
00155 (_v4.y,) = _struct_i.unpack(str[start:end])
00156 start = end
00157 end += 4
00158 (length,) = _struct_I.unpack(str[start:end])
00159 val1.z = []
00160 for i in xrange(0, length):
00161 val2 = test_roslisp.msg.Bar()
00162 start = end
00163 end += 4
00164 (val2.y,) = _struct_i.unpack(str[start:end])
00165 val1.z.append(val2)
00166 self.z.append(val1)
00167 start = end
00168 end += 4
00169 (length,) = _struct_I.unpack(str[start:end])
00170 self.w = []
00171 for i in xrange(0, length):
00172 val1 = std_msgs.msg.String()
00173 start = end
00174 end += 4
00175 (length,) = _struct_I.unpack(str[start:end])
00176 start = end
00177 end += length
00178 val1.data = str[start:end]
00179 self.w.append(val1)
00180 _x = self
00181 start = end
00182 end += 2
00183 (_x.qux, _x.ind,) = _struct_2B.unpack(str[start:end])
00184 self.qux = bool(self.qux)
00185 return self
00186 except struct.error, e:
00187 raise roslib.message.DeserializationError(e)
00188
00189
00190 def serialize_numpy(self, buff, numpy):
00191 """
00192 serialize message with numpy array types into buffer
00193 @param buff: buffer
00194 @type buff: StringIO
00195 @param numpy: numpy python module
00196 @type numpy module
00197 """
00198 try:
00199 buff.write(self.x.tostring())
00200 length = len(self.y)
00201 buff.write(_struct_I.pack(length))
00202 for val1 in self.y:
00203 _v5 = val1.y
00204 buff.write(_struct_i.pack(_v5.y))
00205 length = len(val1.z)
00206 buff.write(_struct_I.pack(length))
00207 for val2 in val1.z:
00208 buff.write(_struct_i.pack(val2.y))
00209 length = len(self.z)
00210 buff.write(_struct_I.pack(length))
00211 for val1 in self.z:
00212 _v6 = val1.y
00213 buff.write(_struct_i.pack(_v6.y))
00214 length = len(val1.z)
00215 buff.write(_struct_I.pack(length))
00216 for val2 in val1.z:
00217 buff.write(_struct_i.pack(val2.y))
00218 length = len(self.w)
00219 buff.write(_struct_I.pack(length))
00220 for val1 in self.w:
00221 _x = val1.data
00222 length = len(_x)
00223 buff.write(struct.pack('<I%ss'%length, length, _x))
00224 _x = self
00225 buff.write(_struct_2B.pack(_x.qux, _x.ind))
00226 except struct.error, se: self._check_types(se)
00227 except TypeError, te: self._check_types(te)
00228
00229 def deserialize_numpy(self, str, numpy):
00230 """
00231 unpack serialized message in str into this message instance using numpy for array types
00232 @param str: byte array of serialized message
00233 @type str: str
00234 @param numpy: numpy python module
00235 @type numpy: module
00236 """
00237 try:
00238 end = 0
00239 start = end
00240 end += 16
00241 self.x = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=4)
00242 start = end
00243 end += 4
00244 (length,) = _struct_I.unpack(str[start:end])
00245 self.y = []
00246 for i in xrange(0, length):
00247 val1 = test_roslisp.msg.Foo()
00248 _v7 = val1.y
00249 start = end
00250 end += 4
00251 (_v7.y,) = _struct_i.unpack(str[start:end])
00252 start = end
00253 end += 4
00254 (length,) = _struct_I.unpack(str[start:end])
00255 val1.z = []
00256 for i in xrange(0, length):
00257 val2 = test_roslisp.msg.Bar()
00258 start = end
00259 end += 4
00260 (val2.y,) = _struct_i.unpack(str[start:end])
00261 val1.z.append(val2)
00262 self.y.append(val1)
00263 start = end
00264 end += 4
00265 (length,) = _struct_I.unpack(str[start:end])
00266 self.z = []
00267 for i in xrange(0, length):
00268 val1 = test_roslisp.msg.Foo()
00269 _v8 = val1.y
00270 start = end
00271 end += 4
00272 (_v8.y,) = _struct_i.unpack(str[start:end])
00273 start = end
00274 end += 4
00275 (length,) = _struct_I.unpack(str[start:end])
00276 val1.z = []
00277 for i in xrange(0, length):
00278 val2 = test_roslisp.msg.Bar()
00279 start = end
00280 end += 4
00281 (val2.y,) = _struct_i.unpack(str[start:end])
00282 val1.z.append(val2)
00283 self.z.append(val1)
00284 start = end
00285 end += 4
00286 (length,) = _struct_I.unpack(str[start:end])
00287 self.w = []
00288 for i in xrange(0, length):
00289 val1 = std_msgs.msg.String()
00290 start = end
00291 end += 4
00292 (length,) = _struct_I.unpack(str[start:end])
00293 start = end
00294 end += length
00295 val1.data = str[start:end]
00296 self.w.append(val1)
00297 _x = self
00298 start = end
00299 end += 2
00300 (_x.qux, _x.ind,) = _struct_2B.unpack(str[start:end])
00301 self.qux = bool(self.qux)
00302 return self
00303 except struct.error, e:
00304 raise roslib.message.DeserializationError(e)
00305
00306 _struct_I = roslib.message.struct_I
00307 _struct_4f = struct.Struct("<4f")
00308 _struct_i = struct.Struct("<i")
00309 _struct_2B = struct.Struct("<2B")