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


geographic_msgs
Author(s): Jack O'Quin
autogenerated on Mon Oct 6 2014 00:09:26