00001 """autogenerated by genpy from geographic_msgs/MapFeature.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 uuid_msgs.msg
00008 import geographic_msgs.msg
00009
00010 class MapFeature(genpy.Message):
00011 _md5sum = "e2505ace5e8da8a15b610eaf62bdefae"
00012 _type = "geographic_msgs/MapFeature"
00013 _has_header = False
00014 _full_text = """# Geographic map feature.
00015 #
00016 # A list of WayPoint IDs for features like streets, highways, hiking
00017 # trails, the outlines of buildings and parking lots in sequential
00018 # order.
00019 #
00020 # Feature lists may also contain other feature lists as members.
00021
00022 uuid_msgs/UniqueID id # Unique feature identifier
00023 uuid_msgs/UniqueID[] components # Sequence of feature components
00024 KeyValue[] props # Key/value properties for this feature
00025
00026 ================================================================================
00027 MSG: uuid_msgs/UniqueID
00028 # A universally unique identifier (UUID).
00029 #
00030 # http://en.wikipedia.org/wiki/Universally_unique_identifier
00031 # http://tools.ietf.org/html/rfc4122.html
00032
00033 uint8[16] uuid
00034
00035 ================================================================================
00036 MSG: geographic_msgs/KeyValue
00037 # Geographic map tag (key, value) pair
00038 #
00039 # This is equivalent to diagnostic_msgs/KeyValue, repeated here to
00040 # avoid introducing a trivial stack dependency.
00041
00042 string key # tag label
00043 string value # corresponding value
00044
00045 """
00046 __slots__ = ['id','components','props']
00047 _slot_types = ['uuid_msgs/UniqueID','uuid_msgs/UniqueID[]','geographic_msgs/KeyValue[]']
00048
00049 def __init__(self, *args, **kwds):
00050 """
00051 Constructor. Any message fields that are implicitly/explicitly
00052 set to None will be assigned a default value. The recommend
00053 use is keyword arguments as this is more robust to future message
00054 changes. You cannot mix in-order arguments and keyword arguments.
00055
00056 The available fields are:
00057 id,components,props
00058
00059 :param args: complete set of field values, in .msg order
00060 :param kwds: use keyword arguments corresponding to message field names
00061 to set specific fields.
00062 """
00063 if args or kwds:
00064 super(MapFeature, self).__init__(*args, **kwds)
00065
00066 if self.id is None:
00067 self.id = uuid_msgs.msg.UniqueID()
00068 if self.components is None:
00069 self.components = []
00070 if self.props is None:
00071 self.props = []
00072 else:
00073 self.id = uuid_msgs.msg.UniqueID()
00074 self.components = []
00075 self.props = []
00076
00077 def _get_types(self):
00078 """
00079 internal API method
00080 """
00081 return self._slot_types
00082
00083 def serialize(self, buff):
00084 """
00085 serialize message into buffer
00086 :param buff: buffer, ``StringIO``
00087 """
00088 try:
00089 _x = self.id.uuid
00090
00091 if type(_x) in [list, tuple]:
00092 buff.write(_struct_16B.pack(*_x))
00093 else:
00094 buff.write(_struct_16s.pack(_x))
00095 length = len(self.components)
00096 buff.write(_struct_I.pack(length))
00097 for val1 in self.components:
00098 _x = val1.uuid
00099
00100 if type(_x) in [list, tuple]:
00101 buff.write(_struct_16B.pack(*_x))
00102 else:
00103 buff.write(_struct_16s.pack(_x))
00104 length = len(self.props)
00105 buff.write(_struct_I.pack(length))
00106 for val1 in self.props:
00107 _x = val1.key
00108 length = len(_x)
00109 if python3 or type(_x) == unicode:
00110 _x = _x.encode('utf-8')
00111 length = len(_x)
00112 buff.write(struct.pack('<I%ss'%length, length, _x))
00113 _x = val1.value
00114 length = len(_x)
00115 if python3 or type(_x) == unicode:
00116 _x = _x.encode('utf-8')
00117 length = len(_x)
00118 buff.write(struct.pack('<I%ss'%length, length, _x))
00119 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00120 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00121
00122 def deserialize(self, str):
00123 """
00124 unpack serialized message in str into this message instance
00125 :param str: byte array of serialized message, ``str``
00126 """
00127 try:
00128 if self.id is None:
00129 self.id = uuid_msgs.msg.UniqueID()
00130 if self.components is None:
00131 self.components = None
00132 if self.props is None:
00133 self.props = None
00134 end = 0
00135 start = end
00136 end += 16
00137 self.id.uuid = str[start:end]
00138 start = end
00139 end += 4
00140 (length,) = _struct_I.unpack(str[start:end])
00141 self.components = []
00142 for i in range(0, length):
00143 val1 = uuid_msgs.msg.UniqueID()
00144 start = end
00145 end += 16
00146 val1.uuid = str[start:end]
00147 self.components.append(val1)
00148 start = end
00149 end += 4
00150 (length,) = _struct_I.unpack(str[start:end])
00151 self.props = []
00152 for i in range(0, length):
00153 val1 = geographic_msgs.msg.KeyValue()
00154 start = end
00155 end += 4
00156 (length,) = _struct_I.unpack(str[start:end])
00157 start = end
00158 end += length
00159 if python3:
00160 val1.key = str[start:end].decode('utf-8')
00161 else:
00162 val1.key = str[start:end]
00163 start = end
00164 end += 4
00165 (length,) = _struct_I.unpack(str[start:end])
00166 start = end
00167 end += length
00168 if python3:
00169 val1.value = str[start:end].decode('utf-8')
00170 else:
00171 val1.value = str[start:end]
00172 self.props.append(val1)
00173 return self
00174 except struct.error as e:
00175 raise genpy.DeserializationError(e)
00176
00177
00178 def serialize_numpy(self, buff, numpy):
00179 """
00180 serialize message with numpy array types into buffer
00181 :param buff: buffer, ``StringIO``
00182 :param numpy: numpy python module
00183 """
00184 try:
00185 _x = self.id.uuid
00186
00187 if type(_x) in [list, tuple]:
00188 buff.write(_struct_16B.pack(*_x))
00189 else:
00190 buff.write(_struct_16s.pack(_x))
00191 length = len(self.components)
00192 buff.write(_struct_I.pack(length))
00193 for val1 in self.components:
00194 _x = val1.uuid
00195
00196 if type(_x) in [list, tuple]:
00197 buff.write(_struct_16B.pack(*_x))
00198 else:
00199 buff.write(_struct_16s.pack(_x))
00200 length = len(self.props)
00201 buff.write(_struct_I.pack(length))
00202 for val1 in self.props:
00203 _x = val1.key
00204 length = len(_x)
00205 if python3 or type(_x) == unicode:
00206 _x = _x.encode('utf-8')
00207 length = len(_x)
00208 buff.write(struct.pack('<I%ss'%length, length, _x))
00209 _x = val1.value
00210 length = len(_x)
00211 if python3 or type(_x) == unicode:
00212 _x = _x.encode('utf-8')
00213 length = len(_x)
00214 buff.write(struct.pack('<I%ss'%length, length, _x))
00215 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00216 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00217
00218 def deserialize_numpy(self, str, numpy):
00219 """
00220 unpack serialized message in str into this message instance using numpy for array types
00221 :param str: byte array of serialized message, ``str``
00222 :param numpy: numpy python module
00223 """
00224 try:
00225 if self.id is None:
00226 self.id = uuid_msgs.msg.UniqueID()
00227 if self.components is None:
00228 self.components = None
00229 if self.props is None:
00230 self.props = None
00231 end = 0
00232 start = end
00233 end += 16
00234 self.id.uuid = str[start:end]
00235 start = end
00236 end += 4
00237 (length,) = _struct_I.unpack(str[start:end])
00238 self.components = []
00239 for i in range(0, length):
00240 val1 = uuid_msgs.msg.UniqueID()
00241 start = end
00242 end += 16
00243 val1.uuid = str[start:end]
00244 self.components.append(val1)
00245 start = end
00246 end += 4
00247 (length,) = _struct_I.unpack(str[start:end])
00248 self.props = []
00249 for i in range(0, length):
00250 val1 = geographic_msgs.msg.KeyValue()
00251 start = end
00252 end += 4
00253 (length,) = _struct_I.unpack(str[start:end])
00254 start = end
00255 end += length
00256 if python3:
00257 val1.key = str[start:end].decode('utf-8')
00258 else:
00259 val1.key = str[start:end]
00260 start = end
00261 end += 4
00262 (length,) = _struct_I.unpack(str[start:end])
00263 start = end
00264 end += length
00265 if python3:
00266 val1.value = str[start:end].decode('utf-8')
00267 else:
00268 val1.value = str[start:end]
00269 self.props.append(val1)
00270 return self
00271 except struct.error as e:
00272 raise genpy.DeserializationError(e)
00273
00274 _struct_I = genpy.struct_I
00275 _struct_16B = struct.Struct("<16B")
00276 _struct_16s = struct.Struct("<16s")