_Component.py
Go to the documentation of this file.
00001 """autogenerated by genpy from srs_msgs/Component.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 Component(genpy.Message):
00009   _md5sum = "34fa2446de99a15241dfcb98c98ebd33"
00010   _type = "srs_msgs/Component"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# this message contains information to define a list of required components for an action 
00013 uint32 componentID   #ID
00014 string componentName   #Name
00015 
00016 """
00017   __slots__ = ['componentID','componentName']
00018   _slot_types = ['uint32','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        componentID,componentName
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(Component, self).__init__(*args, **kwds)
00036       #message fields cannot be None, assign default values for those that are
00037       if self.componentID is None:
00038         self.componentID = 0
00039       if self.componentName is None:
00040         self.componentName = ''
00041     else:
00042       self.componentID = 0
00043       self.componentName = ''
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       buff.write(_struct_I.pack(self.componentID))
00058       _x = self.componentName
00059       length = len(_x)
00060       if python3 or type(_x) == unicode:
00061         _x = _x.encode('utf-8')
00062         length = len(_x)
00063       buff.write(struct.pack('<I%ss'%length, length, _x))
00064     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00065     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00066 
00067   def deserialize(self, str):
00068     """
00069     unpack serialized message in str into this message instance
00070     :param str: byte array of serialized message, ``str``
00071     """
00072     try:
00073       end = 0
00074       start = end
00075       end += 4
00076       (self.componentID,) = _struct_I.unpack(str[start:end])
00077       start = end
00078       end += 4
00079       (length,) = _struct_I.unpack(str[start:end])
00080       start = end
00081       end += length
00082       if python3:
00083         self.componentName = str[start:end].decode('utf-8')
00084       else:
00085         self.componentName = str[start:end]
00086       return self
00087     except struct.error as e:
00088       raise genpy.DeserializationError(e) #most likely buffer underfill
00089 
00090 
00091   def serialize_numpy(self, buff, numpy):
00092     """
00093     serialize message with numpy array types into buffer
00094     :param buff: buffer, ``StringIO``
00095     :param numpy: numpy python module
00096     """
00097     try:
00098       buff.write(_struct_I.pack(self.componentID))
00099       _x = self.componentName
00100       length = len(_x)
00101       if python3 or type(_x) == unicode:
00102         _x = _x.encode('utf-8')
00103         length = len(_x)
00104       buff.write(struct.pack('<I%ss'%length, length, _x))
00105     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00106     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00107 
00108   def deserialize_numpy(self, str, numpy):
00109     """
00110     unpack serialized message in str into this message instance using numpy for array types
00111     :param str: byte array of serialized message, ``str``
00112     :param numpy: numpy python module
00113     """
00114     try:
00115       end = 0
00116       start = end
00117       end += 4
00118       (self.componentID,) = _struct_I.unpack(str[start:end])
00119       start = end
00120       end += 4
00121       (length,) = _struct_I.unpack(str[start:end])
00122       start = end
00123       end += length
00124       if python3:
00125         self.componentName = str[start:end].decode('utf-8')
00126       else:
00127         self.componentName = str[start:end]
00128       return self
00129     except struct.error as e:
00130       raise genpy.DeserializationError(e) #most likely buffer underfill
00131 
00132 _struct_I = genpy.struct_I


srs_msgs
Author(s): renxi
autogenerated on Mon Oct 6 2014 08:20:53