_Save.py
Go to the documentation of this file.
00001 """autogenerated by genpy from motld/Save.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 Save(genpy.Message):
00009   _md5sum = "030824f52a0628ead956fb9d67e66ae9"
00010   _type = "motld/Save"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """string filename
00013 """
00014   __slots__ = ['filename']
00015   _slot_types = ['string']
00016 
00017   def __init__(self, *args, **kwds):
00018     """
00019     Constructor. Any message fields that are implicitly/explicitly
00020     set to None will be assigned a default value. The recommend
00021     use is keyword arguments as this is more robust to future message
00022     changes.  You cannot mix in-order arguments and keyword arguments.
00023 
00024     The available fields are:
00025        filename
00026 
00027     :param args: complete set of field values, in .msg order
00028     :param kwds: use keyword arguments corresponding to message field names
00029     to set specific fields.
00030     """
00031     if args or kwds:
00032       super(Save, self).__init__(*args, **kwds)
00033       #message fields cannot be None, assign default values for those that are
00034       if self.filename is None:
00035         self.filename = ''
00036     else:
00037       self.filename = ''
00038 
00039   def _get_types(self):
00040     """
00041     internal API method
00042     """
00043     return self._slot_types
00044 
00045   def serialize(self, buff):
00046     """
00047     serialize message into buffer
00048     :param buff: buffer, ``StringIO``
00049     """
00050     try:
00051       _x = self.filename
00052       length = len(_x)
00053       if python3 or type(_x) == unicode:
00054         _x = _x.encode('utf-8')
00055         length = len(_x)
00056       buff.write(struct.pack('<I%ss'%length, length, _x))
00057     except struct.error as se: self._check_types(se)
00058     except TypeError as te: self._check_types(te)
00059 
00060   def deserialize(self, str):
00061     """
00062     unpack serialized message in str into this message instance
00063     :param str: byte array of serialized message, ``str``
00064     """
00065     try:
00066       end = 0
00067       start = end
00068       end += 4
00069       (length,) = _struct_I.unpack(str[start:end])
00070       start = end
00071       end += length
00072       if python3:
00073         self.filename = str[start:end].decode('utf-8')
00074       else:
00075         self.filename = 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.filename
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_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 += 4
00107       (length,) = _struct_I.unpack(str[start:end])
00108       start = end
00109       end += length
00110       if python3:
00111         self.filename = str[start:end].decode('utf-8')
00112       else:
00113         self.filename = str[start:end]
00114       return self
00115     except struct.error as e:
00116       raise genpy.DeserializationError(e) #most likely buffer underfill
00117 
00118 _struct_I = genpy.struct_I
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


motld
Author(s): Jost Tobias Springenberg, Jan Wuelfing
autogenerated on Wed Dec 26 2012 16:24:48