_grasp.py
Go to the documentation of this file.
00001 """autogenerated by genpy from srs_object_database_msgs/grasp.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 grasp(genpy.Message):
00009   _md5sum = "cbd3885e5b559dd3c0fbffd8fcb36583"
00010   _type = "srs_object_database_msgs/grasp"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """int32 objectId
00013 string Objecttype
00014 string pose
00015 string fileDescription
00016 uint8[] bs
00017 int32 size
00018 
00019 """
00020   __slots__ = ['objectId','Objecttype','pose','fileDescription','bs','size']
00021   _slot_types = ['int32','string','string','string','uint8[]','int32']
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        objectId,Objecttype,pose,fileDescription,bs,size
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(grasp, self).__init__(*args, **kwds)
00039       #message fields cannot be None, assign default values for those that are
00040       if self.objectId is None:
00041         self.objectId = 0
00042       if self.Objecttype is None:
00043         self.Objecttype = ''
00044       if self.pose is None:
00045         self.pose = ''
00046       if self.fileDescription is None:
00047         self.fileDescription = ''
00048       if self.bs is None:
00049         self.bs = ''
00050       if self.size is None:
00051         self.size = 0
00052     else:
00053       self.objectId = 0
00054       self.Objecttype = ''
00055       self.pose = ''
00056       self.fileDescription = ''
00057       self.bs = ''
00058       self.size = 0
00059 
00060   def _get_types(self):
00061     """
00062     internal API method
00063     """
00064     return self._slot_types
00065 
00066   def serialize(self, buff):
00067     """
00068     serialize message into buffer
00069     :param buff: buffer, ``StringIO``
00070     """
00071     try:
00072       buff.write(_struct_i.pack(self.objectId))
00073       _x = self.Objecttype
00074       length = len(_x)
00075       if python3 or type(_x) == unicode:
00076         _x = _x.encode('utf-8')
00077         length = len(_x)
00078       buff.write(struct.pack('<I%ss'%length, length, _x))
00079       _x = self.pose
00080       length = len(_x)
00081       if python3 or type(_x) == unicode:
00082         _x = _x.encode('utf-8')
00083         length = len(_x)
00084       buff.write(struct.pack('<I%ss'%length, length, _x))
00085       _x = self.fileDescription
00086       length = len(_x)
00087       if python3 or type(_x) == unicode:
00088         _x = _x.encode('utf-8')
00089         length = len(_x)
00090       buff.write(struct.pack('<I%ss'%length, length, _x))
00091       _x = self.bs
00092       length = len(_x)
00093       # - if encoded as a list instead, serialize as bytes instead of string
00094       if type(_x) in [list, tuple]:
00095         buff.write(struct.pack('<I%sB'%length, length, *_x))
00096       else:
00097         buff.write(struct.pack('<I%ss'%length, length, _x))
00098       buff.write(_struct_i.pack(self.size))
00099     except struct.error as se: self._check_types(se)
00100     except TypeError as te: self._check_types(te)
00101 
00102   def deserialize(self, str):
00103     """
00104     unpack serialized message in str into this message instance
00105     :param str: byte array of serialized message, ``str``
00106     """
00107     try:
00108       end = 0
00109       start = end
00110       end += 4
00111       (self.objectId,) = _struct_i.unpack(str[start:end])
00112       start = end
00113       end += 4
00114       (length,) = _struct_I.unpack(str[start:end])
00115       start = end
00116       end += length
00117       if python3:
00118         self.Objecttype = str[start:end].decode('utf-8')
00119       else:
00120         self.Objecttype = str[start:end]
00121       start = end
00122       end += 4
00123       (length,) = _struct_I.unpack(str[start:end])
00124       start = end
00125       end += length
00126       if python3:
00127         self.pose = str[start:end].decode('utf-8')
00128       else:
00129         self.pose = str[start:end]
00130       start = end
00131       end += 4
00132       (length,) = _struct_I.unpack(str[start:end])
00133       start = end
00134       end += length
00135       if python3:
00136         self.fileDescription = str[start:end].decode('utf-8')
00137       else:
00138         self.fileDescription = str[start:end]
00139       start = end
00140       end += 4
00141       (length,) = _struct_I.unpack(str[start:end])
00142       start = end
00143       end += length
00144       self.bs = str[start:end]
00145       start = end
00146       end += 4
00147       (self.size,) = _struct_i.unpack(str[start:end])
00148       return self
00149     except struct.error as e:
00150       raise genpy.DeserializationError(e) #most likely buffer underfill
00151 
00152 
00153   def serialize_numpy(self, buff, numpy):
00154     """
00155     serialize message with numpy array types into buffer
00156     :param buff: buffer, ``StringIO``
00157     :param numpy: numpy python module
00158     """
00159     try:
00160       buff.write(_struct_i.pack(self.objectId))
00161       _x = self.Objecttype
00162       length = len(_x)
00163       if python3 or type(_x) == unicode:
00164         _x = _x.encode('utf-8')
00165         length = len(_x)
00166       buff.write(struct.pack('<I%ss'%length, length, _x))
00167       _x = self.pose
00168       length = len(_x)
00169       if python3 or type(_x) == unicode:
00170         _x = _x.encode('utf-8')
00171         length = len(_x)
00172       buff.write(struct.pack('<I%ss'%length, length, _x))
00173       _x = self.fileDescription
00174       length = len(_x)
00175       if python3 or type(_x) == unicode:
00176         _x = _x.encode('utf-8')
00177         length = len(_x)
00178       buff.write(struct.pack('<I%ss'%length, length, _x))
00179       _x = self.bs
00180       length = len(_x)
00181       # - if encoded as a list instead, serialize as bytes instead of string
00182       if type(_x) in [list, tuple]:
00183         buff.write(struct.pack('<I%sB'%length, length, *_x))
00184       else:
00185         buff.write(struct.pack('<I%ss'%length, length, _x))
00186       buff.write(_struct_i.pack(self.size))
00187     except struct.error as se: self._check_types(se)
00188     except TypeError as te: self._check_types(te)
00189 
00190   def deserialize_numpy(self, str, numpy):
00191     """
00192     unpack serialized message in str into this message instance using numpy for array types
00193     :param str: byte array of serialized message, ``str``
00194     :param numpy: numpy python module
00195     """
00196     try:
00197       end = 0
00198       start = end
00199       end += 4
00200       (self.objectId,) = _struct_i.unpack(str[start:end])
00201       start = end
00202       end += 4
00203       (length,) = _struct_I.unpack(str[start:end])
00204       start = end
00205       end += length
00206       if python3:
00207         self.Objecttype = str[start:end].decode('utf-8')
00208       else:
00209         self.Objecttype = str[start:end]
00210       start = end
00211       end += 4
00212       (length,) = _struct_I.unpack(str[start:end])
00213       start = end
00214       end += length
00215       if python3:
00216         self.pose = str[start:end].decode('utf-8')
00217       else:
00218         self.pose = str[start:end]
00219       start = end
00220       end += 4
00221       (length,) = _struct_I.unpack(str[start:end])
00222       start = end
00223       end += length
00224       if python3:
00225         self.fileDescription = str[start:end].decode('utf-8')
00226       else:
00227         self.fileDescription = str[start:end]
00228       start = end
00229       end += 4
00230       (length,) = _struct_I.unpack(str[start:end])
00231       start = end
00232       end += length
00233       self.bs = str[start:end]
00234       start = end
00235       end += 4
00236       (self.size,) = _struct_i.unpack(str[start:end])
00237       return self
00238     except struct.error as e:
00239       raise genpy.DeserializationError(e) #most likely buffer underfill
00240 
00241 _struct_I = genpy.struct_I
00242 _struct_i = struct.Struct("<i")


srs_object_database_msgs
Author(s): Georg Arbeiter
autogenerated on Wed Nov 27 2013 14:14:38