_UniqueID.py
Go to the documentation of this file.
00001 """autogenerated by genpy from uuid_msgs/UniqueID.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 
00008 class UniqueID(genpy.Message):
00009   _md5sum = "fec2a93b6f5367ee8112c9c0b41ff310"
00010   _type = "uuid_msgs/UniqueID"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# A universally unique identifier (UUID).
00013 #
00014 #  http://en.wikipedia.org/wiki/Universally_unique_identifier
00015 #  http://tools.ietf.org/html/rfc4122.html
00016 
00017 uint8[16] uuid
00018 
00019 """
00020   __slots__ = ['uuid']
00021   _slot_types = ['uint8[16]']
00022 
00023   def __init__(self, *args, **kwds):
00024     """
00025     Constructor. Any message fields that are implicitly/explicitly
00026     set to None will be assigned a default value. The recommend
00027     use is keyword arguments as this is more robust to future message
00028     changes.  You cannot mix in-order arguments and keyword arguments.
00029 
00030     The available fields are:
00031        uuid
00032 
00033     :param args: complete set of field values, in .msg order
00034     :param kwds: use keyword arguments corresponding to message field names
00035     to set specific fields.
00036     """
00037     if args or kwds:
00038       super(UniqueID, self).__init__(*args, **kwds)
00039       #message fields cannot be None, assign default values for those that are
00040       if self.uuid is None:
00041         self.uuid = chr(0)*16
00042     else:
00043       self.uuid = chr(0)*16
00044 
00045   def _get_types(self):
00046     """
00047     internal API method
00048     """
00049     return self._slot_types
00050 
00051   def serialize(self, buff):
00052     """
00053     serialize message into buffer
00054     :param buff: buffer, ``StringIO``
00055     """
00056     try:
00057       _x = self.uuid
00058       # - if encoded as a list instead, serialize as bytes instead of string
00059       if type(_x) in [list, tuple]:
00060         buff.write(_struct_16B.pack(*_x))
00061       else:
00062         buff.write(_struct_16s.pack(_x))
00063     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00064     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00065 
00066   def deserialize(self, str):
00067     """
00068     unpack serialized message in str into this message instance
00069     :param str: byte array of serialized message, ``str``
00070     """
00071     try:
00072       end = 0
00073       start = end
00074       end += 16
00075       self.uuid = str[start:end]
00076       return self
00077     except struct.error as e:
00078       raise genpy.DeserializationError(e) #most likely buffer underfill
00079 
00080 
00081   def serialize_numpy(self, buff, numpy):
00082     """
00083     serialize message with numpy array types into buffer
00084     :param buff: buffer, ``StringIO``
00085     :param numpy: numpy python module
00086     """
00087     try:
00088       _x = self.uuid
00089       # - if encoded as a list instead, serialize as bytes instead of string
00090       if type(_x) in [list, tuple]:
00091         buff.write(_struct_16B.pack(*_x))
00092       else:
00093         buff.write(_struct_16s.pack(_x))
00094     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00095     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00096 
00097   def deserialize_numpy(self, str, numpy):
00098     """
00099     unpack serialized message in str into this message instance using numpy for array types
00100     :param str: byte array of serialized message, ``str``
00101     :param numpy: numpy python module
00102     """
00103     try:
00104       end = 0
00105       start = end
00106       end += 16
00107       self.uuid = str[start:end]
00108       return self
00109     except struct.error as e:
00110       raise genpy.DeserializationError(e) #most likely buffer underfill
00111 
00112 _struct_I = genpy.struct_I
00113 _struct_16B = struct.Struct("<16B")
00114 _struct_16s = struct.Struct("<16s")


uuid_msgs
Author(s): Jack O'Quin
autogenerated on Mon Oct 6 2014 08:23:43