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