00001 """autogenerated by genpy from nasa_r2_common_msgs/VariantMapArray.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 nasa_r2_common_msgs.msg
00008 import std_msgs.msg
00009
00010 class VariantMapArray(genpy.Message):
00011 _md5sum = "81c5b31cbd0a1ce333af5ea67766c271"
00012 _type = "nasa_r2_common_msgs/VariantMapArray"
00013 _has_header = True
00014 _full_text = """Header header
00015 VariantMap[] map
00016
00017 ================================================================================
00018 MSG: std_msgs/Header
00019 # Standard metadata for higher-level stamped data types.
00020 # This is generally used to communicate timestamped data
00021 # in a particular coordinate frame.
00022 #
00023 # sequence ID: consecutively increasing ID
00024 uint32 seq
00025 #Two-integer timestamp that is expressed as:
00026 # * stamp.secs: seconds (stamp_secs) since epoch
00027 # * stamp.nsecs: nanoseconds since stamp_secs
00028 # time-handling sugar is provided by the client library
00029 time stamp
00030 #Frame this data is associated with
00031 # 0: no frame
00032 # 1: global frame
00033 string frame_id
00034
00035 ================================================================================
00036 MSG: nasa_r2_common_msgs/VariantMap
00037 string name
00038 string message
00039 ValueType[] value
00040 string[] stringMap
00041 uint16[] uint16Map
00042 int16[] int16Map
00043 uint32[] uint32Map
00044 int32[] int32Map
00045 float32[] float32Map
00046 bool[] boolMap
00047
00048 ================================================================================
00049 MSG: nasa_r2_common_msgs/ValueType
00050 string key
00051 MappedType type
00052 uint32 index
00053
00054 ================================================================================
00055 MSG: nasa_r2_common_msgs/MappedType
00056 uint8 STRING = 0
00057 uint8 UINT16 = 1
00058 uint8 INT16 = 2
00059 uint8 UINT32 = 3
00060 uint8 INT32 = 4
00061 uint8 FLOAT32 = 5
00062 uint8 BOOL = 6
00063
00064 uint8 type
00065
00066 """
00067 __slots__ = ['header','map']
00068 _slot_types = ['std_msgs/Header','nasa_r2_common_msgs/VariantMap[]']
00069
00070 def __init__(self, *args, **kwds):
00071 """
00072 Constructor. Any message fields that are implicitly/explicitly
00073 set to None will be assigned a default value. The recommend
00074 use is keyword arguments as this is more robust to future message
00075 changes. You cannot mix in-order arguments and keyword arguments.
00076
00077 The available fields are:
00078 header,map
00079
00080 :param args: complete set of field values, in .msg order
00081 :param kwds: use keyword arguments corresponding to message field names
00082 to set specific fields.
00083 """
00084 if args or kwds:
00085 super(VariantMapArray, self).__init__(*args, **kwds)
00086
00087 if self.header is None:
00088 self.header = std_msgs.msg.Header()
00089 if self.map is None:
00090 self.map = []
00091 else:
00092 self.header = std_msgs.msg.Header()
00093 self.map = []
00094
00095 def _get_types(self):
00096 """
00097 internal API method
00098 """
00099 return self._slot_types
00100
00101 def serialize(self, buff):
00102 """
00103 serialize message into buffer
00104 :param buff: buffer, ``StringIO``
00105 """
00106 try:
00107 _x = self
00108 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00109 _x = self.header.frame_id
00110 length = len(_x)
00111 if python3 or type(_x) == unicode:
00112 _x = _x.encode('utf-8')
00113 length = len(_x)
00114 buff.write(struct.pack('<I%ss'%length, length, _x))
00115 length = len(self.map)
00116 buff.write(_struct_I.pack(length))
00117 for val1 in self.map:
00118 _x = val1.name
00119 length = len(_x)
00120 if python3 or type(_x) == unicode:
00121 _x = _x.encode('utf-8')
00122 length = len(_x)
00123 buff.write(struct.pack('<I%ss'%length, length, _x))
00124 _x = val1.message
00125 length = len(_x)
00126 if python3 or type(_x) == unicode:
00127 _x = _x.encode('utf-8')
00128 length = len(_x)
00129 buff.write(struct.pack('<I%ss'%length, length, _x))
00130 length = len(val1.value)
00131 buff.write(_struct_I.pack(length))
00132 for val2 in val1.value:
00133 _x = val2.key
00134 length = len(_x)
00135 if python3 or type(_x) == unicode:
00136 _x = _x.encode('utf-8')
00137 length = len(_x)
00138 buff.write(struct.pack('<I%ss'%length, length, _x))
00139 _v1 = val2.type
00140 buff.write(_struct_B.pack(_v1.type))
00141 buff.write(_struct_I.pack(val2.index))
00142 length = len(val1.stringMap)
00143 buff.write(_struct_I.pack(length))
00144 for val2 in val1.stringMap:
00145 length = len(val2)
00146 if python3 or type(val2) == unicode:
00147 val2 = val2.encode('utf-8')
00148 length = len(val2)
00149 buff.write(struct.pack('<I%ss'%length, length, val2))
00150 length = len(val1.uint16Map)
00151 buff.write(_struct_I.pack(length))
00152 pattern = '<%sH'%length
00153 buff.write(struct.pack(pattern, *val1.uint16Map))
00154 length = len(val1.int16Map)
00155 buff.write(_struct_I.pack(length))
00156 pattern = '<%sh'%length
00157 buff.write(struct.pack(pattern, *val1.int16Map))
00158 length = len(val1.uint32Map)
00159 buff.write(_struct_I.pack(length))
00160 pattern = '<%sI'%length
00161 buff.write(struct.pack(pattern, *val1.uint32Map))
00162 length = len(val1.int32Map)
00163 buff.write(_struct_I.pack(length))
00164 pattern = '<%si'%length
00165 buff.write(struct.pack(pattern, *val1.int32Map))
00166 length = len(val1.float32Map)
00167 buff.write(_struct_I.pack(length))
00168 pattern = '<%sf'%length
00169 buff.write(struct.pack(pattern, *val1.float32Map))
00170 length = len(val1.boolMap)
00171 buff.write(_struct_I.pack(length))
00172 pattern = '<%sB'%length
00173 buff.write(struct.pack(pattern, *val1.boolMap))
00174 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00175 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00176
00177 def deserialize(self, str):
00178 """
00179 unpack serialized message in str into this message instance
00180 :param str: byte array of serialized message, ``str``
00181 """
00182 try:
00183 if self.header is None:
00184 self.header = std_msgs.msg.Header()
00185 if self.map is None:
00186 self.map = None
00187 end = 0
00188 _x = self
00189 start = end
00190 end += 12
00191 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00192 start = end
00193 end += 4
00194 (length,) = _struct_I.unpack(str[start:end])
00195 start = end
00196 end += length
00197 if python3:
00198 self.header.frame_id = str[start:end].decode('utf-8')
00199 else:
00200 self.header.frame_id = str[start:end]
00201 start = end
00202 end += 4
00203 (length,) = _struct_I.unpack(str[start:end])
00204 self.map = []
00205 for i in range(0, length):
00206 val1 = nasa_r2_common_msgs.msg.VariantMap()
00207 start = end
00208 end += 4
00209 (length,) = _struct_I.unpack(str[start:end])
00210 start = end
00211 end += length
00212 if python3:
00213 val1.name = str[start:end].decode('utf-8')
00214 else:
00215 val1.name = str[start:end]
00216 start = end
00217 end += 4
00218 (length,) = _struct_I.unpack(str[start:end])
00219 start = end
00220 end += length
00221 if python3:
00222 val1.message = str[start:end].decode('utf-8')
00223 else:
00224 val1.message = str[start:end]
00225 start = end
00226 end += 4
00227 (length,) = _struct_I.unpack(str[start:end])
00228 val1.value = []
00229 for i in range(0, length):
00230 val2 = nasa_r2_common_msgs.msg.ValueType()
00231 start = end
00232 end += 4
00233 (length,) = _struct_I.unpack(str[start:end])
00234 start = end
00235 end += length
00236 if python3:
00237 val2.key = str[start:end].decode('utf-8')
00238 else:
00239 val2.key = str[start:end]
00240 _v2 = val2.type
00241 start = end
00242 end += 1
00243 (_v2.type,) = _struct_B.unpack(str[start:end])
00244 start = end
00245 end += 4
00246 (val2.index,) = _struct_I.unpack(str[start:end])
00247 val1.value.append(val2)
00248 start = end
00249 end += 4
00250 (length,) = _struct_I.unpack(str[start:end])
00251 val1.stringMap = []
00252 for i in range(0, length):
00253 start = end
00254 end += 4
00255 (length,) = _struct_I.unpack(str[start:end])
00256 start = end
00257 end += length
00258 if python3:
00259 val2 = str[start:end].decode('utf-8')
00260 else:
00261 val2 = str[start:end]
00262 val1.stringMap.append(val2)
00263 start = end
00264 end += 4
00265 (length,) = _struct_I.unpack(str[start:end])
00266 pattern = '<%sH'%length
00267 start = end
00268 end += struct.calcsize(pattern)
00269 val1.uint16Map = struct.unpack(pattern, str[start:end])
00270 start = end
00271 end += 4
00272 (length,) = _struct_I.unpack(str[start:end])
00273 pattern = '<%sh'%length
00274 start = end
00275 end += struct.calcsize(pattern)
00276 val1.int16Map = struct.unpack(pattern, str[start:end])
00277 start = end
00278 end += 4
00279 (length,) = _struct_I.unpack(str[start:end])
00280 pattern = '<%sI'%length
00281 start = end
00282 end += struct.calcsize(pattern)
00283 val1.uint32Map = struct.unpack(pattern, str[start:end])
00284 start = end
00285 end += 4
00286 (length,) = _struct_I.unpack(str[start:end])
00287 pattern = '<%si'%length
00288 start = end
00289 end += struct.calcsize(pattern)
00290 val1.int32Map = struct.unpack(pattern, str[start:end])
00291 start = end
00292 end += 4
00293 (length,) = _struct_I.unpack(str[start:end])
00294 pattern = '<%sf'%length
00295 start = end
00296 end += struct.calcsize(pattern)
00297 val1.float32Map = struct.unpack(pattern, str[start:end])
00298 start = end
00299 end += 4
00300 (length,) = _struct_I.unpack(str[start:end])
00301 pattern = '<%sB'%length
00302 start = end
00303 end += struct.calcsize(pattern)
00304 val1.boolMap = struct.unpack(pattern, str[start:end])
00305 val1.boolMap = map(bool, val1.boolMap)
00306 self.map.append(val1)
00307 return self
00308 except struct.error as e:
00309 raise genpy.DeserializationError(e)
00310
00311
00312 def serialize_numpy(self, buff, numpy):
00313 """
00314 serialize message with numpy array types into buffer
00315 :param buff: buffer, ``StringIO``
00316 :param numpy: numpy python module
00317 """
00318 try:
00319 _x = self
00320 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00321 _x = self.header.frame_id
00322 length = len(_x)
00323 if python3 or type(_x) == unicode:
00324 _x = _x.encode('utf-8')
00325 length = len(_x)
00326 buff.write(struct.pack('<I%ss'%length, length, _x))
00327 length = len(self.map)
00328 buff.write(_struct_I.pack(length))
00329 for val1 in self.map:
00330 _x = val1.name
00331 length = len(_x)
00332 if python3 or type(_x) == unicode:
00333 _x = _x.encode('utf-8')
00334 length = len(_x)
00335 buff.write(struct.pack('<I%ss'%length, length, _x))
00336 _x = val1.message
00337 length = len(_x)
00338 if python3 or type(_x) == unicode:
00339 _x = _x.encode('utf-8')
00340 length = len(_x)
00341 buff.write(struct.pack('<I%ss'%length, length, _x))
00342 length = len(val1.value)
00343 buff.write(_struct_I.pack(length))
00344 for val2 in val1.value:
00345 _x = val2.key
00346 length = len(_x)
00347 if python3 or type(_x) == unicode:
00348 _x = _x.encode('utf-8')
00349 length = len(_x)
00350 buff.write(struct.pack('<I%ss'%length, length, _x))
00351 _v3 = val2.type
00352 buff.write(_struct_B.pack(_v3.type))
00353 buff.write(_struct_I.pack(val2.index))
00354 length = len(val1.stringMap)
00355 buff.write(_struct_I.pack(length))
00356 for val2 in val1.stringMap:
00357 length = len(val2)
00358 if python3 or type(val2) == unicode:
00359 val2 = val2.encode('utf-8')
00360 length = len(val2)
00361 buff.write(struct.pack('<I%ss'%length, length, val2))
00362 length = len(val1.uint16Map)
00363 buff.write(_struct_I.pack(length))
00364 pattern = '<%sH'%length
00365 buff.write(val1.uint16Map.tostring())
00366 length = len(val1.int16Map)
00367 buff.write(_struct_I.pack(length))
00368 pattern = '<%sh'%length
00369 buff.write(val1.int16Map.tostring())
00370 length = len(val1.uint32Map)
00371 buff.write(_struct_I.pack(length))
00372 pattern = '<%sI'%length
00373 buff.write(val1.uint32Map.tostring())
00374 length = len(val1.int32Map)
00375 buff.write(_struct_I.pack(length))
00376 pattern = '<%si'%length
00377 buff.write(val1.int32Map.tostring())
00378 length = len(val1.float32Map)
00379 buff.write(_struct_I.pack(length))
00380 pattern = '<%sf'%length
00381 buff.write(val1.float32Map.tostring())
00382 length = len(val1.boolMap)
00383 buff.write(_struct_I.pack(length))
00384 pattern = '<%sB'%length
00385 buff.write(val1.boolMap.tostring())
00386 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00387 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00388
00389 def deserialize_numpy(self, str, numpy):
00390 """
00391 unpack serialized message in str into this message instance using numpy for array types
00392 :param str: byte array of serialized message, ``str``
00393 :param numpy: numpy python module
00394 """
00395 try:
00396 if self.header is None:
00397 self.header = std_msgs.msg.Header()
00398 if self.map is None:
00399 self.map = None
00400 end = 0
00401 _x = self
00402 start = end
00403 end += 12
00404 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00405 start = end
00406 end += 4
00407 (length,) = _struct_I.unpack(str[start:end])
00408 start = end
00409 end += length
00410 if python3:
00411 self.header.frame_id = str[start:end].decode('utf-8')
00412 else:
00413 self.header.frame_id = str[start:end]
00414 start = end
00415 end += 4
00416 (length,) = _struct_I.unpack(str[start:end])
00417 self.map = []
00418 for i in range(0, length):
00419 val1 = nasa_r2_common_msgs.msg.VariantMap()
00420 start = end
00421 end += 4
00422 (length,) = _struct_I.unpack(str[start:end])
00423 start = end
00424 end += length
00425 if python3:
00426 val1.name = str[start:end].decode('utf-8')
00427 else:
00428 val1.name = str[start:end]
00429 start = end
00430 end += 4
00431 (length,) = _struct_I.unpack(str[start:end])
00432 start = end
00433 end += length
00434 if python3:
00435 val1.message = str[start:end].decode('utf-8')
00436 else:
00437 val1.message = str[start:end]
00438 start = end
00439 end += 4
00440 (length,) = _struct_I.unpack(str[start:end])
00441 val1.value = []
00442 for i in range(0, length):
00443 val2 = nasa_r2_common_msgs.msg.ValueType()
00444 start = end
00445 end += 4
00446 (length,) = _struct_I.unpack(str[start:end])
00447 start = end
00448 end += length
00449 if python3:
00450 val2.key = str[start:end].decode('utf-8')
00451 else:
00452 val2.key = str[start:end]
00453 _v4 = val2.type
00454 start = end
00455 end += 1
00456 (_v4.type,) = _struct_B.unpack(str[start:end])
00457 start = end
00458 end += 4
00459 (val2.index,) = _struct_I.unpack(str[start:end])
00460 val1.value.append(val2)
00461 start = end
00462 end += 4
00463 (length,) = _struct_I.unpack(str[start:end])
00464 val1.stringMap = []
00465 for i in range(0, length):
00466 start = end
00467 end += 4
00468 (length,) = _struct_I.unpack(str[start:end])
00469 start = end
00470 end += length
00471 if python3:
00472 val2 = str[start:end].decode('utf-8')
00473 else:
00474 val2 = str[start:end]
00475 val1.stringMap.append(val2)
00476 start = end
00477 end += 4
00478 (length,) = _struct_I.unpack(str[start:end])
00479 pattern = '<%sH'%length
00480 start = end
00481 end += struct.calcsize(pattern)
00482 val1.uint16Map = numpy.frombuffer(str[start:end], dtype=numpy.uint16, count=length)
00483 start = end
00484 end += 4
00485 (length,) = _struct_I.unpack(str[start:end])
00486 pattern = '<%sh'%length
00487 start = end
00488 end += struct.calcsize(pattern)
00489 val1.int16Map = numpy.frombuffer(str[start:end], dtype=numpy.int16, count=length)
00490 start = end
00491 end += 4
00492 (length,) = _struct_I.unpack(str[start:end])
00493 pattern = '<%sI'%length
00494 start = end
00495 end += struct.calcsize(pattern)
00496 val1.uint32Map = numpy.frombuffer(str[start:end], dtype=numpy.uint32, count=length)
00497 start = end
00498 end += 4
00499 (length,) = _struct_I.unpack(str[start:end])
00500 pattern = '<%si'%length
00501 start = end
00502 end += struct.calcsize(pattern)
00503 val1.int32Map = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
00504 start = end
00505 end += 4
00506 (length,) = _struct_I.unpack(str[start:end])
00507 pattern = '<%sf'%length
00508 start = end
00509 end += struct.calcsize(pattern)
00510 val1.float32Map = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00511 start = end
00512 end += 4
00513 (length,) = _struct_I.unpack(str[start:end])
00514 pattern = '<%sB'%length
00515 start = end
00516 end += struct.calcsize(pattern)
00517 val1.boolMap = numpy.frombuffer(str[start:end], dtype=numpy.bool, count=length)
00518 val1.boolMap = map(bool, val1.boolMap)
00519 self.map.append(val1)
00520 return self
00521 except struct.error as e:
00522 raise genpy.DeserializationError(e)
00523
00524 _struct_I = genpy.struct_I
00525 _struct_3I = struct.Struct("<3I")
00526 _struct_B = struct.Struct("<B")