_MapListEntry.py
Go to the documentation of this file.
00001 """autogenerated by genpy from map_store/MapListEntry.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 MapListEntry(genpy.Message):
00009   _md5sum = "092f024758d394d17196cd37d999fdb0"
00010   _type = "map_store/MapListEntry"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# One entry in a list of maps.
00013 
00014 # Naming a map is optional.
00015 string name
00016 
00017 # Maps made by the make-a-map app are given a session ID, which is the
00018 # time when the map-making session was started, expressed as seconds
00019 # since the epoch and converted to a string.
00020 string session_id
00021 
00022 # Creation time of this map, in seconds since the epoch.
00023 int64 date
00024 
00025 # Unique ID of this map.
00026 string map_id
00027 
00028 """
00029   __slots__ = ['name','session_id','date','map_id']
00030   _slot_types = ['string','string','int64','string']
00031 
00032   def __init__(self, *args, **kwds):
00033     """
00034     Constructor. Any message fields that are implicitly/explicitly
00035     set to None will be assigned a default value. The recommend
00036     use is keyword arguments as this is more robust to future message
00037     changes.  You cannot mix in-order arguments and keyword arguments.
00038 
00039     The available fields are:
00040        name,session_id,date,map_id
00041 
00042     :param args: complete set of field values, in .msg order
00043     :param kwds: use keyword arguments corresponding to message field names
00044     to set specific fields.
00045     """
00046     if args or kwds:
00047       super(MapListEntry, self).__init__(*args, **kwds)
00048       #message fields cannot be None, assign default values for those that are
00049       if self.name is None:
00050         self.name = ''
00051       if self.session_id is None:
00052         self.session_id = ''
00053       if self.date is None:
00054         self.date = 0
00055       if self.map_id is None:
00056         self.map_id = ''
00057     else:
00058       self.name = ''
00059       self.session_id = ''
00060       self.date = 0
00061       self.map_id = ''
00062 
00063   def _get_types(self):
00064     """
00065     internal API method
00066     """
00067     return self._slot_types
00068 
00069   def serialize(self, buff):
00070     """
00071     serialize message into buffer
00072     :param buff: buffer, ``StringIO``
00073     """
00074     try:
00075       _x = self.name
00076       length = len(_x)
00077       if python3 or type(_x) == unicode:
00078         _x = _x.encode('utf-8')
00079         length = len(_x)
00080       buff.write(struct.pack('<I%ss'%length, length, _x))
00081       _x = self.session_id
00082       length = len(_x)
00083       if python3 or type(_x) == unicode:
00084         _x = _x.encode('utf-8')
00085         length = len(_x)
00086       buff.write(struct.pack('<I%ss'%length, length, _x))
00087       buff.write(_struct_q.pack(self.date))
00088       _x = self.map_id
00089       length = len(_x)
00090       if python3 or type(_x) == unicode:
00091         _x = _x.encode('utf-8')
00092         length = len(_x)
00093       buff.write(struct.pack('<I%ss'%length, length, _x))
00094     except struct.error as se: self._check_types(se)
00095     except TypeError as te: self._check_types(te)
00096 
00097   def deserialize(self, str):
00098     """
00099     unpack serialized message in str into this message instance
00100     :param str: byte array of serialized message, ``str``
00101     """
00102     try:
00103       end = 0
00104       start = end
00105       end += 4
00106       (length,) = _struct_I.unpack(str[start:end])
00107       start = end
00108       end += length
00109       if python3:
00110         self.name = str[start:end].decode('utf-8')
00111       else:
00112         self.name = str[start:end]
00113       start = end
00114       end += 4
00115       (length,) = _struct_I.unpack(str[start:end])
00116       start = end
00117       end += length
00118       if python3:
00119         self.session_id = str[start:end].decode('utf-8')
00120       else:
00121         self.session_id = str[start:end]
00122       start = end
00123       end += 8
00124       (self.date,) = _struct_q.unpack(str[start:end])
00125       start = end
00126       end += 4
00127       (length,) = _struct_I.unpack(str[start:end])
00128       start = end
00129       end += length
00130       if python3:
00131         self.map_id = str[start:end].decode('utf-8')
00132       else:
00133         self.map_id = str[start:end]
00134       return self
00135     except struct.error as e:
00136       raise genpy.DeserializationError(e) #most likely buffer underfill
00137 
00138 
00139   def serialize_numpy(self, buff, numpy):
00140     """
00141     serialize message with numpy array types into buffer
00142     :param buff: buffer, ``StringIO``
00143     :param numpy: numpy python module
00144     """
00145     try:
00146       _x = self.name
00147       length = len(_x)
00148       if python3 or type(_x) == unicode:
00149         _x = _x.encode('utf-8')
00150         length = len(_x)
00151       buff.write(struct.pack('<I%ss'%length, length, _x))
00152       _x = self.session_id
00153       length = len(_x)
00154       if python3 or type(_x) == unicode:
00155         _x = _x.encode('utf-8')
00156         length = len(_x)
00157       buff.write(struct.pack('<I%ss'%length, length, _x))
00158       buff.write(_struct_q.pack(self.date))
00159       _x = self.map_id
00160       length = len(_x)
00161       if python3 or type(_x) == unicode:
00162         _x = _x.encode('utf-8')
00163         length = len(_x)
00164       buff.write(struct.pack('<I%ss'%length, length, _x))
00165     except struct.error as se: self._check_types(se)
00166     except TypeError as te: self._check_types(te)
00167 
00168   def deserialize_numpy(self, str, numpy):
00169     """
00170     unpack serialized message in str into this message instance using numpy for array types
00171     :param str: byte array of serialized message, ``str``
00172     :param numpy: numpy python module
00173     """
00174     try:
00175       end = 0
00176       start = end
00177       end += 4
00178       (length,) = _struct_I.unpack(str[start:end])
00179       start = end
00180       end += length
00181       if python3:
00182         self.name = str[start:end].decode('utf-8')
00183       else:
00184         self.name = str[start:end]
00185       start = end
00186       end += 4
00187       (length,) = _struct_I.unpack(str[start:end])
00188       start = end
00189       end += length
00190       if python3:
00191         self.session_id = str[start:end].decode('utf-8')
00192       else:
00193         self.session_id = str[start:end]
00194       start = end
00195       end += 8
00196       (self.date,) = _struct_q.unpack(str[start:end])
00197       start = end
00198       end += 4
00199       (length,) = _struct_I.unpack(str[start:end])
00200       start = end
00201       end += length
00202       if python3:
00203         self.map_id = str[start:end].decode('utf-8')
00204       else:
00205         self.map_id = str[start:end]
00206       return self
00207     except struct.error as e:
00208       raise genpy.DeserializationError(e) #most likely buffer underfill
00209 
00210 _struct_I = genpy.struct_I
00211 _struct_q = struct.Struct("<q")


map_store
Author(s): Dave Hershberger
autogenerated on Sat Dec 28 2013 17:10:27