_ABoxObject.py
Go to the documentation of this file.
00001 """autogenerated by genpy from srs_knowledge/ABoxObject.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 ABoxObject(genpy.Message):
00009   _md5sum = "d55193ed27b763984b5aabe03fef4448"
00010   _type = "srs_knowledge/ABoxObject"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """int32 object_id
00013 string name
00014 string description
00015 
00016 """
00017   __slots__ = ['object_id','name','description']
00018   _slot_types = ['int32','string','string']
00019 
00020   def __init__(self, *args, **kwds):
00021     """
00022     Constructor. Any message fields that are implicitly/explicitly
00023     set to None will be assigned a default value. The recommend
00024     use is keyword arguments as this is more robust to future message
00025     changes.  You cannot mix in-order arguments and keyword arguments.
00026 
00027     The available fields are:
00028        object_id,name,description
00029 
00030     :param args: complete set of field values, in .msg order
00031     :param kwds: use keyword arguments corresponding to message field names
00032     to set specific fields.
00033     """
00034     if args or kwds:
00035       super(ABoxObject, self).__init__(*args, **kwds)
00036       #message fields cannot be None, assign default values for those that are
00037       if self.object_id is None:
00038         self.object_id = 0
00039       if self.name is None:
00040         self.name = ''
00041       if self.description is None:
00042         self.description = ''
00043     else:
00044       self.object_id = 0
00045       self.name = ''
00046       self.description = ''
00047 
00048   def _get_types(self):
00049     """
00050     internal API method
00051     """
00052     return self._slot_types
00053 
00054   def serialize(self, buff):
00055     """
00056     serialize message into buffer
00057     :param buff: buffer, ``StringIO``
00058     """
00059     try:
00060       buff.write(_struct_i.pack(self.object_id))
00061       _x = self.name
00062       length = len(_x)
00063       if python3 or type(_x) == unicode:
00064         _x = _x.encode('utf-8')
00065         length = len(_x)
00066       buff.write(struct.pack('<I%ss'%length, length, _x))
00067       _x = self.description
00068       length = len(_x)
00069       if python3 or type(_x) == unicode:
00070         _x = _x.encode('utf-8')
00071         length = len(_x)
00072       buff.write(struct.pack('<I%ss'%length, length, _x))
00073     except struct.error as se: self._check_types(se)
00074     except TypeError as te: self._check_types(te)
00075 
00076   def deserialize(self, str):
00077     """
00078     unpack serialized message in str into this message instance
00079     :param str: byte array of serialized message, ``str``
00080     """
00081     try:
00082       end = 0
00083       start = end
00084       end += 4
00085       (self.object_id,) = _struct_i.unpack(str[start:end])
00086       start = end
00087       end += 4
00088       (length,) = _struct_I.unpack(str[start:end])
00089       start = end
00090       end += length
00091       if python3:
00092         self.name = str[start:end].decode('utf-8')
00093       else:
00094         self.name = str[start:end]
00095       start = end
00096       end += 4
00097       (length,) = _struct_I.unpack(str[start:end])
00098       start = end
00099       end += length
00100       if python3:
00101         self.description = str[start:end].decode('utf-8')
00102       else:
00103         self.description = str[start:end]
00104       return self
00105     except struct.error as e:
00106       raise genpy.DeserializationError(e) #most likely buffer underfill
00107 
00108 
00109   def serialize_numpy(self, buff, numpy):
00110     """
00111     serialize message with numpy array types into buffer
00112     :param buff: buffer, ``StringIO``
00113     :param numpy: numpy python module
00114     """
00115     try:
00116       buff.write(_struct_i.pack(self.object_id))
00117       _x = self.name
00118       length = len(_x)
00119       if python3 or type(_x) == unicode:
00120         _x = _x.encode('utf-8')
00121         length = len(_x)
00122       buff.write(struct.pack('<I%ss'%length, length, _x))
00123       _x = self.description
00124       length = len(_x)
00125       if python3 or type(_x) == unicode:
00126         _x = _x.encode('utf-8')
00127         length = len(_x)
00128       buff.write(struct.pack('<I%ss'%length, length, _x))
00129     except struct.error as se: self._check_types(se)
00130     except TypeError as te: self._check_types(te)
00131 
00132   def deserialize_numpy(self, str, numpy):
00133     """
00134     unpack serialized message in str into this message instance using numpy for array types
00135     :param str: byte array of serialized message, ``str``
00136     :param numpy: numpy python module
00137     """
00138     try:
00139       end = 0
00140       start = end
00141       end += 4
00142       (self.object_id,) = _struct_i.unpack(str[start:end])
00143       start = end
00144       end += 4
00145       (length,) = _struct_I.unpack(str[start:end])
00146       start = end
00147       end += length
00148       if python3:
00149         self.name = str[start:end].decode('utf-8')
00150       else:
00151         self.name = str[start:end]
00152       start = end
00153       end += 4
00154       (length,) = _struct_I.unpack(str[start:end])
00155       start = end
00156       end += length
00157       if python3:
00158         self.description = str[start:end].decode('utf-8')
00159       else:
00160         self.description = str[start:end]
00161       return self
00162     except struct.error as e:
00163       raise genpy.DeserializationError(e) #most likely buffer underfill
00164 
00165 _struct_I = genpy.struct_I
00166 _struct_i = struct.Struct("<i")


srs_knowledge
Author(s): Ze Ji
autogenerated on Sun Jan 5 2014 12:03:26